/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #f1f0ea;
  --border: rgba(0,0,0,0.1);
  --border-md: rgba(0,0,0,0.18);
  --text: #1a1a18;
  --text-2: #6b6b67;
  --text-3: #a8a8a3;
  --purple-50: #EEEDFE;
  --purple-200: #AFA9EC;
  --purple-400: #7F77DD;
  --purple-600: #534AB7;
  --purple-800: #3C3489;
  --teal-50: #E1F5EE;
  --teal-400: #1D9E75;
  --teal-600: #0F6E56;
  --teal-800: #085041;
  --amber-50: #FAEEDA;
  --amber-200: #EF9F27;
  --amber-600: #854F0B;
  --amber-800: #633806;
  --coral-50: #FAECE7;
  --coral-200: #F0997B;
  --coral-600: #993C1D;
  --coral-800: #712B13;
  --radius: 8px;
  --radius-lg: 12px;
}

:root[data-theme="dark"] {
  --bg: #101115;
  --surface: #181a20;
  --surface-2: #22252d;
  --border: rgba(255,255,255,0.1);
  --border-md: rgba(255,255,255,0.18);
  --text: #f1f3f6;
  --text-2: #b5bac5;
  --text-3: #808895;
  --purple-50: #25213f;
  --purple-200: #7066c5;
  --purple-400: #8d83e7;
  --purple-600: #a69df4;
  --purple-800: #dcd8ff;
  --teal-50: #142b25;
  --teal-400: #3ad0a3;
  --teal-600: #65d9b8;
  --teal-800: #b8f4df;
  --amber-50: #332713;
  --amber-200: #d8a85e;
  --amber-600: #f3c875;
  --amber-800: #ffe2a1;
  --coral-50: #351d19;
  --coral-200: #e28a76;
  --coral-600: #ffad99;
  --coral-800: #ffd0c5;
}

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }

/* ===== AUTH ===== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(245, 245, 243, 0.96);
}
.auth-overlay.hidden { display: none; }
.auth-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.12);
}
.aotpp-logo {
  display: grid;
  place-items: center;
  background: transparent;
  border-radius: 6px;
  overflow: visible;
}
.aotpp-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}
.aotpp-logo-auth {
  width: min(340px, 100%);
  height: auto;
  aspect-ratio: 960 / 285;
  margin: 0 auto 18px;
}
.auth-btn { width: 100%; justify-content: center; padding: 11px 16px; margin-top: 8px; }
.admin-login-version {
  margin-left: 4px;
  color: #c62828;
  font-size: 10px;
  font-weight: 800;
}
.employee-login-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  gap: 8px;
  margin: 8px 0 4px;
  text-align: left;
}
.employee-login-row.hidden { display: none; }
.employee-login-row label {
  grid-column: auto;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.employee-login-row input {
  width: 100%;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}
.employee-login-row input:focus {
  border-color: var(--purple-600);
  box-shadow: 0 0 0 3px rgba(91, 76, 196, 0.12);
}
.employee-login-row .auth-btn {
  width: 100%;
  margin-top: 0;
  white-space: nowrap;
}
.auth-error {
  margin-top: 14px;
  color: #c0392b;
  font-size: 13px;
}

.admin-access-overlay {
  position: fixed;
  z-index: 450;
  top: 52px;
  right: 0;
  bottom: 0;
  left: 160px;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(245, 245, 243, 0.14);
  -webkit-backdrop-filter: blur(6px) saturate(82%);
  backdrop-filter: blur(6px) saturate(82%);
}
.admin-access-overlay.hidden { display: none; }
.admin-access-message {
  max-width: 620px;
  padding: 18px 30px;
  border: 1px solid rgba(91, 76, 196, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #29263a;
  box-shadow: 0 18px 55px rgba(23, 20, 45, 0.18);
  font-size: 17px;
  font-weight: 750;
  text-align: center;
}
:root[data-theme="dark"] .admin-access-overlay {
  background: rgba(16, 18, 24, 0.16);
}
:root[data-theme="dark"] .admin-access-message {
  background: rgba(31, 34, 43, 0.95);
  color: #f4f4f6;
}

/* ===== HEADER ===== */
.header {
  height: 52px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.logo-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.logo > span { display: none; }
.aotpp-logo-header {
  width: 130px;
  height: auto;
  aspect-ratio: 960 / 285;
  flex: 0 0 auto;
  border-radius: 0;
  box-shadow: none;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}
.theme-pill {
  width: 38px;
  height: 26px;
  border-radius: 999px;
  border: 0.5px solid var(--border-md);
  background: var(--surface-2);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-pill .ti { font-size: 16px; }
.theme-pill.active {
  background: var(--purple-50);
  color: var(--purple-800);
  border-color: var(--purple-200);
}
:root[data-theme="dark"] .theme-pill.active {
  background: #2c2f39;
  color: #f7d979;
  border-color: rgba(247,217,121,0.34);
}
:root[data-theme="dark"] .theme-pill#theme-light.active {
  color: #f7d979;
}
:root[data-theme="dark"] .theme-pill#theme-dark.active {
  color: #c6d4ff;
}

