/* ==========================================================================
   Pohoda Bridge Hub – Design System v2 (dark, sidebar dashboard layout)
   Zachované názvy premenných (--bg, --surface, --border, --accent, ...) kvôli
   kompatibilite so šablónami; nové: --surface-3, --radius, --shadow-*, --sidebar-w.
   ========================================================================== */
:root {
  --bg: #0b1220;
  --bg-elev: #0f1729;
  --surface: #131c30;
  --surface-2: #1a2540;
  --surface-3: #22304f;
  --border: #25324d;
  --border-strong: #34456a;
  --text: #e8eef9;
  --text-soft: #c4cee3;
  --muted: #8b9bb8;
  --accent: #38bdf8;
  --accent-hover: #67cdfa;
  --accent-ink: #062a40;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --sidebar-w: 256px;
  --topbar-h: 58px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.01em; }
code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 0.05rem 0.38rem;
  border-radius: 5px;
  color: #dbe6fb;
  word-break: break-word;
}
::selection { background: rgba(56, 189, 248, 0.35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- App shell: sidebar + main ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0d1527 0%, #0a1020 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.05rem 1.15rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.sidebar-brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #fff;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.3);
}
.brand { font-weight: 700; font-size: 1.02rem; color: var(--text); line-height: 1.15; }
.brand span { color: var(--accent); }
.brand-sub { display: block; font-size: 0.7rem; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; margin-top: 2px; }
.sidebar-section {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: #61718f; padding: 1.1rem 1.25rem 0.4rem;
}
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0.35rem 0.7rem; }
.nav a, .nav .nav-btn {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500; font-size: 0.92rem;
  border: 1px solid transparent;
  background: transparent;
  width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.nav a svg, .nav .nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav a:hover, .nav .nav-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.22);
  font-weight: 600;
}
.nav a.active svg { opacity: 1; }
.sidebar-spacer { flex: 1; }
.sidebar-foot { padding: 0.5rem 0.7rem 1rem; border-top: 1px solid var(--border); }
.sidebar-foot form { margin: 0; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(2, 6, 16, 0.65);
  backdrop-filter: blur(2px); z-index: 55;
}
body.sidebar-open .sidebar-backdrop { display: block; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1.5rem;
  background: rgba(11, 18, 32, 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.topbar-title { font-size: 1.05rem; font-weight: 650; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.menu-toggle {
  display: none; width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; place-items: center; padding: 0;
}
.menu-toggle svg { width: 20px; height: 20px; }
.sched-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.3rem 0.75rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
}
.sched-pill:hover { text-decoration: none; border-color: var(--border-strong); }
.sched-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.sched-pill.paused .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.pause-banner {
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 1px solid rgba(245, 158, 11, 0.45);
  padding: 0.6rem 1.5rem;
}
.pause-banner-inner {
  max-width: 1480px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.6rem;
  font-size: 0.88rem;
}

.container { width: 100%; max-width: 1480px; margin: 0 auto; padding: 1.5rem 1.5rem 0.5rem; flex: 1; }

/* ---------- Grids & cards ---------- */
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.grid-4 > .card, .grid-2 > .card { margin-bottom: 0; }
.card h2 { margin: 0 0 0.75rem; font-size: 1.08rem; font-weight: 650; color: var(--text); }
.card h3 { margin: 0 0 0.6rem; font-size: 0.98rem; font-weight: 650; color: var(--text); }
.grid-4 > .card { position: relative; overflow: hidden; }
.grid-4 > .card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), #6366f1);
}
.stat-label { color: var(--muted); font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1.15; margin: 0.25rem 0 0.15rem; letter-spacing: -0.02em; }
.card form > h3 {
  margin-top: 1.5rem; padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  color: var(--accent); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.07em;
}
.card form > h3:first-child { margin-top: 0.2rem; padding-top: 0; border-top: none; }
details { border-radius: var(--radius-sm); }
details > summary { cursor: pointer; user-select: none; }
details[open] > summary { color: var(--text-soft); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
.table-wrap > table { min-width: 620px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.7rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  color: var(--muted); font-weight: 600; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: rgba(15, 23, 41, 0.6); border-bottom: 1px solid var(--border-strong);
  position: sticky; top: 0; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(56, 189, 248, 0.045); }
tfoot td { font-weight: 600; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
.empty-row td { text-align: center; padding: 1.4rem; }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.16rem 0.6rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 650; line-height: 1.5; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-ok { background: rgba(34, 197, 94, 0.14); color: #86efac; border-color: rgba(34, 197, 94, 0.28); }
.badge-warn { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
.badge-err { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.32); }
.badge-info { background: rgba(56, 189, 248, 0.14); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.28); }
.badge-muted { background: rgba(148, 163, 184, 0.13); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.22); }
.tag-chip {
  display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
  background: rgba(99, 102, 241, 0.14); border: 1px solid rgba(129, 140, 248, 0.32);
  color: #c7d2fe; margin: 0 0.25rem 0.2rem 0;
}
a.tag-chip:hover { text-decoration: none; background: rgba(99, 102, 241, 0.26); }
.tag-chip.active-filter { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font-family: inherit; font-size: 0.88rem; font-weight: 550; line-height: 1.3;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
}
.btn:hover { background: var(--surface-3); border-color: #476096; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #4cc7fb, #28a9e6);
  color: var(--accent-ink); border-color: #38bdf8; font-weight: 650;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.22);
}
.btn-primary:hover { background: linear-gradient(180deg, #7bd6fc, #3bb4ec); border-color: #7bd6fc; }
.btn-danger { background: rgba(239, 68, 68, 0.14); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.26); border-color: rgba(239, 68, 68, 0.6); }
.btn-sm { padding: 0.28rem 0.7rem; font-size: 0.8rem; border-radius: 7px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 0.95rem 1.1rem; }
label { display: block; font-size: 0.8rem; font-weight: 550; color: var(--muted); margin-bottom: 0.3rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="url"], input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-family: inherit; font-size: 0.92rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: #5b6b88; }
input:hover, select:hover, textarea:hover { border-color: #476096; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238b9bb8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); vertical-align: middle; cursor: pointer; }
input[type="file"] { font-size: 0.85rem; color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button {
  margin-right: 0.7rem; padding: 0.4rem 0.8rem; border-radius: 7px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; font-family: inherit;
}
textarea { font-family: var(--mono); font-size: 0.82rem; }
.table-toolbar {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.9rem;
}
.table-toolbar input[type="text"], .table-toolbar select { width: auto; }
.ms-dropdown { position: relative; display: inline-block; }
.ms-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  min-width: 250px; max-height: 300px; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 0.6rem 0.75rem; box-shadow: var(--shadow-md);
}
.ms-menu.open { display: block; }
.ms-option { display: flex; align-items: center; gap: 0.5rem; padding: 0.32rem 0.2rem; color: var(--text); font-size: 0.86rem; cursor: pointer; border-radius: 6px; }
.ms-option:hover { background: rgba(255, 255, 255, 0.04); }
.pager-bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.6rem;
  margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--border);
  font-size: 0.82rem; color: var(--muted);
}
pre.code {
  background: #060b17; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.95rem; overflow-x: auto; font-family: var(--mono); font-size: 0.8rem; line-height: 1.55;
  color: #dbe6fb; white-space: pre-wrap; word-break: break-word; max-height: 520px; overflow-y: auto;
}
.alert { padding: 0.8rem 1rem; border-radius: var(--radius-sm); margin: 0.75rem 0; font-size: 0.9rem; border: 1px solid transparent; }
.alert-ok { background: rgba(34, 197, 94, 0.13); border-color: rgba(34, 197, 94, 0.38); color: #86efac; }
.alert-err { background: rgba(239, 68, 68, 0.13); border-color: rgba(239, 68, 68, 0.38); color: #fca5a5; }
.inline-form { display: inline; }
.muted { color: var(--muted); font-size: 0.85rem; }
.company-group-header {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.1), rgba(56, 189, 248, 0.02));
  border-left: 3px solid var(--accent);
  padding: 0.6rem 0.95rem; margin: 1.1rem 0 0.55rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem;
}

/* ---------- Live statusbar ---------- */
.live-statusbar {
  display: none; position: sticky; top: var(--topbar-h); z-index: 35;
  background: linear-gradient(90deg, #0c2440 0%, #131c30 100%);
  border-bottom: 1px solid rgba(56, 189, 248, 0.4);
  padding: 0.65rem 1.5rem;
}
.live-statusbar.visible { display: block; }
.live-statusbar-inner { max-width: 1480px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.5rem; }
.live-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.86rem; }
.progress-track { width: 100%; height: 7px; border-radius: 999px; background: rgba(148, 163, 184, 0.2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #38bdf8, #22c55e); transition: width 0.35s ease; }
.progress-fill.indeterminate { width: 45% !important; animation: pb-slide 1.4s infinite ease-in-out; }
.progress-fill.done { background: #22c55e; }
.progress-fill.err { background: #ef4444; }
@keyframes pb-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* ---------- Footer ---------- */
.site-footer { margin-top: 2.5rem; background: #080e1c; border-top: 1px solid var(--border); padding: 2rem 1.5rem 1.2rem; color: var(--muted); font-size: 0.84rem; }
.footer-inner { max-width: 1480px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: minmax(240px, 1.5fr) minmax(190px, 1fr) minmax(200px, 1fr); gap: 2rem; padding-bottom: 1.4rem; border-bottom: 1px solid rgba(51, 65, 85, 0.55); }
.footer-brand { display: flex; align-items: center; gap: 0.55rem; color: #f8fafc; font-weight: 700; font-size: 1.05rem; margin-bottom: 0.65rem; }
.footer-heading { display: flex; align-items: center; gap: 0.45rem; color: #e2e8f0; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.7rem; }
.footer-kv { font-family: var(--mono); font-size: 0.8rem; line-height: 1.8; }
.footer-kv strong { color: #e2e8f0; font-weight: 600; }
.footer-links { margin-top: 0.65rem; padding-top: 0.65rem; border-top: 1px solid rgba(51, 65, 85, 0.45); display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); text-decoration: none; }
.footer-pill { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.85rem; padding: 0.5rem 0.9rem; border-radius: var(--radius-sm); background: rgba(15, 23, 42, 0.9); border: 1px solid var(--border-strong); color: #e2e8f0; font-family: var(--mono); font-size: 0.78rem; }
.footer-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 8px #10b981; display: inline-block; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; padding-top: 1rem; font-size: 0.78rem; color: #64748b; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-md); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.4rem; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar { padding: 0 0.9rem; }
  .container { padding: 1rem 0.85rem 0.25rem; }
  .card { padding: 1rem; border-radius: 10px; }
  .live-statusbar, .pause-banner { padding-left: 0.9rem; padding-right: 0.9rem; }
  .sched-pill span.sched-text { display: none; }
  .stat-value { font-size: 1.65rem; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  input[type="text"], input[type="password"], input[type="number"], input[type="email"],
  input[type="url"], input[type="search"], input[type="date"], select, textarea { font-size: 16px; min-height: 42px; }
  .table-toolbar > * { flex: 1 1 100%; }
  .table-toolbar .ms-dropdown, .table-toolbar .ms-dropdown > .btn { width: 100%; }
  .table-toolbar input[type="text"], .table-toolbar select { width: 100%; }
  .ms-menu { min-width: 0; width: 100%; }
  th, td { padding: 0.6rem 0.6rem; }
  .pager-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .site-footer { padding: 1.5rem 0.9rem 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
