:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5f6b7a;
  --border: #dde2e8;
  --accent: #1d5fd1;
  --accent-text: #ffffff;
  --good: #1f7a3d;
  --good-bg: #e4f4e9;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --warn-bg: #fff4d6;
  --tag-bg: #eef1f5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --surface: #1c2026;
    --text: #e6e9ed;
    --muted: #9aa5b1;
    --border: #2d333b;
    --accent: #5b9bff;
    --accent-text: #0b1220;
    --good: #6fd08f;
    --good-bg: #17331f;
    --bad: #ff8a80;
    --bad-bg: #3a1d1b;
    --warn-bg: #3a3218;
    --tag-bg: #262c34;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0.25rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; }
main { max-width: 1200px; margin: 0 auto; padding: 1rem 16px 3rem; }

.top { display: flex; align-items: center; gap: 1.5rem; padding: 0.6rem 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.top nav { display: flex; gap: 1rem; flex-wrap: wrap; flex: 1; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.logout { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin: 0 0 1rem; }
.card.narrow { max-width: 380px; margin: 4rem auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }

label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 400; }
label.short { max-width: 9rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.55rem; width: 100%; }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }
button { font: inherit; background: var(--accent); color: var(--accent-text); border: 0; border-radius: 6px; padding: 0.45rem 0.9rem; cursor: pointer; }
button.small { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
button.link { background: none; color: var(--accent); padding: 0; }
button.danger, button.link.danger { color: var(--bad); }
button.danger:not(.link) { background: var(--bad-bg); }
button:disabled { opacity: 0.4; cursor: default; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--bg); }
tr.inactive { opacity: 0.55; }
td.center { text-align: center; }
td.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.nowrap { white-space: nowrap; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; word-break: break-word; }

.tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--tag-bg); font-size: 0.8rem; white-space: nowrap; }
.tag.big { font-size: 0.95rem; padding: 0.2rem 0.8rem; }
.tag.good, .status-kompletiran { background: var(--good-bg); color: var(--good); }
.tag.bad, .status-eliminisan_grad, .status-odustao, .status-bez_pristanka, .status-nije_posao { background: var(--bad-bg); color: var(--bad); }
.status-u_toku { background: var(--warn-bg); }

.tabs { display: flex; gap: 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.tabs a.active { font-weight: 700; color: var(--text); }
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filters input, .filters select { width: auto; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; color: var(--muted); }
.ok { background: var(--good-bg); color: var(--good); padding: 0.5rem 0.75rem; border-radius: 6px; }
.error { background: var(--bad-bg); color: var(--bad); padding: 0.5rem 0.75rem; border-radius: 6px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid var(--border); padding: 0.35rem 0 0.6rem 0.8rem; }
.timeline li.unanswered { border-left-color: var(--bad); }
.timeline .meta { font-size: 0.8rem; color: var(--muted); }
.timeline .q { font-weight: 500; }
.timeline .a { color: var(--text); }

.transcript { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.transcript li { display: flex; gap: 0.6rem; }
.transcript .who { min-width: 5.5rem; color: var(--muted); font-size: 0.85rem; }
.transcript li.agent span:last-child { color: var(--muted); }

.question { border-top: 1px solid var(--border); padding-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.sub { margin-left: 1.5rem; padding-left: 0.75rem; border-left: 3px solid var(--border); display: flex; flex-direction: column; gap: 0.5rem; }
table.log td { font-size: 0.85rem; }

@media (max-width: 640px) {
  .sub { margin-left: 0.5rem; }
  dl { grid-template-columns: 1fr; }
  dt { margin-top: 0.4rem; }
}
