/* ===========================================================
   ML Inventory — Design system
   System fonts only (zero network requests = instant load)
   =========================================================== */

:root {
  --navy: #15233C;
  --navy-soft: #223655;
  --teal: #0E7C6B;
  --teal-soft: #E6F4F1;
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --ink: #1A2230;
  --ink-soft: #5C6678;
  --border: #E4E1DA;
  --amber: #C97A1F;
  --amber-soft: #FBF0E2;
  --red: #B0392F;
  --red-soft: #FAEAE7;
  --green: #1F8A5F;
  --green-soft: #E7F5EE;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(21, 35, 60, 0.06), 0 4px 12px rgba(21, 35, 60, 0.06);

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Consolas, "Roboto Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

a { color: var(--teal); text-decoration: none; }

/* ---------- Layout shell ---------- */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.topbar .brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,124,107,0.35);
}

.topbar nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.topbar nav a {
  color: rgba(255,255,255,0.78);
  font-size: 13.5px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease, color 0.12s ease;
}
.topbar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.topbar nav a.active { background: var(--teal); color: #fff; }

.topbar .who {
  font-size: 12.5px;
  color: rgba(255,255,255,0.6);
}
.topbar .who button {
  margin-left: 10px;
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.85);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
}
.topbar .who button:hover { background: rgba(255,255,255,0.1); }

main {
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ---------- Typography ---------- */
.eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 6px;
}
h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--navy);
}
h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--navy);
}
.subtitle {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 24px;
}

/* ---------- Stage tracker (signature element) ---------- */
.stage-tracker {
  display: flex;
  align-items: center;
  margin: 18px 0 30px;
  user-select: none;
}
.stage-tracker .node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  width: 92px;
}
.stage-tracker .node .circle {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 2px solid var(--border);
  font-size: 12px; font-weight: 700;
  color: var(--ink-soft);
}
.stage-tracker .node.active .circle {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.stage-tracker .node.done .circle {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.stage-tracker .node .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
}
.stage-tracker .node.active .label { color: var(--navy); }
.stage-tracker .line {
  flex: 1 1 auto;
  height: 2px;
  background: var(--border);
  margin-top: -18px;
}
.stage-tracker .line.done { background: var(--navy); }

/* ---------- Cards / forms ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.field .hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

input, select, textarea {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 15px;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.12s ease;
}
input[type="number"] { font-family: var(--font-mono); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}
textarea { resize: vertical; min-height: 70px; }

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .row-2 { grid-template-columns: 1fr; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: transform 0.06s ease, background 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: #0B6A5C; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-danger { background: var(--red-soft); color: var(--red); }

/* ---------- Status / toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 50;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--ink-soft); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
td.num, th.num { font-family: var(--font-mono); text-align: right; }
tr:last-child td { border-bottom: none; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-navy { background: var(--teal-soft); color: var(--teal); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-card .mark {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px;
  margin-bottom: 16px;
}

/* ---------- Utility ---------- */
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.spacer { flex: 1; }
.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease infinite;
  border-radius: var(--radius-sm);
  height: 16px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
