/* D&D Energy ERP — design tokens */
/* Font Georama sa načítava cez <link> v index.html (rýchlejšie než CSS @import). */

:root {
  /* Brand — odvodené z ddenergy.sk. Jediný zdroj pravdy pre ERP aj e-maily.
     Kotvy z webu:  #02396f primary · #1e6fbf accent/link (--ddgr-accent)
                    #f2a63e amber (--ddgr-star-filled) · #0d1b2a dark ink */
  --navy-900: #012a52;   /* sidebar, najtmavšie plochy */
  --navy-800: #02396f;   /* ← WEB PRIMARY — primárne tlačidlá */
  --navy-700: #0a4a86;   /* hover, odkazy */
  --navy-600: #134f8e;   /* web --rz-accent-d */
  --navy-500: #1e6fbf;   /* web --ddgr-accent / --ddgr-link */
  --navy-400: #609bd2;   /* web svetlá modrá */
  --blue-100: #d6e8fb;
  --blue-50:  #eff6fd;
  --bg:       #f6f8fc;
  --card:     #ffffff;
  --border:   #e5e7eb;   /* web */
  --border-strong: #cbd5e1;
  --ink-900:  #0d1b2a;   /* web */
  --ink-700:  #27394f;
  --ink-500:  #5b6b82;
  --ink-400:  #8695ab;
  --ink-300:  #aab6c7;

  --amber-500: #f2a63e;  /* web */
  --amber-400: #f7bd6d;
  --amber-100: #fdeed7;

  --green-500: #2a9d5f;
  --green-100: #dcf3e5;
  --red-500:   #d64545;
  --red-100:   #fce1e1;

  /* Type — Georama, rovnako ako web */
  --font: 'Georama', system-ui, -apple-system, sans-serif;

  /* Radius + spacing (kompakt) */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(2,57,111,0.06);
  --shadow-md: 0 2px 6px rgba(2,57,111,0.08), 0 1px 2px rgba(2,57,111,0.04);
  --shadow-lg: 0 10px 30px rgba(2,57,111,0.12);
}

* { box-sizing: border-box; }

body, html {
  margin: 0;
  font-family: var(--font);
  color: var(--ink-900);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

.app {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink-900);
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
}

/* ───── Sidebar ───── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--navy-900);
  color: #d6e8fb;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #011527;
}
.sidebar.collapsed { width: 56px; }

.sb-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 56px;
}
.sb-logo-mark {
  width: 32px; height: 32px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f7bd6d, #f2a63e 60%, #c47a00);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18), 0 0 0 2px #012a52;
  flex-shrink: 0;
  position: relative;
}
.sb-logo-mark::after{
  content:'';position:absolute;inset:6px;border-radius:50%;
  background:conic-gradient(from 200deg,#fff3c4 0deg,transparent 90deg);
  opacity:.5;
}
.sb-logo-text { font-weight: 800; font-size: 14px; letter-spacing: 0.02em; }
.sb-logo-text small {
  display: block; font-weight: 400; font-size: 9.5px; color: #8ea8c9; letter-spacing: 0.16em; text-transform: uppercase;
}

.sb-section {
  padding: 14px 14px 4px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: #6a8bb3; font-weight: 600;
}

.sb-nav {
  padding: 4px 8px;
  display: flex; flex-direction: column; gap: 1px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;     /* nutné aby flex-1 child mohol scrollovať pri overflow */
  /* Jemný, tenký scrollbar ladiaci s tmavým sidebarom (Firefox) */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
/* Krajší scrollbar sidebaru (WebKit/Chrome/Safari/Edge) */
.sb-nav::-webkit-scrollbar { width: 8px; }
.sb-nav::-webkit-scrollbar-track { background: transparent; }
.sb-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.16);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.sb-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.32); background-clip: content-box; }
.sb-nav:not(:hover)::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); background-clip: content-box; }
.sb-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  color: #b8c9e0; font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
}
.sb-nav a:hover { background: rgba(255,255,255,0.04); color: #fff; }
.sb-nav a.active {
  background: linear-gradient(180deg, #0a4a86, #02396f);
  color: #fff;
  border-color: rgba(247,189,109,0.25);
  box-shadow: inset 2px 0 0 var(--amber-500);
}
.sb-nav a .badge {
  margin-left: auto;
  background: var(--amber-500); color: #1a1200;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  min-width: 18px; text-align: center;
}
.sb-nav a .ico {
  width: 16px; height: 16px; flex-shrink: 0; opacity: .9;
}

.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  background: var(--navy-900);
  /* iOS home-bar safe area, aby logout nesedel pod indicatorom */
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.sb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #f7bd6d, #f2a63e);
  display: flex; align-items: center; justify-content: center;
  color: #1a1200; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.sb-user-name { font-size: 12px; font-weight: 600; color: #fff; line-height: 1.2; }
.sb-user-role { font-size: 10.5px; color: #8ea8c9; }

/* ───── Topbar ───── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar {
  height: 48px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 14px;
  flex-shrink: 0;
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-500); }
.crumbs b { color: var(--ink-900); font-weight: 600; }
.crumbs .sep { color: var(--ink-300); }

.topbar-search {
  margin-left: auto;
  width: 280px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px 0 30px;
  font-family: var(--font);
  font-size: 12.5px;
  background: var(--bg);
  color: var(--ink-900);
}
.topbar-search input:focus { outline: none; border-color: var(--navy-500); background: #fff; }
.topbar-search .ico { position: absolute; left: 9px; top: 7px; color: var(--ink-400); }
.topbar-search kbd {
  position: absolute; right: 8px; top: 6px;
  font-family: var(--font); font-size: 10px; color: var(--ink-500);
  border: 1px solid var(--border-strong); padding: 0 5px; border-radius: 3px; height: 18px; line-height: 17px;
  background: #fff;
}

/* Hamburger button — shown only below 720px (via media query override) */
.topbar-menu-btn { display: none; }

.topbar-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-700);
  position: relative;
}
.topbar-btn:hover { background: var(--bg); }
.topbar-btn .dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber-500); border: 2px solid #fff;
}

.launcher-btn {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff; cursor: pointer;
  font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--ink-700);
}
.launcher-btn:hover { background: var(--bg); }

/* ───── Content ───── */
.content {
  flex: 1; overflow: auto;
  padding: 18px 20px;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 14px; gap: 16px;
}
.page-head h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-500); }
.page-head-actions { display: flex; gap: 8px; }

