/* Servisný portál DataLine — vlastný štýl, bez závislostí */
:root {
  color-scheme: light;
  --blue: #1d4ed8; --blue-dark: #1e40af; --blue-light: #dbeafe; --topbar: #1d4ed8; --login-bg2: #0f2a8a;
  --bg: #f1f5f9; --bg2: #f8fafc; --card: #ffffff; --text: #0f172a; --muted: #64748b;
  --border: #e2e8f0; --grip: #cbd5e1; --danger: #dc2626; --success: #16a34a; --warn: #d97706;
  --green-bg: #dcfce7; --green-fg: #14532d; --red-bg: #fee2e2; --red-fg: #7f1d1d;
  --yellow-bg: #fef9c3; --yellow-fg: #854d0e; --orange-bg: #ffedd5; --orange-fg: #9a3412;
  --orange-soft: #fff7ed; --orange-line: #fdba74; --teal-bg: #ccfbf1; --teal-fg: #115e59;
  --gray-bg: #e2e8f0; --gray-fg: #475569; --red-line: #fecaca;
  --radius: 10px;
  /* nový vzhľad 2026: rámik formulárového poľa je tmavší než rámik karty,
     aby bolo na dotykovom displeji vidno, kam sa dá ťuknúť */
  --field: #cbd5e1; --field-focus: #1d4ed8;
  --green-line: #bbf7d0; --yellow-line: #fde68a; --gray-line: #e2e8f0;
  --danger-soft: #fef2f2;
  --mono: ui-monospace, SFMono-Regular, Menlo, "SF Mono", Consolas, monospace;
}
/* Tmavý režim — prepína sa atribútom data-theme na <html> (light / dark; „system“ vyrieši skript v hlavičke) */
html[data-theme="dark"] {
  color-scheme: dark;
  --blue: #3b82f6; --blue-dark: #93c5fd; --blue-light: rgba(96,165,250,.18); --topbar: #1e3a8a; --login-bg2: #0b1220;
  --bg: #0b1220; --bg2: #172136; --card: #111a2e; --text: #e5e9f0; --muted: #94a3b8;
  --border: #253149; --grip: #3b4a63; --danger: #f87171; --success: #4ade80; --warn: #fbbf24;
  --green-bg: rgba(34,197,94,.18); --green-fg: #86efac; --red-bg: rgba(239,68,68,.2); --red-fg: #fca5a5;
  --yellow-bg: rgba(234,179,8,.2); --yellow-fg: #fde047; --orange-bg: rgba(249,115,22,.2); --orange-fg: #fdba74;
  --orange-soft: rgba(249,115,22,.12); --orange-line: #c2410c; --teal-bg: rgba(20,184,166,.2); --teal-fg: #5eead4;
  --gray-bg: rgba(148,163,184,.2); --gray-fg: #cbd5e1; --red-line: #7f1d1d;
  --field: #3b4a63; --field-focus: #60a5fa;
  --green-line: rgba(74,222,128,.35); --yellow-line: rgba(250,204,21,.35); --gray-line: #253149;
  --danger-soft: rgba(239,68,68,.12);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.ta-r { text-align: right; }

/* Topbar */
.topbar { background: var(--topbar); color: #fff; position: sticky; top: 0; z-index: 50; }
.topbar-inner { display: flex; align-items: center; gap: 12px; max-width: 1280px; margin: 0 auto; padding: 8px 16px; flex-wrap: wrap; }
.brand { color: #fff; display: flex; align-items: center; gap: 8px; font-size: 15px; }
/* Logo: červené D z loga DataLine (public/assets/icons/logo.svg). Skratka SPD sa nikde nezobrazuje. */
.brand-logo { display: block; width: 26px; height: 26px; border-radius: 5px; flex: none; }
.brand-logo.big { width: 64px; height: 64px; border-radius: 12px; margin: 0 auto; }
.brand-name b { font-weight: 700; }
.mainnav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.mainnav a { color: #e0e7ff; padding: 6px 9px; border-radius: 8px; font-size: 13.5px; white-space: nowrap; }
.mainnav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.mainnav a.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.nav-sep { width: 1px; background: rgba(255,255,255,.3); margin: 6px 6px; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
.adminmenu { position: relative; }
.adminmenu summary { list-style: none; cursor: pointer; color: #e0e7ff; padding: 6px 9px; border-radius: 8px; font-size: 13.5px; white-space: nowrap; }
.adminmenu summary::-webkit-details-marker { display: none; }
.adminmenu summary:hover { background: rgba(255,255,255,.12); color: #fff; }
.adminmenu summary.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.adminmenu-panel { position: absolute; left: 0; top: calc(100% + 6px); background: var(--card); border-radius: 10px; box-shadow: 0 10px 30px rgba(2,6,23,.18); padding: 8px; min-width: 200px; display: flex; flex-direction: column; z-index: 60; }
.adminmenu-panel a { color: var(--text); padding: 7px 10px; border-radius: 6px; font-size: 14px; }
.adminmenu-panel a:hover { background: var(--blue-light); }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.bell { position: relative; font-size: 18px; }
.bell .badge { position: absolute; top: -6px; right: -10px; background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 5px; font-weight: 700; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; color: #fff; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.12); font-size: 14px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); color: var(--text); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(2,6,23,.18); padding: 10px; min-width: 180px; display: flex; flex-direction: column; gap: 8px; }
.usermenu-panel a { display: block; padding: 4px 6px; }
.lang-form { display: flex; gap: 6px; }
.lang { border: 1px solid var(--border); background: var(--card); border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 12px; }
.lang.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.linklike { background: none; border: 0; color: var(--danger); cursor: pointer; padding: 4px 6px; text-align: left; font-size: 14px; }

/* Layout */
.container { max-width: 1280px; margin: 20px auto 60px; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 560px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }

/* Flash + callout */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.flash-success { background: var(--green-bg); color: var(--green-fg); }
.flash-error { background: var(--red-bg); color: var(--red-fg); }
.flash-info { background: var(--blue-light); color: var(--blue-dark); }
.callout-action {
  display: block; background: var(--card);
  border: 1px solid var(--warn); border-left: 4px solid var(--warn);
  color: var(--text); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 15px;
}
.callout-action:hover { background: var(--orange-soft); }
.callout-action b { font-size: 17px; font-weight: 600; margin-right: 2px; }

/* Buttons — terč 40 px na počítači, 44–48 px na telefóne (nižšie v mobilnej sekcii) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; border: 1px solid transparent; border-radius: var(--radius);
  padding: 0 16px; font-size: 14.5px; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-align: center;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: var(--card); border-color: var(--field); color: var(--text); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger-outline { background: var(--card); border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: 13px; }
.btn-block { width: 100%; }
/* formulár s jedným tlačidlom vnútri riadku tabuľky */
.inline { display: inline-flex; vertical-align: middle; }
.inline + .inline { margin-left: 6px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* Forms */
label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
label input, label select, label textarea {
  display: block; width: 100%; min-height: 40px; margin-top: 5px; padding: 8px 11px;
  font: inherit; font-weight: 400;
  border: 1px solid var(--field); border-radius: var(--radius); background: var(--card); color: var(--text);
}
label textarea { min-height: 76px; }
label input:focus, label select:focus, label textarea:focus { outline: 2px solid var(--blue-light); border-color: var(--field-focus); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 400; margin-bottom: 0; min-height: 40px; }
label.check input { width: auto; min-height: 0; margin: 0; }
label.check + label.check { border-top: 1px solid var(--border); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 12px; padding: 10px 12px; }
legend { font-size: 13px; font-weight: 700; padding: 0 6px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-label { display: flex; align-items: center; gap: 8px; margin: 0; }
.inline-label select { width: auto; margin: 0; }
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-live-hint { margin: -4px 0 12px; font-size: 13px; }
#searchResults[aria-busy="true"] { opacity: .6; transition: opacity .15s; }
#searchResults:not([hidden]):not(:empty) { margin-bottom: 16px; }
.searchbar input { flex: 1; min-height: 40px; padding: 8px 11px; border: 1px solid var(--field); border-radius: var(--radius); font: inherit; background: var(--card); color: var(--text); }

/* Tables — bez zebry, len linky medzi riadkami; riadok vysoký 44 px */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th { border-bottom-width: 1px; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 8px; padding-bottom: 8px; }
td.ta-r, th.ta-r { font-variant-numeric: tabular-nums; }
/* riadok pod minimom: jemný červený podklad a ľavý pruh */
tr.row-low td { background: var(--danger-soft); }
tr.row-low td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.row-inactive td { opacity: .5; }
.limits-table input.num { width: 64px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.limits-table th, .limits-table td { padding: 6px; }

/* Štítky stavov — tmavé písmo na svetlom podklade + rámik v rovnakom odtieni.
   Nikdy plná farba pod bielym textom: v tabuľke by kričala. */
.tag {
  display: inline-block; background: var(--blue-light); color: var(--blue-dark);
  border: 1px solid var(--border); font-size: 12px; font-weight: 600; line-height: 1.25;
  border-radius: 6px; padding: 3px 8px; white-space: nowrap;
}
.tag-pending { background: var(--yellow-bg); color: var(--yellow-fg); border-color: var(--yellow-line); }
.tag-approved { background: var(--green-bg); color: var(--green-fg); border-color: var(--green-line); }
.tag-rejected { background: var(--red-bg); color: var(--red-fg); border-color: var(--red-line); }
.tag-cancel_requested { background: var(--orange-bg); color: var(--orange-fg); border-color: var(--orange-line); }
.tag-cancelled { background: var(--gray-bg); color: var(--gray-fg); border-color: var(--gray-line); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; flex: none; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }

/* Dlaždice zostatkov — na počítači horný 3 px pruh vo farbe typu, na telefóne ľavý */
.balances { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.balance {
  border: 1px solid var(--border); border-top: 3px solid var(--accent, var(--blue));
  border-radius: var(--radius); padding: 12px;
}
.balance-name {
  font-size: 10.5px; font-weight: 600; line-height: 1;
  letter-spacing: .05em; text-transform: uppercase; color: var(--accent, var(--blue));
}
.balance-big {
  font-size: 38px; font-weight: 600; line-height: 1.05; letter-spacing: -.015em;
  margin-top: 8px; color: var(--text); font-variant-numeric: tabular-nums;
}
.balance-sub { font-size: 12px; line-height: 1.2; color: var(--muted); margin-top: 4px; }
.balance-detail {
  font-size: 11.5px; line-height: 1.4; color: var(--muted);
  margin-top: 8px; border-top: 1px solid var(--border); padding-top: 7px;
}
/* V tmavom režime treba farby typov absencií posvietiť, inak na tmavej karte zhasnú.
   Farba prichádza z databázy ako inline --accent, tak ju len primiešame k bielej. */
@supports (color: color-mix(in srgb, red 50%, white)) {
  html[data-theme="dark"] .balance { border-top-color: color-mix(in srgb, var(--accent, #3b82f6) 72%, #fff); }
  html[data-theme="dark"] .balance-name { color: color-mix(in srgb, var(--accent, #3b82f6) 65%, #fff); }
  @media (max-width: 860px) {
    html[data-theme="dark"] .balance { border-left-color: color-mix(in srgb, var(--accent, #3b82f6) 72%, #fff); }
  }
}

/* ===== Prehľad (variant B: najprv dianie dňa, zostatky ako pás) ===== */
.dash-head { margin: 0 0 14px; }
.dash-hello { font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.dash-date { font-size: 13px; color: var(--muted); margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-side .card, .dash-main .card { margin-bottom: 16px; }
.dash-main > :last-child, .dash-side > :last-child .card { margin-bottom: 0; }

/* hlavička karty: nadpis vľavo, doplnkový údaj vpravo */
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Zostatky ako pás s pruhom čerpania */
.bal-strip { display: flex; flex-direction: column; }
.bal-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px; padding: 11px 0; border-top: 1px solid var(--border);
}
.bal-row:first-child { border-top: 0; padding-top: 2px; }
.bal-row-name { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; min-width: 0; }
.bal-row-num { grid-column: 2; grid-row: 1 / span 2; text-align: right; align-self: center; }
.bal-row-num b { display: block; font-size: 26px; font-weight: 600; line-height: 1.05; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.bal-row-num span { font-size: 11.5px; color: var(--muted); }
.bal-bar { grid-column: 1; height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 3px; }
.bal-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent, var(--blue)); }
.bal-row-detail { grid-column: 1; font-size: 11.5px; line-height: 1.4; color: var(--muted); margin-top: 5px; }
.pill-nolimit {
  font-size: 9.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--gray-fg); background: var(--gray-bg); border-radius: 5px; padding: 3px 5px;
}
.bal-strip + .btn { margin-top: 12px; }

/* Riadky zoznamov na Prehľade */
.list-people li, .list-abs li { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.list-people li { align-items: flex-start; }
.list-people .dot { margin-top: 5px; }
.li-main { flex: 1; min-width: 0; }
.li-title { display: block; font-size: 15px; font-weight: 600; line-height: 1.25; }
.li-sub { display: block; font-size: 12.5px; line-height: 1.35; color: var(--muted); margin-top: 2px; }
.list-abs li { border-left: 3px solid var(--accent, var(--blue)); padding-left: 10px; }
.list-abs .li-title { font-weight: 400; }
.list-abs .tag { flex: none; }
.empty { margin: 2px 0 0; font-size: 14px; }

@supports (color: color-mix(in srgb, red 50%, white)) {
  html[data-theme="dark"] .bal-bar i,
  html[data-theme="dark"] .list-abs li { --accent-lit: color-mix(in srgb, var(--accent, #3b82f6) 72%, #fff); }
  html[data-theme="dark"] .bal-bar i { background: var(--accent-lit); }
  html[data-theme="dark"] .list-abs li { border-left-color: var(--accent-lit); }
}

@media (max-width: 1000px) {
  /* Na užšom počítači a na telefóne ide dianie dňa hore a zostatky pod neho. */
  .dash-grid { grid-template-columns: 1fr; }
  .dash-side { order: 2; }
  .dash-main { order: 1; }
  .dash-main .card:last-child { margin-bottom: 16px; }
}

/* Kalendár */
.month-nav { display: flex; align-items: center; gap: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-cell { min-width: 0; min-height: 84px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--card); }
.cal-empty { background: transparent; border-color: transparent; }
.cal-weekend { background: var(--bg2); }
.cal-holiday { background: var(--red-bg); border-color: var(--red-line); }
.cal-today { outline: 2px solid var(--blue); }
.cal-daynum { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-holiday-name { font-size: 10px; color: var(--red-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event { display: block; min-width: 0; max-width: 100%; font-size: 11px; border-radius: 5px; padding: 1px 5px; margin-top: 3px; background: var(--c, var(--blue)); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.cal-pending { background: repeating-linear-gradient(45deg, var(--c), var(--c) 6px, rgba(255,255,255,.35) 6px, rgba(255,255,255,.35) 10px); }
.cal-event.cal-task { background: #0f766e; }
.cal-legend { margin-top: 10px; font-size: 12px; }
.cal-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.cal-swatch.holiday { background: var(--red-bg); border: 1px solid var(--red-line); }
.cal-swatch.weekend { background: var(--bg2); border: 1px solid var(--border); }

/* Tímový kalendár */
.team-table th, .team-table td { padding: 4px; text-align: center; }
.team-name-col { text-align: left !important; white-space: nowrap; position: sticky; left: 0; background: var(--card); z-index: 2; }
.team-dow { font-size: 10px; color: var(--muted); }
.team-cell { min-width: 26px; height: 30px; }
.team-cell.is-weekend { background: var(--bg2); }
.team-cell.is-holiday { background: var(--red-bg); }
th.is-weekend { color: var(--grip); }
.is-today { outline: 2px solid var(--blue); outline-offset: -2px; }
.team-abs { display: block; width: 100%; height: 18px; border-radius: 4px; background: var(--c, var(--blue)); }
.team-abs.is-pending { background: repeating-linear-gradient(45deg, var(--c), var(--c) 5px, rgba(255,255,255,.45) 5px, rgba(255,255,255,.45) 9px); }

/* Schvaľovanie */
.approval-card .approval-head { margin-bottom: 8px; }
.reject-box { display: inline-block; margin-left: 8px; }
/* Tlačidlo „Zamietnuť“ je <summary>. Nesmie si prebiť display z .btn,
   inak sa text nevycentruje a ostane prilepený hore. */
.reject-box summary { list-style: none; }
.reject-box summary:not(.btn) { display: inline-block; }
.reject-box summary::-webkit-details-marker { display: none; }
.reject-box form { margin-top: 10px; max-width: 420px; }

/* Notifikácie */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { border-bottom: 1px solid var(--border); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list a { display: flex; flex-direction: column; padding: 10px 6px; color: var(--text); }
.notif-list li.unread { background: var(--blue-light); border-radius: 6px; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, var(--topbar) 0%, var(--login-bg2) 100%); padding: 16px; }
.login-card { background: var(--card); border-radius: 14px; padding: 30px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(2,6,23,.35); }
.login-card h1 { font-size: 1.15rem; text-align: center; margin-bottom: 20px; }
.login-brand { text-align: center; margin-bottom: 10px; }
.login-version { text-align: center; font-size: 12px; margin: 16px 0 0; }

/* Rýchle akcie v kalendári */
.cal-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-actions-hint { font-size: 12px; }
.btn-teal { background: #0f766e; color: #fff; }
.btn-teal:hover { background: #115e59; }
.cal-daynum { display: flex; align-items: center; justify-content: space-between; }
.cal-quick { display: none; gap: 3px; }
.cal-cell:hover .cal-quick { display: flex; }
.cal-quick a { font-size: 12px; line-height: 1; text-decoration: none; opacity: .75; }
.cal-quick a:hover { opacity: 1; }

/* Sklad */
.wh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 10px; }
.wh-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 14px; color: var(--text); }
.wh-card:hover { border-color: var(--blue); box-shadow: 0 4px 14px rgba(29, 78, 216, .08); }
.wh-main { border-left: 4px solid var(--blue); }
.wh-vankit { border-left: 4px solid #0f766e; }
.wh-icon { font-size: 26px; line-height: 1; }
.wh-name { font-weight: 700; }
.wh-meta { font-size: 12px; }
/* --- Pásik „Pribudli nové údaje" ---
   Sedí dole nad spodným menu (mobil) alebo dole vpravo (počítač). Nikdy nič
   sám neprekreslí — len ponúkne obnovenie, aby človeku nezmizla rozrobená práca. */
.fresh-bar {
  position: fixed; z-index: 80; display: flex; align-items: center; gap: 10px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--blue); border-left: 4px solid var(--blue);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(2, 6, 23, .18);
  padding: 10px 12px; font-size: 14px;
  right: 16px; bottom: 16px; max-width: calc(100vw - 32px);
}
.fresh-bar[hidden] { display: none; }
.fresh-bar span { flex: 1; min-width: 0; }
.fresh-close { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px; line-height: 1; }
.fresh-close:hover { color: var(--text); }
@media (max-width: 860px) {
  .fresh-bar {
    left: 12px; right: 12px; max-width: none;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }
}

/* Tlacidla vedla seba v obycajnom odseku (napr. Nastavenia -> Logy systemu).
   Ked sa na uzkej obrazovke zalomia pod seba, musi medzi nimi ostat medzera -
   bez tohto sa dotykali. Riesime to na odseku, nie odsadenim na .btn, aby sa
   medzery nezdvojovali tam, kde ich uz riesi flex s gap-om. */
p:has(> .btn) { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Dve tlačidlá v jednej bunke tabuľky — nech sa nelámu pod seba. */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.row-actions .inline { margin: 0; }
.low-qty { color: var(--danger); }
.low-note { color: var(--danger); font-weight: 600; }
.low-stock { border-color: var(--orange-line); }
.card-meta-warn { color: var(--danger); font-weight: 600; }
.page-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.serial { font-family: var(--mono); font-size: 12px; background: var(--bg2); border-radius: 4px; padding: 2px 6px; }
.tag-held { background: var(--teal-bg); color: var(--teal-fg); border-color: var(--teal-bg); }
.tag-instock { background: var(--gray-bg); color: var(--gray-fg); border-color: var(--gray-line); }
.mv-import { background: var(--green-bg); color: var(--green-fg); }
.mv-transfer { background: var(--blue-light); color: var(--blue-dark); }
.mv-consume { background: var(--red-bg); color: var(--red-fg); }
.mv-jig_out { background: var(--orange-bg); color: var(--orange-fg); }
.mv-jig_return { background: var(--teal-bg); color: var(--teal-fg); }
.mv-adjust { background: var(--gray-bg); color: var(--gray-fg); }
.import-errors { margin: 8px 0 0; padding-left: 18px; }
.import-errors li { padding: 2px 0; }
code { background: var(--bg2); border-radius: 4px; padding: 2px 6px; font-family: var(--mono); font-size: 12px; color: var(--blue); }

/* Výjazdy + ICS */
.cal-event.cal-visit { display: block; background: #7c3aed; color: #fff; }
.tag-vplanned { background: var(--blue-light); color: var(--blue-dark); }
.tag-vdone { background: var(--green-bg); color: var(--green-fg); }
.tag-vcancelled { background: var(--gray-bg); color: var(--gray-fg); }
.callout-invite { border-color: var(--orange-line); background: var(--orange-soft); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.callout-invite form { display: flex; gap: 8px; }
.ics-row { display: flex; gap: 8px; margin: 8px 0; }
.ics-row input, .ics-row select { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 12px; color: var(--muted); min-width: 0; }
.ics-regen { margin-top: 4px; }

/* Pätička + verzia */
.appfoot { max-width: 1280px; margin: 0 auto; padding: 0 16px 28px; display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--muted); font-size: 12px; }
.version-pill { background: var(--card); border: 1px solid var(--border); color: var(--blue); border-radius: 999px; padding: 3px 11px; font: inherit; font-weight: 700; cursor: pointer; }
.version-pill:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Modálne okno */
body.modal-open { overflow: hidden; }
.modal-overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal-overlay[hidden] { display: none; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 640px; max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(2, 6, 23, .4); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-close { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 8px 20px 16px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); text-align: right; }

/* Položky histórie zmien */
.rel { padding: 16px 0; border-bottom: 1px solid var(--border); }
.rel:last-child { border-bottom: 0; }
.rel-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rel-ver { font-size: 1.05rem; font-weight: 800; color: var(--blue); }
.rel-date { font-size: 12px; margin-left: auto; }
.rel-title { font-weight: 600; margin: 4px 0 8px; }
.rel-list { list-style: none; margin: 0; padding: 0; }
.rel-list li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; font-size: 14px; }
.chg { flex: none; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 1px 7px; text-transform: uppercase; letter-spacing: .02em; }
.chg-new { background: var(--green-bg); color: var(--green-fg); }
.chg-improved { background: var(--blue-light); color: var(--blue-dark); }
.chg-fixed { background: var(--orange-bg); color: var(--orange-fg); }

/* Nastavenia */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.stat-num { font-size: 26px; font-weight: 800; color: var(--blue); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--muted); }
table.kv th { text-align: left; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; width: 45%; }
table.kv td { font-weight: 600; }

/* Logy */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { padding: 8px 16px; border-radius: 8px 8px 0 0; background: var(--border); color: var(--muted); font-size: 14px; font-weight: 600; }
.tab.on { background: var(--card); color: var(--blue); border: 1px solid var(--border); border-bottom-color: var(--card); }
.log-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.log-filters label { margin: 0; font-size: 12px; }
.log-filters input, .log-filters select { width: auto; min-width: 150px; padding: 7px 9px; }
.log-filter-actions { display: flex; gap: 8px; }
.log-count { font-size: 12px; margin: 12px 0; }
.log-table { font-size: 13px; }
.log-table td { vertical-align: top; }
.nowrap { white-space: nowrap; }
.log-data { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-all; max-width: 320px; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 14px; font-size: 13px; }

/* Mobil */
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .nav-toggle { display: block; order: 3; }
  .topbar-right { order: 2; margin-left: auto; }
  .mainnav { order: 4; display: none; flex-direction: column; width: 100%; padding-bottom: 8px; }
  .mainnav.open { display: flex; }
  .nav-sep { width: auto; height: 1px; margin: 6px 0; }
  .brand-name { display: none; }
  .cal-cell { min-height: 64px; }
  .cal-event { font-size: 10px; }
  .log-filters input, .log-filters select { min-width: 0; width: 100%; }
  .log-filters label { flex: 1 1 140px; }
  .modal { max-height: 92vh; }
  .modal-body { padding: 8px 14px 14px; }
  .log-data { max-width: 160px; }
  .adminmenu-panel { position: static; box-shadow: none; background: rgba(255,255,255,.08); }
  .adminmenu-panel a { color: #e0e7ff; }
  .adminmenu-panel a:hover { background: rgba(255,255,255,.15); }
  .cal-actions-hint { display: none; }
  .cal-actions .btn { flex: 1 1 45%; }

  /* Nový vzhľad 2026 — telefón: väčšie terče, hustejšie karty.
     Polia majú 16 px písmo, inak si ich iPhone pri ťuknutí priblíži. */
  h1 { font-size: 1.3rem; margin-bottom: 12px; }
  h2 { font-size: 13px; }
  .card { padding: 12px; margin-bottom: 10px; }
  .btn { min-height: 44px; font-size: 15px; }
  .btn-sm { min-height: 36px; font-size: 13px; }
  label input, label select, label textarea { min-height: 48px; font-size: 16px; }
  .searchbar input { min-height: 48px; font-size: 16px; }
  .searchbar { flex-wrap: wrap; }
  .searchbar input { flex: 1 1 100%; }
  .searchbar .btn { flex: 1; }
  .balances { grid-template-columns: 1fr 1fr; gap: 8px; }
  .balance { border-top: 1px solid var(--border); border-left: 3px solid var(--accent, var(--blue)); padding: 10px; }
  .balance-big { font-size: 30px; }
  .balance-detail { font-size: 11px; }
  th, td { padding: 10px 8px; }
  label.check { min-height: 46px; }
  label.check input { width: 20px; height: 20px; }
  .form-actions .btn { flex: 1; }

  /* --- Tabuľky ako riadkové karty ---
     Popisky stĺpcov do buniek doplní app.js (data-l). Nič sa neroluje do strán. */
  .table-wrap:has(.as-cards) { overflow-x: visible; }
  table.as-cards, table.as-cards tbody, table.as-cards tr, table.as-cards td { display: block; }
  table.as-cards thead { display: none; }
  table.as-cards tr {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px 12px; margin-bottom: 8px; background: var(--card);
  }
  table.as-cards tr:last-child { margin-bottom: 0; }
  table.as-cards td {
    border: 0; padding: 6px 0; text-align: right;
    display: flex; align-items: baseline; justify-content: flex-end; gap: 6px;
  }
  table.as-cards td + td { border-top: 1px solid var(--border); }
  /* popisok stĺpca vľavo, hodnota vpravo; „margin-right: auto“ ich rozostúpi,
     ale viac častí hodnoty (bodka + názov, číslo + jednotka) ostane pri sebe */
  table.as-cards td::before {
    content: attr(data-l); flex: none; margin-right: auto;
    font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: var(--muted); padding-top: 2px; text-align: left;
  }
  table.as-cards td[data-label]::before { content: attr(data-label); }
  table.as-cards td:not([data-l]):not([data-label])::before { content: none; }
  /* hlavná bunka karty (názov práce) — cez celú šírku, bez popisku */
  table.as-cards td.tc-title { display: block; text-align: left; font-size: 16px; padding: 2px 0 8px; }
  table.as-cards td.tc-title::before { content: none; }
  table.as-cards td.nowrap { white-space: normal; }
  /* bunka bez popisku = stĺpec s akciou: tlačidlo na celú šírku */
  table.as-cards td:not([data-l]):not([data-label]):not(.tc-title) { justify-content: stretch; padding-top: 8px; }
  table.as-cards td:not([data-l]):not([data-label]) > .btn { flex: 1; }
  /* tlačidlo býva zabalené vo vlastnom formulári — musí sa roztiahnuť aj s ním */
  table.as-cards td:not([data-l]):not([data-label]) .inline { flex: 1; }
  table.as-cards td:not([data-l]):not([data-label]) .inline .btn { width: 100%; }
  table.as-cards td:not([data-l]):not([data-label]) .inline + .inline { margin-left: 8px; }
  table.as-cards td:not([data-l]):not([data-label]) .row-actions { flex: 1; }
  .row-actions .btn { flex: 1; }
  table.as-cards td:empty { display: none; }
  table.as-cards td.ta-r { text-align: left; }
  /* podlimitný riadok: pruh je na celej karte, nie na prvej bunke */
  table.as-cards tr.row-low { border-color: var(--red-line); box-shadow: inset 3px 0 0 var(--danger); }
  table.as-cards tr.row-low td { background: transparent; }
  table.as-cards tr.row-low td:first-child { box-shadow: none; }
  table.as-cards tr.row-inactive { opacity: .55; }
  table.as-cards tr.row-inactive td { opacity: 1; }
}

/* ===== Príručka (help) ===== */
.help-layout { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.help-toc { position: sticky; top: 70px; display: flex; flex-direction: column; gap: 2px; padding: 14px; }
.help-toc b { margin-bottom: 8px; font-size: 14px; }
.help-toc a { color: var(--blue); text-decoration: none; font-size: 13.5px; padding: 5px 8px; border-radius: 8px; }
.help-toc a:hover { background: var(--blue-light); }
.help-body { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.help-body section { scroll-margin-top: 70px; }
.help-body h2 { margin-top: 0; }
.help-body h3 { margin: 18px 0 8px; }
.help-fig { margin: 14px 0; text-align: center; }
.help-fig img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 4px 14px rgba(15,23,42,.08); }
.help-fig figcaption { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.help-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 12px 0; }
.help-step { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.help-step svg { width: 84px; height: 84px; margin-bottom: 6px; }
.help-step p { margin: 0; font-size: 13.5px; text-align: left; }
.help-body table { width: 100%; }

@media (max-width: 900px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; }
  .help-steps { grid-template-columns: 1fr 1fr; }
}

/* ===== Spodná lišta menu (mobil) ===== */
.bottomnav { display: none; }
.bnsheet { display: none; }

@media (max-width: 860px) {
  /* Mobil / PWA: stránka roluje normálne, menu je fixne na spodnej hrane.
     Žiadna pevná výška ani vnútorné rolovanie — na iOS to robí problémy. */
  html, body { height: auto; overflow: visible; }
  body {
    /* miesto pre spodné menu vrátane bezpečnej zóny iPhonu */
    padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px));
  }
  /* poistka: žiadny spodný okraj/odsadenie, ktoré by robilo medzeru nad menu */
  main.container { margin: 16px auto 0 !important; padding-bottom: 0 !important; }
  .appfoot { padding: 10px 16px 6px !important; margin: 0 auto !important; }
  .card:last-child { margin-bottom: 0; }

  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--card); border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(15,23,42,.08);
    /* iPhone: nápisy tesne nad systémovou čiarou domov (nie celých 34 px nad ňou) */
    padding-bottom: max(3px, calc(env(safe-area-inset-bottom, 0px) - 18px));
  }
  .bottomnav a, .bottomnav .bn-more {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; padding: 5px 2px 3px; min-height: 48px;
    color: var(--muted); text-decoration: none; font: inherit;
    background: none; border: 0; cursor: pointer; position: relative;
  }
  .bottomnav .bn-i { font-size: 20px; line-height: 1; }
  .bottomnav .bn-t { font-size: 10.5px; font-weight: 600; letter-spacing: -.2px;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottomnav a.on, .bottomnav .bn-more[aria-expanded="true"] { color: var(--blue); }
  .bottomnav a.on::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--blue);
  }
  .bottomnav .bn-dot {
    position: absolute; top: 6px; right: calc(50% - 16px);
    width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  }

  /* vysúvacia ponuka „Viac“ — končí NAD spodnou lištou, nie cez ňu.
     Predtým ju panel (pri 11 položkách u admina) celú prekryl, takže sa
     nedala zavrieť ťuknutím na ⋯ a ľuďom to pripadalo ako zaseknuté menu. */
  .bnsheet { display: block; position: fixed; z-index: 70;
    left: 0; right: 0; top: 0;
    bottom: calc(50px + max(3px, calc(env(safe-area-inset-bottom, 0px) - 18px)));
    background: rgba(15,23,42,.45); }
  .bnsheet[hidden] { display: none; }
  .bnsheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: var(--card); border-radius: 16px 16px 0 0;
    padding: 6px 10px 10px;
    max-height: calc(100% - 56px); overflow-y: auto;
    animation: bnUp .18s ease-out;
  }
  @keyframes bnUp { from { transform: translateY(14px); opacity: .6 } to { transform: none; opacity: 1 } }
  .bnsheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--grip); margin: 8px auto 10px; }
  .bnsheet-panel a, .bnsheet-panel .linklike {
    display: block; width: 100%; text-align: left;
    padding: 13px 12px; border-radius: 10px; font-size: 15px;
    color: var(--text); text-decoration: none; border: 0; background: none; cursor: pointer;
  }
  .bnsheet-panel a:active, .bnsheet-panel a:hover { background: var(--bg2); }
  .bnsheet-panel form { margin: 0; }

  /* na mobile stačí spodná lišta — hamburger netreba */
  .nav-toggle, .mainnav { display: none !important; }
}

/* ===== Sklad: vyhľadávanie, fotky dielov, presuny ===== */
.stock-search { margin: 0 0 16px; }
.stock-search input[type="search"] { flex: 1 1 280px; }
.item-thumb { display: inline-block; vertical-align: middle; margin-right: 8px; }
.item-thumb img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--card); }
.item-photo-preview { display: block; margin: 6px 0 8px; }
.item-photo-preview img { max-width: 220px; max-height: 160px; border-radius: 10px; border: 1px solid var(--border); }
.search-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 8px; }
.search-head .item-photo { flex: 0 0 auto; width: 96px; height: 96px; border-radius: 12px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 34px; background: var(--bg2); overflow: hidden; }
.search-head .item-photo img { width: 100%; height: 100%; object-fit: cover; }
.search-title h2 { margin: 4px 0 4px; }
.search-title { min-width: 0; }
.search-total { margin-top: 4px; }
.search-item h3 { margin: 12px 0 6px; font-size: .95rem; color: var(--muted); }
@media (max-width: 860px) {
  .search-head .item-photo { width: 72px; height: 72px; font-size: 26px; }
}


/* ===== Kalendár: ponuka po ťuknutí na deň ===== */
.cal-quick { display: none !important; }          /* nahradené ponukou po ťuknutí */
.cal-cell { position: relative; }
/* neviditeľné tlačidlo cez celú bunku dňa — skutočný <button>, aby ho spracoval aj iOS Safari */
.cal-tap { position: absolute; inset: 0; width: 100%; height: 100%;
  background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit;
  cursor: pointer; border-radius: 8px; z-index: 0; -webkit-tap-highlight-color: rgba(29,78,216,.12); }
.cal-tap:hover { background: rgba(15,23,42,.04); }
.cal-tap:active { background: rgba(29,78,216,.10); }
.cal-tap:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.cal-daynum, .cal-holiday-name { position: relative; z-index: 1; pointer-events: none; }
.cal-event { position: relative; z-index: 1; }

.daysheet { position: fixed; inset: 0; z-index: 90; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.daysheet[hidden] { display: none; }
.daysheet-panel { background: var(--card); border-radius: 16px; width: 100%; max-width: 380px;
  padding: 8px 14px 14px; box-shadow: 0 24px 70px rgba(2,6,23,.4); animation: bnUp .18s ease-out; }
.daysheet-grip { display: none; }
.daysheet-title { text-align: center; padding: 8px 0 12px; font-weight: 700; font-size: 16px; }
.daysheet-title small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 2px; }
.daysheet-btn { display: block; width: 100%; text-align: left; margin-bottom: 8px;
  padding: 14px 14px; border-radius: 12px; font: inherit; font-size: 15.5px; cursor: pointer;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.daysheet-btn:hover { background: var(--border); }
.daysheet-cancel { background: none; border-color: transparent; color: var(--muted); text-align: center; margin-bottom: 0; }

@media (max-width: 860px) {
  .daysheet { align-items: flex-end; padding: 0; }
  .daysheet-panel { max-width: none; border-radius: 16px 16px 0 0;
    padding: 6px 12px calc(14px + env(safe-area-inset-bottom)); }
  .daysheet-grip { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--grip); margin: 8px auto 4px; }
}

/* --- Push notifikácie (profil, karta používateľa) --------------------------- */
.push-box { margin-top: 10px; }
.push-state { margin: 0 0 10px; font-weight: 600; }
.push-state.ok { color: var(--success); }
.push-state.warn { color: var(--warn); font-weight: 500; line-height: 1.45; }
.notif-prefs { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 6px 0 14px; }
.notif-prefs legend { font-weight: 600; padding: 0 6px; }
.notif-prefs small { display: block; margin-bottom: 8px; }
.notif-prefs .check { margin: 6px 0; }

/* --- Dlhé texty bez medzier (URL, sériové čísla, poznámky) nesmú roztiahnuť stránku.
   POZOR: len na konkrétne prvky — na tabuľkách by „anywhere“ zlomil slová po písmenách. --- */
.wrap-any, .cal-event, .notif-body, .daysheet, .flash { overflow-wrap: anywhere; }
th, td { overflow-wrap: normal; }

/* Zoznam Práca mal od 5.3.3 vlastné karty na mobile (trieda .table-cards, ručné data-label).
   Od 5.9.0 to rieši jedno spoločné pravidlo vyššie (.as-cards) — tieto atribúty rešpektuje,
   takže tu už netreba nič, len ponechať triedu v šablóne kvôli spätnej kompatibilite. */

/* --- Vzhľad (svetlý / tmavý / podľa zariadenia) --- */
.theme-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; font-size: 13px; background: var(--bg2); }
.theme-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-opt.on { border-color: var(--blue); background: var(--blue-light); color: var(--blue-dark); font-weight: 600; }
.theme-ico { font-size: 22px; line-height: 1; }

/* --- Kalendár: prepínač zobrazení + riadkové zobrazenia (týždeň / deň / zoznam) --- */
.cal-views { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-left: auto; }
.cal-view { padding: 6px 12px; font-size: 13px; color: var(--muted); background: var(--card); border-right: 1px solid var(--border); white-space: nowrap; }
.cal-view:last-child { border-right: 0; }
.cal-view.on { background: var(--blue); color: #fff; font-weight: 600; }
.cal-rows { display: flex; flex-direction: column; gap: 6px; }
.cal-row { display: grid; grid-template-columns: 96px 1fr 36px; gap: 10px; align-items: start; border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; background: var(--card); position: relative; }
.cal-row.cal-weekend { background: var(--bg2); }
.cal-row.cal-holiday { background: var(--red-bg); border-color: var(--red-line); }
.cal-row.cal-today { outline: 2px solid var(--blue); }
.cal-row-date { display: flex; flex-direction: column; line-height: 1.2; }
.cal-row-dow { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.cal-row-num { font-size: 20px; font-weight: 800; }
.cal-row .cal-holiday-name { white-space: normal; pointer-events: auto; }
.cal-row-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-top: 2px; }
.cal-row-empty { font-size: 13px; }
.cal-event-row { font-size: 13px; padding: 5px 9px; margin: 0; }
.cal-event-row small { opacity: .85; font-weight: 400; }
.cal-rows-day .cal-row-num { font-size: 28px; }
.cal-rows-day .cal-event-row { font-size: 15px; padding: 9px 12px; }
/* tlačidlo „+“ v riadku — nie je cez celý riadok, len malé tlačidlo vpravo */
.cal-tap.cal-tap-btn { position: static; inset: auto; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--blue); font-size: 20px; font-weight: 700; line-height: 1; z-index: 1; }
.cal-tap.cal-tap-btn:hover { background: var(--blue-light); }
@media (max-width: 860px) {
  .cal-views { margin-left: 0; width: 100%; }
  .cal-view { flex: 1; text-align: center; padding: 8px 4px; }
  .cal-actions .cal-views { flex: 1 1 100%; }
  .cal-row { grid-template-columns: 64px 1fr 34px; padding: 8px; }
  .cal-row-num { font-size: 18px; }
}
.cal-event-row { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }

.user-delete { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.user-delete small { flex: 1 1 240px; }

/* --- Zámok aplikácie (Face ID / odtlačok) ---------------------------------- */
/* --primary neexistuje (premenná sa volá --blue) — odkaz bol preto čierny. */
.btn-link { background: none; border: none; min-height: 0; color: var(--blue); text-decoration: underline; padding: 4px 2px; cursor: pointer; font-size: 13px; }
.lock-card { text-align: center; }
.lock-icon { font-size: 40px; line-height: 1; margin: 4px 0 2px; }
.lock-card h1 { margin: 6px 0 2px; }
.lock-who { font-weight: 600; margin: 0 0 6px; }
.lock-hint { margin: 0 0 16px; line-height: 1.5; }
.lock-err { color: var(--danger); font-weight: 600; margin: 12px 0 0; line-height: 1.45; }
.lock-logout { margin-top: 14px; }

.device-list { list-style: none; margin: 8px 0 12px; padding: 0; }
.device-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
                  padding: 8px 0; border-bottom: 1px solid var(--border); }
.device-list li:last-child { border-bottom: 0; }
.device-list .dev-name { font-weight: 600; }
.device-list .dev-date { margin-left: auto; font-size: 13px; }
.device-list form { margin: 0; }

/* --- Zamknutá obrazovka v štýle systémového zámku ------------------------- */
.lock-screen { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 0%, var(--topbar) 0%, var(--login-bg2) 70%); color: #fff;
  padding: 24px; -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); }
.lock-wrap { text-align: center; width: 100%; max-width: 360px; animation: lock-in .25s ease-out; }
@keyframes lock-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.lock-glyph { color: #fff; opacity: .95; margin: 0 auto 18px; width: 96px; height: 96px; }
.lock-glyph.pulse { animation: lock-pulse 1.2s ease-in-out infinite; }
@keyframes lock-pulse { 0%,100% { opacity: .95; transform: scale(1); } 50% { opacity: .6; transform: scale(.94); } }
.lock-name { font-weight: 700; font-size: 1.15rem; margin: 0 0 6px; }
.lock-text { color: rgba(255,255,255,.75); margin: 0 0 22px; line-height: 1.45; }
.lock-btn { min-width: 220px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); color: #fff; }
.lock-btn:hover { background: rgba(255,255,255,.22); }
.lock-screen .lock-err { color: #fecaca; }
.lock-pw { background: none; border: 0; color: rgba(255,255,255,.7); text-decoration: underline; font-size: 13px; padding: 6px; cursor: pointer; }
.lock-screen .lock-logout { margin-top: 26px; }
.lock-brand { margin-top: 40px; opacity: .6; }

/* Poznámka pod formulárom (napr. kam sa zapisuje materiál) */
.form-note { margin: 4px 0 12px; font-size: 13px; }


/* ===== Fotka dielu na stred obrazovky (lightbox) =====
   Otvorí sa klikom na miniatúru (a.item-thumb / a.item-photo), stmavené pozadie,
   hore lišta: posuvník priblíženia, celá obrazovka, zavrieť. Koliesko / dva prsty
   priblížia, dvojklik prepne 1× ↔ 2,5×, ťahaním sa posúva. Esc, ✕ alebo klik
   na pozadie zavrie; na telefóne aj gesto späť. */
/* --- Skener čiarového kódu (📷 pri hľadaní dielu) ---------------------------
   Obraz z fotoaparátu cez celú obrazovku, uprostred svetlý rámček (tmavý okraj
   robí obrovský box-shadow), dole Prisvietiť a Zavrieť. Nad všetkým ostatným. */
/* .btn má display: inline-flex, ktorý by prebil vlastnosť hidden — bez tohto
   by tlačidlo 📷 svietilo aj tam, kde prehliadač fotoaparát otvoriť nevie. */
.btn[hidden] { display: none; }
.scan { position: fixed; inset: 0; z-index: 210; background: #000; overflow: hidden; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; left: 8%; right: 8%; top: 50%; transform: translateY(-50%);
  height: min(34vh, 240px); border: 2px solid rgba(255,255,255,.9); border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); pointer-events: none; }
.scan-msg { position: absolute; z-index: 2; top: max(18px, env(safe-area-inset-top)); left: 16px; right: 16px;
  margin: 0; text-align: center; color: #fff; font-size: 15px; text-shadow: 0 1px 4px rgba(0,0,0,.9); }
.scan-msg.scan-err { top: 50%; transform: translateY(-50%); font-size: 16px; line-height: 1.5; }
/* Pole, ku ktorému patrí tlačidlo na naskenovanie kódu (napr. PN pri novej položke).
   Políčko so skenerom dostane celý riadok, inak by na telefóne ostal na PN prúžok. */
.row-2 > .row-full { grid-column: 1 / -1; }
.field-scan { display: flex; gap: 8px; align-items: stretch; }
.field-scan input, .field-scan select { flex: 1 1 140px; min-width: 0; }
.field-scan .btn { flex: 0 0 auto; white-space: nowrap; }

/* Spodok skenera: posuvník priblíženia a tlačidlá pod sebou v jednom stĺpci.
   (Keď boli každý zvlášť na absolútnej pozícii, na telefóne sa navzájom prekryli.) */
.scan-bottom { position: absolute; z-index: 2; left: 12px; right: 12px; bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; }
.scan-zoom { align-self: center; width: min(280px, 84%); -webkit-appearance: none; appearance: none;
  height: 6px; min-height: 0; margin: 4px 0 6px; padding: 0; border: 0; border-radius: 3px;
  background: rgba(255,255,255,.55); outline: none; }
.scan-zoom::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.5); cursor: pointer; }
.scan-zoom::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0; cursor: pointer; }
.scan-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.scan-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.scan-actions .btn { flex: 1 1 30%; min-width: 96px; background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.55); }
.scan-actions .btn.on { background: #fff; color: #0f172a; border-color: #fff; }
/* Odfotiť kód je istota, keď živý obraz kód nechytí — vlastný riadok a plná farba. */
.scan-actions .scan-photo { flex: 1 1 100%; background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 700; }

.lb { position: fixed; inset: 0; z-index: 200; background: rgba(15, 23, 42, .92); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lb-toolbar { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; z-index: 2; }
.lb-tool { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; font: inherit; }
.lb-tool:hover { background: rgba(255,255,255,.26); }
.lb-zoom { display: flex; align-items: center; gap: 10px; color: #fff; background: rgba(255,255,255,.14); border-radius: 999px; padding: 0 14px; height: 44px; margin-right: auto; }
.lb-zoom input[type="range"] { -webkit-appearance: none; appearance: none; width: 130px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.4); outline: none; cursor: pointer; margin: 0; padding: 0; min-height: 0; border: 0; }
.lb-zoom input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: pointer; }
.lb-zoom input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; cursor: pointer; }
.lb-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.lb-img { max-width: min(1100px, 94vw); max-height: 80vh; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5); transition: transform .08s linear; cursor: zoom-in; user-select: none; -webkit-user-select: none; touch-action: none; }
.lb-img.zoomed { cursor: grab; }
.lb-img.dragging { cursor: grabbing; transition: none; }
.lb-caption { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 16px; right: 16px; text-align: center; color: rgba(255,255,255,.85); font-size: 14px; z-index: 2; pointer-events: none; }
.lb-caption small { display: block; color: rgba(255,255,255,.55); font-size: 12px; margin-top: 4px; }
body.lb-open { overflow: hidden; }
a.item-thumb, a.item-photo { cursor: zoom-in; }
@media (max-width: 860px) {
  .lb { padding: 12px; }
  .lb-zoom input[type="range"] { width: 90px; }
  .lb-img { max-width: 96vw; max-height: 74vh; border-radius: 10px; }
  .lb-caption small { display: none; }
}


/* Akcie priamo vo výsledku hľadania (Presunúť / Odpísať / Vydať jig).
   Na telefóne sa tabuľka mení na karty, preto tlačidlá dostanú celú šírku riadku. */
.search-actions { white-space: nowrap; }
.search-actions .btn + .btn { margin-left: 6px; }
@media (max-width: 860px) {
  table.as-cards .search-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; white-space: normal; }
  table.as-cards .search-actions::before { content: none; }
  table.as-cards .search-actions .btn { flex: 1 1 auto; margin-left: 0; justify-content: center; }
  table.as-cards .search-actions:empty { display: none; }
}
