:root {
  --purple: #534AB7;
  --purple-light: #EEEDFE;
  --purple-mid: #AFA9EC;
  --purple-dark: #3C3489;
  --teal: #1D9E75;
  --teal-light: #E1F5EE;
  --coral: #993C1D;
  --coral-light: #FAECE7;
  --amber: #BA7517;
  --amber-light: #FAEEDA;
  --blue: #185FA5;
  --blue-light: #E6F1FB;
  --green: #3B6D11;
  --green-light: #EAF3DE;
  --red: #A32D2D;
  --red-light: #FCEBEB;
  --gray-light: #F1EFE8;
  --bg: #fff;
  --bg2: #F7F7F5;
  --border: rgba(0,0,0,0.12);
  --text: #1a1a1a;
  --text2: #555;
  --text3: #999;
  --radius: 10px;
  --radius-lg: 14px;
  --nav-h: 56px;
  --bottom-nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e; --bg2: #2c2c2e; --border: rgba(255,255,255,0.12);
    --text: #f0f0f0; --text2: #aaa; --text3: #666;
    --purple-light: #2a2660; --teal-light: #0d3d2c; --coral-light: #3d1a0d;
    --amber-light: #3d2a06; --blue-light: #0d2a4d; --green-light: #1a3008;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; color: var(--text); background: var(--bg2); }

/* LOGIN */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg2); }
.login-wrap { width: 100%; max-width: 360px; padding: 20px; }
.login-card { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 28px 24px; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.logo-icon { width: 34px; height: 34px; background: var(--purple); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.logo-text { font-size: 17px; font-weight: 600; color: var(--text); }
.login-sub { font-size: 13px; color: var(--text2); margin-bottom: 20px; }

/* LAYOUT */
#app { display: none; height: 100vh; display: flex; flex-direction: column; }
.top-nav { height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: var(--bg); border-bottom: 0.5px solid var(--border); flex-shrink: 0; position: sticky; top: 0; z-index: 100; }
.top-nav .logo { display: flex; align-items: center; gap: 8px; }
.top-nav .logo .logo-icon { width: 28px; height: 28px; border-radius: 7px; font-size: 15px; }
.top-nav .logo-text { font-size: 15px; font-weight: 600; }
.top-nav .user-info { display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--purple-light); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--purple-dark); }
.badge-admin { padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--coral-light); color: var(--coral); font-weight: 500; }

.page-content { flex: 1; overflow-y: auto; padding-bottom: calc(var(--bottom-nav-h) + 8px); }
.page { display: none; padding: 14px 16px; }
.page.active { display: block; }

/* BOTTOM NAV */
.bottom-nav { height: var(--bottom-nav-h); display: flex; background: var(--bg); border-top: 0.5px solid var(--border); flex-shrink: 0; padding-bottom: env(safe-area-inset-bottom); }
.bnav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; font-size: 10px; color: var(--text3); border: none; background: none; padding: 8px 0; transition: color .15s; }
.bnav-item.active { color: var(--purple); }
.bnav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* DESKTOP NAV TABS (hidden on mobile) */
.desktop-tabs { display: none; }
@media (min-width: 640px) {
  .bottom-nav { display: none; }
  .desktop-tabs { display: flex; gap: 4px; }
  .desktop-tab { padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; border: 0.5px solid transparent; color: var(--text2); background: transparent; }
  .desktop-tab.active { background: var(--bg2); border-color: var(--border); color: var(--text); }
  .page-content { padding-bottom: 16px; }
  .page { padding: 18px 24px; }
}

