/* Kontaktna shema – dizajn usklajen s portal.marex.si */
:root {
  --bg: #f4f4f5; --surface: #fff; --surface-2: #fafafa; --panel: #f4f4f5;
  --border: #e4e4e7; --border-strong: #d4d4d8; --row-line: #f1f1f3;
  --text: #18181b; --text-2: #3f3f46; --muted: #71717a; --muted-2: #a1a1aa;
  --accent: #18181b; --brand: #0f4c81; --green: #16a34a; --red: #dc2626; --red-soft: #fef2f2; --orange: #ea580c;
  --radius: 10px; --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.ico { width: 16px; height: 16px; flex: none; vertical-align: middle; stroke-width: 1.75; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden, [hidden] { display: none !important; }

/* ---------- okvir (kot domača stran portala) ---------- */
.shell { min-height: 100vh; padding: 16px; display: flex; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: clip; }
.topbar { position: sticky; top: 0; z-index: 30; height: 58px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .ico { width: 13px; height: 13px; }
.crumbs .strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-logo { height: 28px; width: auto; display: block; flex: none; }
.top-sep { width: 1px; height: 22px; background: var(--border); flex: none; }
.top-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.top-link:hover { color: var(--text); }
.content { flex: 1; padding: 26px clamp(16px, 4vw, 48px) 40px; background: var(--surface-2); }
.content > * { max-width: 1280px; margin-left: auto; margin-right: auto; }

/* ---------- gumbi ---------- */
.btn, .btn-primary, .btn-small {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s;
}
.btn:hover, .btn-small:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #27272a; border-color: #27272a; }
.btn .ico, .btn-primary .ico { width: 15px; height: 15px; }
.btn-small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-small .ico { width: 14px; height: 14px; }
.btn-small.danger, .btn.danger { color: var(--red); }
.btn-small.danger:hover, .btn.danger:hover { background: var(--red-soft); border-color: #fecaca; }
.btn-ghost { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); border: 0; background: none; cursor: pointer; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ---------- glava strani ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.gen-card { margin-left: auto; display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-sm); }
.gen-ico { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.gen-card small { display: block; font-size: 12px; color: var(--muted); }
.gen-card a { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }

/* ---------- orodna vrstica ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); width: 15px; height: 15px; }
.search input { width: 100%; height: 34px; padding: 0 10px 0 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); outline: 0; font-size: 13.5px; }
.search input:focus { border-color: #a1a1aa; box-shadow: 0 0 0 3px rgba(24,24,27,.07); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.chips a { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; font-weight: 500; background: var(--surface); color: var(--text-2); }
.chips a:hover { border-color: var(--border-strong); color: var(--text); }

/* ---------- kartice poslovalnic ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.pe { margin-bottom: 14px; overflow: hidden; scroll-margin-top: 74px; }
.pe-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pe-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--bg); border: 1px solid #ececef; display: inline-flex; align-items: center; justify-content: center; color: var(--text); flex: none; }
.pe-title { display: flex; flex-direction: column; min-width: 0; }
.pe-title h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.pe-sub { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pe-sub span, .pe-sub a { display: inline-flex; align-items: center; gap: 5px; }
.pe-sub .ico { width: 13px; height: 13px; }
.pe-sub a:hover { color: var(--text); }
.pe-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 5px; line-height: 1.4; white-space: nowrap; background: var(--bg); color: var(--text-2); border: 1px solid #ececef; }
.badge.off { background: #fef9c3; color: #854d0e; border-color: #fde68a; }

/* ---------- tabela ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .name { font-weight: 600; }
.tbl .role { color: var(--text-2); }
.tbl .mail a { color: var(--brand); }
.tbl .mail a:hover, .tbl .tel a:hover { text-decoration: underline; }
.tbl .tel { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .int { color: var(--muted); font-variant-numeric: tabular-nums; width: 52px; }
.empty-box { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- obrazci / modal ---------- */
.f { display: flex; flex-direction: column; gap: 5px; }
.f > label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.f input, .f select { height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); width: 100%; outline: 0; font-size: 13.5px; transition: border-color .12s, box-shadow .12s; }
.f select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 28px; }
.f input:focus, .f select:focus { border-color: #a1a1aa; box-shadow: 0 0 0 3px rgba(24,24,27,.07); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.span-all { grid-column: 1 / -1; }
.pair { display: grid; grid-template-columns: 1fr 80px; gap: 8px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text); }
.chk input { width: 15px; height: 15px; accent-color: var(--accent); }
.modal { position: fixed; inset: 0; background: rgba(9,9,11,.4); display: none; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 100; overflow: auto; }
.modal.open { display: flex; }
.modal-box { width: 100%; max-width: 600px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h2 { font-size: 16px; }
.modal-head .btn-ghost { margin-left: auto; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-foot .sp { margin-left: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--accent); color: #fff; padding: 9px 14px; border-radius: 9px; font-size: 13px; opacity: 0; transition: .18s; pointer-events: none; z-index: 120; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--red); }

/* ---------- prijava ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark { width: 36px; height: 36px; font-size: 16px; border-radius: 9px; }
.login-logo { height: 30px; width: auto; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.login-card .btn-primary { height: 40px; margin-top: 6px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 9px; font-size: 13px; margin-top: 14px; }

/* ---------- admin seznam ---------- */
.settings { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: end; padding: 14px 16px; margin-bottom: 18px; }
.handle { cursor: grab; color: var(--muted-2); display: inline-flex; padding: 4px; border-radius: 6px; }
.handle:hover { color: var(--text); background: var(--bg); }
.kl { list-style: none; margin: 0; padding: 0; min-height: 44px; }
.kl:empty::after { content: "Prazno – povleci kontakt sem ali dodaj novega"; display: block; padding: 12px 16px; color: var(--muted); font-size: 13px; }
.k { display: grid; grid-template-columns: 26px minmax(150px,1.3fr) minmax(110px,1fr) minmax(170px,1.4fr) minmax(120px,1fr) minmax(120px,1fr) auto; gap: 10px; align-items: center; padding: 7px 12px 7px 10px; border-bottom: 1px solid var(--row-line); font-size: 13px; background: var(--surface); }
.k:last-child { border-bottom: 0; }
.k:hover { background: var(--surface-2); }
.k.off { background: #fffbeb; }
.k .n { font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.k .m { color: var(--muted); }
.k > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k .acts { display: flex; gap: 2px; }
.k .note { grid-column: 2 / -1; font-size: 12px; color: #b45309; white-space: normal; margin-top: -3px; }
.pe-foot { padding: 8px 12px; border-top: 1px dashed var(--border); }
.pe.off .pe-head { background: #fffbeb; }
.sortable-ghost { opacity: .35; }

/* ---------- mobilno ---------- */
@media screen and (max-width: 900px) {
  .shell { padding: 0; }
  .main { border-radius: 0; border: 0; }
  .top-logo { height: 24px; }
  .settings { grid-template-columns: 1fr; }
  .k { grid-template-columns: 26px 1fr auto; row-gap: 2px; }
  .k .c-od, .k .c-mail, .k .c-tel, .k .c-mob { grid-column: 2 / 3; }
  .k .acts { grid-column: 3; grid-row: 1; }
}
@media screen and (max-width: 760px) {
  .gen-card { margin-left: 0; width: 100%; }
  .top-label { display: none; }
  .row2 { grid-template-columns: 1fr; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 10px 16px; border-bottom: 1px solid var(--row-line); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { padding: 1px 0; border: 0; }
  .tbl td:empty { display: none; }
  .tbl td.int { display: inline; width: auto; }
  .tbl td[data-l]:not(:empty)::before { content: attr(data-l) " "; color: var(--muted-2); font-size: 12px; }
}

/* ---------- tisk ---------- */
@media print {
  @page { size: A4 landscape; margin: 9mm; }
  body { background: #fff; font-size: 10px; }
  .shell { padding: 0; display: block; }
  .main { border: 0; border-radius: 0; }
  .topbar { position: static; height: auto; padding: 0 0 8px; }
  .top-actions .btn, .top-link, .toolbar, .chips { display: none !important; }
  .top-logo { height: 24px; }
  .content { padding: 0; background: #fff; }
  .page-head { margin: 8px 0; }
  .page-head h1 { font-size: 16px; }
  .gen-card { box-shadow: none; padding: 4px 10px; }
  .card { box-shadow: none; border-color: #bbb; border-radius: 6px; }
  .pe { margin-bottom: 6px; break-inside: auto; }
  .pe-head { padding: 5px 8px; }
  .pe-ico { display: none; }
  .pe-title h2 { font-size: 12px; }
  .tbl { font-size: 9.5px; }
  .tbl th, .tbl td { padding: 2px 6px; }
  .tbl th { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl tr { break-inside: avoid; }
  .tbl { display: table; width: 100% !important; }
  .tbl thead { display: table-header-group; }
  .tbl tbody { display: table-row-group; }
  .tbl tr { display: table-row; width: auto; }
  .tbl td, .tbl th { display: table-cell; width: auto; }
  .tbl { table-layout: fixed; }
  .tbl th:nth-child(1) { width: 19%; } .tbl th:nth-child(2) { width: 17%; } .tbl th:nth-child(3) { width: 25%; }
  .tbl th:nth-child(4) { width: 12%; } .tbl th:nth-child(5) { width: 6%; } .tbl th:nth-child(6) { width: 15%; } .tbl th:nth-child(7) { width: 6%; }
  .tbl td { overflow: hidden; text-overflow: ellipsis; }
  .tbl td::before { content: none !important; }
  .tbl td, .tbl th { white-space: nowrap; }
  .tbl td.mail, .tbl td.name, .tbl td.role { white-space: normal; }
  .tbl td a { color: inherit !important; }
  .gen-ico { width: 26px; height: 26px; border-radius: 7px; }
  .gen-card a { font-size: 13px; }
}
