/* Atlas Call Center — operativni konzol.
   Dizajn: tamna, gusta, mirna "mission control" površina koju agent gleda 8h.
   Boje statusa NOSE ZNAČENJE (zeleno=slobodan, plavo=na pozivu, žuto=wrap,
   crveno=hitno/negativno). Jedan akcent (teal) korišten štedljivo. */

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --elevated:  #1c2230;
  --border:    #262d3a;
  --border-2:  #323b4c;
  --text:      #e6edf3;
  --muted:     #8b97a7;
  --faint:     #5b6675;

  --accent:    #2dd4bf;   /* teal — akcent, štedljivo */
  --accent-dim:#1b8276;

  --ok:        #3fb950;   /* slobodan / pozitivno */
  --busy:      #58a6ff;   /* na pozivu / aktivno */
  --warn:      #d29922;   /* wrap / pending */
  --idle:      #8b949e;   /* pauza / offline */
  --bad:       #f85149;   /* hitno / negativno */
  --vip:       #d4af37;

  --r: 8px;
  --r-lg: 12px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Layout shell ---- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 210px; flex: 0 0 210px; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 16px 18px; font-weight: 700; letter-spacing: .04em; font-size: 15px;
  display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--border);
}
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent); }
.brand small { color: var(--faint); font-weight: 400; letter-spacing: 0; font-size: 11px; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  color: var(--muted); padding: 9px 12px; border-radius: var(--r); font-weight: 500;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px;
}
.nav a:hover { background: var(--elevated); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--elevated); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav .ico { width: 16px; text-align: center; opacity: .85; }
.side-foot { padding: 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.side-foot .me { color: var(--text); font-weight: 600; }
.side-foot a { color: var(--faint); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 52px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  padding: 0 20px; gap: 16px; background: rgba(13,17,23,.7); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 15px; margin: 0; font-weight: 650; }
.topbar .spacer { flex: 1; }
.content { padding: 20px; flex: 1; }

/* ---- Pills / badges ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--elevated); color: var(--muted);
  border: 1px solid var(--border);
}
.pill .led { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok    { color: var(--ok); }
.pill.busy  { color: var(--busy); }
.pill.warn  { color: var(--warn); }
.pill.idle  { color: var(--idle); }
.pill.bad   { color: var(--bad); }
.pill.vip   { color: var(--vip); border-color: #4a3d12; background: #241d08; }
.pill.accent{ color: var(--accent); }

.tag { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--elevated);
  color: var(--muted); border: 1px solid var(--border); }

/* ---- Buttons ---- */
.btn {
  font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  padding: 9px 15px; border-radius: var(--r); border: 1px solid var(--border-2);
  background: var(--elevated); color: var(--text); transition: .12s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--accent-dim); }
