/* ─────────────────────────────────────────────────────────────
   Mountwhite TMS — design tokens
   Snowfield white surface · ink text · glacier-blue action color
   Signature: the ridgeline. Everything else stays quiet.
   ───────────────────────────────────────────────────────────── */
:root {
  --ink:        #16202B;   /* primary text */
  --ink-soft:   #5A6B7C;   /* secondary text */
  --snow:       #F6F8FA;   /* page background */
  --paper:      #FFFFFF;   /* cards */
  --line:       #E3E9EF;   /* borders */
  --glacier:    #2563EB;   /* primary action */
  --glacier-dk: #1D4FC4;
  --pine:       #157A5B;   /* done / success */
  --amber:      #B45309;   /* review / warning */
  --clay:       #C2410C;   /* urgent / blocked */
  --slate-pill: #EEF2F6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22,32,43,.06), 0 4px 16px rgba(22,32,43,.05);
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--snow);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
a { color: var(--glacier); text-decoration: none; }
:focus-visible { outline: 2px solid var(--glacier); outline-offset: 2px; }

/* ── wordmark ── */
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}
.wordmark span { color: var(--glacier); font-weight: 500; }
.wordmark.small { font-size: 18px; }

/* ── login ── */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0 28px 28px;
  overflow: hidden;
}
.ridge { color: var(--ink); margin: 0 -28px 18px; }
.ridge svg { display: block; width: 100%; height: 48px; }
.login-card h1 { font-size: 26px; margin-bottom: 4px; }
.login-sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 20px; }
.login-error {
  background: #FDF2F0; color: var(--clay);
  border: 1px solid #F5D5CC; border-radius: 8px;
  padding: 10px 12px; font-size: 13.5px;
}
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.login-card input {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 16px; /* prevents iOS zoom */
  background: var(--snow);
}
.login-card button {
  width: 100%; margin-top: 20px;
  background: var(--glacier); color: #fff;
  border: none; border-radius: 8px;
  padding: 12px; font-weight: 600; font-size: 15px;
}
.login-card button:hover { background: var(--glacier-dk); }
.login-help { color: var(--ink-soft); font-size: 12.5px; text-align: center; margin: 16px 0 0; }

/* ── top bar + tabs ── */
.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px 8px;
  max-width: 1200px; margin: 0 auto;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.userchip { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }

.tabs {
  display: flex; gap: 2px; overflow-x: auto;
  max-width: 1200px; margin: 0 auto; padding: 0 12px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: none;
  padding: 10px 14px 12px;
  font-weight: 500; font-size: 14px; color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab.active { color: var(--ink); border-bottom-color: var(--glacier); font-weight: 600; }
.pill {
  display: inline-block; min-width: 18px;
  background: var(--clay); color: #fff;
  font-size: 11px; font-weight: 600;
  border-radius: 9px; padding: 1px 5px;
  vertical-align: 1px;
}
.pill:empty { display: none; }

/* ── layout ── */
.content { max-width: 1200px; margin: 0 auto; padding: 20px; }
.tabpane { display: none; }
.tabpane.active { display: block; }
.loading { text-align: center; color: var(--ink-soft); padding: 60px 0; }

/* ── buttons ── */
.btn {
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); border-radius: 8px;
  padding: 8px 14px; font-size: 13.5px; font-weight: 500;
}
.btn:hover { border-color: var(--glacier); color: var(--glacier); }
.btn.primary { background: var(--glacier); border-color: var(--glacier); color: #fff; }
.btn.primary:hover { background: var(--glacier-dk); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn.ghost:hover { color: var(--glacier); }

/* ── stat cards ── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stat .num { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; }
.stat .lbl { color: var(--ink-soft); font-size: 12.5px; margin-top: 6px; }
.stat.warn .num { color: var(--clay); }
.stat.good .num { color: var(--pine); }

/* ── section header / toolbar ── */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 8px 0 14px;
}
.section-head h2 { font-family: var(--font-display); font-size: 19px; margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input {
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); padding: 7px 10px; font-size: 13.5px;
}

/* ── task cards ── */
.cardlist { display: grid; gap: 10px; }
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-title { font-weight: 600; font-size: 15px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; color: var(--ink-soft); align-items: center; }
.card-brief { font-size: 13.5px; color: var(--ink-soft); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.overdue { color: var(--clay); font-weight: 600; }

/* ── badges ── */
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  border-radius: 6px; padding: 3px 8px;
  background: var(--slate-pill); color: var(--ink-soft);
  white-space: nowrap;
}
.badge.s-idea       { background: #EEF2F6; color: var(--ink-soft); }
.badge.s-notstarted { background: #EEF2F6; color: var(--ink); }
.badge.s-inprogress { background: #E7EEFC; color: var(--glacier-dk); }
.badge.s-inreview   { background: #FBF3E4; color: var(--amber); }
.badge.s-done       { background: #E6F4EE; color: var(--pine); }
.badge.s-blocked    { background: #FDECE6; color: var(--clay); }
.badge.p-urgent { background: #FDECE6; color: var(--clay); }
.badge.p-high   { background: #FBF3E4; color: var(--amber); }
.badge.brand    { background: #F0F3F7; color: var(--ink); }

/* ── tables (projects/team) ── */
.tablewrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--snow); }

/* ── modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(22,32,43,.45);
  display: grid; place-items: center; z-index: 50; padding: 16px;
}
.modal {
  background: var(--paper); border-radius: 14px;
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  padding: 22px; box-shadow: 0 20px 60px rgba(22,32,43,.25);
}
.modal h3 { font-family: var(--font-display); margin: 0 0 14px; font-size: 18px; }
.modal label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.modal input, .modal select, .modal textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 11px; background: var(--snow); font-size: 15px;
}
.modal textarea { min-height: 90px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

/* ── toast ── */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  border-radius: 10px; padding: 11px 18px; font-size: 14px;
  z-index: 60; box-shadow: var(--shadow); max-width: 90vw;
}
.toast.err { background: var(--clay); }

/* ── empty state ── */
.empty {
  text-align: center; color: var(--ink-soft);
  padding: 48px 16px; background: var(--paper);
  border: 1px dashed var(--line); border-radius: var(--radius);
}

@media (max-width: 640px) {
  .topbar-inner { padding: 10px 14px 6px; }
  .userchip { display: none; }
  .content { padding: 14px; }
  .card-top { flex-direction: column; }
}
@media (prefers-reduced-motion: no-preference) {
  .card { transition: border-color .15s; }
  .card:hover { border-color: #CBD6E0; }
}