/* ───── Buttons ───── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: var(--font); font-weight: 500; font-size: 12.5px; color: var(--ink-900);
  cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn-primary {
  background: var(--navy-800); border-color: var(--navy-900); color: #fff;
}
.btn-primary:hover { background: var(--navy-700); }
.btn-amber {
  background: var(--amber-500); border-color: #d98a24; color: #1a1200;
}
.btn-amber:hover { background: var(--amber-400); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(2,57,111,0.06); }
.btn-danger { color: var(--red-500); border-color: var(--border); }
.btn-danger:hover { background: var(--red-100); }
.btn-sm { height: 26px; padding: 0 8px; font-size: 11.5px; }
.btn-xs { height: 22px; padding: 0 6px; font-size: 11px; border-radius: 4px; }

/* ───── Cards / panels ───── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.card-head .muted { color: var(--ink-500); font-size: 11.5px; font-weight: 400; }
.card-body { padding: 14px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 12px 14px; position: relative; overflow: hidden;
}
.kpi .label { font-size: 11px; color: var(--ink-500); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }
.kpi .delta { font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; margin-top: 4px; }
.kpi .delta.up { color: var(--green-500); }
.kpi .delta.down { color: var(--red-500); }
.kpi .spark { position: absolute; right: 10px; bottom: 10px; opacity: .6; }

.kpi.accent {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff; border-color: var(--navy-900);
}
.kpi.accent .label { color: #9dc2e8; }
.kpi.accent .value { color: #fff; }

/* ───── Tables ───── */
table.tbl {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 12.5px;
}
table.tbl th {
  text-align: left; font-weight: 600; color: var(--ink-500);
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  background: var(--blue-50);
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  position: sticky; top: 0;
}
table.tbl td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tr:hover td { background: var(--blue-50); }
table.tbl tr.sel td { background: #fff8e4; }
table.tbl tr:last-child td { border-bottom: none; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--blue-100); color: var(--navy-800);
  border: 1px solid transparent;
}
.chip.green { background: var(--green-100); color: #135e37; }
.chip.amber { background: var(--amber-100); color: #7d5500; }
.chip.red   { background: var(--red-100); color: #7c1d1d; }
.chip.gray  { background: #eef2f7; color: var(--ink-500); }
.chip.navy  { background: var(--navy-800); color: #fff; }
.chip.dot::before{ content:''; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.9; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11.5px; color: var(--ink-700); font-weight: 500; }
.field .hint { font-size: 11px; color: var(--ink-500); }
.input, .select, .textarea {
  height: 30px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 0 10px;
  font-family: var(--font); font-size: 12.5px; color: var(--ink-900);
  background: #fff;
}
.textarea { height: auto; padding: 8px 10px; min-height: 60px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(30,111,191,0.18); }

.checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; cursor: pointer;
}
.checkbox input { margin: 0; accent-color: var(--navy-700); }

.toggle {
  width: 32px; height: 18px; border-radius: 999px;
  background: var(--border-strong); position: relative; cursor: pointer;
  transition: background .15s;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: left .15s;
}
.toggle.on { background: var(--navy-700); }
.toggle.on::after { left: 16px; }

/* Login */
.auth-wrap {
  width: 100%; height: 100%;
  display: flex;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700) 60%, var(--navy-600));
  position: relative; overflow: hidden;
}
.auth-wrap::before {
  content:''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(247,189,109,0.18), transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(30,111,191,0.3), transparent 45%);
}
.auth-left {
  flex: 1; color: #fff;
  padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
}
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo .sb-logo-mark { width: 40px; height: 40px; }
.auth-logo-text { font-weight: 800; font-size: 16px; letter-spacing: 0.02em; }
.auth-logo-text small { display:block; font-weight: 400; font-size: 10.5px; color: #9dc2e8; letter-spacing: 0.2em; text-transform: uppercase; }

.auth-tagline h2 { font-size: 34px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.02em; line-height: 1.1; }
.auth-tagline h2 span { color: var(--amber-400); }
.auth-tagline p { color: #b8c9e0; max-width: 420px; font-size: 14px; line-height: 1.5; }

.auth-foot { font-size: 11.5px; color: #7a97bd; display: flex; gap: 20px; }

.auth-right {
  width: 440px;
  background: #fff;
  padding: 48px 44px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; z-index: 1;
}
.auth-right h3 { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.auth-right .sub { font-size: 13px; color: var(--ink-500); margin-bottom: 24px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .input { height: 38px; font-size: 13.5px; }
.auth-form .field label { font-size: 12.5px; font-weight: 600; }
.btn-lg { height: 38px; padding: 0 16px; font-size: 13.5px; font-weight: 600; }

.row-between { display: flex; justify-content: space-between; align-items: center; }

/* 2FA otp boxes */
.otp-row { display: flex; gap: 8px; justify-content: center; }
.otp-box {
  width: 46px; height: 54px;
  border: 1.5px solid var(--border-strong); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 600; color: var(--navy-900);
  background: #fff;
}
.otp-box.filled { border-color: var(--navy-700); background: var(--blue-50); }
.otp-box.focus { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(30,111,191,0.22); }

/* Sparkline svg defaults */
svg { display: block; }

/* Segmented */
.seg {
  display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #fff;
}
.seg button {
  border: none; background: transparent;
  font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--ink-500);
  padding: 6px 12px; cursor: pointer;
  border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--navy-800); color: #fff; }

/* Filters bar */
.filters {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.filters .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button {
  background: transparent; border: none; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--ink-500);
  padding: 8px 14px; position: relative;
}
.tabs button.active { color: var(--navy-900); font-weight: 600; }
.tabs button.active::after {
  content:''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--amber-500);
}

/* Module tile */
.mod-tile {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
  position: relative; transition: all .15s;
}
.mod-tile:hover { border-color: var(--navy-400); box-shadow: var(--shadow-md); }
.mod-tile .mod-ico {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--blue-100); color: var(--navy-700);
  display: flex; align-items: center; justify-content: center;
}
.mod-tile.off { opacity: 0.55; background: #fafbfd; }
.mod-tile.off .mod-ico { background: #eef2f7; color: var(--ink-400); }
.mod-tile h4 { margin: 0; font-size: 13.5px; font-weight: 600; }
.mod-tile p { margin: 0; font-size: 11.5px; color: var(--ink-500); line-height: 1.4; }
.mod-tile .mod-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.mod-tile .mod-users { font-size: 11px; color: var(--ink-500); }

/* permission matrix */
.perm-matrix { width: 100%; border-collapse: collapse; font-size: 12px; }
.perm-matrix th, .perm-matrix td {
  border-bottom: 1px solid var(--border);
  padding: 6px 10px; text-align: center;
  vertical-align: middle;
}
.perm-matrix th.lbl, .perm-matrix td.lbl { text-align: left; }
.perm-matrix thead th {
  background: var(--blue-50); font-size: 10.5px; color: var(--ink-500);
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
}
.perm-matrix tbody tr:hover td { background: var(--blue-50); }

/* Clickable permission cell — full button with Áno/Nie state, optimistic updates */
.perm-cell {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 58px; height: 26px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 999px;
  font-family: var(--font); font-size: 11.5px; font-weight: 600;
  cursor: pointer; transition: background .12s, border-color .12s, transform .08s;
  user-select: none;
}
.perm-cell.on {
  background: var(--green-100);
  color: #135e37;
  border-color: rgba(42,157,95,0.35);
}
.perm-cell.on:hover:not(.disabled) {
  background: #b8e6c9;
  border-color: var(--green-500);
}
.perm-cell.off {
  background: #f4f6fa;
  color: var(--ink-400);
  border-color: var(--border);
}
.perm-cell.off:hover:not(.disabled) {
  background: #fee2e2;
  color: #7c1d1d;
  border-color: rgba(214,69,69,0.3);
}
.perm-cell:active:not(.disabled) { transform: scale(0.96); }
.perm-cell.disabled { cursor: not-allowed; opacity: 0.55; }

/* keep legacy class for any remaining usages */
.dot-perm {
  width: 16px; height: 16px; border-radius: 4px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.dot-perm.y { background: var(--green-100); color: #135e37; }
.dot-perm.n { background: #f2f4f7; color: var(--ink-300); }
.dot-perm.p { background: var(--amber-100); color: #7d5500; }

/* utility */
.hstack { display: flex; align-items: center; gap: 8px; }
.vstack { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--ink-500); }
.small { font-size: 11.5px; }
.mono { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* order detail 2-col */
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }

/* Timeline */
.tl { position: relative; padding-left: 18px; }
.tl::before { content:''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl .tl-item { position: relative; padding: 0 0 12px; font-size: 12px; }
.tl .tl-item::before {
  content:''; position: absolute; left: -15px; top: 4px; width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid var(--navy-500);
}
.tl .tl-item .t { font-size: 11px; color: var(--ink-500); }

/* ───── Auth — interactive additions ───── */
.input-wrap { position: relative; }
.input-wrap .input { width: 100%; padding-left: 34px; }
.input-wrap .input-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-400); pointer-events: none;
}
.input-wrap .input-action {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 6px;
  border: none; background: transparent; cursor: pointer;
  color: var(--ink-500);
  display: flex; align-items: center; justify-content: center;
}
.input-wrap .input-action:hover { background: var(--blue-50); color: var(--navy-700); }
.input-wrap .input-action:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 1px; }

.input.is-invalid { border-color: var(--red-500); }
.input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(214,69,69,0.18); }

.field-err { font-size: 11.5px; color: var(--red-500); margin-top: 2px; }
.field-warn { font-size: 11.5px; color: #8a5a00; margin-top: 2px; display: inline-flex; align-items: center; gap: 4px; }

.auth-alert {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--red-100); color: #7c1d1d;
  font-size: 12.5px; font-weight: 500;
  border: 1px solid rgba(214,69,69,0.25);
  margin-bottom: 12px;
}
/* ── Účet bez pridelenej roly: rozmazaná atrapa ERP + ostrý overlay ──
   Blur je dekorácia, nie ochrana — v devtools sa vypne dvoma klikmi. Preto pod
   ním nie sú žiadne dáta, len skeleton obdĺžniky. Reálne to drží server:
   rola 'bez_pristupu' nemá oprávnenia, takže API vracia 403 a nič neposiela. */
.noaccess-wrap { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }

.noaccess-mock {
  position: absolute; inset: 0; display: flex;
  filter: blur(7px) saturate(0.6);
  pointer-events: none;      /* nedá sa klikať ani označiť */
  user-select: none;
  transform: scale(1.02);    /* prekryje mäkké okraje po blure */
}
.noaccess-sidebar {
  width: 220px; flex-shrink: 0; padding: 18px 14px;
  background: linear-gradient(180deg, var(--navy-900) 0%, #01203f 70%, #011a33 100%);
  color: #d6e8fb; display: flex; flex-direction: column; gap: 14px;
}
.noaccess-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.noaccess-navitem { display: flex; align-items: center; gap: 10px; padding: 5px 0; }

.noaccess-main { flex: 1; padding: 22px 26px; color: var(--ink-900); display: flex; flex-direction: column; gap: 18px; }
.noaccess-topbar { display: flex; align-items: center; justify-content: space-between; }
.noaccess-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.noaccess-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-sm); }
.noaccess-table { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.noaccess-row { display: flex; align-items: center; gap: 28px; }

.noaccess-overlay {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(246, 248, 252, 0.55);
}
.noaccess-card-front {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 34px 36px; max-width: 460px; text-align: center;
}
.noaccess-badge {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--blue-50); color: var(--navy-700);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.noaccess-card-front h2 { margin: 0 0 10px; font-size: 22px; font-weight: 700; color: var(--ink-900); letter-spacing: -0.01em; }
.noaccess-card-front p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.6; color: var(--ink-500); }
.noaccess-card-front p b { color: var(--ink-900); font-weight: 600; }
.noaccess-note {
  background: var(--blue-50); border: 1px solid rgba(2,57,111,0.12);
  border-radius: var(--r-lg); padding: 11px 13px; font-size: 12.5px !important;
}
.noaccess-actions { display: flex; gap: 10px; justify-content: center; margin: 20px 0 14px; }
.noaccess-actions .btn { min-width: 130px; justify-content: center; }
.noaccess-help { font-size: 11.5px; color: var(--ink-400); }

@media (max-width: 720px) {
  .noaccess-sidebar { display: none; }
  .noaccess-kpis { grid-template-columns: repeat(2, 1fr); }
  .noaccess-card-front { padding: 26px 20px; }
  .noaccess-actions { flex-direction: column; }
}

/* Meno v zozname používateľov otvára detail účtu. */
.user-row-open { cursor: pointer; border-radius: var(--r-md); padding: 2px 4px; margin: -2px -4px; transition: background .12s var(--ease); }
.user-row-open:hover { background: var(--blue-50); }
.user-row-open:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 1px; }

/* Nadpis sekcie v modáloch (detail účtu). */
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-400); margin: 0 0 10px;
}

.auth-alert svg { flex-shrink: 0; }
/* Informatívny variant — „účet vytvorený, čaká na schválenie" nie je zlyhanie,
   červená by zbytočne budila dojem, že sa niečo pokazilo. */
.auth-alert.is-info {
  background: var(--blue-50); color: var(--navy-700);
  border-color: rgba(2,57,111,0.20);
}

.auth-badge {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--blue-100); color: var(--navy-700);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

.btn-block { width: 100%; justify-content: center; }
/* Microsoft SSO — primárna cesta prihlásenia. Ostáva biele s rámčekom podľa
   Microsoft brand guidelines; dominanciu nesie pozícia (prvé), výška a tieň,
   nie farebná výplň — tú si drží .btn-primary v hesľovom formulári nižšie. */
.btn-sso {
  background: #fff; color: var(--ink-900); border: 1.5px solid var(--border-strong);
  font-weight: 600; height: 42px; gap: 10px;
  box-shadow: var(--shadow-sm);
}
.btn-sso:hover { background: var(--blue-50); border-color: var(--navy-500); }
.btn-sso:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 2px; }

.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary:disabled { background: var(--navy-700); }

.auth-sep {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-400); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  margin: 6px 0 2px;
}
.auth-sep::before, .auth-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.auth-links {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 6px; font-size: 12px; margin-top: 6px;
}
.auth-links a {
  color: var(--navy-700); font-weight: 500; cursor: pointer; text-decoration: none;
}
.auth-links a:hover { text-decoration: underline; }
.auth-links a.muted { color: var(--ink-500); font-weight: 400; }
.auth-links a.disabled { color: var(--ink-400); pointer-events: none; }
.auth-links .sep { color: var(--ink-300); }

.link-muted {
  font-size: 11.5px; color: var(--navy-700); text-decoration: none; font-weight: 500; cursor: pointer;
}
.link-muted:hover { text-decoration: underline; }

/* honeypot — invisible, but still submittable; not display:none (bots skip those) */
.hp-trap {
  position: absolute; left: -9999px; top: -9999px;
  width: 1px; height: 1px; overflow: hidden;
}

