/* Acme check-in dashboard: a wall monitor at 10 feet (1080p / 4K) and a phone. Always dark, high contrast. */
:root {
  --bg: #0a0d12;
  --panel: #131922;
  --panel-edge: #232c38;
  --row-edge: #1f2731;
  --text: #eef2f6;
  --muted: #a3afbd;
  --faint: #6f7c8b;
  --red: #ff5a5a;
  --red-bg: #b3001b;
  --amber: #ffb224;
  --green: #3ee08a;
  --blue: #63b0ff;
  --grey: #8d97a3;
  --chip-text: #0a0d12;
  --radius: 0.5em;
  font-size: clamp(15px, 1.02vw, 42px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.3; -webkit-font-smoothing: antialiased;
}
body:not(.login-body) { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
button { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- red stale banner: the first thing seen */
.banner {
  background: var(--red-bg); color: #fff; font-weight: 700; font-size: 1.35rem;
  padding: 0.45em 1em; border-bottom: 0.15em solid #ff8a8a;
}
.banner[hidden] { display: none; }
.banner ul { margin: 0; padding-left: 1.2em; }
.banner li + li { margin-top: 0.15em; }

/* ---------------------------------------------------------------- header strip */
.strip {
  display: flex; align-items: center; gap: 1.6em; flex-wrap: wrap;
  padding: 0.5em 1em; border-bottom: 1px solid var(--panel-edge);
}
.strip-date { font-size: 1.5rem; font-weight: 700; }
.strip-updated { color: var(--muted); font-size: 1.05rem; }
.pill {
  font-weight: 800; font-size: 1rem; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.2em 0.8em; border-radius: 999px; background: var(--grey); color: var(--chip-text);
}
.pill.green { background: var(--green); }
.pill.red { background: var(--red); color: #fff; }
.strip-counts { display: flex; gap: 1.6em; margin-left: auto; flex-wrap: wrap; font-size: 1.15rem; color: var(--muted); }
.count b { color: var(--text); font-size: 1.6rem; margin-right: 0.2em; }
.count-decisions.has b { color: var(--amber); }
.count-overdue.has b { color: var(--red); }
.logout button {
  background: none; border: 1px solid var(--panel-edge); border-radius: var(--radius);
  padding: 0.25em 0.8em; color: var(--muted); cursor: pointer;
}

/* ---------------------------------------------------------------- 2 rows x 3 panels */
.grid {
  flex: 1; min-height: 0; display: grid; gap: 0.7em; padding: 0.7em;
  grid-template-columns: 4fr 3fr 3fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
}
.panel {
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 0.8em; padding: 0.5em 0.8em 0.35em;
  border-bottom: 1px solid var(--row-edge);
}
.panel-head h2 { margin: 0; font-size: 1.3rem; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
.panel-head .badge { margin-left: auto; }
.panel-body { flex: 1; min-height: 0; overflow: hidden; padding: 0.35em 0.8em 0.5em; position: relative; }
body.interactive .panel-body { overflow-y: auto; }
.panel.error .panel-head h2::after { content: " · not refreshing"; color: var(--red); font-weight: 600; text-transform: none; }
.more { color: var(--muted); font-size: 0.95rem; padding-top: 0.3em; }
.empty { color: var(--muted); font-size: 1.25rem; padding: 0.6em 0; }
.empty-big {
  display: flex; align-items: center; justify-content: center; height: 100%; text-align: center;
  font-size: 2.1rem; font-weight: 700; color: var(--green);
}
.note { color: var(--faint); font-size: 0.9rem; margin-top: 0.4em; }

.toggle { display: flex; gap: 0.3em; }
.toggle button {
  background: none; border: 1px solid var(--panel-edge); border-radius: var(--radius);
  padding: 0.15em 0.7em; color: var(--muted); cursor: pointer; font-size: 0.95rem;
}
.toggle button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------------------------------------------------------------- chips and badges */
.chip {
  display: inline-block; font-size: 0.85rem; font-weight: 700; padding: 0.08em 0.55em;
  border-radius: 999px; white-space: nowrap; color: var(--chip-text); background: var(--grey);
}
.chip + .chip { margin-left: 0.3em; }
.chip.decision { background: var(--amber); }
.chip.junk { background: var(--grey); }
.chip.not_provided { background: var(--blue); }
.chip.declined { background: transparent; color: var(--grey); border: 1px solid var(--grey); text-decoration: line-through; }
.chip.nojob { background: var(--red); color: #fff; }
.chip.shadow { background: transparent; color: var(--faint); border: 1px solid var(--faint); font-weight: 600; }
.chip.assumed { background: transparent; color: var(--muted); border: 1px dashed var(--muted); font-weight: 600; }
.badge {
  display: inline-block; min-width: 1.6em; text-align: center; font-weight: 800;
  padding: 0.05em 0.5em; border-radius: 999px; background: var(--red); color: #fff;
}
.badge.zero { background: var(--row-edge); color: var(--muted); }
.jt { font-weight: 800; color: var(--text); white-space: nowrap; }
.jt.none { color: var(--red); }

/* ---------------------------------------------------------------- opportunities table */
table.opps { width: 100%; border-collapse: collapse; table-layout: fixed; }
.opps th {
  text-align: left; font-size: 0.85rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
  padding: 0.2em 0.4em 0.3em 0; border-bottom: 1px solid var(--row-edge);
}
.opps td { padding: 0.35em 0.4em 0.35em 0; border-bottom: 1px solid var(--row-edge); vertical-align: top; font-size: 0.98rem; }
.opps .c-customer { width: 18%; font-weight: 700; }
.opps .c-service { width: 18%; }
.opps .c-via { width: 8%; }
.opps .c-in { width: 11%; white-space: nowrap; }
.opps .c-cust { width: 7%; }
.opps .c-job { width: 12%; white-space: nowrap; }
.opps .c-flag { width: 26%; }
.opps td { overflow: hidden; text-overflow: ellipsis; }
.opps td.c-flag { overflow: visible; }
.opps td.c-flag .chip { display: table; margin: 0 0 0.2em; white-space: normal; max-width: 100%; border-radius: 0.4em; }
.opps td.c-flag .chip + .chip { margin-left: 0; }
.opps tr.declined td { color: var(--grey); text-decoration: line-through; }
.opps tr.declined td.c-flag { text-decoration: none; }
.sub { display: block; color: var(--muted); font-size: 0.85rem; font-weight: 400; }

/* ---------------------------------------------------------------- list rows (hot, decisions, commitments) */
.group + .group { margin-top: 0.5em; }
.group-title { font-size: 1rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; margin: 0.2em 0; }
.group-title.upset { color: var(--red); }
.group-title.ready { color: var(--green); }
.group-title.declined { color: var(--grey); }
.group-title.unreached { color: var(--amber); }
.row { padding: 0.3em 0; border-bottom: 1px solid var(--row-edge); }
.row-top { display: flex; gap: 0.6em; align-items: baseline; }
.row-main { font-weight: 700; font-size: 1.1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-time { margin-left: auto; color: var(--muted); white-space: nowrap; font-size: 0.95rem; }
.row-line { color: var(--muted); font-size: 0.98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.urgent { border-left: 0.25em solid var(--red); padding-left: 0.4em; }

.decision .row-main { white-space: normal; font-size: 1.2rem; }
.wait { font-weight: 800; color: var(--amber); white-space: nowrap; }
.wait.long { color: var(--red); }

.owner + .owner { margin-top: 0.45em; }
.owner-head { display: flex; align-items: center; gap: 0.5em; font-weight: 800; font-size: 1.1rem; }
.over { font-weight: 800; color: var(--red); white-space: nowrap; }
.over.today { color: var(--amber); }

/* ---------------------------------------------------------------- reps */
.rep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10em, 1fr)); gap: 0.6em; margin-top: 0.4em; }
.rep { border: 1px dashed var(--panel-edge); border-radius: var(--radius); padding: 0.5em 0.7em; }
.rep-name { font-weight: 800; font-size: 1.2rem; }
.rep-stat { color: var(--faint); }
.message { color: var(--muted); font-size: 1.05rem; }

/* ---------------------------------------------------------------- health */
.src-group { display: grid; grid-template-columns: 5.2em 1fr; gap: 0 0.6em; align-items: baseline; }
.src-group + .src-group { margin-top: 0.3em; }
.src-title { font-size: 0.85rem; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.srcs { display: flex; flex-wrap: wrap; gap: 0.15em 0.9em; }
.src { display: inline-flex; align-items: center; gap: 0.35em; font-size: 0.98rem; white-space: nowrap; }
.dot { width: 0.75em; height: 0.75em; border-radius: 50%; background: var(--grey); flex: none; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.grey { background: var(--row-edge); border: 1px solid var(--grey); }
.src-time { color: var(--faint); font-size: 0.85rem; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5em; margin-top: 0.6em; }
.tile { border: 1px solid var(--row-edge); border-radius: var(--radius); padding: 0.45em 0.6em; }
.tile-title { font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.tile-value { font-size: 1.35rem; font-weight: 800; }
.tile-value.red { color: var(--red); }
.tile-value.green { color: var(--green); }
.tile-value.amber { color: var(--amber); }
.tile-value.soon { color: var(--faint); font-size: 1rem; font-weight: 600; }
.tile details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.tile ul { margin: 0.3em 0 0; padding-left: 1.1em; font-size: 0.9rem; color: var(--muted); }

/* ---------------------------------------------------------------- sign-in */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login { width: min(26em, 100%); }
.login h1 { font-size: 2rem; margin: 0 0 0.6em; }
.login-form { display: flex; flex-direction: column; gap: 0.6em; }
.login-form input {
  font: inherit; font-size: 1.3rem; padding: 0.5em 0.6em; border-radius: var(--radius);
  border: 1px solid var(--panel-edge); background: var(--panel); color: var(--text);
}
.login-form button {
  font-size: 1.2rem; font-weight: 700; padding: 0.5em; border: 0; border-radius: var(--radius);
  background: var(--text); color: var(--bg); cursor: pointer;
}
.login-msg { color: var(--amber); }
:focus-visible { outline: 0.15em solid var(--blue); outline-offset: 0.1em; }

/* ---------------------------------------------------------------- phone and narrow screens: panels stack */
@media (max-width: 900px) {
  :root { font-size: 15px; }
  body:not(.login-body) { height: auto; min-height: 100vh; overflow: visible; }
  .strip { gap: 0.6em 1em; padding: 0.6em 16px; }
  .strip-counts { margin-left: 0; gap: 1em; }
  .grid { display: flex; flex-direction: column; padding: 0.6em 16px; }
  body:not(.login-body) { overflow-x: hidden; }
  .panel { overflow: visible; width: 100%; min-width: 0; }
  .row-top { flex-wrap: wrap; }
  .row-main { flex: 1 1 100%; }
  .opps td.c-via, .opps td.c-in, .opps td.c-cust { display: inline-block; margin-right: 0.9em; }
  .panel-body, body.interactive .panel-body { overflow: visible; }
  .panel-decisions { order: -1; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .src-group { grid-template-columns: 1fr; }
  table.opps, .opps tbody, .opps tr, .opps td { display: block; width: auto; }
  .opps thead { display: none; }
  .opps tr { padding: 0.45em 0; border-bottom: 1px solid var(--row-edge); }
  .opps td { border: 0; padding: 0.05em 0; width: auto !important; white-space: normal; }
  .opps td[data-label]::before { content: attr(data-label) ": "; color: var(--faint); font-size: 0.85rem; }
  .row-main, .row-line { white-space: normal; }
}