.hchip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
}
.hchip .ti { font-size: 13px; }
.firebase-chip.firebase-live { background: var(--teal-50); color: var(--teal-800); border-color: rgba(15,110,86,0.24); }
.version-chip {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.date-chip {
  background: var(--surface-2);
  color: var(--text);
}
:root[data-theme="dark"] .version-chip {
  background: #3a1717;
  color: #fecaca;
  border-color: #7f1d1d;
}

.hright { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.pulse-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--teal-600); }
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal-400);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.avatar-stack { display: flex; }
.av {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  border: 2px solid var(--surface);
  margin-left: -6px;
  cursor: default;
}
.av:first-child { margin-left: 0; }
.av-purple { background: var(--purple-50); color: var(--purple-800); }
.av-teal   { background: var(--teal-50);   color: var(--teal-800); }
.av-coral  { background: var(--coral-50);  color: var(--coral-800); }

/* ===== LAYOUT ===== */
.body-wrap { display: flex; height: calc(100vh - 52px); overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 160px; flex-shrink: 0;
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  display: flex; flex-direction: column;
  align-items: stretch;
  padding: 10px 8px;
  gap: 4px;
}

.ni {
  width: 100%; min-height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: flex-start;
  gap: 8px;
  padding: 0 9px;
  font-size: 18px;
  color: #2b2b2b;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.ni .ti {
  flex: 0 0 18px;
  text-align: center;
  color: #7c8aa6;
}
.ni span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
  white-space: nowrap;
}
.ni:hover { background: var(--surface-2); color: var(--text); }
.ni:hover span { color: var(--text); }
.ni.active { background: var(--purple-50); color: var(--text); }
.ni.active span { color: var(--text); }
.ni[title="Zamestnanci"] .ti { color: #7aa7d9; }
.ni[title="Agenda"] .ti { color: #8fbf9f; }
.ni[title="DMS kontrola chýb"] .ti { color: #d39b73; }
.ni[title="DMS kontrola chýb"] span { font-size: 11px; }
.ni[title="Losovanie"] .ti { color: #a99bd8; }
.ni[title="DMS oprava"] .ti { color: #d2ad72; }
.ni[title="Úlohy na dnes"] .ti { color: #d78383; }
.ni[title="Ulohy"] .ti { color: #88b9aa; }
.ni[title="Ďalšie zoznamy"] .ti { color: #88b9aa; }
.ni[title="Ďalšie zoznamy"] span { font-size: 11px; }
.ni[title="Vykazy"] .ti { color: #90a8d0; }
.ni[title="Dokumenty"] .ti { color: #9ab59b; }
.ni[title="Nastavenia"] .ti { color: #9b9b9b; }
.ni[title="Kalendár"] .ti { color: #70b8b1; }
.ni[title="Logs"] .ti { color: #b48ab6; }
.ni[title="Logout"] .ti { color: #c08c8c; }

.nav-sep { height: 0.5px; background: var(--border); margin: 4px 8px; }
.nav-bottom { margin-top: auto; }
.logout-hint {
  margin: 4px 2px 2px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: #fff1f2;
  border: 0.5px solid #fecdd3;
  color: #9f1239;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  box-shadow: 0 10px 22px rgba(159,18,57,0.12);
}
.logout-hint.hidden { display: none; }
:root[data-theme="dark"] .logout-hint {
  background: #3b1620;
  border-color: #7f1d1d;
  color: #fecdd3;
}

.dms-copy {
  display: none;
}
.dms-toolbar {
  justify-content: flex-end;
}

/* ===== MAIN CONTENT ===== */
.content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

.page-top {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px 0;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title { font-size: 18px; font-weight: 600; color: var(--text); }
.page-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex; align-items: center;
  gap: 8px;
  margin: 12px 22px 0;
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  padding: 0 12px;
}
.search-bar.hidden { display: none; }
.search-icon { color: var(--text-3); font-size: 16px; }
.search-bar input {
  flex: 1; border: none; outline: none;
  background: transparent; font-size: 14px;
  color: var(--text); padding: 9px 0;
}
.search-bar input::placeholder { color: var(--text-3); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  color: var(--text);
  transition: background 0.1s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn .ti { font-size: 15px; }

.btn-primary { background: var(--purple-600); color: #fff; border-color: var(--purple-600); }
.btn-primary:hover { background: var(--purple-800); }

.btn-danger { background: transparent; color: #c0392b; border-color: #c0392b; }
.btn-danger:hover { background: #fdf0f0; }

/* ===== STAT CARDS ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px 22px;
}
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.card-label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; }
.card-value { font-size: 26px; font-weight: 600; color: var(--text); margin-top: 2px; }
.card-mini { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.card-value.green  { color: var(--teal-600); }
.card-value.amber  { color: var(--amber-600); }
.card-value.purple { color: var(--purple-600); }

.cdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.cdot-green  { background: var(--teal-400); }
.cdot-amber  { background: var(--amber-200); }
.cdot-purple { background: var(--purple-400); }

/* ===== WHO BAR ===== */
.who-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 22px 10px;
  flex-wrap: wrap;
}
.who-label { font-size: 12px; color: var(--text-3); }
.who-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 5px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 99px;
  font-size: 12px; color: var(--text-2);
}
.who-av {
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600;
}

/* ===== TABLE ===== */
.table-wrap { padding: 0 22px 24px; overflow-x: auto; overflow-y: visible; flex: 1; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  table-layout: auto;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 0.5px solid var(--border);
  box-shadow: 0 1px 0 var(--border);
  white-space: nowrap;
}
.col-num { width: 50px; text-align: center; }
.col-name { min-width: 160px; }
.col-actions { width: 44px; }

tbody tr { border-bottom: 0.5px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

tbody td { padding: 9px 12px; vertical-align: middle; color: var(--text); }
td.col-num { text-align: center; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }

/* live editing states */
tr.editing-row { background: var(--amber-50) !important; }
tr.editing-row:hover { background: #fde8c8 !important; }
td.editing-cell {
  outline: 2px solid var(--amber-200);
  border-radius: 4px;
  padding: 3px 8px !important;
  background: #fdeac5;
  color: var(--amber-800);
  font-weight: 500;
}

tr.sync-row { background: var(--purple-50) !important; }
tr.sync-row:hover { background: #e6e4fd !important; }
td.sync-cell {
  outline: 2px solid var(--purple-200);
  border-radius: 4px;
  padding: 3px 8px !important;
  background: var(--purple-50);
  color: var(--purple-800);
  font-weight: 500;
}
td.sync-cell .ti { font-size: 12px; margin-right: 3px; }
td.editing-cell .ti { font-size: 12px; margin-right: 3px; }
td.note-cell { color: var(--text-3); font-size: 12px; }

/* ===== AGENDA ===== */
.agenda-view {
  padding: 0 22px 24px;
  flex: 1;
}
.agenda-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.agenda-search {
  flex: 1;
  margin: 0;
}
.agenda-count {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}
.agenda-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 10px;
}
.agenda-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.agenda-card-aotp {
  background: var(--surface);
}
.agenda-card-svidnik {
  background: #f3f4f6;
}
.agenda-card-giraltovce {
  background: #f8f2ea;
}
.agenda-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.agenda-name {
  font-size: 15px;
  font-weight: 700;
}
.agenda-dept {
  font-size: 11px;
  color: var(--purple-800);
  background: var(--purple-50);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
.agenda-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.agenda-pill {
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 8px;
}
.agenda-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}
.agenda-mail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  color: var(--teal-600);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.agenda-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-2);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ===== LOGS ===== */
.logs-view {
  padding: 0 22px 24px;
  flex: 1;
}

.settings-view {
  padding: 0 22px 24px;
  flex: 1;
}
.settings-card {
  width: min(720px, 100%);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.settings-card h2 {
  font-size: 18px;
  margin-bottom: 16px;
}
.logs-summary {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 12px;
}
.logs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}
.log-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.log-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.log-device {
  font-size: 15px;
  font-weight: 700;
}
.log-user {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.log-status {
  align-self: flex-start;
  color: var(--teal-800);
  background: var(--teal-50);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}
.log-table {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}
.log-table div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-2);
}
.log-table strong {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}
.log-agent {
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}
.log-history {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.log-history h3 {
  margin: 0 0 10px;
  font-size: 14px;
}
.log-history-row {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 0.5px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}
.log-history-row strong {
  color: var(--text);
}

/* ===== WELCOME ===== */
.welcome-view {
  flex: 1;
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 24px;
}
.welcome-logo {
  width: min(520px, 78vw);
  aspect-ratio: 960 / 285;
  animation: welcomeSpin 4.5s linear infinite;
  transform-style: preserve-3d;
  will-change: transform;
}
.welcome-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.welcome-text {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
}
@keyframes welcomeSpin {
  0% { transform: perspective(900px) rotateY(0deg); }
  100% { transform: perspective(900px) rotateY(360deg); }
}

/* ===== CALENDAR ===== */
.calendar-chip {
  cursor: pointer;
  font: inherit;
}
.calendar-panel {
  position: fixed;
  top: 62px;
  right: 18px;
  width: min(430px, calc(100vw - 28px));
  z-index: 180;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,0.16);
  padding: 14px;
}
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.calendar-weekday {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  padding: 4px 0;
}
.calendar-day {
  position: relative;
  min-height: 54px;
  border: 0.5px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 5px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
.calendar-day:hover,
.calendar-day.active {
  border-color: var(--purple-400);
  background: var(--purple-50);
}
.calendar-day.has-note {
  box-shadow: none;
}
.calendar-day strong {
  display: block;
  font-size: 12px;
}
.calendar-dot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 9px;
  max-height: 26px;
  overflow: hidden;
}
.calendar-entry-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
}
.calendar-entry-dot.normal { background: #16a34a; }
.calendar-entry-dot.urgent { background: #dc2626; }
.calendar-entry-modal {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 70px 452px 16px 18px;
  background: transparent;
  pointer-events: none;
}
.calendar-entry-modal.hidden { display: none; }
.calendar-entry-card {
  width: calc(100vw - 922px);
  min-width: 360px;
  max-width: 620px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 90px rgba(0,0,0,0.22);
  padding: 12px;
  display: grid;
  gap: 8px;
  pointer-events: auto;
}
.calendar-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.calendar-entry-head strong {
  color: var(--text);
  font-size: 15px;
}
.calendar-entry-lines {
  display: grid;
  gap: 5px;
}
.calendar-entry-line {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 0.5px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  background: #f8fbff;
}
.calendar-entry-line:nth-child(2) { background: #f8fff9; }
.calendar-entry-line:nth-child(3) { background: #fffaf3; }
.calendar-entry-line:nth-child(4) { background: #fbf8ff; }
.calendar-entry-line:nth-child(5) { background: #f8ffff; }
.calendar-entry-line:nth-child(6) { background: #fbfcf4; }
.calendar-entry-line:nth-child(7) { background: #f7fbff; }
.calendar-entry-line:nth-child(8) { background: #fff8fb; }
.calendar-entry-line:nth-child(9) { background: #f8fff9; }
.calendar-line-number {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 800;
}
.calendar-entry-line input[type="text"],
.calendar-entry-line textarea {
  width: 100%;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  padding: 5px 8px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
}
.calendar-entry-line-more {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  min-height: 92px;
}
.calendar-entry-line-more textarea {
  min-height: 84px;
  resize: vertical;
}
.calendar-urgent-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.calendar-urgent-inline input {
  width: 14px;
  height: 14px;
  accent-color: #dc2626;
}
.calendar-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-tasks-view {
  padding: 0 452px 24px 22px;
}
.today-tasks-head {
  display: none;
  margin-bottom: 0;
}
.today-tasks-head h2 {
  margin: 0;
  font-size: 20px;
}
.today-tasks-head p {
  margin: 4px 0 0;
  color: var(--text-2);
}
.today-tasks-list {
  display: grid;
  gap: 8px;
}

/* ===== DALSIE ZOZNAMY ===== */
.additional-lists-view {
  padding: 8px 22px 28px;
  min-width: 0;
}
.additional-list-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}
.additional-list-picker.admin { grid-template-columns: repeat(3, minmax(210px, 1fr)); }
.additional-list-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(20, 24, 36, 0.06);
}
.additional-list-folder {
  width: 100%;
  min-height: 100px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  box-shadow: none;
}
.additional-list-folder:hover { background: var(--surface-2); border-color: var(--purple-600); }
.additional-list-folder .ti { font-size: 28px; color: #7c8fd0; }
.additional-list-folder span { font-size: 14px; font-weight: 750; }
.additional-list-folder small { color: var(--text-3); font-size: 11px; }
.additional-list-card-settings {
  display: grid;
  gap: 7px;
  padding: 9px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.additional-list-card-settings input[type="text"] {
  width: 100%; min-width: 0; height: 32px; padding: 5px 7px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text);
}
.additional-list-card-settings label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.additional-list-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.additional-list-toolbar strong { font-size: 16px; }
.additional-list-status { margin-left: auto; color: #15803d; font-size: 12px; font-weight: 700; }
.additional-list-status.error { color: #b42318; }
.additional-list-main-settings {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px auto auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
}
.additional-list-main-settings label { display: grid; gap: 4px; color: var(--text-2); font-size: 11px; font-weight: 700; }
.additional-list-main-settings input[type="text"],
.additional-list-main-settings input[type="number"] {
  width: 100%; height: 34px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text);
}
.additional-list-main-settings .additional-visible-toggle { display: flex; align-items: center; gap: 7px; min-height: 34px; white-space: nowrap; }
.additional-list-main-settings .btn { min-height: 34px; align-self: end; }
.additional-column-settings {
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
}
.additional-settings-title { font-size: 12px; font-weight: 750; white-space: nowrap; }
.additional-column-name-grid { display: grid; grid-template-columns: repeat(4, minmax(190px, 1fr)); gap: 8px; margin-top: 8px; }
.additional-column-config {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}
.additional-column-config > label { display: grid; gap: 3px; color: var(--text-3); font-size: 10px; font-weight: 700; }
.additional-column-config .additional-column-show {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 11px;
}
.additional-column-name-grid input[type="text"],
.additional-column-name-grid input[type="number"] {
  width: 100%; min-width: 0; height: 34px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text);
}
.additional-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 175px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.additional-table { table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.additional-table th,
.additional-table td { height: 42px; padding: 0 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: left; }
.additional-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-size: 12px; }
.additional-table tbody th { min-width: 0; background: var(--surface); font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.additional-workplace { color: var(--text-2); font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.additional-cell { width: 100%; min-width: 0; height: 32px; padding: 5px 7px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--text); }
.additional-cell:hover:not([readonly]), .additional-cell:focus { border-color: var(--purple-600); background: var(--surface); outline: none; }
.additional-cell[readonly] { color: var(--text-2); cursor: default; }
.today-task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.today-task.urgent {
  border-color: rgba(220, 38, 38, 0.35);
}
.today-task.normal {
  border-color: rgba(22, 163, 74, 0.28);
}

.lottery-view {
  padding: 0 22px 24px;
  flex: 1;
  min-height: 0;
}
.lottery-frame {
  width: 100%;
  height: calc(100vh - 132px);
  min-height: 680px;
  border: 0;
  border-radius: var(--radius-lg);
  background: #1e1b4b;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 0.5px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}
.sort-control select {
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

/* ===== DMS CHYBOVOST ===== */
.dms-view {
  padding: 0 22px 24px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dms-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.dms-toolbar h2 {
  font-size: 17px;
  margin: 0;
}
.dms-toolbar p {
  color: var(--text-2);
  margin: 2px 0 0;
  font-size: 12px;
}
.dms-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dms-uploadbar {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}
.dms-uploadbar .btn {
  min-width: 120px;
  justify-content: center;
}
.dms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
.dms-folder-card,
.dms-file-card {
  min-height: 96px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  padding: 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 34px 1fr;
  column-gap: 10px;
  align-items: start;
}
.dms-folder-card:hover,
.dms-file-card:hover {
  background: var(--surface-2);
}
.dms-folder-card .ti,
.dms-file-card .ti {
  grid-row: span 2;
  color: var(--purple-600);
  font-size: 26px;
  margin-top: 2px;
}
.dms-folder-card span,
.dms-file-card span {
  font-weight: 700;
  word-break: break-word;
}
.dms-folder-card strong,
.dms-file-card strong {
  color: var(--text-2);
  font-size: 12px;
  margin-top: 6px;
}
.dms-editor {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.dms-sheet-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  overflow-x: auto;
  background: var(--surface-2);
  border-bottom: 0.5px solid var(--border);
}
.dms-sheet-tab {
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.dms-sheet-tab.active {
  color: #fff;
  background: var(--purple-600);
  border-color: var(--purple-600);
}
.dms-table-wrap {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 222px);
  max-height: none;
  overflow: auto;
  background: #f8fafc;
  scrollbar-gutter: stable both-edges;
}
.dms-table {
  border-collapse: collapse;
  table-layout: auto;
  width: max-content;
  min-width: auto;
  background: #fff;
  color: #111827;
  font-size: 12px;
}
.dms-table th,
.dms-table td {
  border: 1px solid #d1d5db;
  padding: 5px 7px;
  min-width: 92px;
  max-width: 420px;
  white-space: pre-wrap;
  word-break: break-word;
  vertical-align: top;
}
.dms-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #e5e7eb;
  color: #111827;
  text-align: center;
}
.dms-corner,
.dms-row-head {
  position: sticky;
  left: 0;
  z-index: 6;
  min-width: 46px !important;
  width: 46px;
  background: #e5e7eb !important;
  color: #374151;
  text-align: right;
}
.dms-corner {
  z-index: 8;
}
.dms-table td:focus {
  outline: 2px solid var(--purple-400);
  outline-offset: -2px;
  background: #fff;
}
.dms-edited-cell {
  color: #dc2626;
  font-weight: 800;
  background: #fff7ed !important;
}
.dms-saving-cell {
  background: #fef3c7 !important;
}
.dms-live-cell {
  box-shadow: inset 0 0 0 2px #22c55e;
}

/* ===== DMS kontrola chyb ===== */
.isszbj-view {
  padding: 0 22px 24px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.isszbj-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-2);
  font-size: 12px;
}
.isszbj-frame-wrap {
  flex: 1;
  min-height: calc(100vh - 150px);
  overflow: hidden;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.isszbj-frame {
  width: 100%;
  height: calc(100vh - 150px);
  display: block;
  border: 0;
  background: var(--surface);
}

/* name cell */
.name-cell { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-green  { background: var(--teal-400); }
.dot-amber  { background: var(--amber-200); }
.dot-purple { background: var(--purple-400); }

/* secondary text in table */
td.muted { color: var(--text-2); }

/* status badges */
.sb {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.sb-a { background: var(--teal-50);   color: var(--teal-800); }
.sb-d { background: var(--amber-50);  color: var(--amber-800); }
.sb-n { background: var(--purple-50); color: var(--purple-800); }

/* action buttons */
.act-btns { display: flex; gap: 4px; justify-content: flex-end; }
.act-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: background 0.1s, color 0.1s;
}
.act-btn:hover { background: var(--surface-2); color: var(--text); }
.act-btn.danger:hover { background: #fdf0f0; color: #c0392b; }

/* ===== PAGINATION ===== */
.pagination {
  display: none; align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 0 2px;
}
.page-info { font-size: 12px; color: var(--text-3); }
.page-btns { display: flex; gap: 4px; }
.page-btn { padding: 5px 11px; font-size: 12px; }
.active-page { background: var(--surface-2) !important; font-weight: 600; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 0.5px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px; border-radius: 6px;
  border: none; background: transparent;
  cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.modal-close:hover { background: var(--surface-2); }

.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.form-group input,
.form-group select {
  padding: 8px 10px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.1s;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--purple-400); }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px 18px;
  border-top: 0.5px solid var(--border);
}

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 300;
  transition: opacity 0.3s;
}
.toast.hidden { display: none; }

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== SEED PAGE ===== */
.seed-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.seed-panel {
  width: min(680px, 100%);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.seed-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.seed-log {
  min-height: 180px;
  white-space: pre-wrap;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--text-2);
  font-size: 12px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .hchip { display: none; }
}
@media (max-width: 760px) {
  html, body {
    height: auto;
    min-height: 100%;
  }
  .auth-overlay {
    align-items: start;
    padding: 18px;
    overflow-y: auto;
  }
  .auth-panel {
    width: 100%;
    padding: 18px;
  }
  .aotpp-logo-auth {
    width: min(260px, 100%);
    margin-bottom: 12px;
  }
  .employee-login-row {
    grid-template-columns: 1fr;
  }
  .employee-login-row .auth-btn {
    width: 100%;
  }
  .admin-access-overlay {
    top: 56px;
    left: 0;
    padding: 18px;
  }
  .admin-access-message {
    border-radius: 22px;
    padding: 18px 20px;
    font-size: 15px;
  }
  .additional-list-picker, .additional-list-picker.admin { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .additional-list-main-settings, .additional-column-name-grid { grid-template-columns: 1fr; }
  .additional-lists-view { padding: 8px 12px 24px; }
  .header {
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .aotpp-logo-header {
    width: 104px;
  }
  .hright {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 8px;
  }
  .avatar-stack {
    display: none;
  }
  .body-wrap {
    height: auto;
    min-height: calc(100vh - 96px);
    flex-direction: column;
    overflow: visible;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 90;
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    border-right: none;
    border-bottom: 0.5px solid var(--border);
    gap: 6px;
    scrollbar-gutter: stable;
  }
  .ni {
    width: auto;
    min-width: 92px;
    height: 38px;
    flex: 0 0 auto;
    justify-content: center;
    padding: 0 10px;
  }
  .ni span {
    font-size: 11px;
  }
  .nav-sep {
    display: none;
  }
  .nav-bottom {
    margin-top: 0;
  }
  .content {
    overflow: visible;
  }
  .page-top,
  .search-bar,
  .stat-cards,
  .who-bar,
  .agenda-view,
  .logs-view,
  .today-tasks-view,
  .dms-view,
  .isszbj-view,
  .lottery-view,
  .table-wrap {
    padding-left: 12px;
    padding-right: 12px;
  }
  .page-actions {
    width: 100%;
  }
  .page-actions .btn,
  .sort-control {
    flex: 1 1 auto;
  }
  .table-wrap {
    max-height: calc(100vh - 260px);
    overflow: auto;
  }
  table {
    min-width: 760px;
  }
  .calendar-panel {
    top: 84px;
    left: 10px;
    right: 10px;
    width: auto;
  }
  .calendar-entry-modal {
    align-items: start;
    justify-content: center;
    padding: 12px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.24);
    pointer-events: auto;
  }
  .calendar-entry-card {
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: none;
    overflow-y: visible;
    padding: 12px;
  }
  .calendar-entry-line {
    grid-template-columns: 26px minmax(0, 1fr);
  }
  .calendar-urgent-inline {
    grid-column: 2;
    justify-self: end;
  }
  .calendar-editor-actions {
    flex-wrap: wrap;
  }
  .calendar-editor-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .dms-grid {
    grid-template-columns: 1fr;
  }
  .dms-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .dms-table-wrap {
    height: calc(100vh - 260px);
    min-height: 360px;
  }
  .lottery-frame {
    height: calc(100vh - 170px);
    min-height: 620px;
  }
}
@media (max-width: 640px) {
  .page-top { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
}