/* 2FA — interactive inputs */
.otp-box {
  font-family: var(--font);
  outline: none;
  transition: border-color .12s, box-shadow .12s, background .12s;
  padding: 0;
  text-align: center;
}
.otp-box:focus { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(30,111,191,0.22); background: #fff; }

/* loader spin */
.spin { animation: dd-spin 0.85s linear infinite; }
@keyframes dd-spin { to { transform: rotate(360deg); } }

/* ───── Modal ───── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(2,57,111, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: dd-fade 0.15s ease;
}
.modal {
  background: #fff; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 100%;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  animation: dd-pop 0.15s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}
@keyframes dd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dd-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Select in compact tables */
table.tbl .select { height: 26px; font-size: 11.5px; padding: 0 6px; }

/* AI typing dots */
.typing {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 3px;
  animation: dd-typing 1.4s infinite;
}
@keyframes dd-typing {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* Responsive — CRM sa prispôsobí tabletu aj mobilu */
@media (max-width: 1024px) {
  .sidebar { width: 56px !important; }
  .sb-logo-text, .sb-nav a span:not(.badge), .sb-user-name, .sb-user-role, .sb-section { display: none; }
  .sb-logo { justify-content: center; padding: 14px 8px; }
  .sb-nav a { justify-content: center; padding: 8px; position: relative; }
  .sb-nav a .badge { position: absolute; top: 2px; right: 2px; }
  .sb-user { justify-content: center; padding: 10px 8px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .auth-right { width: 420px; }
}

@media (max-width: 820px) {
  .auth-wrap { flex-direction: column; }
  .auth-left {
    flex: 0 0 auto;
    padding: 24px 24px 18px;
    background: transparent;
  }
  .auth-tagline { display: none; }
  .auth-foot { display: none; }
  .auth-right {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 22px 22px 28px;
    border-radius: 14px 14px 0 0;
    flex: 1;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  /* Sidebar becomes an off-canvas drawer that slides in when body.sidebar-open */
  .sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 260px !important;
    height: 100vh;
    height: 100dvh;   /* iOS Safari: dynamic viewport — počíta s URL barom správne, aby sb-user nebol pod okrajom */
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 1100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    display: flex !important;   /* override previous display:none from older rules */
    flex-direction: column;     /* poistka — niektoré staršie pravidlá prepisujú */
  }
  body.sidebar-open .sidebar { transform: translateX(0); }

  /* expanded version of sidebar contents when drawer is open — reset the 1024 collapse */
  .sidebar .sb-logo-text,
  .sidebar .sb-nav a span:not(.badge),
  .sidebar .sb-user-name,
  .sidebar .sb-user-role,
  .sidebar .sb-section { display: block !important; }
  .sidebar .sb-logo { justify-content: flex-start; padding: 14px 14px; }
  .sidebar .sb-nav a { justify-content: flex-start; padding: 7px 10px; }
  .sidebar .sb-nav a .badge { position: static; }
  .sidebar .sb-user { justify-content: flex-start; padding: 10px 12px; }

  /* Backdrop behind the drawer */
  body.sidebar-open::before {
    content: '';
    position: fixed; inset: 0;
    background: rgba(11, 26, 46, 0.5);
    z-index: 1050;
    animation: dd-fade 0.15s ease;
  }

  .topbar-menu-btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink-700);
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 4px;
  }
  .topbar-menu-btn:hover { background: var(--bg); }

  .topbar { padding: 0 12px; gap: 8px; }
  .launcher-btn span { display: none; }
  .content { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-head-actions { flex-wrap: wrap; width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi .value { font-size: 18px; }
  .filters { flex-direction: column; align-items: stretch; gap: 6px; }
  .filters > * { width: 100%; }
  table.tbl { font-size: 11.5px; }
  table.tbl th, table.tbl td { padding: 6px 8px; }

  /* Auth on phones */
  .auth-right { padding: 18px 16px 24px; }
  .auth-right h3 { font-size: 18px; }
  .auth-right .sub { font-size: 12.5px; margin-bottom: 16px; }
  .auth-form { gap: 12px; }
  /* Touch-friendly minimum */
  .auth-form .input { height: 42px; font-size: 14px; }
  .btn-lg { height: 44px; font-size: 14px; }
  .otp-row { gap: 6px; }
  .otp-box { width: 14vw; max-width: 48px; min-width: 38px; height: 54px; font-size: 22px; }
  .auth-logo-text { font-size: 14px; }
}

@media (max-width: 380px) {
  .otp-box { font-size: 20px; height: 50px; }
  .auth-left { padding: 18px 16px 12px; }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; }
  .splash .dot { animation: none; }
  * { transition: none !important; }
}


/* ───── AI Asistent ───── */
.ai-avatar { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.ai-avatar-user { background: var(--navy-700); color: #fff; }
.ai-avatar-bot  { background: linear-gradient(135deg, var(--amber-500), var(--amber-400)); color: #1a1200; }

/* ───── AI chat bubbles + Markdown rendering ───── */
.ai-bubble {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-900);
  overflow-wrap: anywhere;
}
.ai-bubble-user { }
.ai-bubble-err  { background: var(--red-100); border-color: #fecaca; color: #7c1d1d; }

.ai-md :first-child { margin-top: 0; }
.ai-md :last-child  { margin-bottom: 0; }
.ai-md p    { margin: 0 0 10px; }
.ai-md h1, .ai-md h2, .ai-md h3, .ai-md h4 { margin: 14px 0 6px; font-weight: 700; color: var(--navy-900); }
.ai-md h1 { font-size: 18px; }
.ai-md h2 { font-size: 16px; }
.ai-md h3 { font-size: 14.5px; }
.ai-md ul, .ai-md ol { margin: 6px 0 10px; padding-left: 22px; }
.ai-md li { margin: 3px 0; }
.ai-md a  { color: var(--navy-700); text-decoration: underline; text-underline-offset: 2px; }
.ai-md a:hover { color: var(--navy-900); }
.ai-md strong { color: var(--navy-900); font-weight: 600; }
.ai-md em { color: var(--ink-700); }
.ai-md code {
  background: var(--blue-50);
  border: 1px solid rgba(10,61,98,0.12);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--navy-800);
}
.ai-md pre {
  background: var(--blue-50);
  border: 1px solid rgba(10,61,98,0.12);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
}
.ai-md pre code { background: transparent; border: none; padding: 0; }
.ai-md blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--amber-500);
  background: #fff8e7;
  color: var(--ink-700);
  border-radius: 4px;
}
.ai-md hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* Markdown tables → SF-style clean look */
.ai-md table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0 12px;
  font-size: 12.5px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.ai-md thead { background: var(--blue-50); }
.ai-md th, .ai-md td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.ai-md th {
  font-weight: 600;
  color: var(--ink-700);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-strong);
}
.ai-md tbody tr:last-child td { border-bottom: none; }
.ai-md tbody tr:hover { background: var(--blue-50); }
.ai-md td .mono, .ai-md td code { font-weight: 600; }

/* ───── AI chat meta chips (per-message + context strip) ───── */
.ai-context-strip {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(180deg, var(--blue-50) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.ai-meta {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-top: 6px;
  padding: 4px 2px;
  align-items: center;
}
.ai-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-700);
  background: #fff;
  border: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.ai-chip svg { width: 11px; height: 11px; flex-shrink: 0; }
.ai-chip-model {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #fcd34d;
  color: #78350f;
  font-weight: 600;
}
.ai-chip-skill {
  background: #e0e7ff;
  border-color: #a5b4fc;
  color: #3730a3;
  font-weight: 600;
}
.ai-chip-tool {
  background: #d1fae5;
  border-color: #86efac;
  color: #065f46;
  font-weight: 600;
}
.ai-chip-tok {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: var(--ink-700);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
}
.ai-chip-tag {
  display: inline-flex; align-items: center;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(0,0,0,0.08);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ai-tools-trace { margin-top: 6px; }
.ai-tools-trace summary { cursor: pointer; padding: 2px 4px; }
.ai-tools-trace summary:hover { color: var(--navy-700); }
.ai-tools-trace[open] summary { color: var(--navy-700); font-weight: 500; }
.ai-tools-trace code {
  background: var(--blue-50);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   AI ASISTENT — LAYOUT + RESPONSIVE (consolidated, mobile-first overrides at bottom)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Layout shell ── */
.ai-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  min-height: calc(100dvh - 140px);
}
.ai-content { min-width: 0; }

/* ── Sub-sidebar (left nav) ── */
.ai-subnav {
  padding: 8px 6px;
  height: fit-content;
  position: sticky;
  top: 72px;
}
.ai-subnav-list { display: flex; flex-direction: column; gap: 2px; padding: 4px; }
.ai-subnav-section {
  font-size: 10px; font-weight: 600;
  color: var(--ink-500);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 10px 4px;
}
.ai-subnav-section:first-child { padding-top: 4px; }
.ai-subnav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-700);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.ai-subnav-item:hover { background: var(--blue-50); }
.ai-subnav-item.is-active {
  background: var(--blue-100);
  color: var(--navy-900);
  box-shadow: inset 2px 0 0 var(--amber-500);
  font-weight: 500;
}
.ai-subnav-item svg { flex-shrink: 0; }
.ai-subnav-badge {
  margin-left: auto;
  background: var(--amber-500);
  color: #1a1200;
  font-weight: 700;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ── Chat container ── */
.ai-chat {
  display: flex; flex-direction: column;
  min-height: calc(100dvh - 170px);
  min-width: 0;
  overflow: hidden;
}
.ai-chat-head { gap: 10px; flex-wrap: wrap; }
.ai-chat-head-actions { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.ai-model-select { width: 200px; max-width: 100%; padding: 5px 6px; }

.ai-chat-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 18px; }
.ai-chat-messages { max-width: 860px; margin: 0 auto; }

.ai-chat-empty { text-align: center; max-width: 780px; margin: 30px auto; padding: 0 10px; }
.ai-chat-empty-badge {
  width: 64px; height: 64px; border-radius: 16px;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-500));
  display: grid; place-items: center;
  margin: 0 auto 18px;
  box-shadow: 0 8px 30px rgba(19,50,88,0.3);
  color: #fff;
}
.ai-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.ai-suggestion {
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ai-suggestion:hover { background: var(--blue-50); }
.ai-suggestion-label { font-size: 12.5px; font-weight: 500; }
.ai-suggestion-prompt { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Input bar ── */
.ai-chat-input-wrap {
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.ai-chat-last-meta { max-width: 860px; margin: 0 auto 8px; }
.ai-chat-input {
  max-width: 860px; margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px;
}
.ai-chat-textarea {
  width: 100%;
  border: none; outline: none; resize: none;
  font-family: var(--font);
  font-size: 13.5px;
  min-height: 44px;
  padding: 4px 6px;
  background: transparent;
}
.ai-chat-input-bar { margin-top: 6px; }
.ai-send-btn { margin-left: auto; flex-shrink: 0; }

/* ── Form rows + stats grid ── */
.ai-form-row { display: flex; gap: 10px; flex-wrap: nowrap; align-items: stretch; }
.ai-form-col-narrow { width: 180px; flex-shrink: 0; }
.ai-form-col-checks { width: 220px; flex-shrink: 0; }
.ai-stats-grid { padding: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ai-stat-card { padding: 14px; }
.ai-stat-value { font-size: 22px; font-weight: 700; }

/* ── Tables (horizontal scroll) ── */
.ai-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ai-table-wrap table.tbl { width: 100%; min-width: 560px; }

/* ── Approvals ── */
.ai-approval-item { padding: 14px; border-bottom: 1px solid var(--border); }
.ai-approval-item:last-child { border-bottom: none; }
.ai-approval-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ai-approval-kind { padding: 2px 8px; text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em; flex-shrink: 0; }
.ai-approval-meta { flex: 1; min-width: 160px; }
.ai-approval-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.ai-btn-approve { background: var(--green-100); color: #135e37; border-color: transparent; }
.ai-approval-content { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; overflow-wrap: break-word; }

/* ── Skill Builder modal body ── */
.ai-builder-body { display: flex; flex-direction: column; height: min(70vh, 620px); margin: -4px -4px 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLET (≤ 980 px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 980px) {
  .ai-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }

  .ai-subnav {
    position: sticky; top: 56px;
    padding: 4px;
    overflow: hidden;
    z-index: 5;
  }
  .ai-subnav-list {
    flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 4px; gap: 6px;
  }
  .ai-subnav-section {
    flex-shrink: 0;
    padding: 6px 8px 6px 10px;
    align-self: center;
    border-left: 1px solid var(--border);
  }
  .ai-subnav-section:first-child { border-left: none; padding-left: 4px; }
  .ai-subnav-item {
    flex-shrink: 0; white-space: nowrap;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 12.5px;
    box-shadow: none !important;
  }
  .ai-subnav-item.is-active {
    background: var(--navy-700);
    color: #fff;
    border-color: var(--navy-700);
  }
  .ai-subnav-item.is-active svg { color: #fff; }
  .ai-subnav-badge { margin-left: 4px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE (≤ 640 px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Layout */
  .ai-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; min-height: calc(100dvh - 110px); }

  /* Chat container */
  .ai-chat { min-height: calc(100dvh - 190px); border-radius: 8px; }

  /* Chat header — hide title on mobile, put select + Nový on ONE row */
  .ai-chat-head { padding: 10px 12px; align-items: center; flex-wrap: nowrap; gap: 8px; }
  .ai-chat-head h3 { display: none; }
  .ai-chat-head-actions { flex: 1; display: flex; gap: 6px; margin-left: 0; flex-wrap: nowrap; align-items: center; }
  .ai-model-select {
    flex: 1 1 auto; min-width: 0; width: auto;
    font-size: 16px; /* iOS no-zoom */
    height: 36px;
  }
  .ai-chat-head-actions .btn-sm { flex-shrink: 0; height: 36px; padding: 0 10px; }

  /* Context strip — horizontal scroll */
  .ai-context-strip { padding: 6px 10px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 5px; }
  .ai-context-strip > * { flex-shrink: 0; }
  .ai-chip-convo-id { margin-left: 0 !important; }

  /* Chat messages */
  .ai-chat-scroll { padding: 10px; }
  .ai-chat-messages { max-width: 100%; }
  .ai-bubble { padding: 8px 10px; font-size: 13px; }
  .ai-avatar { width: 28px; height: 28px; font-size: 10px; }

  .ai-md table { font-size: 11.5px; display: block; overflow-x: auto; }
  .ai-md th, .ai-md td { padding: 5px 7px; }
  .ai-md pre { font-size: 11px; padding: 8px; white-space: pre-wrap; }

  .ai-meta { gap: 3px; }
  .ai-chip { font-size: 10px; padding: 1px 6px; }
  .ai-chip-tag { font-size: 8.5px; padding: 0 3px; }

  /* Input bar */
  .ai-chat-input-wrap { padding: 10px calc(10px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left)); }
  .ai-chat-last-meta { max-width: 100%; }
  .ai-chat-input { max-width: 100%; padding: 8px; }
  .ai-chat-textarea { font-size: 16px; min-height: 52px; }

  /* Suggestions */
  .ai-suggestions-grid { grid-template-columns: 1fr; }
  .ai-chat-empty { margin: 18px auto; padding: 0 4px; }
  .ai-chat-empty-badge { width: 52px; height: 52px; }
  .ai-chat-empty h2 { font-size: 18px; }

  /* Forms in modals */
  .ai-form-row { flex-wrap: wrap; gap: 8px; }
  .ai-form-col-narrow, .ai-form-col-checks { width: 100%; }

  /* Stats */
  .ai-stats-grid { grid-template-columns: 1fr 1fr; padding: 10px; gap: 6px; }
  .ai-stat-card { padding: 10px; }
  .ai-stat-value { font-size: 18px; }

  /* Tables inside AI content */
  .ai-content .card-head { padding: 8px 12px; gap: 6px; flex-wrap: wrap; }
  .ai-content .card-head h3 { font-size: 13.5px; }
  .ai-content .card-head .hstack { width: 100%; flex-wrap: wrap; }
  .ai-content .card-head .btn-sm { padding: 3px 8px; font-size: 11px; }
  .ai-table-wrap table.tbl { min-width: 480px; font-size: 11.5px; }
  .ai-table-wrap table.tbl th, .ai-table-wrap table.tbl td { padding: 5px 7px; }

  /* Approvals */
  .ai-approval-item { padding: 10px; }
  .ai-approval-actions { width: 100%; justify-content: flex-end; margin-top: 4px; }
  .ai-approval-actions .btn-xs { flex: 1; justify-content: center; min-width: 100px; }

  /* Skill Builder */
  .ai-builder-body { height: 70dvh; margin: 0; }

  /* Modals */
  .modal { width: 96vw !important; max-height: 92dvh; }
  .modal-body { padding: 12px; }
  .modal-foot { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
  .modal textarea.input { font-size: 16px; }
  .modal .checkbox { padding: 8px 10px; }

  /* Ensure all inputs in AI use 16px to prevent iOS zoom */
  .ai-content textarea,
  .ai-content input.input,
  .ai-content select.input { font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   NARROW (≤ 400 px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .ai-chat-head { padding: 8px 10px; gap: 6px; }
  .ai-chip svg { width: 10px; height: 10px; }
  .ai-meta .ai-chip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
  .ai-stats-grid { grid-template-columns: 1fr; }
}

/* Prevent horizontal overflow from long tool output anywhere */
.ai-bubble { max-width: 100%; word-break: break-word; }
.ai-md a { word-break: break-all; }

/* ═══════════════════════════════════════════════════════════════════════════
   FLOATING AI CHAT — bubble + slide-in panel (visible on every screen except /#/ai)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   FAB — SUN launcher
   - Bigger (72 px) for presence
   - Dark contrast ring keeps it visible on both light and dark backgrounds
   - Idle float animation + breathing halo + rotating rays
   - Central sparkle-star signals „AI"
   ═══════════════════════════════════════════════════════════════════════════ */
.ai-fab {
  position: fixed;
  right: 22px;
  /* Sit higher so it doesn't cover pagination / sticky footers / form action bars. */
  bottom: calc(90px + env(safe-area-inset-bottom));
  width: 72px; height: 72px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid; place-items: center;
  z-index: 1200;
  padding: 0;
  outline: none;
  filter: drop-shadow(0 10px 24px rgba(2,57,111, 0.35));
  animation:
    ai-fab-enter 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    ai-fab-float 4s ease-in-out 0.55s infinite;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s;
}
@keyframes ai-fab-enter {
  from { transform: scale(0) rotate(-180deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes ai-fab-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.ai-fab:hover {
  animation-play-state: paused;
  transform: translateY(-4px) scale(1.08);
  filter: drop-shadow(0 16px 34px rgba(242,166,62, 0.55));
}
.ai-fab:active { transform: scale(0.94); }

.ai-fab-sun {
  position: relative;
  width: 72px; height: 72px;
  display: grid; place-items: center;
}

/* Breathing halo — soft warm aura */
.ai-fab-halo {
  position: absolute; inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(247,189,109,0.65) 0%,
    rgba(242,166,62,0.35) 35%,
    rgba(242,166,62,0.08) 60%,
    transparent 75%);
  animation: ai-fab-breathe 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes ai-fab-breathe {
  0%, 100% { transform: scale(0.88); opacity: 0.7; }
  50%      { transform: scale(1.18); opacity: 1; }
}
.ai-fab:hover .ai-fab-halo {
  animation-duration: 1.4s;
  background: radial-gradient(circle,
    rgba(247,189,109,0.9) 0%,
    rgba(242,166,62,0.5) 35%,
    rgba(242,166,62,0.12) 60%,
    transparent 75%);
}

/* Sun rays — two layers rotating opposite directions for more energy */
.ai-fab-rays {
  position: absolute;
  inset: -4px;
  width: 80px; height: 80px;
  filter: drop-shadow(0 0 4px rgba(247,189,109, 0.85));
  z-index: 1;
  pointer-events: none;
}
.ai-fab-rays-long  { animation: ai-fab-rays-spin 12s linear infinite; }
.ai-fab-rays-short { animation: ai-fab-rays-spin 18s linear infinite reverse; }
.ai-fab:hover .ai-fab-rays-long  { animation-duration: 3.5s; }
.ai-fab:hover .ai-fab-rays-short { animation-duration: 5s; }
@keyframes ai-fab-rays-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Dark contrast ring — keeps the sun visible on light AND dark backgrounds */
.ai-fab-ring {
  position: absolute;
  width: 48px; height: 48px;
  border-radius: 50%;
  box-shadow:
    0 0 0 2.5px rgba(2,57,111, 0.92),
    0 0 0 5px rgba(255, 246, 200, 0.6);
  z-index: 2;
  pointer-events: none;
}

/* Central sun orb — warm glow + specular highlight */
.ai-fab-core {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%,
      #fff9e5 0%,
      #ffd878 22%,
      #f2a63e 55%,
      #b8680b 100%);
  box-shadow:
    inset 0 -4px 10px rgba(120, 60, 0, 0.45),
    inset 0 3px 6px rgba(255, 246, 200, 0.85),
    0 4px 14px rgba(242,166,62, 0.6);
  z-index: 3;
  display: grid; place-items: center;
}
.ai-fab-core::before {
  content: '';
  position: absolute;
  top: 6px; left: 9px; right: 12px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.85) 0%, transparent 70%);
}

/* Central AI sparkle star — pulses gently */
.ai-fab-spark {
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 1px 2px rgba(120, 60, 0, 0.5));
  animation: ai-fab-spark-pulse 3s ease-in-out infinite;
}
@keyframes ai-fab-spark-pulse {
  0%, 100% { transform: scale(1)    rotate(0deg);   opacity: 0.9; }
  50%      { transform: scale(1.15) rotate(45deg);  opacity: 1; }
}
.ai-fab:hover .ai-fab-spark { animation-duration: 1.2s; }

/* Green "unread conversation" pulse dot — offset to not cover the spark */
.ai-fab-dot {
  position: absolute; top: 2px; right: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, #34d399 0%, #16a34a 100%);
  border: 2.5px solid #fff;
  z-index: 4;
  animation: ai-fab-dot-pulse 1.6s ease-in-out infinite;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.5);
}
@keyframes ai-fab-dot-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 2px 6px rgba(22,163,74,0.5), 0 0 0 0 rgba(34,197,94,0.7); }
  50%      { transform: scale(1.15); box-shadow: 0 2px 6px rgba(22,163,74,0.5), 0 0 0 8px rgba(34,197,94,0); }
}

@media (prefers-reduced-motion: reduce) {
  .ai-fab, .ai-fab-rays, .ai-fab-halo, .ai-fab-dot, .ai-fab-spark { animation: none !important; }
}

/* Backdrop (tap outside to close on mobile) */
.ai-fab-backdrop {
  position: fixed; inset: 0;
  background: transparent;
  z-index: 1199;
}
@media (max-width: 640px) {
  .ai-fab-backdrop { background: rgba(2,57,111, 0.35); }
}

/* Panel — "blooms" out of the sun at the bottom-right */
.ai-fab-panel {
  position: fixed;
  right: 20px;
  /* Match the FAB position so the panel anchors near the sun. */
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 620px;
  max-height: calc(100dvh - 40px);
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0 30px 70px rgba(2,57,111, 0.28),
    0 8px 20px rgba(242,166,62, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.08);
  z-index: 1200;
  display: flex; flex-direction: column;
  overflow: hidden;
  transform-origin: 100% 100%;
  animation: ai-fab-bloom 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes ai-fab-bloom {
  0%   { opacity: 0; transform: scale(0.35) translate(10%, 10%); filter: blur(6px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1) translate(0, 0); filter: blur(0); }
}

/* A subtle warm ring glow on the panel border while opening */
.ai-fab-panel::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(247,189,109,0.5), rgba(242,166,62,0) 40%, rgba(247,189,109,0.5));
  opacity: 0;
  z-index: -1;
  animation: ai-fab-panel-glow 1s ease-out forwards;
}
@keyframes ai-fab-panel-glow {
  0%   { opacity: 0.9; }
  100% { opacity: 0; }
}

/* Head — subtle warm gradient with sun accent */
.ai-fab-head {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fef4e0 0%, #fffbf2 100%);
  overflow: hidden;
}
.ai-fab-head::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247,189,109,0.35) 0%, transparent 65%);
  animation: ai-fab-head-shimmer 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ai-fab-head-shimmer {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.7; }
  50%      { transform: translate(-15px, 10px) scale(1.15); opacity: 1; }
}
.ai-fab-head-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ai-fab-head-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.ai-fab-model {
  height: 28px;
  font-size: 11.5px !important;
  padding: 0 6px !important;
  width: 80px;
  border-color: var(--border);
}
.ai-fab-icon-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  color: var(--ink-700);
}
.ai-fab-icon-btn:hover { background: var(--blue-50); color: var(--navy-700); }

/* Scroll area */
.ai-fab-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 4px;
  background: var(--bg);
}

/* Empty state */
.ai-fab-empty { padding: 16px 8px; }
.ai-fab-empty-hint {
  font-size: 12px;
  color: var(--ink-500);
  text-align: center;
  margin-bottom: 14px;
  padding: 0 8px;
  line-height: 1.55;
}
.ai-fab-empty-hint i { color: var(--ink-700); background: #fff; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.ai-fab-suggestions { display: flex; flex-direction: column; gap: 6px; }
.ai-fab-suggestion {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  color: var(--ink-900);
  font-family: var(--font);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.ai-fab-suggestion::before {
  content: '☀';
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%) scale(0);
  color: var(--amber-500);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
}
.ai-fab-suggestion:hover {
  border-color: var(--amber-400);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(242,166,62,0.2);
  padding-left: 30px;
}
.ai-fab-suggestion:hover::before {
  transform: translateY(-50%) scale(1);
  opacity: 1;
}

/* Input */
.ai-fab-input-wrap {
  border-top: 1px solid var(--border);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff;
}
.ai-fab-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 13px;
  resize: none;
  outline: none;
  background: #fff;
  min-height: 50px;
}
.ai-fab-textarea:focus { border-color: var(--navy-500); }
.ai-fab-input-foot {
  display: flex; align-items: center;
  margin-top: 6px;
  gap: 8px;
}
.ai-fab-send { margin-left: auto; flex-shrink: 0; }

/* ── MOBILE: panel becomes almost full-screen ── */
@media (max-width: 640px) {
  .ai-fab {
    right: 14px;
    /* Sit higher to keep pagination + form action bars accessible */
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: 64px; height: 64px;
  }
  .ai-fab-sun { width: 64px; height: 64px; }
  .ai-fab-rays { width: 72px; height: 72px; inset: -4px; }
  .ai-fab-ring { width: 42px; height: 42px; }
  .ai-fab-core { width: 38px; height: 38px; }
  .ai-fab-spark { width: 15px; height: 15px; }
  .ai-fab-dot { width: 12px; height: 12px; }
  .ai-fab-panel {
    right: 0; bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: calc(100dvh - 50px);
    max-height: calc(100dvh - 50px);
    border-radius: 14px 14px 0 0;
  }
  .ai-fab-head { padding: 12px 14px; }
  .ai-fab-model { width: 72px; font-size: 11px !important; }
  .ai-fab-textarea { font-size: 16px; min-height: 54px; /* iOS no-zoom */ }
  .ai-fab-suggestions { gap: 6px; }
}

/* ── Hide the FAB when a modal is open so it doesn't overlap Close/Save buttons ── */
body:has(.modal-backdrop) .ai-fab { opacity: 0; pointer-events: none; transform: translateY(20px); }
body:has(.modal-backdrop) .ai-fab-panel { opacity: 0.7; pointer-events: none; }

/* ───── AI navigation action (from crm_open_* tools) ───── */
.ai-nav-action {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  color: #fff !important;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(2,57,111, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-nav-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(2,57,111, 0.35);
  background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-600) 100%);
}
.ai-nav-action svg { flex-shrink: 0; }

