/* ===========================================================================
   Prowl Ops — original stylesheet.
   Palette carried over from prowlpest.com so the tool feels like the company:
   navy #0B1221 ground, #1B6FFF accent.
   Dark by default; this is a screen people leave open all day.
   =========================================================================== */

:root {
  --ground:      #0B1221;
  --panel:       #131C30;
  --panel-2:     #1A2540;
  --line:        #26324C;
  --line-soft:   #1E2840;

  --ink:         #EAF0FA;
  --ink-soft:    #A9B6CE;
  --ink-mute:    #6F7E9B;

  --accent:      #1B6FFF;
  --accent-soft: #4D94FF;

  --good:        #2BB673;
  --warn:        #E8A33D;
  --bad:         #E05260;

  --radius:      12px;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- brand ---------- */
.brand { display: flex; align-items: baseline; gap: 7px; }
.brand-mark {
  font-size: 25px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink);
}
.brand-sub {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--accent-soft);
}
.brand-sm .brand-mark { font-size: 19px; }

/* ---------- gate (sign in / pending) ---------- */
.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 0%, #16223C, var(--ground) 65%);
}
.gate-card {
  width: 100%; max-width: 420px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 36px 32px;
}
.gate-card .brand { margin-bottom: 22px; }
.gate-lead { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 22px; }
.pending-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }

.gate-form { display: flex; flex-direction: column; gap: 11px; }
.gate-form input, .inline-form input, .inline-form select {
  background: var(--ground); color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 12px 14px; width: 100%;
}
.gate-form input:focus, .inline-form input:focus, .inline-form select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(27,111,255,.18);
}
.gate-form button {
  background: var(--accent); color: #fff; font-weight: 700;
  border-radius: 9px; padding: 12px 16px; transition: background .18s;
}
.gate-form button:hover { background: var(--accent-soft); }
.gate-form button:disabled { opacity: .55; cursor: not-allowed; }

.gate-links {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft);
  display: flex; gap: 16px; flex-wrap: wrap;
}
.link {
  font-size: 13px; font-weight: 600; color: var(--accent-soft);
  padding: 0; border-bottom: 1px solid transparent;
}
.link:hover { border-bottom-color: var(--accent-soft); }

.danger {
  border: 1px solid rgba(224,82,96,.4); color: #F08792;
  border-radius: 8px; padding: 6px 11px; font-size: 12.5px; font-weight: 600;
}
.danger:hover { background: rgba(224,82,96,.12); border-color: var(--bad); }

.gate-msg { margin-top: 16px; font-size: 13.5px; color: var(--ink-soft); min-height: 20px; }
.gate-msg.is-error { color: var(--bad); }
.gate-msg.is-ok { color: var(--good); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 22px;
  padding: 13px 22px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; flex-wrap: wrap;
}
.tabs { display: flex; gap: 3px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600;
  color: var(--ink-mute); transition: all .16s;
}
.tab:hover { color: var(--ink); background: var(--panel-2); }
.tab.is-active { color: var(--ink); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.whoami { font-size: 12.5px; color: var(--ink-mute); }
.sync-state { font-size: 12px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.sync-state.is-stale { color: var(--warn); }
.sync-state.is-bad { color: var(--bad); }

.btn-ghost {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-mute); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-primary {
  background: var(--accent); color: #fff; font-weight: 700;
  border-radius: 8px; padding: 9px 14px;
}
.btn-primary:hover { background: var(--accent-soft); }

/* ---------- views ---------- */
main { max-width: 1280px; margin: 0 auto; padding: 30px 22px 72px; }
.view-head { margin-bottom: 24px; }
.view-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.view-sub { color: var(--ink-soft); font-size: 14px; margin-top: 6px; max-width: 70ch; }
.sub-head {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-mute);
  margin: 34px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft);
}
.hint { font-size: 13px; color: var(--ink-mute); margin-bottom: 14px; max-width: 72ch; }
.empty {
  color: var(--ink-mute); font-size: 14px; padding: 26px;
  border: 1px dashed var(--line); border-radius: var(--radius); text-align: center;
}

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
}
.kpi {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 17px 14px;
  display: flex; flex-direction: column; gap: 9px; min-height: 142px;
}
.kpi-name {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-mute);
  display: flex; align-items: center; gap: 6px;
}
.kpi-value {
  font-size: 30px; font-weight: 750; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.05;
}
/* No data is NOT zero. A tile reading 0% retention looks like catastrophe
   when it actually means nothing has been measured yet. */
