/* =====================================================================
   Utility TAM - Operations Console aesthetic
   Industrial, dense, purposeful. Slate/ink base with amber accent.
   ===================================================================== */
:root {
  --ink:        #0b1220;
  --ink-2:      #131a2c;
  --slate-50:   #f6f7f9;
  --slate-100:  #eceef3;
  --slate-200:  #d8dde7;
  --slate-300:  #b7bfcf;
  --slate-400:  #8790a3;
  --slate-500:  #5a6478;
  --slate-600:  #3b4456;
  --slate-700:  #252c3d;
  --slate-800:  #181e2e;

  --amber:      #e8a317;
  --amber-dk:   #b47d0a;
  --amber-lt:   #fff2cf;

  --green:      #1b8a5a;
  --green-lt:   #dcf2e6;
  --red:        #c0392b;
  --red-lt:     #fbe3df;
  --blue:       #2563a6;
  --blue-lt:    #dde9f5;
  --violet:     #6c47b3;
  --violet-lt:  #ece4fa;

  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Inter var", "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;

  --border: 1px solid var(--slate-200);
  --border-dk: 1px solid var(--slate-700);
  --shadow-sm: 0 1px 2px rgba(10,15,30,.05), 0 1px 0 rgba(10,15,30,.03);
  --shadow-md: 0 4px 14px rgba(10,15,30,.08);
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--slate-50); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { font-size: 14px; line-height: 1.45; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* -- Operations top bar -------------------------------------------------- */
.topbar {
  background: var(--ink);
  color: var(--slate-100);
  border-bottom: 2px solid var(--amber);
  display: flex; align-items: center;
  padding: 0 18px; height: 52px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand {
  font-family: var(--mono);
  font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; font-size: 13px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .brand .dot {
  width: 10px; height: 10px; background: var(--amber); border-radius: 2px;
  box-shadow: 0 0 0 2px rgba(232,163,23,.18);
}
.topbar nav { display: flex; gap: 2px; margin-left: 36px; }
.topbar nav a {
  color: var(--slate-300);
  padding: 8px 14px;
  font-size: 13px; font-weight: 500;
  border-radius: 4px;
}
.topbar nav a:hover { background: var(--slate-700); color: white; text-decoration: none; }
.topbar nav a.active { background: var(--slate-700); color: white; }
.topbar .user {
  margin-left: auto; display: flex; align-items: center; gap: 14px;
  font-size: 12px; color: var(--slate-300);
}
.topbar .user .chip {
  background: var(--slate-700); padding: 4px 10px; border-radius: 12px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
}
.topbar .user a { color: var(--slate-200); }

/* -- Page shell ---------------------------------------------------------- */
.shell { max-width: 1340px; margin: 0 auto; padding: 22px 20px 60px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: var(--border);
}
.page-head h1 {
  font-size: 22px; margin: 0;
  font-weight: 600; letter-spacing: -.01em;
}
.page-head .breadcrumb {
  font-family: var(--mono); font-size: 11px;
  color: var(--slate-500); text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 4px;
}
.page-head .actions { display: flex; gap: 8px; }

/* -- Cards --------------------------------------------------------------- */
.card {
  background: white;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card header {
  padding: 12px 16px;
  border-bottom: var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card header h2 { font-size: 14px; margin: 0; font-weight: 600; }
.card header .sub {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--slate-500);
}
.card .body { padding: 16px; }
.card .body.tight { padding: 0; }

/* -- Stat tiles ---------------------------------------------------------- */
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat {
  background: white; border: var(--border); border-radius: var(--radius);
  padding: 14px 16px; position: relative; overflow: hidden;
}
.stat .label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--slate-500);
}
.stat .value { font-size: 26px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; color: var(--slate-500); }
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--amber);
}
.stat.blue::before { background: var(--blue); }
.stat.green::before { background: var(--green); }
.stat.red::before { background: var(--red); }
.stat.violet::before { background: var(--violet); }