/* AI navigation toast — appears briefly after AI auto-opens a page */
.ai-nav-toast {
  position: fixed;
  top: 60px; right: 20px;
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(2,57,111, 0.35);
  font-size: 13px;
  z-index: 1300;
  animation: ai-nav-toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex; align-items: center; gap: 8px;
}
.ai-nav-toast b { color: #f7bd6d; }
.ai-nav-toast span { font-size: 16px; }
.ai-nav-toast.fade { opacity: 0; transform: translateY(-8px); transition: opacity 0.4s, transform 0.4s; }
@keyframes ai-nav-toast-in { from { opacity:0; transform: translateY(-20px); } to { opacity:1; transform: translateY(0); } }
@media (max-width: 640px) {
  .ai-nav-toast { top: 55px; right: 10px; left: 10px; font-size: 12.5px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TEAM CALENDAR / LEAVES
   ═══════════════════════════════════════════════════════════════════════════ */

.cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
}
.cal-head {
  gap: 10px;
  flex-wrap: wrap;
}
.cal-nav { flex-wrap: wrap; gap: 4px; }

.cal-grid-wrap { padding: 0 10px 10px; }
.cal-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  padding: 8px 0 4px;
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cal-weekday { text-align: center; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.cal-cell {
  min-height: 88px;
  background: #fff;
  padding: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: none;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  align-items: stretch;
  transition: background 0.1s;
}
.cal-cell:hover { background: var(--blue-50); }
.cal-cell.out-month { background: #f6f8fc; }
.cal-cell.out-month .cal-daynum { color: var(--ink-300); }

.cal-daynum {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-700);
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.cal-cell.is-today .cal-daynum {
  background: var(--navy-800);
  color: #fff;
  font-weight: 700;
}
.cal-events {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.cal-event {
  font-size: 10.5px;
  font-weight: 500;
  color: #fff;
  background: var(--ev-color, var(--navy-700));
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.cal-event.pending {
  background: repeating-linear-gradient(
    45deg,
    var(--ev-color, var(--navy-700)) 0, var(--ev-color, var(--navy-700)) 6px,
    rgba(255, 255, 255, 0.3) 6px, rgba(255, 255, 255, 0.3) 10px
  );
  opacity: 0.85;
}
.cal-event-name { pointer-events: none; }
.cal-event-more { font-size: 9.5px; color: var(--ink-500); padding: 0 2px; }

/* Legend */
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: 12px 10px 4px;
  font-size: 11px;
  color: var(--ink-500);
}
.cal-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* Side panel rows */
.cal-side-row {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.cal-side-row:first-child { border-top: none; }
.cal-type-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 13px;
  flex-shrink: 0;
}

/* New leave — type picker grid */
.cal-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}
.cal-type-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--ink-700);
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.cal-type-btn:hover {
  border-color: var(--type-color, var(--navy-500));
  background: #fafbfd;
  transform: translateY(-1px);
}
.cal-type-btn.is-active {
  border-color: var(--type-color, var(--navy-700));
  background: var(--blue-50);
  color: var(--ink-900);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(10, 61, 98, 0.08);
}
.cal-type-btn-icon {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--type-color, var(--navy-500));
  color: #fff;
  font-size: 13px;
  flex-shrink: 0;
}

/* ─── TABLET (≤ 980 px): stack ─── */
@media (max-width: 980px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-cell { min-height: 78px; }
}

/* ─── MOBILE (≤ 640 px): compact cells + horizontal scroll if needed ─── */
@media (max-width: 640px) {
  .cal-head { padding: 8px 10px; }
  .cal-grid-wrap { padding: 0 6px 6px; }
  .cal-cell { min-height: 66px; padding: 3px; }
  .cal-daynum { width: 18px; height: 18px; font-size: 11px; }
  .cal-event { font-size: 9.5px; padding: 1px 4px; }
  .cal-event-more { font-size: 9px; }
  .cal-legend { gap: 8px; font-size: 10.5px; padding: 10px 6px 4px; }
  .cal-legend-swatch { width: 8px; height: 8px; }
  .cal-type-grid { grid-template-columns: 1fr 1fr; }
  .cal-side-row { padding: 10px; }
  .cal-head h3, .cal-head b { font-size: 13.5px; }
  .cal-head .btn-sm { padding: 3px 8px; font-size: 11px; }
}
@media (max-width: 400px) {
  .cal-cell { min-height: 58px; padding: 2px; }
  .cal-event { font-size: 9px; padding: 0 3px; }
  .cal-type-grid { grid-template-columns: 1fr; }
}

/* ───── Allowance tiles ───── */
.cal-allowance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  padding: 10px 14px 14px;
}
.cal-allowance-tile {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.cal-allowance-bar {
  margin-top: 6px;
  height: 5px;
  background: var(--blue-50);
  border-radius: 3px;
  overflow: hidden;
}
.cal-allowance-bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 0.2s;
}

/* ───── Attachments panel ───── */
.cal-attach-panel {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--blue-50);
  border: 1px solid rgba(10, 61, 98, 0.1);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-attach-row {
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.cal-attach-link {
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0;
  color: var(--navy-700);
  text-decoration: none;
  font-size: 12px;
}
.cal-attach-link:hover { color: var(--navy-900); }
.cal-attach-thumb {
  width: 28px; height: 28px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.cal-attach-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--red-100);
  color: #b91c1c;
  border-radius: 4px;
  flex-shrink: 0;
  font-size: 14px;
}
.cal-attach-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.cal-file-drop {
  padding: 8px 10px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  background: #fafbfd;
}

/* ───── Segment buttons (seg) — ensure they work in calendar ───── */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button {
  border: none; background: #fff;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--ink-700);
  cursor: pointer;
  font-family: var(--font);
  border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: none; }
.seg button:hover { background: var(--blue-50); }
.seg button.active { background: var(--navy-700); color: #fff; }

/* ───── FULL MOBILE PASS FOR CALENDAR ───── */
@media (max-width: 980px) {
  .cal-allowance-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .cal-allowance-grid { padding: 8px 10px; gap: 6px; }
  .cal-allowance-tile { padding: 6px 8px; }
  .cal-attach-row { flex-wrap: wrap; }
  .cal-attach-name { font-size: 11.5px; }
}
@media (max-width: 400px) {
  .cal-allowance-grid { grid-template-columns: 1fr; }
}

/* ───── Animated typing indicator (AI chat, Skill Builder, FAB) ───── */
.ty-wrap { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ty-label { margin-bottom: 0; }
.ty-bubble {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  width: fit-content;
  max-width: 100%;
  font-size: 12px;
  color: var(--ink-500);
}
.ty-dots {
  display: inline-flex; gap: 4px; align-items: center;
}
.ty-dots > span {
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, var(--amber-500), #d97706);
  box-shadow: 0 0 0 0 rgba(242,166,62,0.5);
  animation: ty-bounce 1.1s ease-in-out infinite;
}
.ty-dots > span:nth-child(1) { animation-delay: 0s; }
.ty-dots > span:nth-child(2) { animation-delay: 0.18s; }
.ty-dots > span:nth-child(3) { animation-delay: 0.36s; }
@keyframes ty-bounce {
  0%, 80%, 100% { transform: scale(0.6) translateY(0); opacity: 0.5; box-shadow: 0 0 0 0 rgba(242,166,62,0.45); }
  40%           { transform: scale(1.15) translateY(-4px); opacity: 1; box-shadow: 0 0 0 4px rgba(242,166,62,0); }
}
.ty-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--ink-400);
  padding: 1px 6px;
  background: var(--blue-50);
  border-radius: 4px;
}

/* Variant — small (for FAB) */
.ty-wrap.ty-small .ty-bubble { padding: 6px 10px; font-size: 11px; }
.ty-wrap.ty-small .ty-dots > span { width: 6px; height: 6px; }
@media (prefers-reduced-motion: reduce) {
  .ty-dots > span { animation: none; opacity: 0.7; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATION TOAST (popup in top-right when a new item arrives)
   ═══════════════════════════════════════════════════════════════════════════ */
.notif-toast {
  position: fixed;
  top: 60px;
  right: 20px;
  width: 360px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber-500);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(2,57,111, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 12px 14px;
  z-index: 1400;
  animation: notif-toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.notif-toast.fade { opacity: 0; transform: translateX(20px); transition: opacity 0.3s, transform 0.3s; }
@keyframes notif-toast-in {
  0%   { opacity: 0; transform: translateX(30px) scale(0.95); }
  100% { opacity: 1; transform: translateX(0)     scale(1); }
}
.notif-toast-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.notif-toast-chip {
  background: var(--amber-500);
  color: #1a1200;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
}
.notif-toast-close {
  margin-left: auto;
  width: 22px; height: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-400);
  font-size: 13px;
  line-height: 1;
}
.notif-toast-close:hover { color: var(--ink-900); }
.notif-toast-title { font-size: 13px; font-weight: 600; color: var(--ink-900); margin-bottom: 2px; }
.notif-toast-sub   { font-size: 11.5px; color: var(--ink-500); margin-bottom: 6px; }
.notif-toast-action {
  color: var(--navy-700);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}
.notif-toast-action:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .notif-toast { top: 55px; right: 10px; left: 10px; width: auto; }
}

/* ───── Sound toggle switch (in bell dropdown footer) ───── */
.notif-switch {
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}
.notif-switch.on { background: var(--amber-500); }
.notif-switch-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.notif-switch.on .notif-switch-knob { transform: translateX(16px); }

/* chip blue (for AI chip in notifications) */
.chip.blue { background: var(--blue-100); color: var(--navy-700); }

/* ═══════════════════════════════════════════════════════════════════════════
   AI CHAT ATTACHMENTS (paperclip + drag&drop + preview chips + inline gallery)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Paperclip button inside input bar */
.ai-attach-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-500);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ai-attach-btn:hover { background: var(--blue-50); color: var(--navy-700); border-color: var(--border); }
.ai-attach-btn-sm { width: 28px; height: 28px; }

/* Drag-over visual */
.ai-chat-input.is-dragging,
.ai-fab-input-wrap.is-dragging {
  outline: 2px dashed var(--amber-500);
  outline-offset: -4px;
  background: #fff8e7;
}

/* Pending attachment chips (shown above textarea before sending) */
.ai-attach-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 4px 2px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.ai-attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 4px;
  background: var(--blue-50);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 200px;
  font-size: 11px;
}
.ai-attach-chip-thumb {
  width: 28px; height: 28px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.ai-attach-chip-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  flex-shrink: 0;
}
.ai-attach-chip-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-attach-chip-x {
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-400); font-size: 12px; padding: 0 4px;
}
.ai-attach-chip-x:hover { color: var(--red-500); }

