@font-face { font-family: 'Jakarta'; src: url('assets/PlusJakartaSans.ttf') format('truetype'); font-weight: 200 800; font-display: swap; }

:root {
  --red: #E3101C;
  --red-2: #FF3B3B;
  --red-soft: #FDECEC;
  --ink: #16161A;
  --ink-2: #4A4A55;
  --ink-3: #8A8A96;
  --line: #E8E8ED;
  --bg: #FAFAF9;
  --side: #F3F3F1;
  --card: #FFFFFF;
  --hover: rgba(17,17,20,.05);
  --user-bubble: #EFEFEC;
  --code-bg: rgba(17,17,20,.06);
  --green: #12A150; --green-soft: #E7F6EE;
  --amber: #B76E00; --amber-soft: #FFF4E0;
  --blue: #2463EB; --blue-soft: #EAF0FD;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(17,17,20,.04), 0 4px 16px rgba(17,17,20,.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red-soft: rgba(227,16,28,.16);
    --ink: #ECECEE; --ink-2: #B8B8C2; --ink-3: #7E7E8A;
    --line: #2C2C31; --bg: #1C1C1F; --side: #151517; --card: #242428;
    --hover: rgba(255,255,255,.06); --user-bubble: #2E2E33; --code-bg: rgba(255,255,255,.08);
    --green: #3DD68C; --green-soft: rgba(61,214,140,.14);
    --amber: #F5B544; --amber-soft: rgba(245,181,68,.14);
    --blue: #7EA6FF; --blue-soft: rgba(126,166,255,.14);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --red-soft: rgba(227,16,28,.16);
  --ink: #ECECEE; --ink-2: #B8B8C2; --ink-3: #7E7E8A;
  --line: #2C2C31; --bg: #1C1C1F; --side: #151517; --card: #242428;
  --hover: rgba(255,255,255,.06); --user-bubble: #2E2E33; --code-bg: rgba(255,255,255,.08);
  --green: #3DD68C; --green-soft: rgba(61,214,140,.14);
  --amber: #F5B544; --amber-soft: rgba(245,181,68,.14);
  --blue: #7EA6FF; --blue-soft: rgba(126,166,255,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Jakarta', 'Segoe UI', system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; color: inherit; }
input, textarea { color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }

.app { display: grid; grid-template-columns: 272px 1fr; height: 100vh; height: 100dvh; }

/* ---------- sidebar ---------- */
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; gap: 8px; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.brand b { color: var(--red); }
.new-chat { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 12px; font-weight: 600; box-shadow: var(--shadow); }
.new-chat:hover { border-color: var(--ink-3); }
.new-chat svg { color: var(--red); }
nav { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.nav { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border: 0; background: none; border-radius: 9px; color: var(--ink-2); font-weight: 600; text-align: left; position: relative; }
.nav svg { width: 17px; height: 17px; }
.nav:hover { background: var(--hover); }
.nav.active { background: var(--hover); color: var(--ink); }
.badge { margin-left: auto; background: var(--ink); color: var(--bg); font-size: 11px; border-radius: 99px; padding: 1px 7px; min-width: 20px; text-align: center; }
.badge.red { background: var(--red); color: #fff; }

.search { display: flex; align-items: center; gap: 8px; margin: 8px 2px 2px; padding: 7px 10px; border-radius: 9px; background: var(--hover); color: var(--ink-3); }
.search svg { width: 15px; height: 15px; }
.search input { border: 0; background: none; outline: none; font: inherit; flex: 1; min-width: 0; }
.conv-list { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.conv-group { font-size: 11.5px; color: var(--ink-3); font-weight: 600; padding: 12px 10px 4px; }
.conv { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--ink-2); position: relative; }
.conv:hover { background: var(--hover); }
.conv.active { background: var(--hover); color: var(--ink); font-weight: 600; }
.conv .t { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.conv .busy-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); animation: pulse 1.2s infinite; flex-shrink: 0; }
.conv .more { opacity: 0; border: 0; background: none; padding: 2px; border-radius: 6px; color: var(--ink-3); }
.conv:hover .more, .conv.active .more { opacity: 1; }
.conv .more:hover { background: var(--hover); color: var(--ink); }
.conv .more svg { width: 16px; height: 16px; }
.conv input { flex: 1; font: inherit; border: 1px solid var(--red); border-radius: 6px; padding: 2px 6px; background: var(--card); outline: none; }
.conv-empty { color: var(--ink-3); font-size: 13px; padding: 10px; }

.side-foot { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.team { display: grid; gap: 1px; }
.member { display: flex; align-items: center; gap: 9px; padding: 3px 8px; font-weight: 600; font-size: 13px; }
.member small { margin-left: auto; color: var(--ink-3); font-weight: 500; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dot.ok { background: var(--green); }
.dot.busy { background: var(--amber); animation: pulse 1.2s infinite; }
.dot.bad { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }
.foot-row { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.conn { font-size: 12px; color: var(--ink-3); }
.conn.off { color: var(--red); }
.theme-switch { display: flex; background: var(--hover); border-radius: 8px; padding: 2px; }
.theme-switch button { border: 0; background: none; padding: 4px 6px; border-radius: 6px; color: var(--ink-3); display: grid; place-items: center; }
.theme-switch button svg { width: 15px; height: 15px; }
.theme-switch button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.icon-btn { border: 0; background: none; padding: 7px; border-radius: 8px; color: var(--ink-2); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.on { color: var(--red); }

/* ---------- main ---------- */
main { min-width: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.view { display: none; height: 100%; flex-direction: column; }
.view.active { display: flex; }
.top { display: flex; align-items: center; gap: 16px; padding: 22px 28px 14px; }
.top > div:first-of-type { flex: 1; }
.top h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.sub { margin: 4px 0 0; color: var(--ink-3); }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 9px 14px; border-radius: 10px; font-weight: 600; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: linear-gradient(135deg, var(--red-2), var(--red)); color: #fff; border: 0; }
.btn.ok { background: var(--green); color: #fff; border: 0; }
.btn.danger { color: var(--red); }
.btn.small { padding: 6px 11px; font-size: 13px; }

/* ---------- chat ---------- */
.chat-top { display: flex; align-items: center; gap: 8px; padding: 12px 18px; min-height: 56px; }
.chat-top h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: text; color: var(--ink-2); }
.chat-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; }
.chat-wrap.with-live { grid-template-columns: 1fr 320px; }
.chat-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.messages { flex: 1; overflow-y: auto; padding: 8px 24px 24px; display: flex; flex-direction: column; gap: 18px; }
.messages > * { width: 100%; max-width: 780px; margin-left: auto; margin-right: auto; }
.msg { line-height: 1.65; font-size: 15px; }
.msg.korisnik { display: flex; justify-content: flex-end; }
.msg.korisnik .bubble { background: var(--user-bubble); padding: 10px 16px; border-radius: 18px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; }
.msg.lana { display: flex; gap: 14px; align-items: flex-start; }
.msg.lana .body { min-width: 0; flex: 1; word-wrap: break-word; }
.avatar { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; margin-top: 2px; }
.radnja { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); padding-left: 42px; margin-top: -8px; }
.radnja svg { width: 14px; height: 14px; color: var(--red); }
.msg.sistem { text-align: center; font-size: 12.5px; color: var(--ink-3); }
.msg.pitanje .body { border-left: 3px solid var(--red); padding-left: 14px; }
.options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.body p { margin: 0 0 10px; } .body p:last-child { margin: 0; }
.body ul, .body ol { margin: 4px 0 10px; padding-left: 22px; }
.body li { margin: 2px 0; }
.body code { background: var(--code-bg); padding: 1px 6px; border-radius: 5px; font-size: 13px; font-family: Consolas, 'Cascadia Code', monospace; }
.body pre { background: #141417; color: #e8e8ea; padding: 14px; border-radius: 12px; overflow-x: auto; font-size: 13px; border: 1px solid var(--line); }
.body pre code { background: none; color: inherit; padding: 0; }
.body a { color: var(--red); }
.body h3 { font-size: 16px; margin: 14px 0 6px; }
.body table { border-collapse: collapse; margin: 8px 0; font-size: 13.5px; display: block; overflow-x: auto; }
.body td, .body th { border: 1px solid var(--line); padding: 6px 10px; }
.typing { display: inline-flex; gap: 5px; padding: 10px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }

.welcome { margin: auto !important; text-align: center; padding: 40px 0; }
.welcome img { width: 52px; height: 52px; border-radius: 14px; }
.welcome h1 { font-size: 28px; letter-spacing: -.02em; margin: 16px 0 6px; font-weight: 700; }
.welcome p { color: var(--ink-3); margin: 0 0 22px; }
.suggest { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; text-align: left; }
.suggest button { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.suggest button:hover { border-color: var(--ink-3); color: var(--ink); }
.suggest b { display: block; color: var(--ink); margin-bottom: 2px; }

.composer { padding: 0 24px 14px; }
.composer-box { max-width: 780px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 12px 12px 8px 18px; box-shadow: var(--shadow); }
.composer-box:focus-within { border-color: var(--ink-3); }
.composer textarea { width: 100%; resize: none; border: 0; outline: none; background: none; font: inherit; font-size: 15px; max-height: 240px; line-height: 1.5; padding: 2px 0; }
.composer-bar { display: flex; align-items: center; gap: 8px; }
.hint { font-size: 12px; color: var(--ink-3); flex: 1; }
.send { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: grid; place-items: center; }
.send:disabled { opacity: .35; cursor: default; }
.send.stop { background: var(--ink); color: var(--bg); }
.disclaimer { text-align: center; font-size: 11.5px; color: var(--ink-3); margin: 8px 0 0; }

.live { border-left: 1px solid var(--line); background: var(--side); padding: 18px; overflow-y: auto; display: none; }
.with-live .live { display: block; }
.live h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 0 0 10px; }
.live-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.empty { color: var(--ink-3); font-size: 13px; margin: 0; }
.tcard { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; background: var(--card); }
.tcard:hover { border-color: var(--ink-3); }
.tcard .row { display: flex; align-items: center; gap: 8px; }
.tcard .title { font-weight: 600; font-size: 13px; }
.tcard .last { font-size: 12px; color: var(--ink-3); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard { border: 1.5px solid var(--amber); background: var(--amber-soft); border-radius: 12px; padding: 12px; }
.acard .what { font-family: Consolas, monospace; font-size: 12px; background: var(--card); padding: 8px; border-radius: 8px; margin: 8px 0; white-space: pre-wrap; word-break: break-all; max-height: 160px; overflow: auto; }
.acard .acts { display: flex; gap: 8px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.pill.radi { background: var(--blue-soft); color: var(--blue); }
.pill.ceka { background: var(--amber-soft); color: var(--amber); }
.pill.gotov { background: var(--green-soft); color: var(--green); }
.pill.greska, .pill.prekinut { background: var(--red-soft); color: var(--red); }
.wk { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--hover); color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.wk.claude { background: rgba(217,119,87,.15); color: #D97757; }
.wk.codex { background: var(--hover); color: var(--ink); }

/* ---------- zadaci ---------- */
.filters { display: flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 99px; font-weight: 600; color: var(--ink-2); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tasks-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); }
.tasks-layout.open { grid-template-columns: 1fr 540px; }
.table-wrap { overflow: auto; padding: 0 28px 28px; }
table.tasks { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tasks th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tasks td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tasks tr:last-child td { border-bottom: 0; }
.tasks tbody tr { cursor: pointer; }
.tasks tbody tr:hover td { background: var(--hover); }
.tasks tr.sel td { background: var(--red-soft); }
.tasks .folder { color: var(--ink-3); font-size: 12.5px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail { border-left: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; }
.detail .dh { padding: 18px 20px; border-bottom: 1px solid var(--line); max-height: 45%; overflow-y: auto; }
.detail .dh h3 { margin: 8px 0 4px; font-size: 17px; }
.detail .dh .acts { display: flex; gap: 8px; margin-top: 12px; }
.summary { margin-top: 12px; background: var(--bg); padding: 12px 14px; border-radius: 10px; line-height: 1.55; }
.log { flex: 1; overflow-y: auto; padding: 14px 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.le { line-height: 1.5; }
.le.alat { font-family: Consolas, monospace; font-size: 12px; color: var(--ink-2); background: var(--bg); padding: 6px 9px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; }
.le.zadatak { background: var(--blue-soft); padding: 10px; border-radius: 10px; white-space: pre-wrap; }
.le.odobrenje { background: var(--amber-soft); padding: 8px 10px; border-radius: 8px; }
.le.greska { color: var(--red); }
.le .t { font-size: 10.5px; color: var(--ink-3); }
.followup { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.followup input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; background: var(--bg); }
.mono { font-family: Consolas, monospace; font-size: 12px; word-break: break-all; color: var(--ink-2); }

/* ---------- odobrenja ---------- */
.appr-list { padding: 14px 28px 28px; display: grid; gap: 12px; overflow-y: auto; border-top: 1px solid var(--line); align-content: start; }
.appr-list .acard { max-width: 900px; }

/* ---------- podešavanja ---------- */
.settings { padding: 14px 28px 40px; overflow-y: auto; border-top: 1px solid var(--line); display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); align-content: start; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line); }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card p.sub { margin-bottom: 14px; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.srow:first-of-type { border-top: 0; }
.srow label { font-weight: 600; }
.srow input[type=text] { width: 230px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; background: var(--bg); }
.qr { display: flex; gap: 18px; align-items: center; padding-top: 10px; }
.qr .q { width: 210px; height: 210px; background: #fff; border-radius: 12px; padding: 10px; flex-shrink: 0; }
.qr .q img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

/* ---------- meni, pair, toast ---------- */
.menu { position: fixed; z-index: 70; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 4px; min-width: 170px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 7px; text-align: left; font-size: 13.5px; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--red); }
.menu svg { width: 15px; height: 15px; }
.pair { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 50; padding: 20px; }
.pair-card { background: var(--card); padding: 32px; border-radius: 20px; box-shadow: var(--shadow); max-width: 400px; width: 100%; display: grid; gap: 14px; text-align: center; border: 1px solid var(--line); }
.pair-logo { width: 56px; height: 56px; margin: 0 auto; border-radius: 14px; }
.pair-card h1 { margin: 0; font-size: 20px; }
.pair-card p { margin: 0; color: var(--ink-3); }
.pair-card input { border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: inherit; background: var(--bg); }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); z-index: 60; max-width: 360px; }
.scrim { display: none; }

/* ---------- telefon ---------- */
@media (max-width: 900px) {
  .mobile-only { display: inline-grid !important; }
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 86%; max-width: 320px; z-index: 40; transform: translateX(-102%); transition: transform .22s ease; padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .app.side-open .side { transform: none; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }
  main { height: 100dvh; }
  .chat-top { padding: calc(8px + env(safe-area-inset-top)) 10px 6px; min-height: 50px; }
  .top { padding: calc(12px + env(safe-area-inset-top)) 14px 10px; gap: 8px; flex-wrap: wrap; }
  .top h2 { font-size: 18px; }
  .top .sub { display: none; }
  .chat-wrap.with-live { grid-template-columns: 1fr; }
  .with-live .live { display: none; }
  #toggleLive { display: none; }
  .messages { padding: 4px 14px 16px; }
  .composer { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  .hint, .disclaimer { display: none; }
  .suggest { grid-template-columns: 1fr; }
  .welcome h1 { font-size: 23px; }
  .tasks-layout.open { grid-template-columns: 1fr; }
  .tasks-layout.open .table-wrap { display: none; }
  .table-wrap { padding: 0 12px 16px; }
  .tasks th:nth-child(4), .tasks td:nth-child(4), .tasks th:nth-child(6), .tasks td:nth-child(6) { display: none; }
  .settings { grid-template-columns: 1fr; padding: 12px 14px 30px; }
  .appr-list { padding: 12px 14px; }
  .srow input[type=text] { width: 150px; }
  .qr { flex-direction: column; align-items: flex-start; }
  .conv .more { opacity: 1; }
}
