/* ============================================================
   InvoiceCore – jednotný dizajnový systém
   Mobile-first, spoločné pre superadmin / admin / user
   ============================================================ */

:root {
  --navy:        #16213d;
  --navy-2:      #233256;
  --navy-light:  #eef1f6;
  --stamp:       #a33d2e;
  --stamp-bg:    #fbebe8;
  --teal:        #2f6f62;
  --teal-bg:     #e9f3f0;
  --amber:       #92620a;
  --amber-bg:    #fef3d9;
  --ink:         #16213d;
  --muted:       #5b6580;
  --light:       #8a93ab;
  --border:      #dde3ee;
  --bg:          #f4f6fa;
  --card:        #ffffff;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 1px 2px rgba(22,33,61,.04), 0 6px 20px rgba(22,33,61,.06);
  --shadow-md:   0 12px 32px rgba(22,33,61,.12);
  --font: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--navy); text-decoration: none; }
a.plain:hover, a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  height: 60px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 600;
  box-shadow: 0 2px 12px rgba(0,0,0,.20);
}
.navbar-brand {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.navbar-brand:hover { text-decoration: none; }
.navbar-brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--stamp); display: inline-block; }
.navbar-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  color: #cfd8ea; padding: 2px 8px; border-radius: 20px; margin-left: 2px;
}

