/* onService Live (Control Center P1-preview). No external fonts/CDNs (CSP: self only). */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #172033; --muted: #5d6b82; --line: #dfe4ec;
  --brand: #1f5eff; --brand-ink: #ffffff;
  --ok: #0f9d58; --ok-bg: #e3f6ec; --busy: #d93025; --busy-bg: #fde8e6; --ring: #e37400; --ring-bg: #fff1dc;
  --hold: #7b4fd6; --hold-bg: #efe8fc; --pause: #8a5a00; --pause-bg: #fbf0d6; --off: #7a8599; --off-bg: #eceff4;
  --warn-bg: #fff4cf; --warn-ink: #6b4d00; --red-tile: #fde2df; --yellow-tile: #fff3cc;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141c; --panel: #171e29; --ink: #e8edf5; --muted: #9aa7bb; --line: #263142;
    --brand: #5b8cff; --brand-ink: #0b1020;
    --ok: #3ddc84; --ok-bg: #12301f; --busy: #ff6b5e; --busy-bg: #3a1714; --ring: #ffb347; --ring-bg: #3a2810;
    --hold: #b38cff; --hold-bg: #2a1f45; --pause: #f0c060; --pause-bg: #3a2e10; --off: #8592a6; --off-bg: #222b38;
    --warn-bg: #3a3110; --warn-ink: #ffd76a; --red-tile: #3d1916; --yellow-tile: #3a3110;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, textarea, select { font: inherit; }
.muted { color: var(--muted); } .small { font-size: 13px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.brand span { color: var(--brand); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-ink); }
.spacer { flex: 1; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; }
.topbar nav a.active, .topbar nav a:hover { color: var(--ink); background: var(--bg); }
.who { color: var(--muted); font-size: 14px; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 7px 14px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn:disabled { opacity: .55; cursor: default; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }

.banner { margin: 14px 20px 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; }
.banner.stale { background: var(--busy-bg); color: var(--busy); font-weight: 700; }
main.wrap { padding: 16px 20px 110px; max-width: 1500px; margin: 0 auto; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 22px 0 10px; }

/* ---------- queue tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.tile.yellow { background: var(--yellow-tile); } .tile.red { background: var(--red-tile); }
.tile h3 { margin: 0 0 8px; font-size: 16px; display: flex; justify-content: space-between; gap: 8px; }
.tile h3 .num { color: var(--muted); font-weight: 600; }
.big { display: flex; gap: 18px; align-items: baseline; margin-bottom: 8px; }
.big .v { font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.big .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; font-size: 13px; }
.kv b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- status chips ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st.available { color: var(--ok); background: var(--ok-bg); }
.st.oncall, .st.on-call { color: var(--busy); background: var(--busy-bg); }
.st.ringing { color: var(--ring); background: var(--ring-bg); }
.st.onhold, .st.on-hold { color: var(--hold); background: var(--hold-bg); }
.st.paused { color: var(--pause); background: var(--pause-bg); }
.st.offline { color: var(--off); background: var(--off-bg); }

/* ---------- agents ---------- */
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.agent { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--off); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.agent.available { border-left-color: var(--ok); } .agent.on-call { border-left-color: var(--busy); }
.agent.ringing { border-left-color: var(--ring); } .agent.on-hold { border-left-color: var(--hold); } .agent.paused { border-left-color: var(--pause); }
.agent .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.agent .nm { font-weight: 700; font-size: 16px; }
.agent .ext { color: var(--muted); font-size: 13px; }
.agent .line2 { margin-top: 6px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.agent .call { margin-top: 6px; font-size: 13px; }
.agent.me { outline: 2px solid var(--brand); }

/* ---------- tables ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: var(--bg); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 14px; color: var(--muted); }
.tablewrap { overflow-x: auto; }

/* ---------- login ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; }
.login-card h1 { margin: 0; font-size: 24px; }
.login-card label { display: block; margin-top: 14px; font-weight: 600; font-size: 14px; }
.login-card input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
.login-card button { width: 100%; margin-top: 18px; padding: 11px; border: 0; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-weight: 700; cursor: pointer; }
.error { background: var(--busy-bg); color: var(--busy); padding: 10px 12px; border-radius: 10px; font-size: 14px; }

/* ---------- report-a-problem ---------- */
.fab { position: fixed; right: 18px; bottom: 18px; z-index: 20; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px;
  border: 0; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-weight: 700; box-shadow: 0 6px 18px rgba(31,94,255,.35); cursor: pointer; }
.fab:hover { filter: brightness(1.08); }
.overlay { position: fixed; inset: 0; background: rgba(10,14,22,.55); z-index: 30; display: flex; align-items: flex-end; justify-content: flex-end; padding: 16px; }
.dialog { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); color: var(--ink); border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.35); padding: 20px; }
.dialog h3 { margin: 0 0 4px; font-size: 19px; }
.dialog textarea { width: 100%; min-height: 120px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical; }
.drop { margin-top: 12px; border: 2px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--brand); color: var(--brand); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; aspect-ratio: 4/3; background: var(--bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 4px; right: 4px; border: 0; border-radius: 999px; width: 24px; height: 24px; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; line-height: 24px; padding: 0; }
.row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.ok-msg { background: var(--ok-bg); color: var(--ok); padding: 12px; border-radius: 10px; font-weight: 600; }

/* ---------- feedback list ---------- */
.reports { display: grid; gap: 12px; }
.report { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.report .meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
.report .msg { white-space: pre-wrap; margin: 10px 0; font-size: 15px; }
.report .shots { display: flex; gap: 8px; flex-wrap: wrap; }
.report .shots img { width: 160px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--off-bg); color: var(--off); }
.badge.new { background: var(--ring-bg); color: var(--ring); } .badge.fixed { background: var(--ok-bg); color: var(--ok); }
.badge.in-progress { background: var(--hold-bg); color: var(--hold); }
.lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.85); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

@media (max-width: 640px) {
  .topbar { padding: 10px 12px; position: static; } .clock { font-size: 12px; } main.wrap { padding: 12px 12px 110px; } .banner { margin: 12px 12px 0; }
  .big .v { font-size: 30px; } .fab span.lbl { display: none; } .overlay { padding: 8px; align-items: flex-end; }
}
