/* Call Capture – web app styles */
:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --bg: #f4f5f7; --surface-1: #fcfcfb; --surface-2: #ffffff; --surface-3: #ffffff;
  --text-1: #0b0b0b; --text-2: #52514e; --muted: #6b6a66; --border: #e3e2de; --grid: #ecebe7;
  --brand: #1f6feb; --brand-ink: #ffffff; --brand-soft: #e7f0fe;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
  --ok-bg: #e6f6ee; --ok-ink: #0b6b3a; --err-bg: #fdecec; --err-ink: #a32020; --warn-ink: #9a4a12;
  --late: #fff4e5;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #121211; --surface-1: #1a1a19; --surface-2: #1f1f1e; --surface-3: #2a2a28;
    --text-1: #ffffff; --text-2: #c3c2b7; --muted: #9c9b93; --border: #34332f; --grid: #2a2a28;
    --brand: #3987e5; --brand-soft: #1d2b40;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --ok-bg: #15301f; --ok-ink: #7fe0a8; --err-bg: #3a1717; --err-ink: #ff9b9b; --warn-ink: #f2a26b;
    --late: #33281a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text-1); font: 15px/1.45 var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code { background: var(--surface-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: .85em; word-break: break-all; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem;
  background: var(--surface-2); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; color: var(--text-1); white-space: nowrap; }
.top nav { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
.top nav a { color: var(--text-2); padding: .4rem .7rem; border-radius: 8px; }
.top nav a.on, .top nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.who { font-size: .85rem; white-space: nowrap; }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-1); font-size: 1.1rem; padding: .2rem .6rem; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 1rem; }
.foot { text-align: center; padding: 1.5rem; font-size: .8rem; }

/* cards & layout */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid2 .card { margin: 0; }
.grid2 + * { margin-top: 1rem; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0 0 .8rem; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.scroll { overflow-x: auto; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; }
.kpi span { display: block; color: var(--text-2); font-size: .82rem; }
.kpi b { display: block; font-size: 1.7rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: .1rem; }
.kpi b.small-b { font-size: 1.15rem; }
.kpi small { color: var(--muted); font-size: .78rem; }
.kpi.warn b { color: var(--warn-ink); }

.chart { position: relative; height: 280px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tr.dim td { opacity: .55; }
tr.late { background: var(--late); }
td.nowrap, .nowrap { white-space: nowrap; }
td.notes { max-width: 320px; font-size: .9rem; }
audio { height: 34px; max-width: 240px; vertical-align: middle; }
.dl { font-size: 1.1rem; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; border: 1px solid var(--border); color: var(--text-1); }
.badge::first-letter { font-weight: 700; }
.badge.in { box-shadow: inset 3px 0 0 var(--s1); }
.badge.out { box-shadow: inset 3px 0 0 var(--s3); }
.badge.miss { box-shadow: inset 3px 0 0 var(--s2); }
.stars { color: #c98500; letter-spacing: 1px; white-space: nowrap; }
.pill { display: inline-block; background: var(--brand-soft); color: var(--text-1); border-radius: 999px; padding: .1rem .6rem; font-size: .82rem; margin-top: .2rem; }
.pill.big { font-size: .95rem; padding: .4rem .9rem; }

/* filters & forms */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; font-size: .8rem; color: var(--text-2); gap: .2rem; }
.filters .grow { flex: 1; min-width: 200px; }
.filters .dates { display: none; }
.filters.show-dates .dates { display: flex; }
input, select, textarea { font: inherit; color: var(--text-1); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .6rem; min-height: 38px; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; background: var(--brand); color: var(--brand-ink);
  border: 1px solid var(--brand); border-radius: 8px; padding: .5rem 1rem; font: inherit; font-weight: 600; cursor: pointer; min-height: 38px; text-decoration: none !important; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.small { padding: .3rem .7rem; min-height: 30px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.form { display: grid; gap: .8rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--text-2); }
.form.two { grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
.form h2 { margin: .6rem 0 0; }
label.check { flex-direction: row !important; align-items: flex-start; gap: .5rem !important; color: var(--text-1) !important; }
label.check input { min-height: 0; margin-top: .2rem; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: .8rem 1rem; display: grid; gap: .6rem; }
legend { padding: 0 .4rem; font-weight: 600; font-size: .9rem; }
.radio-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
label.radio { flex-direction: row !important; gap: .5rem !important; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: .6rem; color: var(--text-1) !important; cursor: pointer; }
label.radio input { min-height: 0; margin-top: .25rem; }
form.inline { display: inline; }
.toggle { border: 1px solid var(--border); background: var(--surface-3); color: var(--muted); border-radius: 999px; padding: .2rem .7rem; font: inherit; font-size: .8rem; cursor: pointer; }
.toggle.on { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }

.ok, .err { padding: .7rem 1rem; border-radius: 10px; }
.ok { background: var(--ok-bg); color: var(--ok-ink); }
.err { background: var(--err-bg); color: var(--err-ink); }

.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin: 1rem 0; }
.tableview summary { cursor: pointer; color: var(--brand); }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 1.1rem 1rem; }
.timeline li::before { content: ""; position: absolute; left: -1.42rem; top: .45rem; width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--surface-1); }
.timeline p { margin: .3rem 0; }
.tl-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* login */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 1.6rem; }
.auth-card h1 { margin-top: 0; }

/* phone */
@media (max-width: 860px) {
  .grid2, .form.two, .radio-row { grid-template-columns: 1fr; }
  .menu-btn { display: block; }
  .top { flex-wrap: wrap; }
  .top nav, .who { display: none; width: 100%; }
  body.nav-open .top nav { display: flex; flex-direction: column; }
  body.nav-open .who { display: block; padding: .4rem .7rem; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi b { font-size: 1.35rem; }
  .wrap { padding: .8rem 16px; }
  .chart { height: 240px; }
}