/* -- Tables -------------------------------------------------------------- */
table.data { width: 100%; border-collapse: collapse; background: white; }
table.data th, table.data td {
  padding: 9px 12px; text-align: left; border-bottom: var(--border);
  font-size: 13px; vertical-align: middle;
}
table.data th {
  background: var(--slate-50);
  font-family: var(--mono); font-weight: 600;
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--slate-500);
  border-bottom: var(--border);
}
table.data tr:hover td { background: #fafbfd; }
table.data td.num { font-variant-numeric: tabular-nums; text-align: right; }
table.data td.mono { font-family: var(--mono); }
table.data caption { caption-side: top; text-align: left; padding: 10px 14px; font-size: 12px; color: var(--slate-500); }
.empty-state {
  padding: 44px 20px; text-align: center; color: var(--slate-500);
  font-size: 13px;
}

/* -- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 5px;
  border: 1px solid var(--slate-300); background: white;
  color: var(--ink); font-weight: 500; font-size: 13px;
  cursor: pointer; transition: all .12s ease;
  font-family: var(--sans);
}
.btn:hover { background: var(--slate-50); border-color: var(--slate-400); }
.btn.primary { background: var(--ink); color: white; border-color: var(--ink); }
.btn.primary:hover { background: #1a253e; }
.btn.amber { background: var(--amber); color: var(--ink); border-color: var(--amber-dk); font-weight: 600; }
.btn.amber:hover { background: var(--amber-dk); color: white; }
.btn.danger { color: var(--red); border-color: var(--red-lt); }
.btn.danger:hover { background: var(--red-lt); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* -- Form ---------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--slate-600); margin-bottom: 4px;
}
.field .hint { font-size: 12px; color: var(--slate-500); margin-top: 4px; font-weight: 400; text-transform: none; letter-spacing: 0; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], textarea, select {
  width: 100%;
  padding: 8px 10px; font-size: 13px; font-family: var(--sans);
  border: 1px solid var(--slate-300); border-radius: 5px;
  background: white; color: var(--ink);
  transition: border-color .1s, box-shadow .1s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11,18,32,.08);
}
textarea { min-height: 80px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* -- Pills / status ------------------------------------------------------ */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em;
  text-transform: uppercase; font-weight: 600;
  background: var(--slate-100); color: var(--slate-600);
  border: 1px solid var(--slate-200);
}
.pill.green  { background: var(--green-lt);  color: var(--green);  border-color: #bde5cd; }
.pill.red    { background: var(--red-lt);    color: var(--red);    border-color: #f3c9c0; }
.pill.blue   { background: var(--blue-lt);   color: var(--blue);   border-color: #c9dcef; }
.pill.amber  { background: var(--amber-lt);  color: var(--amber-dk); border-color: #f3dfa3; }
.pill.violet { background: var(--violet-lt); color: var(--violet); border-color: #dccef5; }
.pill.dark   { background: var(--ink); color: white; border-color: var(--ink); }

/* -- Flash --------------------------------------------------------------- */
.flash {
  border-left: 4px solid;
  padding: 10px 14px; margin-bottom: 16px;
  border-radius: 4px; font-size: 13px;
  background: white; box-shadow: var(--shadow-sm);
}
.flash.success { border-color: var(--green); }
.flash.error   { border-color: var(--red); }
.flash.info    { border-color: var(--blue); }
.flash.warning { border-color: var(--amber); }

/* -- Grid helpers -------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .topbar nav { display: none; }
}

/* -- Kanban -------------------------------------------------------------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(230px, 1fr));
  gap: 12px; overflow-x: auto;
}
.kanban .lane {
  background: var(--slate-100); border-radius: var(--radius);
  padding: 10px; min-height: 440px;
  border: 1px solid var(--slate-200);
}
.kanban .lane header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; padding: 2px 6px;
}
.kanban .lane h3 {
  margin: 0; font-size: 11px; text-transform: uppercase;
  letter-spacing: .09em; font-family: var(--mono); color: var(--slate-600);
}
.kanban .lane .count {
  background: var(--ink); color: white; padding: 1px 7px;
  border-radius: 10px; font-family: var(--mono); font-size: 10px;
}
.kcard {
  background: white; border: var(--border); border-radius: 5px;
  padding: 10px 12px; margin-bottom: 8px;
  box-shadow: var(--shadow-sm); cursor: grab;
  border-left: 3px solid var(--slate-300);
}
.kcard:active { cursor: grabbing; }
.kcard.urgent  { border-left-color: var(--red); }
.kcard.high    { border-left-color: var(--amber); }
.kcard.normal  { border-left-color: var(--blue); }
.kcard h4 { font-size: 13px; margin: 0 0 4px 0; font-weight: 600; }
.kcard .meta { font-size: 11px; color: var(--slate-500); display: flex; gap: 8px; }

/* -- Timeline ------------------------------------------------------------ */
.timeline { border-left: 2px solid var(--slate-200); margin-left: 8px; padding-left: 16px; }
.timeline .event { position: relative; margin-bottom: 14px; font-size: 13px; }
.timeline .event::before {
  content: ""; position: absolute; left: -23px; top: 6px;
  width: 10px; height: 10px; background: var(--amber);
  border: 2px solid white; border-radius: 50%;
  box-shadow: 0 0 0 2px var(--slate-200);
}
.timeline .event .t { font-family: var(--mono); font-size: 11px; color: var(--slate-500); }

/* -- Login / auth pages -------------------------------------------------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(232,163,23,.06), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(37,99,166,.06), transparent 50%),
    var(--slate-50);
}
.auth-card {
  width: 100%; max-width: 400px; padding: 32px;
  background: white; border: var(--border); border-radius: 8px;
  box-shadow: 0 10px 40px rgba(10,15,30,.08);
}
.auth-card h1 {
  margin: 0 0 6px 0; font-size: 22px; font-weight: 600;
  letter-spacing: -.01em;
}
.auth-card .sub {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--slate-500);
}
.auth-card .brand-mark {
  width: 36px; height: 36px; background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; margin-bottom: 14px;
  position: relative;
}
.auth-card .brand-mark::after {
  content: ""; position: absolute;
  width: 10px; height: 10px; background: var(--amber); border-radius: 2px;
}

/* -- Dashboard sections -------------------------------------------------- */
.section-title {
  font-family: var(--mono); text-transform: uppercase; font-size: 11px;
  letter-spacing: .12em; color: var(--slate-500);
  margin: 24px 0 10px; padding-bottom: 4px; border-bottom: var(--border);
}

/* -- Sub-nav (page tabs) ------------------------------------------------- */
.subnav { display: flex; gap: 4px; border-bottom: var(--border); margin-bottom: 20px; }
.subnav a {
  padding: 9px 14px; font-size: 13px; color: var(--slate-600);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--ink); border-bottom-color: var(--amber); font-weight: 600; }

/* -- Utility ------------------------------------------------------------- */
.muted { color: var(--slate-500); }
.mono { font-family: var(--mono); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.gap-2 { display: flex; gap: 6px; align-items: center; }
.gap-3 { display: flex; gap: 10px; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--slate-200); margin: 14px 0; }