/* FORMS */
.fg { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.fg label { font-size: 12px; color: var(--text2); font-weight: 500; }
.fg input, .fg select, .fg textarea {
  font-size: 15px; padding: 11px 12px; border-radius: var(--radius);
  border: 0.5px solid var(--border); background: var(--bg); color: var(--text);
  width: 100%; appearance: auto; -webkit-appearance: auto;
}
.fg input:focus, .fg select:focus, .fg textarea:focus {
  outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(83,74,183,0.15);
}
.fg textarea { resize: none; height: 80px; line-height: 1.5; }
.frow2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.frow3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* BUTTONS */
.btn-primary { padding: 11px 20px; border-radius: var(--radius); font-size: 15px; cursor: pointer; border: none; background: var(--purple); color: #fff; font-weight: 500; transition: background .15s; }
.btn-primary:hover { background: var(--purple-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-full { width: 100%; }
.btn-secondary { padding: 9px 16px; border-radius: var(--radius); font-size: 13px; cursor: pointer; border: 0.5px solid var(--border); background: var(--bg); color: var(--text2); }
.btn-danger { padding: 9px 16px; border-radius: var(--radius); font-size: 13px; cursor: pointer; border: 0.5px solid var(--red-light); background: var(--red-light); color: var(--red); }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* TOGGLE */
.toggle-row { display: flex; gap: 8px; margin-bottom: 14px; }
.tbtn { flex: 1; padding: 10px; border-radius: var(--radius); font-size: 14px; cursor: pointer; border: 0.5px solid var(--border); background: var(--bg); color: var(--text2); text-align: center; transition: all .15s; }
.tbtn.active { background: var(--purple-light); border-color: var(--purple-mid); color: var(--purple-dark); font-weight: 500; }

/* CARDS */
.card { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 500; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* METRICS */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .metric-grid { grid-template-columns: repeat(4, 1fr); } }
.metric { background: var(--bg2); border-radius: var(--radius); padding: 12px 14px; }
.metric .label { font-size: 11px; color: var(--text2); margin-bottom: 3px; }
.metric .value { font-size: 22px; font-weight: 500; }
.metric .sub { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* LISTS */
.list-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 0.5px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.row-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.icon-remote { background: var(--blue-light); color: var(--blue); }
.icon-onsite { background: var(--green-light); color: var(--green); }
.icon-server { background: var(--coral-light); color: var(--coral); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.row-time { font-size: 12px; color: var(--text3); flex-shrink: 0; }

/* PILLS */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; margin-left: 5px; }
.pill-remote { background: var(--blue-light); color: var(--blue); }
.pill-onsite { background: var(--green-light); color: var(--green); }
.pill-server { background: var(--coral-light); color: var(--coral); }
.pill-pausal { background: var(--purple-light); color: var(--purple-dark); }
.pill-nepausal { background: var(--amber-light); color: var(--amber); }
.pill-ok { background: var(--teal-light); color: var(--teal); }
.pill-warn { background: var(--amber-light); color: var(--amber); }
.pill-admin { background: var(--coral-light); color: var(--coral); }
.pill-technik { background: var(--purple-light); color: var(--purple-dark); }

/* TIME BOX */
.time-display { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.time-box { background: var(--bg2); border-radius: var(--radius); padding: 10px; text-align: center; }
.time-box .tl { font-size: 11px; color: var(--text2); margin-bottom: 2px; }
.time-box .tv { font-size: 18px; font-weight: 500; }
.time-box.highlighted { background: var(--purple-light); }
.time-box.highlighted .tl { color: var(--purple-dark); }
.time-box.highlighted .tv { color: var(--purple-dark); }

/* PROGRESS */
.progress-wrap { background: var(--bg2); border-radius: 999px; height: 6px; overflow: hidden; margin-top: 5px; }
.progress-bar { height: 6px; border-radius: 999px; transition: width .3s; }

/* ALERTS */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.alert-danger { background: var(--red-light); color: var(--red); }
.alert-warning { background: var(--amber-light); color: var(--amber); }
.alert-success { background: var(--teal-light); color: var(--teal); }
.alert-info { background: var(--blue-light); color: var(--blue); }

/* SERVER LIST */
.server-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); cursor: pointer; margin-bottom: 4px; border: 0.5px solid transparent; }
.server-item.active { background: var(--purple-light); border-color: var(--purple-mid); }
.server-item:hover:not(.active) { background: var(--bg2); }
.server-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex-shrink: 0; }

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 8px 12px; text-align: left; font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; border-bottom: 0.5px solid var(--border); font-weight: 500; }
.data-table td { padding: 10px 12px; border-bottom: 0.5px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn { padding: 5px 8px; border-radius: 6px; border: 0.5px solid var(--border); background: transparent; color: var(--text2); cursor: pointer; font-size: 14px; }

/* SECTION LABEL */
.slabel { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }

/* SEPARATOR */
.sep { border-top: 0.5px solid var(--border); margin: 12px 0; }

/* FIRMA DETAIL split view (desktop) */
@media (min-width: 640px) {
  .split-view { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
}

/* REPORT TABLE */
.report-row { display: flex; align-items: center; padding: 9px 0; border-bottom: 0.5px solid var(--border); font-size: 13px; gap: 8px; flex-wrap: wrap; }
.report-row:last-child { border-bottom: none; }
.badge-nadcas { background: var(--amber-light); color: var(--amber); padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-faktura { background: var(--purple-light); color: var(--purple-dark); padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-vpausu { background: var(--teal-light); color: var(--teal); padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; }

/* SCROLLABLE TABLE on mobile */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─── NOVÉ STYLY v2 ─────────────────────────────────────────────────────────── */

/* Modal overlay */
#modal-overlay { display: none !important; }
#modal-overlay.open { display: flex !important; }

/* Spolupracovníci tagy */
.spoluprac-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--purple-light); color: var(--purple-dark);
  padding: 3px 8px; border-radius: 999px; font-size: 12px;
}
.spoluprac-tag button {
  border: none; background: none; cursor: pointer;
  color: inherit; font-size: 14px; line-height: 1; padding: 0;
}

/* Zákazník detail — filtry kategorií zařízení */
#zarizeni-filtry { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
#zarizeni-filtry .tbtn { flex: none; padding: 6px 12px; font-size: 12px; }

/* Dashboard toggle */
#page-dashboard .toggle-row .tbtn { font-size: 13px; padding: 8px 10px; }

/* Manager stránka */
#page-manager .card-title { margin-bottom: 14px; }

/* Report badge row */
.report-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr; align-items: center; padding: 9px 0; border-bottom: 0.5px solid var(--border); font-size: 13px; gap: 8px; }
.report-row:last-child { border-bottom: none; }

/* Tlačítko delete na zařízeních */
.icon-btn.btn-danger { background: var(--red-light); color: var(--red); border-color: var(--red-light); }
.icon-btn.btn-danger:hover { background: var(--red); color: #fff; }

/* Profil checkbox */
#profil-jen-moji { accent-color: var(--purple); }

/* Metriky - 4 sloupce na větší displeji */
@media (min-width: 640px) {
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Animace alert */
.alert { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Lepší focus ring */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--purple); outline-offset: 2px;
}

/* Nový záznam info */
#new-device-info { margin-bottom: 6px; }