.navbar-burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2); border-radius: 8px; cursor: pointer; padding: 6px; flex-shrink: 0;
}
.navbar-burger span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: .25s; }
.navbar-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar-burger.open span:nth-child(2) { opacity: 0; }
.navbar-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.navbar-nav { display: flex; align-items: center; gap: 2px; flex: 1; margin: 0 14px; }
.navbar-nav a {
  color: rgba(255,255,255,.82); padding: 7px 11px; border-radius: 8px; font-size: 13px; font-weight: 600;
  transition: background .15s; white-space: nowrap; display: flex; align-items: center; gap: 5px;
}
.navbar-nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.navbar-nav a.active { background: rgba(255,255,255,.20); color: #fff; }

.navbar-dropdown { position: relative; }
.navbar-dropdown > a.dd-trigger { cursor: pointer; }
.navbar-dropdown .dd-arrow { font-size: 9px; opacity: .7; transition: transform .15s; }
.navbar-dropdown.open .dd-arrow, .navbar-dropdown:hover .dd-arrow { transform: rotate(180deg); }
.navbar-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 60;
  background: var(--navy-2); border-radius: 10px; box-shadow: var(--shadow-md);
  min-width: 210px; padding: 6px; flex-direction: column; gap: 1px;
}
.navbar-dropdown:hover .navbar-dropdown-menu, .navbar-dropdown.open .navbar-dropdown-menu { display: flex; }
.navbar-dropdown-menu a { color: rgba(255,255,255,.85); padding: 8px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.navbar-dropdown-menu a:hover { background: rgba(255,255,255,.12); }
.navbar-dropdown-menu a.active { background: rgba(255,255,255,.20); color: #fff; font-weight: 600; }

.navbar-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.navbar-user {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); color: #fff;
  font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.navbar-logout { background: rgba(239,68,68,.2) !important; color: #fca5a5 !important; padding: 6px 11px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.notif-dot { display: inline-block; width: 7px; height: 7px; background: #ef4444; border-radius: 50%; flex-shrink: 0; }

.navbar-mobile {
  display: none; position: fixed; top: 60px; left: 0; right: 0;
  background: linear-gradient(180deg, var(--navy), var(--navy-2)); z-index: 599;
  padding: 8px 0 16px; box-shadow: 0 8px 24px rgba(0,0,0,.25); border-top: 1px solid rgba(255,255,255,.1);
  max-height: calc(100vh - 60px); overflow-y: auto;
}
.navbar-mobile.open { display: block; }
.navbar-mobile a {
  display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.9);
  font-size: 15px; font-weight: 600; padding: 13px 20px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.navbar-mobile a.active { background: rgba(255,255,255,.13); color: #fff; }
.navbar-mobile .mob-user { padding: 10px 20px 4px; font-size: 12px; color: rgba(255,255,255,.45); font-weight: 600; }
.navbar-mobile .mob-logout { color: #fca5a5 !important; margin-top: 4px; }

.navbar-overlay { display: none; position: fixed; inset: 0; top: 60px; background: rgba(0,0,0,.35); z-index: 598; }
.navbar-overlay.open { display: block; }

@media (max-width: 860px) {
  .navbar-nav, .navbar-user { display: none; }
  .navbar-burger { display: flex; }
}
@media (min-width: 861px) {
  .navbar-mobile, .navbar-overlay { display: none !important; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.wrap { max-width: 1400px; margin: 0 auto; padding: 22px 20px 60px; }
.wrap-narrow { max-width: 460px; margin: 0 auto; padding: 40px 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--light); }

/* ============================================================
   TABS (sekundárna navigácia v rámci sekcie, ak treba)
   ============================================================ */
nav.tabs { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
nav.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
nav.tabs a.active { color: var(--navy); border-color: var(--navy); font-weight: 600; }
nav.tabs a:hover { text-decoration: none; color: var(--navy); }

/* ============================================================
   KARTY
   ============================================================ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h3 { font-size: 15.5px; font-weight: 600; margin-bottom: 14px; }
.card-flat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }

/* ============================================================
   ŠTATISTICKÉ DLAŽDICE
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.customer-detail-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 18px; }
@media (min-width: 860px) {
  .customer-detail-grid { grid-template-columns: 1.1fr 2fr; }
}
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-tile .label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.stat-tile .value { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.stat-tile .sub { font-size: 12.5px; color: var(--light); margin-top: 4px; }
.stat-tile .value.danger { color: var(--stamp); }
.stat-tile .icon { width: 34px; height: 34px; border-radius: 8px; background: var(--navy-light); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }

/* ============================================================
   TLAČIDLÁ
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 17px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  border: 1.5px solid transparent; cursor: pointer; transition: transform .1s ease, background .15s ease;
  text-decoration: none !important; line-height: 1.2;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-stamp { background: var(--stamp); color: #fff; }
.btn-stamp:hover { background: #8f3527; }
.btn-ghost { border-color: var(--border); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--navy); background: var(--navy-light); }
.btn-danger { background: var(--stamp-bg); color: var(--stamp); border-color: #f0d4cf; }
.btn-danger:hover { background: #f6ddd8; }
.btn-success { background: var(--teal); color: #fff; }
.btn-success:hover { background: #255a4f; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ============================================================
   FORMULÁRE
   ============================================================ */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-group label .req { color: var(--stamp); margin-left: 2px; }
.form-control,
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=submit]):not([type=button]),
select, textarea {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 9px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(22,33,61,.10);
}
textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-4 { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; }
.item-row-grid { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.form-hint { font-size: 11.5px; color: var(--light); margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input[type=checkbox] { width: auto; accent-color: var(--navy); }
.checkbox-row label { margin: 0; font-size: 13.5px; color: var(--ink); }

/* ---- Heslo s tlačidlom zobrazenia ---- */
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 42px; }
.pass-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--light); font-size: 15px; padding: 4px; line-height: 1;
}
.pass-toggle:hover { color: var(--muted); }

/* ============================================================
   BADGE / STAV
   ============================================================ */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.badge.paid, .badge.aktivny { background: var(--teal-bg); color: var(--teal); }
.badge.unpaid, .badge.issued { background: var(--amber-bg); color: var(--amber); }
.badge.overdue { background: var(--stamp-bg); color: var(--stamp); }
.badge.cancelled, .badge.pozastaveny { background: #eceff4; color: var(--muted); }
.badge.sent { background: var(--navy-light); color: var(--navy); }

/* ============================================================
   TABUĽKY
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--light); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: var(--navy-light); }
td.wrap-text { white-space: normal; }

/* ============================================================
   KARTY DOKLADOV (dashboard – "Posledné doklady")
   ============================================================ */
.doc-list { display: flex; flex-direction: column; gap: 12px; }
.doc-card { border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }

/* Farba podľa stavu - celá karta, nielen štítok, aby to bolo na prvý pohľad jasné */
.doc-card.card-unpaid   { background: #fdeeec; border-color: #f2c2b8; }
.doc-card.card-overdue  { background: #fbe0db; border-color: var(--stamp); }
.doc-card.card-paid     { background: #eaf6f1; border-color: #a9d9c5; }
.doc-card.card-cancelled{ background: #eef0f4; border-color: var(--border); }
.doc-card.card-credit-note { background: #f2eefb; border-color: #d5c7ef; }
.badge.credit_note { background: #f2eefb; color: #6c4fb0; }

/* Spojený pár: predfaktúra hore v jemnej modrej ("uhradená, len referencia"),
   faktúra dole v zelenej (skutočne zaplatená) - dvojfarebná karta na prvý pohľad. */
.doc-card-linked { background: transparent; border-color: #a9d9c5; }
.pf-stub {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 16px; background: #e2ecfb; font-size: 12.5px; color: #3c5a86;
  text-decoration: none; border-bottom: 1.5px solid #c7d8f2;
}
.pf-stub:hover { background: #d5e3f8; text-decoration: none; }
.pf-stub strong { color: #1e3a5f; font-weight: 700; }
.pf-arrow { font-size: 10.5px; color: #2f6f62; text-align: center; padding: 5px 0; background: #e2ecfb; font-weight: 700; letter-spacing: .02em; }
.doc-card-linked .doc-body { background: #eaf6f1; }

/* Telo karty - vždy 3 riadky pod sebou, nič sa neschová, nič sa nespolieha na flex-wrap */
.doc-body { padding: 12px 14px; }
.doc-link { display: block; text-decoration: none; color: inherit; }
.doc-link:hover .doc-row1 strong { text-decoration: underline; }
.doc-row1 { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.doc-row1 strong { color: var(--ink); font-weight: 700; }
.doc-row1 .doc-badge-from-pf { font-size: 10.5px; font-weight: 600; color: #3c5a86; background: #e2ecfb; padding: 1px 7px; border-radius: 10px; margin-left: 2px; }
.doc-row2 { font-size: 12.5px; color: var(--light); margin-top: 3px; }
.doc-row3 { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; flex-wrap: wrap; }
.doc-amt-big { font-weight: 700; font-size: 16px; color: var(--ink); }
.doc-btns { display: flex; gap: 8px; flex-shrink: 0; }
.doc-actions { padding: 0 12px 12px; }
.doc-actions .btn { width: 100%; }

/* Na širších obrazovkách (desktop) sa každý doklad zmestí do JEDNÉHO
   kompaktného riadku namiesto mobilného 3-riadkového rozloženia - viac
   dokladov naraz na obrazovke, žiadne plytvanie miestom po stranách. */
@media (min-width: 860px) {
  .doc-list { gap: 6px; }
  .doc-body { display: flex; align-items: center; gap: 14px; padding: 7px 14px; }
  .doc-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 3px 4px; border-radius: 7px; }
  .doc-row1 { white-space: nowrap; flex-shrink: 0; }
  .doc-row2 { margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
  .doc-row3 { margin-top: 0; flex-shrink: 0; gap: 10px; }
  .doc-amt-big { font-size: 14px; white-space: nowrap; }
  .doc-actions { padding: 0; flex-shrink: 0; }
  .doc-actions .btn { width: auto; white-space: nowrap; }
  .hide-desktop-label { display: none; }

  /* Spojený pár (predfaktúra -> faktúra): jeden riadok, dve farebné zóny -
     modrá vľavo (referencia na predfaktúru), zelená pokračuje vpravo (faktúra). */
  .doc-card-linked { display: flex; align-items: stretch; }
  .pf-arrow { display: none; }
  .pf-stub {
    flex-shrink: 0; border-bottom: none; border-right: 1.5px solid #c7d8f2;
    padding: 0 16px; display: flex; align-items: center; white-space: nowrap;
  }
  .pf-stub span:last-child { display: none; }
  .doc-card-linked .doc-body { flex: 1; min-width: 0; }
}


/* ============================================================
   FLASH SPRÁVY
   ============================================================ */
.flash, .error, .success { display: flex; align-items: flex-start; gap: 9px; padding: 11px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 16px; line-height: 1.5; }
.error, .flash-error { background: var(--stamp-bg); color: var(--stamp); border-left: 4px solid var(--stamp); }
.success, .flash-success { background: var(--teal-bg); color: var(--teal); border-left: 4px solid var(--teal); }
.flash-info { background: var(--navy-light); color: var(--navy); border-left: 4px solid var(--navy); }
.flash-warning { background: var(--amber-bg); color: var(--amber); border-left: 4px solid var(--amber); }

/* ============================================================
   PRÁZDNY STAV
   ============================================================ */
.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-state .ic { font-size: 32px; margin-bottom: 10px; }
.empty-state p { font-size: 13.5px; }

/* ============================================================
   AUTH KARTA (login / registrácia) – v štýle Bytka
   ============================================================ */
body.auth-body-bg {
  background: linear-gradient(135deg, #0f1830 0%, var(--navy) 55%, var(--navy-2) 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}
.auth-card { background: #fff; border-radius: 20px; width: 100%; max-width: 420px; box-shadow: 0 24px 64px rgba(0,0,0,.35); overflow: hidden; }
.auth-card.wide { max-width: 560px; }
.auth-head { background: linear-gradient(135deg, var(--navy), var(--navy-2)); padding: 30px 28px 22px; text-align: center; }
.auth-logo { font-size: 26px; font-weight: 700; color: #fff; letter-spacing: -.02em; display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-logo .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--stamp); }
.auth-tagline { color: rgba(255,255,255,.68); font-size: 13px; margin-top: 5px; }
.auth-step-label {
  display: inline-block; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-size: 11.5px; font-weight: 700; padding: 4px 14px; border-radius: 20px; margin-top: 10px;
}
.auth-body { padding: 26px 28px; }
.auth-foot { padding: 0 28px 24px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-foot a { color: var(--navy); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }
.auth-foot a i { margin-right: 4px; }
.auth-foot .sep { margin: 0 10px; color: var(--line); }
.divider { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--light); margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

@media (max-width: 480px) {
  .auth-card { border-radius: 16px; }
  .auth-head { padding: 24px 20px 18px; }
  .auth-body { padding: 20px; }
  .auth-foot { padding: 0 20px 20px; }
}

/* ============================================================
   PWA BANNER + iOS MODAL (spoločné pre celý systém)
   ============================================================ */
#pwa-banner {
  display: none; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 700;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-md);
  padding: 12px 14px; align-items: center; gap: 12px;
}
#pwa-banner.show { display: flex; }
#pwa-banner img { width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0; }
#pwa-banner .pwa-text { flex: 1; }
#pwa-banner .pwa-text strong { display: block; font-size: 13.5px; }
#pwa-banner .pwa-text span { font-size: 12px; color: var(--muted); }
#pwa-banner button { border: none; background: var(--navy); color: #fff; padding: 8px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
#pwa-banner #pwa-dismiss { background: none; color: var(--light); padding: 6px; font-size: 16px; }

#ios-modal { display: none; position: fixed; inset: 0; background: rgba(15,20,35,.55); z-index: 800; align-items: flex-end; justify-content: center; }
#ios-modal.show { display: flex; }
#ios-modal .ios-box { background: #fff; border-radius: 18px 18px 0 0; padding: 22px 22px 28px; width: 100%; max-width: 480px; }
#ios-modal .ios-steps { padding-left: 18px; font-size: 13.5px; color: var(--muted); line-height: 2; }
#ios-modal button { margin-top: 16px; width: 100%; border: none; background: var(--navy); color: #fff; padding: 11px; border-radius: 10px; font-weight: 600; cursor: pointer; }

/* ============================================================
   PREDVOLENÉ POTVRDZOVACIE OKNO (namiesto natívneho confirm())
   ============================================================ */
.ic-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(22,33,61,.45);
  z-index: 900; align-items: center; justify-content: center; padding: 20px;
}
.ic-modal-overlay.show { display: flex; }
.ic-modal-box {
  background: #fff; border-radius: 16px; width: 100%; max-width: 380px;
  box-shadow: 0 24px 60px rgba(22,33,61,.28); overflow: hidden;
  animation: icModalIn .16s ease-out;
}
@keyframes icModalIn { from { opacity:0; transform: translateY(8px) scale(.98); } to { opacity:1; transform: translateY(0) scale(1); } }
.ic-modal-body { padding: 26px 26px 20px; text-align: center; }
.ic-modal-icon {
  width: 46px; height: 46px; border-radius: 50%; background: var(--teal-bg); color: var(--teal);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 22px;
}
.ic-modal-title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.ic-modal-message { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.ic-modal-actions { display: flex; gap: 10px; padding: 4px 26px 22px; }
.ic-modal-actions .btn { flex: 1; }
.ic-modal-brand {
  text-align: center; padding: 10px; border-top: 1px solid var(--border); background: var(--navy-light);
  font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: .03em;
}
.ic-modal-brand .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--stamp); display: inline-block; margin-right: 5px; }

/* ============================================================
   RESPONZÍVNOSŤ – všeobecné doladenia
   ============================================================ */
@media (max-width: 700px) {
  .wrap { padding: 16px 14px 50px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-4 { grid-template-columns: 1fr 1fr; }
  .form-row-4 > *:first-child { grid-column: 1 / -1; }
  .item-row-grid { grid-template-columns: 1fr 1fr; }
  .item-row-grid > *:first-child { grid-column: 1 / -1; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  th, td { padding: 8px; font-size: 12.5px; }
  .page-head h1 { font-size: 19px; }
}
@media (max-width: 460px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   ŽIVÝ NÁHĽAD FAKTÚRY (Nastavenia -> Vzhľad)
   ============================================================ */
.appearance-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 18px; }
.appearance-grid .card { margin-bottom: 0; }
@media (min-width: 900px) {
  .appearance-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .preview-card { position: sticky; top: 76px; }
}
.preview-tabs { display: flex; gap: 4px; background: var(--navy-light); border-radius: 8px; padding: 3px; }
.pv-tab { border: none; background: transparent; padding: 5px 11px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.pv-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.pv-mock { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: 11px; background: #fff; box-shadow: 0 6px 20px rgba(22,33,61,.08); }
.pv-head { background: #1a2744; color: #fff; padding: 12px 14px; display: flex; justify-content: space-between; align-items: flex-start; transition: background .15s; }
.pv-title { font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.pv-sub { font-size: 10px; color: rgba(255,255,255,.65); margin-top: 2px; }
.pv-numblock { text-align: right; font-size: 10px; }
.pv-muted { color: var(--light); font-size: 10px; }
.pv-numblock .pv-muted { color: rgba(255,255,255,.6); margin-top: 2px; }
.pv-body { padding: 12px 14px; }
.pv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.pv-label { font-size: 9px; text-transform: uppercase; letter-spacing: .04em; color: var(--light); margin-bottom: 3px; }
.pv-strong { font-weight: 600; font-size: 11.5px; }
.pv-items { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.pv-items td { padding: 4px 0; font-size: 11px; border-bottom: 1px dashed var(--border); }
.pv-items .pv-right { text-align: right; color: var(--muted); }
.pv-total { background: #1a2744; color: #fff; font-weight: 700; padding: 8px 12px; border-radius: 7px; text-align: right; font-size: 12.5px; transition: background .15s; }
.pv-note { margin-top: 8px; text-align: center; font-size: 9.5px; color: var(--amber); }
.pv-footer { border-top: 1px solid var(--border); background: #f8f9fb; padding: 10px 14px; }
.pv-footer-line { font-size: 9.5px; color: var(--muted); text-align: center; margin-bottom: 3px; }
.pv-footer-muted { color: var(--light); font-size: 8.5px; }
.pv-footer-marketing { font-size: 8.5px; color: var(--light); text-align: center; font-style: italic; margin-top: 4px; }

/* ============================================================
   ŽIVÝ NÁHĽAD E-MAILU (Nastavenia -> E-mailové šablóny)
   ============================================================ */
.em-preview { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 6px 20px rgba(22,33,61,.08); }
.em-preview-head { background: var(--navy-light); padding: 12px 16px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
.em-preview-head div { margin-bottom: 3px; }
.em-preview-head strong { color: var(--ink); font-weight: 600; }
.em-preview-body { padding: 18px 16px; font-size: 13px; color: var(--ink); line-height: 1.6; }
#emBodyPreview { white-space: pre-line; }
.em-logo-placeholder {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px;
  background: var(--navy-light); border: 1px dashed var(--border); border-radius: 6px;
  font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: .05em;
}
.em-preview-attachment {
  margin-top: 16px; padding: 8px 12px; background: var(--navy-light); border-radius: 8px;
  font-size: 12px; color: var(--muted); display: inline-block;
}

/* ============================================================
   PRAKTICKÝ VÝBER FARIEB (Nastavenia -> Vzhľad faktúry)
   ============================================================ */
.color-field-row { display: flex; gap: 22px; flex-wrap: wrap; margin: 6px 0 4px; }
.color-field { display: flex; align-items: center; gap: 12px; }
.color-swatch {
  display: block; width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 2px var(--border), 0 2px 6px rgba(22,33,61,.12);
  cursor: pointer; overflow: hidden; flex-shrink: 0; transition: box-shadow .15s;
}
.color-swatch:hover { box-shadow: 0 0 0 2px var(--navy), 0 2px 8px rgba(22,33,61,.2); }
.color-swatch input[type=color] {
  -webkit-appearance: none; appearance: none; width: 60px; height: 60px;
  margin: -7px; padding: 0; border: none; cursor: pointer; background: none;
}
.color-swatch input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch input[type=color]::-webkit-color-swatch { border: none; }
.color-field-label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.color-field-hex { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 1px; letter-spacing: .02em; }
@media (max-width: 500px) {
  .color-field-row { gap: 16px; }
}

/* ============================================================
   API DOKUMENTÁCIA (app/api_keys.php)
   ============================================================ */
code { background: var(--navy-light); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--navy); word-break: break-word; overflow-wrap: anywhere; }
.api-code {
  background: var(--navy); color: #dbe3f2; border-radius: 10px; padding: 14px 16px;
  font-family: var(--mono); font-size: 12px; overflow-x: auto; white-space: pre; line-height: 1.6; margin: 6px 0;
}
.api-doc-list details { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; overflow: hidden; background: #fff; }
.api-doc-list details[open] { border-color: var(--navy-light); }
.api-doc-list summary {
  list-style: none; cursor: pointer; padding: 12px 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--navy-light); font-size: 13px;
}
.api-doc-list summary::-webkit-details-marker { display: none; }
.api-doc-list summary::before { content: '▶'; font-size: 9px; color: var(--muted); transition: transform .15s; flex-shrink: 0; }
.api-doc-list details[open] > summary::before { transform: rotate(90deg); }
.api-doc-title { color: var(--muted); font-weight: 500; }
.api-method { font-family: var(--mono); font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 5px; flex-shrink: 0; }
.api-method.get { background: var(--teal-bg); color: var(--teal); }
.api-method.post { background: var(--stamp-bg); color: var(--stamp); }
.api-doc-body { padding: 14px 16px; font-size: 13px; }
.api-doc-body h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--light); margin: 14px 0 6px; }
.api-doc-body h4:first-child { margin-top: 0; }
.api-doc-body table { margin: 4px 0; }
.api-doc-body p { margin: 0 0 8px; line-height: 1.5; }

/* ============================================================
   HROMADNÝ IMPORT E-FAKTÚR (app/received_invoices.php)
   ============================================================ */
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 32px 20px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s; background: var(--navy-light);
}
.dropzone:hover, .dropzone-active { border-color: var(--navy); background: #eef1fb; }
.dropzone-icon { font-size: 28px; margin-bottom: 8px; }
.dropzone-text { font-size: 13.5px; color: var(--muted); }
.dropzone-text strong { color: var(--ink); }
.upload-result { padding: 8px 12px; border-radius: 8px; font-size: 12.5px; margin-top: 8px; }
.upload-result-pending { background: var(--navy-light); color: var(--muted); }
.upload-result-ok { background: var(--teal-bg); color: var(--teal); }
.upload-result-err { background: var(--stamp-bg); color: var(--stamp); }
.upload-result-summary { margin-top: 10px; font-weight: 600; font-size: 13px; color: var(--ink); }

/* ============================================================
   HROMADNÝ VÝBER + EXPORT (invoices.php / proformas.php)
   ============================================================ */
.bulk-chk {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #c7cede;
  appearance: none; cursor: pointer; flex-shrink: 0; position: relative; background: #fff;
  transition: background .12s, border-color .12s; margin: 0;
}
.bulk-chk:checked { background: var(--navy); border-color: var(--navy); }
.bulk-chk:checked::after {
  content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.bulk-chk:indeterminate { background: var(--border); border-color: #b7c0d4; }
.bulk-chk:indeterminate::after { content: ''; position: absolute; left: 3px; top: 7px; width: 9px; height: 2px; background: var(--muted); }
.bulk-item-chk { margin-right: 12px; }
@media (min-width: 860px) {
  .doc-body { flex-wrap: nowrap; }
  .bulk-item-chk { order: -1; }
}

.bulk-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; border-radius: 14px; padding: 11px 12px 11px 18px;
  align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(22,33,61,.35); z-index: 710;
}
.bulk-bar-count { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.bulk-bar-clear { background: none; border: none; color: #8a93ab; font-size: 12.5px; cursor: pointer; padding: 0; }
.bulk-bar-btn {
  background: var(--stamp); color: #fff; border: none; border-radius: 9px; padding: 9px 18px;
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}

.bulk-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(22,33,61,.45); z-index: 720;
  align-items: center; justify-content: center; padding: 20px;
}
.bulk-modal-overlay.bulk-modal-open { display: flex; }
.bulk-modal { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 380px; box-shadow: 0 24px 60px rgba(22,33,61,.3); }
.bulk-modal-title { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.bulk-modal-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 18px; }
.bulk-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 1.5px solid var(--border); border-radius: 11px; padding: 12px 14px; margin-bottom: 10px;
  background: #fff; cursor: pointer; transition: border-color .12s, background .12s;
}
.bulk-opt:hover { border-color: var(--navy); background: #f7f8fc; }
.bulk-opt-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.bulk-opt-title { display: block; font-size: 13.5px; font-weight: 600; }
.bulk-opt-desc { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.rec-badge { font-size: 12px; cursor: help; opacity: .8; }
.project-badge { font-size: 10.5px; font-weight: 600; background: var(--navy-light); color: var(--navy); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
/* API Explorer - krokový sprievodca */
.wizard-step{margin-bottom:18px;padding-bottom:18px;border-bottom:1px solid var(--border);}
.wizard-step:last-of-type{border-bottom:none;}
.wizard-step-label{display:block;font-size:13px;font-weight:600;color:var(--ink);margin-bottom:8px;}
.wizard-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;}
.wizard-item-row{display:flex;gap:8px;margin-bottom:8px;align-items:center;}
.wizard-item-row input[type=text]:first-child{flex:1;min-width:100px;}
@media (max-width:640px){.wizard-item-row{flex-wrap:wrap;}}