.btn.primary { background: var(--accent); color: #042f2a; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: #2a1416; color: var(--bad); border-color: #5e2327; }
.btn.danger:hover { background: #3a181b; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Cards / panels ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-h { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 650;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }

/* ---- Tables ---- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; color: var(--faint); font-weight: 600; text-transform: uppercase;
  font-size: 11px; letter-spacing: .04em; padding: 8px 12px; border-bottom: 1px solid var(--border); }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.tbl tr:hover td { background: rgba(255,255,255,.015); }
.mono { font-family: var(--mono); }

/* ---- KPI ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 700; font-family: var(--mono); letter-spacing: -.02em; }
.kpi .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.alert .v { color: var(--bad); }
.kpi.good .v { color: var(--ok); }

/* ---- Forms ---- */
input, select, textarea {
  font-family: inherit; font-size: 13.5px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--r); padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
label.f { display: block; font-size: 12px; color: var(--muted); margin: 0 0 5px; font-weight: 600; }
.field { margin-bottom: 12px; }

/* ====== AGENT DESKTOP ====== */
.agent-grid { display: grid; grid-template-columns: 280px 1fr 320px; gap: 16px; height: calc(100vh - 52px); padding: 16px; }
.col { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.col.scroll { overflow-y: auto; }

.call-cockpit { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.cockpit-head { display: flex; align-items: center; gap: 14px; padding: 16px; border-bottom: 1px solid var(--border); }
.cockpit-head .who { font-size: 18px; font-weight: 700; }
.cockpit-head .timer { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--busy); }
.cockpit-head .spacer { flex: 1; }

.transcript { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.line { max-width: 82%; padding: 9px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.4; }
.line .spk { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; opacity: .6; margin-bottom: 2px; }
.line.customer { align-self: flex-start; background: var(--elevated); border: 1px solid var(--border); }
.line.agent { align-self: flex-end; background: var(--accent-dim); color: #e9fffb; }
.transcript .empty { color: var(--faint); text-align: center; margin: auto; max-width: 280px; }

.compose { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.compose input { flex: 1; }

/* AI co-pilot panel */
.copilot { display: flex; flex-direction: column; gap: 14px; }
.sentiment-meter { height: 8px; border-radius: 999px; background: var(--elevated); overflow: hidden; position: relative; }
.sentiment-meter .fill { height: 100%; transition: .5s; }
.suggest-box { background: linear-gradient(180deg, rgba(45,212,191,.07), transparent);
  border: 1px solid var(--accent-dim); border-radius: var(--r); padding: 13px; font-size: 13.5px; line-height: 1.5; }
.suggest-box .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.kb-hit { padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 8px; background: var(--surface); }
.kb-hit .t { font-weight: 600; font-size: 13px; }
.kb-hit .s { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* customer 360 */
.c360 .row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.c360 .row .k { color: var(--muted); }
.c360 .row:last-child { border: none; }
.hist-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.hist-item:last-child { border: none; }

.queue-card { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: var(--r); background: var(--surface); margin-bottom: 8px; }
.queue-card.urgent { border-color: #5e2327; }
.queue-card .meta { flex: 1; }
.queue-card .wait { font-family: var(--mono); font-size: 13px; color: var(--warn); }
.queue-card .wait.long { color: var(--bad); }

.empty-state { text-align: center; color: var(--faint); padding: 40px 20px; }
.empty-state .big { font-size: 40px; opacity: .4; }

/* status dot for agents */
.adot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.s-available { background: var(--ok); } .s-on_call { background: var(--busy); }
.s-wrap { background: var(--warn); } .s-break, .s-offline { background: var(--idle); }

/* bars (analytics, no chart lib) */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.bar-row .lab { width: 110px; color: var(--muted); flex: 0 0 110px; }
.bar-track { flex: 1; background: var(--elevated); border-radius: 5px; height: 22px; position: relative; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); display: flex; align-items: center; padding-left: 9px; font-size: 12px; font-family: var(--mono); color: #042f2a; font-weight: 700; }
.spark { display: flex; align-items: flex-end; gap: 5px; height: 80px; }
.spark .b { flex: 1; background: var(--accent-dim); border-radius: 3px 3px 0 0; min-height: 3px; position: relative; }
.spark .b:hover { background: var(--accent); }
.spark .b span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--faint); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 360px; }
.login-card .demo { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.7; }
.login-card .demo code { background: var(--elevated); padding: 1px 5px; border-radius: 4px; }

.err { background: #2a1416; border: 1px solid #5e2327; color: var(--bad); padding: 10px 12px; border-radius: var(--r); font-size: 13px; margin-bottom: 14px; }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--elevated); border: 1px solid var(--accent-dim);
  padding: 12px 16px; border-radius: var(--r); box-shadow: var(--shadow); z-index: 50; max-width: 320px; font-size: 13px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

@media (max-width: 1100px) { .agent-grid { grid-template-columns: 1fr; height: auto; } .col.scroll { overflow: visible; } }
@media (max-width: 720px) { .side { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* nav section dividers (admin/account groups) */
.nav-sec {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); opacity: .6; padding: 14px 12px 5px; font-weight: 600;
}
.nav-sec:first-child { padding-top: 6px; }

/* simple admin tables + forms */
.adm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.adm-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.adm-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.adm-table tr:hover td { background: var(--elevated); }
.role-badge { font-size: 11px; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--border);
  color: var(--text); display: inline-block; }
.role-badge.owner { color: var(--accent); border-color: var(--accent); }
.role-badge.admin { color: #F4A93B; border-color: #F4A93B; }
.badge-off { font-size: 11px; color: var(--bad); border: 1px solid var(--bad); padding: 1px 8px; border-radius: 99px; }
.badge-on { font-size: 11px; color: var(--accent); padding: 1px 8px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 16px; font-size: 16px; }
.frm-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 12px; }
.frm-row .full { grid-column: 1 / -1; }
.frm label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin-bottom: 6px; }
.frm input, .frm select, .frm textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 10px 12px; font-family: inherit; font-size: 14px; }
.frm input:focus, .frm select:focus, .frm textarea:focus { outline: none; border-color: var(--accent); }
.msg-ok { background: rgba(45,212,167,.12); border: 1px solid var(--accent); color: var(--accent);
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.msg-err { background: rgba(229,86,75,.12); border: 1px solid var(--bad); color: var(--bad);
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.inline-frm { display: flex; gap: 8px; align-items: center; }
.inline-frm input { width: 130px; }
@media (max-width: 640px){ .frm-row { grid-template-columns: 1fr; } }