.kpi-value.is-nodata { font-size: 15px; font-weight: 600; color: var(--ink-mute); }
.kpi-meta { font-size: 12px; color: var(--ink-mute); margin-top: auto; }
.kpi-target { font-size: 12px; font-weight: 600; }
.kpi-target.is-good { color: var(--good); }
.kpi-target.is-warn { color: var(--warn); }
.kpi-target.is-bad { color: var(--bad); }
.kpi-spark { height: 28px; display: block; width: 100%; }

.info {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--line); color: var(--ink-mute);
  font-size: 9px; line-height: 12px; text-align: center; cursor: help;
}

.badge {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 7px; border-radius: 99px; border: 1px solid var(--line);
  color: var(--ink-mute);
}

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 11px 13px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--line-soft); }
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-mute); font-weight: 700; background: var(--panel);
  position: sticky; top: 0;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel); }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13px; }

td select, td input {
  background: var(--ground); color: var(--ink); border: 1px solid var(--line);
  border-radius: 7px; padding: 5px 8px; font-size: 13px; max-width: 150px;
}

/* ---------- inline forms ---------- */
.inline-form {
  display: flex; gap: 9px; margin-bottom: 18px; flex-wrap: wrap; align-items: center;
}
.inline-form input { flex: 1 1 260px; width: auto; }
.inline-form select { flex: 0 0 auto; width: auto; }

/* ---------- priorities ---------- */
.prio {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 17px; margin-bottom: 11px;
}
.prio.is-child { margin-left: 26px; border-left: 2px solid var(--accent); }
.prio-top { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.prio-title { font-weight: 650; font-size: 15px; flex: 1 1 260px; }
.prio-owner { font-size: 12.5px; color: var(--ink-mute); }
.bar { height: 6px; background: var(--panel-2); border-radius: 99px; margin-top: 11px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.pill {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.pill.on_track  { background: rgba(43,182,115,.16); color: #5BD69B; }
.pill.at_risk   { background: rgba(232,163,61,.16); color: #F0BC6C; }
.pill.off_track { background: rgba(224,82,96,.16);  color: #F08792; }
.pill.done      { background: rgba(27,111,255,.16); color: var(--accent-soft); }
.pill.dropped   { background: var(--panel-2); color: var(--ink-mute); }

/* ---------- huddles ---------- */
.huddle {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 17px 18px; margin-bottom: 14px;
}
.huddle-head { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: 12px; }
.huddle-head h3 { font-size: 16px; font-weight: 700; }
.items { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 11px; background: var(--ground);
  border: 1px solid var(--line-soft); border-radius: 9px; font-size: 13.5px;
}
.item.is-carried { border-left: 2px solid var(--warn); }
.item.is-resolved { opacity: .5; }
.item.is-resolved .item-body { text-decoration: line-through; }
.item-kind {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-mute); flex-shrink: 0; padding-top: 2px;
  min-width: 68px;
}
.item-body { flex: 1; }
.item-who { font-size: 11.5px; color: var(--ink-mute); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; z-index: 60; max-width: 92vw;
}
.toast.is-error { border-color: var(--bad); color: #F08792; }

@media (max-width: 680px) {
  .topbar { gap: 12px; }
  .topbar-right { width: 100%; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .kpi-value { font-size: 25px; }
  main { padding: 22px 15px 60px; }
}