/* Inline attachments in the sent message bubble (above the text) */
.ai-msg-files {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 6px;
}
.ai-msg-file {
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.ai-msg-file-img {
  max-width: 180px;
  max-height: 180px;
  border: 1px solid var(--border);
  display: block;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ai-msg-file-img:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(2,57,111,0.2); }
.ai-msg-file-img img {
  width: 100%; height: 100%; display: block;
  max-width: 180px; max-height: 180px;
  object-fit: cover;
}
.ai-msg-file-doc {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 280px;
  min-width: 160px;
}
.ai-msg-file-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--red-100);
  color: #b91c1c;
  border-radius: 6px;
  font-size: 16px;
  flex-shrink: 0;
}
.ai-msg-file-name {
  font-size: 12px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Reserve safe space at the bottom of the main content so pagination / sticky
   action rows aren't hidden beneath the floating AI sun. */
body:has(.ai-fab) .content { padding-bottom: 100px; }
@media (max-width: 640px) {
  body:has(.ai-fab) .content { padding-bottom: 90px; }
}

/* ═══ DOCHÁDZKA — mobile-first attendance screen ═══════════════════════ */
.att-screen {
  display: flex; flex-direction: column;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 4px 32px;
}

/* Status banner */
.att-banner {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px;
  border-radius: 14px;
  color: #fff;
  box-shadow: 0 6px 22px rgba(2,57,111,0.18);
  position: relative;
  overflow: hidden;
}
.att-banner::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 0%, rgba(255,255,255,0.18), transparent 60%);
  pointer-events: none;
}
.att-status-off      { background: linear-gradient(135deg, #475569, #1e293b); }
.att-status-working  { background: linear-gradient(135deg, #059669, #047857); }
.att-status-on_break { background: linear-gradient(135deg, #d97706, #b45309); }
.att-status-on_trip  { background: linear-gradient(135deg, #2563eb, #1e3a8a); }

.att-banner-main { display: flex; align-items: center; gap: 14px; }
.att-banner-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
  display: grid; place-items: center;
  font-size: 26px;
  flex-shrink: 0;
}
.att-banner-text { min-width: 0; }
.att-banner-title { font-size: 20px; font-weight: 700; letter-spacing: 0.01em; }
.att-banner-sub   { font-size: 13px; opacity: 0.88; margin-top: 2px; }

.att-gps {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  align-self: flex-start;
}
.att-gps-dot {
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
  flex-shrink: 0;
  animation: att-pulse 2s ease-in-out infinite;
}
@keyframes att-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

/* Countdown */
.att-countdown {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(2,57,111,0.05);
}
.att-countdown-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.att-countdown-block {
  text-align: center;
  padding: 8px 4px;
}
.att-countdown-block.primary {
  background: #fef3c7;
  border-radius: 10px;
}
.att-countdown-label {
  font-size: 11px; font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.att-countdown-value {
  font-size: 22px; font-weight: 700;
  color: #012a52;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.att-countdown-block.primary .att-countdown-value { color: #92400e; font-size: 26px; }
.att-progress {
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.att-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 1s linear;
}
.att-countdown-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: #64748b;
}

/* Action buttons — BIG, touch-friendly */
.att-actions {
  display: flex; flex-direction: column;
  gap: 10px;
}
.att-actions-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.att-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  padding: 22px 16px;
  min-height: 88px;
  border: 0;
  border-radius: 16px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}
.att-btn:active:not(:disabled) { transform: scale(0.97); }
.att-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.att-btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 8px 22px rgba(16,185,129,0.35);
}
.att-btn-primary:hover:not(:disabled) { box-shadow: 0 10px 28px rgba(16,185,129,0.5); }

.att-btn-go {
  min-height: 120px;
  font-size: 18px;
}
.att-btn-go .att-btn-text { font-size: 26px; letter-spacing: 0.04em; }

.att-btn-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  box-shadow: 0 8px 22px rgba(239,68,68,0.35);
}

.att-btn-secondary {
  background: #fff;
  color: #012a52;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(2,57,111,0.05);
}
.att-btn-secondary:hover:not(:disabled) { background: #f1f5f9; }

.att-btn-ico  { font-size: 28px; line-height: 1; }
.att-btn-text { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; }
.att-btn-sub  { font-size: 12px; opacity: 0.85; font-weight: 500; }

/* Today log card */
.att-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.att-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.att-card-head h3 { margin: 0; font-size: 14px; font-weight: 600; color: #012a52; }
.att-empty {
  padding: 28px 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}
.att-log { display: flex; flex-direction: column; }
.att-log-row {
  display: grid;
  grid-template-columns: 56px 36px 1fr;
  gap: 10px;
  padding: 10px 16px;
  align-items: center;
  border-top: 1px solid #f1f5f9;
}
.att-log-row:first-child { border-top: 0; }
.att-log-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #475569;
  font-size: 14px;
}
.att-log-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 15px;
}
.att-log-label { font-size: 14px; font-weight: 600; color: #012a52; }
.att-log-meta { font-size: 11px; color: #94a3b8; margin-top: 1px; }

.att-tips {
  font-size: 12px;
  color: #64748b;
  padding: 8px 4px;
}
.att-tips p { margin: 4px 0; }

/* Break menu modal grid */
.att-break-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.att-break-pick {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.att-break-pick:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, #fff); }
.att-break-ico { font-size: 28px; }
.att-break-lbl { font-size: 13px; font-weight: 600; color: #012a52; }

/* Leave-zone modal actions */
.att-leave-actions {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.att-leave-actions .att-btn { min-height: 100px; padding: 14px 10px; }

/* Mobile tweaks */
@media (max-width: 520px) {
  .att-countdown-row { grid-template-columns: 1fr 1fr; }
  .att-countdown-block:nth-child(3) { grid-column: span 2; border-top: 1px solid #e2e8f0; padding-top: 10px; margin-top: 4px; }
  .att-banner-title { font-size: 18px; }
  .att-btn-go { min-height: 110px; }
  .att-btn-go .att-btn-text { font-size: 22px; }
}

/* ═══ Zone editor — mapa + assignment ════════════════════════════════ */
.zone-edit-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.zone-edit-map-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.zone-edit-form-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.zone-edit-map {
  height: 380px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #e2e8f0;
}

/* Leaflet attribution + zoom controls — tighter */
.zone-edit-map .leaflet-control-attribution { font-size: 9px; }

.zone-search-results {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 180px;
  overflow-y: auto;
}
.zone-search-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: none;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  font-family: inherit;
}
.zone-search-row:hover { background: #f8fafc; }
.zone-search-row:last-child { border-bottom: 0; }

.zone-user-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
}
.zone-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  user-select: none;
}
.zone-user-row:last-child { border-bottom: 0; }
.zone-user-row:hover { background: #f8fafc; }
.zone-user-row.checked { background: #eff6ff; }
.zone-user-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }

/* Mobile: stack vertikálne */
@media (max-width: 720px) {
  .zone-edit-grid { grid-template-columns: 1fr; }
  .zone-edit-map { height: 280px; }
}

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  font-weight: 500;
  line-height: 16px;
  vertical-align: middle;
}

/* ═══ Attendance — undo, secondary actions, history, stats ════════════ */
.att-secondary-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 8px 4px;
}
.att-secondary-actions .btn { flex: 1 1 auto; min-width: 0; }

/* Undo — moderná karta s width-based progress fillom */
.att-log-row { position: relative; }
.att-log-row.has-undo {
  background: linear-gradient(to right, transparent 0%, #fffaf5 100%);
}

.att-undo {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  background: #fff;
  border: 2px solid #fda4af;
  color: #be123c;
  border-radius: 14px;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  margin-left: 10px;
  min-width: 168px;
  min-height: 46px;
  padding: 0;
  transition: border-color 0.2s, transform 0.08s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.att-undo:hover { border-color: #ef4444; box-shadow: 0 4px 12px rgba(239,68,68,0.2); }
.att-undo:active { transform: scale(0.97); }

/* Pozadie ktoré sa zmenšuje keď ubieha čas (width % computed v JS) */
.att-undo-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(to right, #fee2e2, #fecaca);
  transition: width 0.95s linear;
  pointer-events: none;
  z-index: 0;
}

.att-undo-content {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  flex: 1;
  white-space: nowrap;
}
.att-undo-icon { color: #be123c; flex-shrink: 0; }
.att-undo-text {
  font-size: 14px; font-weight: 700;
  letter-spacing: 0.01em;
  flex: 1;
}
.att-undo-timer {
  font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: #ef4444;
  padding: 4px 10px;
  border-radius: 999px;
  min-width: 46px;
  text-align: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(239,68,68,0.35);
}

.att-undo.urgent {
  border-color: #ef4444;
  animation: att-undo-pulse 1.1s ease-in-out infinite;
}
.att-undo.urgent .att-undo-timer {
  background: #b91c1c;
  animation: att-undo-timer-blink 0.6s ease-in-out infinite alternate;
}
@keyframes att-undo-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.45); }
  50%      { box-shadow: 0 0 0 8px rgba(239,68,68,0.0); }
}
@keyframes att-undo-timer-blink {
  from { opacity: 1; }
  to   { opacity: 0.6; }
}

@media (max-width: 520px) {
  .att-log-row.has-undo { flex-wrap: wrap; row-gap: 8px; }
  .att-undo {
    margin-left: 0;
    margin-top: 6px;
    margin-bottom: 2px;
    flex-basis: 100%;
    width: 100%;
    min-height: 52px;
    border-radius: 12px;
  }
  .att-undo-content { padding: 10px 14px; gap: 12px; }
  .att-undo-text { font-size: 15px; }
  .att-undo-timer { font-size: 14px; padding: 6px 12px; min-width: 56px; }
}

/* Manager chips list */
.att-mgr-chips {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 4px;
}

/* ═══ Login — mobile responsivita polish ══════════════════════════════ */
@media (max-width: 820px) {
  .auth-wrap {
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}
@media (max-width: 480px) {
  .auth-left {
    padding: 16px 18px 8px;
  }
  .auth-right {
    padding: 16px 16px 28px calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
    border-radius: 16px 16px 0 0;
  }
  .auth-right h3 { font-size: 18px; }
  .auth-right .sub { font-size: 13px; margin-bottom: 16px; }
  .auth-form { gap: 14px; }
  .auth-form .input { height: 46px; font-size: 16px;  /* iOS zoom-prevention */ }
  .btn-lg { height: 48px; font-size: 15px; }
  .auth-logo .sb-logo-mark { width: 36px; height: 36px; }
  .auth-logo-text { font-size: 14px; }
  .auth-logo-text small { font-size: 9px; }
}
@media (max-width: 380px) {
  .otp-box { width: 13vw; max-width: 44px; min-width: 36px; height: 50px; font-size: 20px; }
}
/* Safe-area insets na iPhone X+ s notchom */
.auth-wrap {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* History summary cards */
.att-history-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.att-history-summary > div {
  text-align: center;
  padding: 10px 6px;
  background: #f8fafc;
  border-radius: 10px;
}
.att-history-summary .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; font-weight: 500; }
.att-history-summary .val { font-size: 20px; font-weight: 700; color: #012a52; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* History table */
.att-history-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 13px;
}
.att-history-thead, .att-history-row {
  display: grid;
  grid-template-columns: 60px 70px 70px 70px 70px 40px 70px 50px;
  gap: 6px;
  padding: 8px 12px;
  align-items: center;
}
.att-history-thead {
  background: #f1f5f9;
  font-weight: 600;
  font-size: 11px;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.att-history-row {
  border-bottom: 1px solid #f1f5f9;
  font-variant-numeric: tabular-nums;
}
.att-history-row:last-child { border-bottom: 0; }
.att-history-row:hover { background: #f8fafc; }
.att-history-row.is-empty { color: #cbd5e1; }
.att-history-row.is-empty:hover { background: transparent; }
.att-history-row.is-open { background: #fffbeb; }

/* Stats cards */
.att-stats-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.att-stats-card {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}
.att-stats-card.primary {
  background: linear-gradient(135deg, #012a52, #02396f);
  color: #fff;
  border: 0;
}
.att-stats-card .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: inherit; opacity: 0.75; font-weight: 500; }
.att-stats-card .val { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.att-stats-card .sub { font-size: 11px; opacity: 0.7; margin-top: 2px; }

/* Track timeline below map */
.att-track-timeline {
  display: flex; flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  max-height: 200px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.att-track-time-item {
  display: flex; gap: 8px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
}
.att-track-time-item:hover { background: #f8fafc; }

@media (max-width: 720px) {
  .att-history-summary { grid-template-columns: repeat(2, 1fr); }
  .att-history-thead, .att-history-row {
    grid-template-columns: 50px 55px 55px 55px 50px 30px 50px 40px;
    font-size: 12px;
    padding: 6px 8px;
    gap: 4px;
  }
  .att-stats-cards { grid-template-columns: repeat(2, 1fr); }
}

.att-track-shortcut {
  display: flex; align-items: center; gap: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 10px 12px;
  border-radius: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.att-track-shortcut .input { width: 160px; }
@media (max-width: 600px) {
  .att-track-shortcut { gap: 6px; }
  .att-track-shortcut .input { flex: 1 1 100%; width: auto; }
}

/* ═══ Tracking playback ═══════════════════════════════════════════════ */
.att-punch-marker {
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: opacity 0.25s, transform 0.25s;
}
.att-playhead-marker {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #60a5fa, #2563eb 65%, #1e3a8a);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #2563eb, 0 4px 12px rgba(37,99,235,0.55);
  animation: att-playhead-pulse 1.5s ease-in-out infinite;
}
@keyframes att-playhead-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

.att-playback {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  background: #012a52;
  color: #fff;
  border-radius: 12px;
  align-items: center;
}
.att-playback-time {
  display: flex; flex-direction: column;
  font-variant-numeric: tabular-nums;
}
.att-playback-now {
  font-size: 22px; font-weight: 700;
  letter-spacing: 0.02em;
}
.att-playback-range {
  font-size: 11px;
  color: #9dc2e8;
}
.att-playback-controls {
  grid-column: 1 / 2;
  grid-row: 2;
  display: flex; gap: 6px;
  margin-top: 8px;
}
.att-pb-btn {
  background: rgba(255,255,255,0.12);
  border: 0;
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s;
  font-family: inherit;
}
.att-pb-btn:hover { background: rgba(255,255,255,0.22); }
.att-pb-play {
  width: 52px; height: 52px;
  background: #f2a63e;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(242,166,62,0.4);
}
.att-pb-play:hover { background: #f7bd6d; }
.att-pb-speed {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  min-width: 90px;
}
.att-pb-speed option { background: #012a52; }

.att-playback-slider {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 100%;
  height: 10px;
  appearance: none; -webkit-appearance: none;
  background: linear-gradient(to right,
    #10b981 0%, #10b981 var(--pct, 0%),
    rgba(255,255,255,0.16) var(--pct, 0%), rgba(255,255,255,0.16) 100%);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}
.att-playback-slider::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: pointer;
  border: 3px solid #10b981;
}
.att-playback-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: pointer;
  border: 3px solid #10b981;
}

/* Timeline rows klikateľné */
.att-track-time-item {
  background: none; border: 0;
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: #012a52;
  transition: background 0.1s;
}
.att-track-time-item:hover { background: #eff6ff; }
.att-track-time-item.upcoming { opacity: 0.45; }
.att-track-time-item.upcoming:hover { opacity: 1; background: #f8fafc; }

@media (max-width: 640px) {
  .att-playback {
    grid-template-columns: 1fr;
  }
  .att-playback-controls {
    grid-column: 1;
    grid-row: auto;
    justify-content: center;
  }
  .att-playback-slider {
    grid-column: 1;
    grid-row: auto;
  }
}

/* ═══ Sidebar — explicit logout button (visible on mobile too) ═══════ */
.sb-logout {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.sb-logout:hover { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.5); color: #fff; }
.sb-logout-ico { width: 16px; height: 16px; }
/* Na desktop (zúžený sidebar 1024-) skry text */
@media (max-width: 1024px) {
  .sb-logout-text { display: none; }
  .sb-logout { padding: 6px; }
}
/* Mobile drawer — opäť ukáž text aby bolo jasné že je to logout */
@media (max-width: 720px) {
  .sb-logout-text { display: inline !important; }
  .sb-logout { padding: 8px 12px; font-size: 13px; }
}

/* ═══ Notification dropdown — responsive ═══════════════════════════════ */
.notif-dropdown {
  position: absolute;
  top: 38px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 24px);   /* nikdy širšie ako viewport */
  max-height: 480px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(2,57,111,0.18);
  z-index: 500;
}
@media (max-width: 640px) {
  .notif-dropdown {
    position: fixed;
    top: 56px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 72px);
  }
}

/* ═══ App Launcher — klikateľný grid modulov ═══════════════════════════ */
.launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.launcher-card {
  display: flex; flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  padding: 0;
  transition: transform 0.12s, box-shadow 0.18s, border-color 0.18s;
}
.launcher-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(2,57,111,0.12);
  border-color: var(--navy-700);
}
.launcher-card:active { transform: translateY(0); }

.launcher-card-banner {
  position: relative;
  height: 76px;
  display: flex; align-items: center; justify-content: center;
}
.launcher-card-emoji {
  font-size: 34px;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.25));
}
.launcher-card-body {
  padding: 10px 14px 12px;
}
.launcher-card-title {
  font-weight: 600;
  font-size: 14px;
  color: #012a52;
  line-height: 1.25;
}
.launcher-card-cta {
  font-size: 11.5px;
  color: var(--navy-700);
  font-weight: 500;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .launcher-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .launcher-card-banner { height: 64px; }
  .launcher-card-emoji { font-size: 28px; }
  .launcher-card-title { font-size: 13px; }
  .launcher-card-body { padding: 8px 10px 10px; }
}
@media (max-width: 380px) {
  .launcher-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ═══ Attendance — pending trips approval, manager assignment ════════ */
.att-btn-warn {
  background: #fef3c7 !important;
  border-color: #fcd34d !important;
  color: #92400e !important;
  font-weight: 600;
}
.att-btn-warn:hover { background: #fde68a !important; }

.att-trip-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.att-trip-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.att-trip-user { font-weight: 600; font-size: 14px; color: #012a52; }
.att-trip-meta { font-size: 11px; color: #94a3b8; }
.att-trip-body { padding: 10px 12px; }
.att-trip-actions {
  display: flex; gap: 8px; padding: 8px 12px 10px;
  justify-content: flex-end;
}

.att-mgr-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
@media (max-width: 600px) {
  .att-mgr-row { flex-direction: column; align-items: stretch; }
  .att-mgr-row select.input { width: 100% !important; }
  .att-trip-actions { flex-direction: column; }
  .att-trip-actions .btn { width: 100%; }
}

.chip.blue { background: #dbeafe; color: #1e40af; }
.chip.navy { background: #e0e7ff; color: #012a52; }
.chip.amber { background: #fef3c7; color: #92400e; }
.chip.gray { background: #f1f5f9; color: #475569; }

/* ═══ Notification dropdown — quick action buttons + row hover ═════════ */
.notif-row {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink-900);
  background: #fff;
  transition: background 0.12s;
}
.notif-row:hover { background: #eff6ff; }
.notif-row:last-child { border-bottom: 0; }

.notif-quick-actions {
  display: flex; gap: 6px;
  margin-top: 8px;
}
.notif-quick-btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.notif-quick-btn.approve {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.notif-quick-btn.approve:hover { background: #16a34a; color: #fff; border-color: #16a34a; }
.notif-quick-btn.reject {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}
.notif-quick-btn.reject:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

/* ═══ Admin screens — mobile responsivity + readable text ═════════════ */
@media (max-width: 720px) {
  /* Permission matrix v UsersPermissions — kompaktnejšie */
  .perm-matrix { font-size: 12px; }
  .perm-matrix th, .perm-matrix td { padding: 4px 6px !important; }
  /* Module manager karta — celá šírka */
  .module-card { flex-direction: column; align-items: stretch !important; }
  .module-card > * { width: 100%; }
  /* Page heads na mobile */
  .page-head h1 { font-size: 18px; }
  .page-head p { font-size: 12.5px; }
  /* Tabuľky v admin sekciách */
  table { font-size: 12px; }
  /* Card body na mobile menej paddingu */
  .card-body, .card { padding: 12px !important; }
  /* Inputs aby boli 16px (iOS no-zoom) */
  input.input, select.input, textarea.input { font-size: 16px !important; }
  /* Buttons aby boli touch-friendly */
  .btn { min-height: 38px; }
  .btn-sm { min-height: 32px; }
}

/* Niektoré starsie ad-hoc inline štýly mali farbu textu inherit od dark background;
   poistka aby kartičky/dialogy v admin sekciách boli vždy čierne na bielom. */
.card, .modal, .att-card, .auth-right {
  color: var(--ink-900);
}
.card input.input, .card select.input, .card textarea.input,
.modal input.input, .modal select.input, .modal textarea.input {
  color: var(--ink-900);
  background: #fff;
}

/* ═══ Generic mobile responsivity — všetky moduly ════════════════════ */
@media (max-width: 720px) {
  /* Content padding rešpektuje safe-area-inset */
  .content {
    padding: 12px;
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  /* Tabuľky — horizontálny scroll wrapper */
  .table-wrap, .tbl-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;        /* zarovnať do okraja */
    padding: 0 12px;
  }
  table.tbl, table.table {
    min-width: 100%;
    font-size: 12px;
  }

  /* Filter rows — stack zvisle */
  .filters, .filter-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .filters > *, .filter-row > * { width: 100%; }

  /* Page head — názov + akcie pod sebou */
  .page-head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .page-head h1 { font-size: 18px; }
  .page-head p { font-size: 12.5px; }
  .page-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .page-head-actions .btn { flex: 1 1 auto; min-width: 0; }

  /* Modaly — full-screen na mobile */
  .modal {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: calc(100dvh - 24px) !important;
    margin: 12px auto;
  }
  .modal-body { padding: 12px !important; }

  /* Card grids — responsive auto-fit už default; ručne stack pre niektoré starsie .split */
  .split { grid-template-columns: 1fr !important; }
  .col-2, .col-3, .col-4 { grid-template-columns: 1fr !important; }

  /* Forms — labels nad inputmi */
  .field { width: 100%; }
  .field-row, .form-row { flex-direction: column !important; align-items: stretch !important; }

  /* Buttons — touch friendly */
  .btn { min-height: 38px; padding: 8px 12px; }
  .btn-sm { min-height: 32px; padding: 5px 9px; }
  .btn-xs { min-height: 26px; padding: 3px 7px; font-size: 11px; }
  .btn-lg { min-height: 48px; padding: 12px 16px; font-size: 15px; }

  /* iOS no-zoom — všetky inputs ≥16px */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="search"], input[type="tel"],
  input[type="url"], input[type="date"], input[type="datetime-local"],
  input[type="time"], select, textarea {
    font-size: 16px !important;
  }
  .input { font-size: 16px !important; }

  /* Topbar — kompaktný */
  .topbar { padding: 6px 10px; }
  .topbar-search { display: none; }
  .launcher-btn span { display: none; }

  /* AI floating bublina menšia */
  .ai-fab { width: 56px !important; height: 56px !important; right: 12px !important; bottom: 12px !important; }
}

/* Veľmi malé telefóny (iPhone SE etc.) */
@media (max-width: 380px) {
  .content { padding: 10px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 17px; }
  .btn { min-height: 36px; font-size: 12.5px; padding: 6px 10px; }
  .att-btn-go { min-height: 100px; }
  .att-btn-go .att-btn-text { font-size: 20px; }
}

/* Dashboard 2-stĺpcový grid — na užších obrazovkách 1 stĺpec */
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   POLISH LAYER (2026-07-21) — jemné vizuálne doladenie celej appky.
   Zámerne bez zmien layoutu: len tiene, prechody, zaoblenia, focus
   stavy a mikro-interakcie, aby panel pôsobil sviežo a prémiovo.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --r-md: 8px;
  --r-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(2,57,111,.05), 0 1px 1px rgba(2,57,111,.03);
  --shadow-md: 0 2px 4px rgba(2,57,111,.06), 0 6px 16px rgba(2,57,111,.07);
  --shadow-lg: 0 6px 16px rgba(2,57,111,.10), 0 18px 44px rgba(2,57,111,.14);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* Globálne: výber textu, tenké scrollbary, plynulé focusy */
::selection { background: rgba(247,189,109,.35); color: var(--ink-900); }
* { scrollbar-width: thin; scrollbar-color: rgba(2,57,111,.22) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(2,57,111,.18);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(2,57,111,.34); background-clip: content-box; }

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--amber-500);
  outline-offset: 1px;
  border-radius: 6px;
}

/* Sidebar — jemný hĺbkový gradient + zlatý indikátor aktívnej položky */
.sidebar {
  background: linear-gradient(180deg, var(--navy-900) 0%, #01203f 70%, #011a33 100%);
}
.sb-nav a {
  position: relative;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.sb-nav a.active::before {
  content: '';
  position: absolute; left: -8px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--amber-400), var(--amber-500));
  box-shadow: 0 0 10px rgba(247,189,109,.55);
}
.sb-logo-mark { box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), 0 0 0 2px #012a52, 0 4px 14px rgba(242,166,62,.28); }

/* Tlačidlá — prechody, vrstvený vzhľad, poctivý active stav */
.btn {
  border-radius: 7px;
  transition: background .15s var(--ease), border-color .15s var(--ease),
              box-shadow .15s var(--ease), color .15s var(--ease), transform .06s ease;
  box-shadow: 0 1px 1px rgba(2,57,111,.04);
}
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--navy-700), var(--navy-800));
  box-shadow: 0 1px 2px rgba(2,57,111,.25), inset 0 1px 0 rgba(255,255,255,.08);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--navy-600), var(--navy-700));
  box-shadow: 0 2px 8px rgba(2,57,111,.30), inset 0 1px 0 rgba(255,255,255,.10);
}
.btn-amber {
  background: linear-gradient(180deg, var(--amber-400), var(--amber-500));
  box-shadow: 0 1px 2px rgba(196,122,0,.30), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-amber:hover { background: linear-gradient(180deg, #f8ca63, var(--amber-400)); }
.btn-danger:hover { border-color: rgba(214,69,69,.35); }

/* Karty a KPI — mäkšie, vrstvené tiene */
.card { box-shadow: var(--shadow-sm); transition: box-shadow .2s var(--ease); }
.kpi  { box-shadow: var(--shadow-sm); transition: box-shadow .2s var(--ease); }
.kpi:hover { box-shadow: var(--shadow-md); }
.kpi .value { font-variant-numeric: tabular-nums; }

/* Formuláre — plynulé prechody, jemný hover */
.input, .select, .textarea {
  border-radius: 7px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.input:hover:not(:focus), .select:hover:not(:focus), .textarea:hover:not(:focus) {
  border-color: var(--navy-400);
}
.toggle { transition: background .18s var(--ease); }
.toggle::after { transition: left .18s var(--ease); }

/* Tabuľky — hladší hover, čitateľné čísla */
table.tbl td { transition: background .12s var(--ease); font-variant-numeric: tabular-nums; }
table.tbl th { backdrop-filter: saturate(1.1); }

/* Chipy — jemná definícia okraja */
.chip { border-color: rgba(2,57,111,.06); box-shadow: inset 0 0 0 .5px rgba(255,255,255,.5); }

/* Nadpisy stránok — pevnejšia typografia */
.page-head h1 { letter-spacing: -0.015em; }

/* Prístupnosť: rešpektuj zníženie pohybu */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   Popupy — jednotný moderný vzhľad
   ───────────────────────────────────────────────────────────────────────
   Platí pre KAŽDÝ dialóg v ERP: <Modal> (admin.jsx) aj dd-dialógy
   (ddConfirm / ddPrompt / ddAlert v shared.jsx, náhrada natívnych okien
   prehliadača). Preto sú pravidlá tu a nie v jednotlivých moduloch —
   pridaním ďalšieho popupu sa štýl zdedí sám.
   ═══════════════════════════════════════════════════════════════════════ */

.modal-backdrop {
  background: rgba(4, 22, 43, 0.48);
  -webkit-backdrop-filter: blur(6px) saturate(115%);
  backdrop-filter: blur(6px) saturate(115%);
  animation: dd-fade 0.18s var(--ease);
}

.modal {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    0 32px 64px -24px rgba(1, 32, 63, 0.45),
    0 12px 28px -12px rgba(2, 57, 111, 0.24),
    0 0 0 1px rgba(2, 57, 111, 0.06);
  overflow: hidden;                 /* aby hlavička/pätka rešpektovali rádius */
  animation: dd-modal-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Tenký brandový prúžok po hornej hrane — jediný farebný akcent hlavičky. */
.modal-head {
  position: relative;
  padding: 15px 16px 13px 18px;
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--navy-800), var(--navy-500) 55%, var(--amber-500));
}
.modal-head h3 {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}
.modal-head .modal-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-500);
  font-weight: 500;
}
/* Zatváracie X — kruhové, nenápadné, ale s poctivým hit targetom. */
.modal-head > .btn.btn-ghost {
  width: 28px; height: 28px; padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--ink-400);
  box-shadow: none;
}
.modal-head > .btn.btn-ghost:hover { background: rgba(2, 57, 111, 0.07); color: var(--ink-900); }

.modal-body {
  padding: 18px;
  overscroll-behavior: contain;     /* scroll v modáli neposúva stránku pod ním */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.modal-body::-webkit-scrollbar { width: 10px; }
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 3px solid #fff;
}
.modal-body::-webkit-scrollbar-track { background: transparent; }

.modal-foot {
  padding: 12px 16px;
  background: linear-gradient(180deg, #fbfcfe, #f4f7fb);
  border-top: 1px solid var(--border);
  align-items: center;
  flex-shrink: 0;
}

@keyframes dd-modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Popup bez štandardnej hlavičky/tela (registrácia, onboarding Touch ID) —
   obsah scrolluje priamo v okne, lebo nemá vlastný .modal-body.
   overflow-y prebíja `overflow: hidden` len na zvislej osi, takže rohy
   ostávajú orezané a vodorovný pretok sa nemôže objaviť. */
.modal.modal-plain { overflow-y: auto; }

/* ── Modal s pevnou výškou ──────────────────────────────────────────────
   Karty s taby (napr. servisný prípad) dostávajú height cez prop, aby sa
   okno pri prepínaní tabov neroztiahlo a nezmenšilo. Telo potom scrolluje
   vnútri a hlavička s pätkou ostávajú na mieste. */
.modal.modal-fixed .modal-body { flex: 1 1 auto; min-height: 0; }

/* ── dd-dialógy (confirm / prompt / alert) ───────────────────────────── */
.dd-dlg-backdrop { z-index: 1100; }   /* nad bežným Modalom — vie sa z neho otvoriť */
.dd-dlg { position: relative; max-width: calc(100vw - 32px); }
/* Rovnaký brandový prúžok ako má hlavička <Modal> — malé dialógy hlavičku
   nemajú, ale majú vyzerať ako z tej istej rodiny. */
.dd-dlg::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--navy-800), var(--navy-500) 55%, var(--amber-500));
}
.dd-dlg-body { display: flex; gap: 14px; padding: 22px 22px 18px; }
.dd-dlg-ico {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.dd-dlg-text { flex: 1; min-width: 0; }
.dd-dlg-text h3 {
  margin: 1px 0 6px;
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--ink-900);
}
.dd-dlg-text p {
  margin: 2px 0 0;
  font-size: 13px; line-height: 1.5;
  color: var(--ink-700);
  white-space: pre-line;            /* hlášky s \n si držia zalomenie */
  overflow-wrap: anywhere;
}
.dd-dlg-text .input { width: 100%; margin-top: 12px; }
.dd-dlg-invalid { border-color: var(--red-500) !important; box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.14) !important; }
.dd-dlg-err  { margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--red-500); }
.dd-dlg-hint { margin-top: 10px; font-size: 11.5px; line-height: 1.5; color: var(--ink-500); }
.dd-dlg .modal-foot { justify-content: flex-end; }

/* Deštruktívne potvrdenie — plná červená, aby sa nedalo prehliadnuť. */
.btn-danger-solid {
  background: linear-gradient(180deg, #e05656, var(--red-500));
  border-color: #c33a3a;
  color: #fff;
  box-shadow: 0 1px 2px rgba(214, 69, 69, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-danger-solid:hover {
  background: linear-gradient(180deg, #e96b6b, #cf4040);
  box-shadow: 0 2px 8px rgba(214, 69, 69, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

@media (max-width: 720px) {
  .dd-dlg { width: calc(100vw - 24px) !important; }
  .dd-dlg-body { padding: 18px 16px 14px; gap: 12px; }
  .dd-dlg .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
}
