/* Motorpool Purchasing System — plain CSS, no build step, works offline. */
:root {
  --ink: #1c2430;
  --muted: #5f6b7a;
  --line: #dfe3e8;
  --bg: #f3f5f8;
  --card: #ffffff;
  --brand: #1f3a5f;
  --brand-2: #2c5282;
  --accent: #d69e2e;
  --ok: #2f855a;
  --warn: #b7791f;
  --info: #2b6cb0;
  --bad: #c53030;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.45;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- Top bar ---------- */
.topbar { background: var(--brand); color: #fff; border-bottom: 3px solid var(--accent); }
.topbar .inner { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 20px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .2px; color: #fff; white-space: nowrap; }
.brand small { display: block; font-weight: 400; opacity: .75; font-size: .75rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: #dbe6f3; padding: 8px 10px; border-radius: 6px; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.who { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.who a, .who button { color: #dbe6f3; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 1.8rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .85rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #f8fafc; }
tr:hover td { background: #fafbfd; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.b-pending { background: #edf2f7; color: #4a5568; border-color: #cbd5e0; }
.b-submitted { background: #e6fffa; color: #2c7a7b; border-color: #81e6d9; }
.b-ordered { background: #ebf4ff; color: var(--info); border-color: #bee3f8; }
.b-for_pickup { background: #fffaf0; color: var(--warn); border-color: #fbd38d; }
.b-issued { background: #f0fff4; color: var(--ok); border-color: #9ae6b4; }
.b-cancelled { background: #fff5f5; color: var(--bad); border-color: #feb2b2; }
.b-cmo { background: #faf5ff; color: #6b46c1; border-color: #d6bcfa; }
.b-none { background: #fff; color: var(--muted); border-color: var(--line); font-weight: 400; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], input[type=number], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c8d0da; border-radius: 6px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #90cdf4; border-color: var(--brand-2); }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 14px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.help { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.error { color: var(--bad); font-size: .85rem; margin-top: 3px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 150px; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn-light { background: #fff; color: var(--brand); }
.btn-light:hover { background: #f0f4f8; }
.btn-danger { background: #fff; color: var(--bad); border-color: #feb2b2; }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 4px 9px; font-size: .85rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert-ok { background: #f0fff4; border: 1px solid #9ae6b4; color: #22543d; }
.alert-bad { background: #fff5f5; border: 1px solid #feb2b2; color: #742a2a; }

/* ---------- Detail list ---------- */
dl.details { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0; }
dl.details dt { color: var(--muted); font-size: .9rem; }
dl.details dd { margin: 0; font-weight: 600; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--line); padding: 2px 0 12px 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--brand-2); }
.timeline li.cmo::before { background: #6b46c1; }
.timeline .when { font-size: .82rem; color: var(--muted); }

/* ---------- Bars (records) ---------- */
.bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar span { display: block; height: 100%; background: var(--brand-2); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--brand) 0%, #16283f 100%); }
.login { width: 100%; max-width: 380px; background: #fff; border-radius: 10px; padding: 28px; border-top: 5px solid var(--accent); }

ul.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 14px 0 0; flex-wrap: wrap; }
ul.pagination li > a, ul.pagination li > span { display: block; padding: 5px 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
ul.pagination li.active > span { background: var(--brand); color: #fff; border-color: var(--brand); }
ul.pagination li.disabled > span { color: #a0aec0; }

@media (max-width: 640px) {
  dl.details { grid-template-columns: 1fr; }
  dl.details dt { margin-top: 6px; }
}

@media print {
  body { background: #fff; }
  .topbar, form.filters, .btn, .page-head .actions { display: none !important; }
  .card, .stat { border-color: #bbb; break-inside: avoid; }
  .container { padding: 0; max-width: none; }
}
