/* AIT brand palette, dark mode by default:
   Navy 900 #002147 surfaces · Navy 600 #1257a1 emphasis/fills ·
   AIT Red #e21033 (rare) · Off-White #fafafa type · AIT Black ink base */
:root {
  --bg: #0a1220;          /* deep navy-black ground */
  --panel: #0f1b2d;       /* cards — navy mass */
  --navy: #002147;        /* Navy 900 — sidebar, strong surfaces */
  --navy-fill: #1257a1;   /* Navy 600 — buttons, bars, fills */
  --navy-emph: #5b9bd8;   /* Navy 600 lifted for text on dark */
  --red: #e21033;         /* AIT Red — rare by design */
  --ink: #fafafa;         /* Off-White — body copy on dark */
  --border: #1c2e44;
  --muted: #8496ab;
  --green: #35a066;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-emph); }

/* ---------- boot / login ---------- */
.boot {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 28px;
}
.boot-logo, .login-logo { width: 220px; filter: invert(1); }
.boot-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--navy-emph);
  animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  width: 380px; background: var(--panel); border: 1px solid var(--border);
  border-top: 4px solid var(--red);
  border-radius: 14px; padding: 36px 32px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 8px 28px rgba(0, 0, 0, 0.3);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  @starting-style { opacity: 0; transform: translateY(8px); }
}
.login-card h1 { font-size: 17px; font-weight: 650; color: var(--ink); }
.login-card .sub { color: var(--muted); font-size: 13px; margin-top: -10px; }
.login-logo { width: 180px; align-self: center; margin-bottom: 6px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--navy-emph); box-shadow: 0 0 0 3px rgba(18, 87, 161, 0.12);
}
.hint { font-size: 12px; color: var(--muted); }

.btn {
  background: var(--navy-fill); color: #fff; font-weight: 600;
  border: 0; border-radius: 8px; padding: 10px 14px; cursor: pointer;
  transition: transform 140ms var(--ease-out), background 140ms ease;
}
.btn:hover { background: #1a6bc4; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ghost {
  background: transparent; color: var(--navy-emph); border: 1px solid var(--border); font-weight: 500;
}
.btn.ghost:hover { background: rgba(91, 155, 216, 0.1); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--border); }
.btn.danger:hover { background: rgba(226, 16, 51, 0.12); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }

.error { color: var(--red); font-size: 13px; min-height: 18px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--navy); border-right: 1px solid var(--navy);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-logo { width: 130px; filter: invert(1); margin: 2px 8px 14px; }
.side a {
  color: rgba(255, 255, 255, 0.72); text-decoration: none; padding: 7px 10px; border-radius: 7px;
  font-size: 13.5px; transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.side a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.side a.on {
  background: rgba(255, 255, 255, 0.1); color: #fff; font-weight: 600;
  box-shadow: inset 3px 0 0 var(--red);
}
.side .sep { border-top: 1px solid rgba(255, 255, 255, 0.14); margin: 10px 8px; }
.side .grow { flex: 1; }
.side .who { padding: 8px 10px; font-size: 12.5px; color: rgba(255, 255, 255, 0.6); }
.side .who b { color: #fff; display: block; }

.main { padding: 26px 32px 60px; max-width: 1180px; min-width: 0; }
.topline {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.topline h2 { font-size: 19px; font-weight: 700; color: var(--ink); }
.topline .addr { color: var(--muted); font-size: 12.5px; }

.countdown {
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 15px; font-size: 13px; color: var(--muted); white-space: nowrap;
}
.countdown b { color: var(--navy-emph); font-size: 15px; }
.countdown.hot b { color: var(--red); }

/* ---------- cards / stats ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
}
.card .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.card .v { font-size: 26px; font-weight: 700; margin-top: 2px; color: var(--navy-emph); }
.card .v.red { color: var(--red); }
.card .v.green { color: var(--green); }

.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--navy-fill); border-radius: 3px; transition: width 400ms var(--ease-out); }

.section { margin-bottom: 28px; }
.section h3 { font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 10px; letter-spacing: 0.4px; text-transform: uppercase; }

.catbars { display: flex; flex-direction: column; gap: 10px; }
.catbar { display: grid; grid-template-columns: 240px 1fr 90px; gap: 12px; align-items: center; font-size: 13px; }
.catbar a { color: var(--ink); text-decoration: none; }
.catbar a:hover { color: var(--navy-emph); }
.catbar .n { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.tablewrap {
  overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
}
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--bg);
}
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 120ms ease; }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
td input, td select, td textarea {
  background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 5px 7px;
  width: 100%; min-width: 70px; outline: none; transition: border-color 140ms ease, background 140ms ease;
}
td input:hover, td select:hover, td textarea:hover { border-color: var(--border); }
td input:focus, td select:focus, td textarea:focus { border-color: var(--navy-emph); background: var(--panel); }
td .meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }

.status-chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform 120ms var(--ease-out), filter 140ms ease;
}
.status-chip:active { transform: scale(0.95); }
.st-not_started { background: #1b2635; color: var(--muted); }
.st-in_progress { background: rgba(91, 155, 216, 0.16); color: var(--navy-emph); }
.st-blocked { background: rgba(226, 16, 51, 0.16); color: #ff5d76; }
.st-done { background: var(--navy-fill); color: #fff; }

.due { white-space: nowrap; font-variant-numeric: tabular-nums; }
.due.past { color: #ff5d76; font-weight: 600; }
.due.soon { color: var(--navy-emph); font-weight: 600; }

/* ---------- forms / add rows ---------- */
.addrow {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
}
.addrow .field { min-width: 130px; flex: 1; }
.addrow .field.wide { flex: 2.5; }

.list { display: flex; flex-direction: column; gap: 12px; }
.note {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  @starting-style { opacity: 0; transform: translateY(6px); }
}
.note .t { font-weight: 650; margin-bottom: 4px; color: var(--ink); }
.note .b { white-space: pre-wrap; }
.note .meta { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }

.empty { color: var(--muted); padding: 26px; text-align: center; }

.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 50;
  background: var(--navy-fill); color: #fff; border-radius: 10px;
  padding: 11px 16px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  @starting-style { opacity: 0; transform: translateY(8px); }
}
.toast.err { background: var(--red); }

.totals td { font-weight: 700; border-top: 1px solid var(--border); background: var(--bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--red); }
.pos { color: var(--green); }

.rolechip { font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: #ff5d76; }
.side .rolechip { color: #ffb3bf; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side .sep, .side .grow { display: none; }
  .side-logo { margin: 0 10px 0 0; width: 90px; }
  .main { padding: 18px 16px 60px; }
  .catbar { grid-template-columns: 1fr 90px; }
  .catbar .bar { display: none; }
}

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