:root {
  --bg: #1e1e1e;
  --panel: #252526;
  --panel-2: #2d2d30;
  --border: #3c3c3c;
  --border-soft: #333;
  --text: #d4d4d4;
  --muted: #9b9b9b;
  --blue: #0e639c;
  --blue-2: #094771;
  --green: #69c46d;
  --green-demo: #2f8f46;
  --yellow: #dcdc7b;
  --red: #f05d5e;
  --gray: #9b9b9b;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.35 "Segoe UI", Arial, sans-serif; }
a { color: #9cdcfe; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.app-shell { height: 100vh; display: flex; flex-direction: column; min-width: 1100px; }
.appbar { height: 34px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; background: #181818; border-bottom: 1px solid var(--border); }
.app-title { font-weight: 700; letter-spacing: .2px; display: inline-flex; align-items: center; gap: 6px; }
.brand-logo { display: inline-block; object-fit: contain; }
.brand-logo-appbar { width: 24px; height: 24px; }
.brand-logo-login { width: 32px; height: 32px; }
.global-counters { color: #c8c8c8; font-family: Consolas, monospace; }
.toolbar { height: 45px; display: flex; align-items: stretch; gap: 1px; padding: 4px 6px; background: var(--panel); border-bottom: 1px solid var(--border); }
.toolbtn { min-width: 74px; padding: 3px 7px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; background: #2b2b2b; color: var(--text); border: 1px solid var(--border); cursor: pointer; line-height: 1.1; }
.toolbtn span { color: #c5c5c5; font-size: 13px; }
.toolbtn:hover { background: #333337; }
.logout-form { margin-left: auto; display: flex; }
.tabs { height: 31px; display: flex; align-items: end; background: #202020; border-bottom: 1px solid var(--border); padding-left: 6px; }
.tab { padding: 7px 13px 6px; color: #bdbdbd; border: 1px solid transparent; border-bottom: none; }
.tab.active { background: var(--bg); color: #fff; border-color: var(--border); }
.filters { display: none; align-items: center; gap: 6px; padding: 5px 7px; background: #202020; border-bottom: 1px solid var(--border); }
.filters.open { display: flex; }
.filters input, .filters select { height: 25px; background: #151515; color: var(--text); border: 1px solid var(--border); padding: 2px 6px; }
.filters input[name="q"] { width: 220px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px; border: 1px solid var(--border); background: #282828; white-space: nowrap; }
.clear-link { color: var(--muted); }
.main-split { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.grid-wrap { flex: 1; min-height: 0; overflow: auto; border-bottom: none; }
.splitter {
  flex: 0 0 7px;
  height: 7px;
  min-height: 7px;
  max-height: 7px;
  width: 100%;
  cursor: row-resize;
  background: #1f1f1f;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
  box-sizing: border-box;
  touch-action: none;
  pointer-events: auto;
  z-index: 9999;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.splitter::after {
  content: '';
  display: block;
  width: 28px;
  height: 3px;
  border-top: 1px solid #444;
  border-bottom: 1px solid #444;
  background: transparent;
}
.splitter:hover, .splitter.dragging { background: #2a2a2a; }
.data-grid, .mini-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-grid th { position: sticky; top: 0; z-index: 2; height: 29px; background: #2b2b2b; color: #eee; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: left; font-weight: 700; white-space: nowrap; }
.data-grid th a { display: block; padding: 6px 7px; color: #eee; }
.data-grid td { height: 30px; padding: 3px 7px; border-right: 1px solid var(--border-soft); border-bottom: 1px solid #2c2c2c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-row { background: #1f1f1f; cursor: default; }
.data-row:nth-child(even) { background: #222; }
.data-row:hover { background: #2a2d2e; }
.data-row.selected, .data-row.selected:hover { background: var(--blue); color: #fff; }
.group-row td { height: 27px; padding: 4px 8px; background: #303030; border-top: 1px solid #444; border-bottom: 1px solid #444; color: #d7d7d7; font-weight: 700; }
.group-row.collapsed td { color: #bcbcbc; }
.group-count { color: var(--muted); font-weight: 400; }
.hidden { display: none; }
.empty { color: var(--muted); text-align: center; padding: 25px !important; }
.num { text-align: right; font-family: Consolas, "Courier New", monospace; }
.badge { display: inline-block; min-width: 42px; padding: 1px 5px; border-radius: 2px; border: 1px solid currentColor; font-size: 12px; text-align: center; text-transform: uppercase; }
.badge.ok, .ok { color: var(--green); }
.badge.demo, .demo { color: var(--green-demo); }
.badge.warn, .warn { color: var(--yellow); }
.badge.bad, .bad { color: var(--red); }
.badge.muted, .muted { color: var(--gray); }
.badge.ready_to_send { color: var(--yellow); }
.badge.sent { color: var(--green); }
.badge.failed { color: var(--red); }
.trust-risk-row { border-left: 4px solid var(--red); }
.trust-risk-row td:first-child { padding-left: 3px; }
.col-cost_today, .col-cost_month, .col-open_payments { color: #d7ba7d; }
.detail-panel { flex: 0 0 auto; overflow: auto; background: var(--panel); padding: 8px; min-height: 140px; }
.detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.detail-title { font-weight: 700; color: #fff; margin-bottom: 6px; }
.detail-actions { display: flex; gap: 8px; align-items: center; }
.detail-actions form { display: inline; }
.detail-actions button, .detail-actions a, .form-actions button, .form-actions a { background: #2b2b2b; border: 1px solid var(--border); color: var(--text); padding: 4px 8px; }
.detail-grid { display: grid; grid-template-columns: 130px minmax(200px, 1fr) 130px minmax(200px, 1fr); gap: 4px 10px; margin-bottom: 8px; }
.detail-grid > div { color: var(--muted); }
.detail-grid > span, .detail-grid > strong { overflow-wrap: anywhere; }
h3 { margin: 8px 0 4px; font-size: 13px; color: #eee; }
.mini-table th, .mini-table td { padding: 4px 6px; border: 1px solid var(--border); vertical-align: top; }
.mini-table th { background: #303030; text-align: left; }
.mini-table td { background: #202020; }
.risk-word { background: #6f1d1d; color: #fff; padding: 0 2px; }
.statusbar { height: 24px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; background: #007acc; color: #fff; font-size: 12px; white-space: nowrap; }
.statusbar a { color: #fff; margin-right: 12px; }
.login-shell, .form-shell { min-height: 100vh; background: var(--bg); }
.login-shell { display: grid; place-items: center; }
.login-box, .edit-form { width: 380px; background: var(--panel); border: 1px solid var(--border); padding: 16px; }
.login-box h1, .edit-form h1 { margin: 0 0 10px; font-size: 18px; }
.login-title { display: inline-flex; align-items: center; gap: 8px; }
.login-box p { margin: 0 0 12px; color: var(--muted); }
.login-box label, .edit-form label { display: block; margin-bottom: 9px; color: #cfcfcf; }
.login-box input, .edit-form input, .edit-form select, .edit-form textarea { width: 100%; margin-top: 3px; background: #151515; color: var(--text); border: 1px solid var(--border); padding: 6px; }
.edit-form textarea { min-height: 70px; resize: vertical; }
.login-box button, .edit-form button { width: 100%; margin-top: 8px; padding: 7px; color: #fff; background: var(--blue); border: 1px solid #1177bb; }
.flash.error { padding: 6px; margin-bottom: 8px; background: #5a1d1d; border: 1px solid var(--red); }
.form-shell .appbar { margin-bottom: 16px; }
.edit-form { width: min(720px, calc(100vw - 40px)); margin: 0 auto; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.settings-form small { display: block; color: var(--muted); margin-top: 2px; }

/* --- Infrastructure tab ------------------------------------------------- */
.infra-sync-form { display: inline-flex; }
.toolbtn-infra { border-color: #1e6bff55; }
.infra-main { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.infra-header { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px; background: var(--panel); border-bottom: 1px solid var(--border); }
.infra-count { color: var(--muted); font-size: 12px; }
.infra-notice { padding: 6px 10px; font-size: 12px; border-bottom: 1px solid var(--border); }
.infra-notice.info { background: #0d2a4a; color: #9cdcfe; }
.infra-notice.ok { background: #1b3a1b; color: var(--green); }
.infra-notice.error { background: #3a1a1a; color: var(--red); }
.infra-notice code { background: #1e1e1e; padding: 0 3px; border-radius: 2px; }
.infra-wrap { flex: 1; min-height: 0; overflow: auto; }
.infra-table { table-layout: auto; }
.infra-table th { white-space: nowrap; }
.infra-ports { font-family: Consolas, monospace; font-size: 11px; color: #b5cea8; }
.infra-image { color: #ce9178; }
.infra-unmapped { opacity: 0.75; border-left: 3px solid #555; }
.infra-unmapped td:first-child { padding-left: 4px; }
.infra-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 12px; color: var(--muted); }

@media (max-width: 1366px) {
  body { font-size: 13px; }
  .toolbtn { min-width: 65px; padding: 3px 5px; }
  .data-grid th a, .data-grid td { padding-left: 5px; padding-right: 5px; }
}

/* http_stats source: cost figures are estimates (messages x 0.001 USD). */
.est-flag { font-size: 10px; color: #8a8a8a; letter-spacing: .02em; }

/* V9.2: "Otvori kao klijent" u Clients tabu */
.data-grid td.col-portal { white-space: nowrap; }
.open-as-client { display: inline-block; padding: 2px 8px; border-radius: 4px;
                  border: 1px solid #3a6ea5; color: #3a6ea5; text-decoration: none;
                  font-size: 12px; }
.open-as-client:hover { background: #3a6ea5; color: #fff; }

/* Pregled klijenata (03.11.2026): ko placa, do kad, sta kasni, sledeci rokovi */
.client-overview { padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); }
.client-overview .co-head { margin-bottom: 6px; color: #e6e6e6; }
.client-overview .co-late-count { color: var(--red); font-weight: 700; }
.co-table { width: 100%; border-collapse: collapse; background: var(--bg); }
.co-table th, .co-table td { text-align: left; vertical-align: top; padding: 5px 8px; border: 1px solid var(--border); color: var(--text); }
.co-table th { background: #2b2b2b; color: #eee; font-weight: 700; }
.co-table a { color: #fff; }
.co-table a:hover { text-decoration: underline; }
.co-row-late td:first-child { border-left: 4px solid var(--red); }
.co-ok { color: var(--green); font-weight: 700; }
.co-free { color: #9cdcfe; font-weight: 700; }
.co-bad { color: var(--red); font-weight: 700; }
.co-days { color: var(--muted); }

/* Lina pogled (03.11.2026): gornji meni sa padajucom listom Lina; strana /lina/<id> 1/3 + 2/3 */
.topnav { height: 32px; display: flex; align-items: stretch; background: #202020; border-bottom: 1px solid var(--border); padding-left: 6px; }
.topnav-item { position: relative; display: inline-flex; align-items: center; padding: 0 14px; color: #bdbdbd; border-right: 1px solid #2a2a2a; }
.topnav-item:hover, .topnav-item.active { background: var(--bg); color: #fff; }
.topnav-item.has-menu > .topnav-link { color: inherit; display: inline-flex; align-items: center; gap: 4px; height: 100%; }
.topnav-item .caret { font-size: 11px; color: #9cdcfe; }
.topnav-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 300px; max-height: 70vh; overflow: auto; background: #252526; border: 1px solid var(--border); box-shadow: 0 10px 24px rgba(0,0,0,.5); z-index: 500; padding: 4px 0; }
.topnav-item.has-menu:hover .topnav-menu, .topnav-item.has-menu:focus-within .topnav-menu { display: block; }
.topnav-menu .menu-group { padding: 6px 12px 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.topnav-menu .menu-link { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 18px; color: #e6e6e6; white-space: nowrap; }
.topnav-menu .menu-link:hover, .topnav-menu .menu-link.current { background: var(--blue-2); color: #fff; }
.topnav-menu .menu-domain { color: var(--muted); font-size: 11px; margin-left: auto; padding-left: 12px; }
.topnav-menu .menu-all { border-top: 1px solid var(--border); margin-top: 4px; padding-left: 12px; color: #9cdcfe; }
.topnav-menu .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.lina-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 1fr) 2fr; }
.lina-client { overflow: auto; padding: 10px 12px; background: var(--panel); border-right: 1px solid var(--border); }
.lina-texts { overflow: hidden; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.lv-title { font-weight: 700; font-size: 15px; color: #fff; }
.lv-sub { color: var(--muted); margin: 2px 0 8px; }
.lv-kv { display: grid; grid-template-columns: 90px 1fr; gap: 3px 8px; margin-bottom: 6px; }
.lv-kv > div { color: var(--muted); }
.lv-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.lv-actions a { background: #2b2b2b; border: 1px solid var(--border); color: var(--text); padding: 3px 8px; }
.lv-channels th { width: 80px; color: var(--muted); font-weight: 400; }
.lv-notes { white-space: pre-wrap; color: #cfcfcf; font-size: 12px; }
.lv-texts-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: #202020; }
.lv-dir { color: var(--muted); font-family: Consolas, monospace; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-filetabs { display: flex; gap: 2px; padding: 6px 12px 0; border-bottom: 1px solid var(--border); background: #202020; overflow-x: auto; }
.lv-filetab { background: #2b2b2b; color: #bdbdbd; border: 1px solid var(--border); border-bottom: none; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.lv-filetab.active { background: var(--bg); color: #fff; }
.lv-filetab .muted { font-size: 11px; margin-left: 6px; }
.lv-text { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 12px 16px; white-space: pre-wrap; word-wrap: break-word; font: 13px/1.5 Consolas, "Courier New", monospace; color: #d7d7d7; }
.lv-empty { padding: 30px; color: var(--muted); text-align: center; }

/* Pocetna (03.11.2026): sta trazi Dejana, klijenti kao kartice, bez tabela */
.home-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.home-logout { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: 2px 10px; cursor: pointer; }
.home { width: min(1120px, 100%); margin: 0 auto; padding: 28px 20px 48px; font-size: 15px; line-height: 1.45; }
.home-date { color: var(--muted); font-size: 13px; }
.home h1 { margin: 2px 0 20px; font-size: 28px; line-height: 1.2; color: #fff; font-weight: 600; }
.home h2 { margin: 34px 0 12px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.home-todo { display: grid; gap: 8px; }
.todo { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--yellow); border-radius: 8px; color: var(--text); }
.todo.bad { border-left-color: var(--red); }
.todo:hover { background: var(--panel-2); }
.todo strong { display: block; color: #fff; font-size: 16px; font-weight: 600; }
.todo span { color: var(--muted); font-size: 14px; }
.todo .go { margin-left: auto; color: #9cdcfe; white-space: nowrap; font-size: 14px; }
.home-clear { padding: 16px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--green); border-radius: 8px; color: #e6e6e6; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.ccard { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-top: 3px solid var(--green); border-radius: 8px; color: var(--text); }
.ccard.warn { border-top-color: var(--yellow); }
.ccard.bad { border-top-color: var(--red); }
.ccard:hover { background: var(--panel-2); }
.ccard-name { color: #fff; font-size: 18px; font-weight: 600; line-height: 1.25; }
.ccard-state { font-size: 15px; font-weight: 600; color: var(--green); }
.ccard.warn .ccard-state { color: var(--yellow); }
.ccard.bad .ccard-state { color: var(--red); }
.ccard-next, .ccard-msgs { color: var(--muted); font-size: 14px; }
.ccard-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.pill { padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; color: #cfcfcf; }
.home-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
a.stat:hover { background: var(--panel-2); }
.stat b { display: block; color: #fff; font-size: 24px; font-weight: 600; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13.5px; }
.home-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-link { padding: 8px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; }
.chip-link:hover { background: var(--panel-2); color: #fff; }
.chip-link.primary { background: var(--blue); border-color: #1177bb; color: #fff; }
.lina-main-solo { grid-template-columns: minmax(300px, 640px); justify-content: center; }
@media (max-width: 700px) {
  .home { padding: 18px 14px 36px; }
  .home h1 { font-size: 23px; }
  .home-cards { grid-template-columns: 1fr; }
  .todo { flex-wrap: wrap; gap: 4px 14px; }
  .todo .go { margin-left: 0; }
  .topnav { height: auto; flex-wrap: wrap; }
  .topnav-item { min-height: 40px; }
}
/* 17.11.2026: dugme Placeno (forma placanja i lista) */
.paid-form { margin-top: 12px; display: flex; gap: 12px; align-items: center; }
.paid-button { background: #1f7a4d; color: #fff; border: 1px solid #1f7a4d; font-weight: 600; padding: 8px 18px; cursor: pointer; }
.paid-button:hover { background: #17633e; }
.paid-button.small { padding: 2px 10px; font-size: 12px; }
.paid-hint { font-size: 12px; opacity: .75; }
.col-paid form { margin: 0; }
