@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800&display=swap');

:root {
  --bg: #0d0f0d;
  --bg-2: #121412;
  --surface: #181a18;
  --surface-2: #1f221f;
  --border: rgba(255, 255, 255, 0.09);
  --text: #ffffff;
  --muted: #9ca3af;
  --accent: #c8f31d;
  --accent-hover: #d4ff33;
  --accent-text: #0a0a0a;
  --accent-soft: rgba(200, 243, 29, 0.14);
  --warn: #ffb347;
  --danger: #ff6b6b;
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-w: 248px;
  --content-max: 1400px;
  --bp-phone: 480px;
  --bp-tablet: 768px;
  --bp-compact: 992px;
  --bp-sidebar: 1200px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  min-height: 100vh;
}

body.admin-page,
body.portal-body:not(.portal-login-page) {
  overflow-x: hidden;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
}

body.sidebar-open {
  overflow: hidden;
}

body.login-page {
  position: relative;
  overflow-x: hidden;
  background: #060806;
}

body.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 75% 55% at 88% 48%, rgba(28, 72, 36, 0.62) 0%, transparent 58%),
    radial-gradient(ellipse 55% 45% at 12% 18%, rgba(200, 243, 29, 0.07) 0%, transparent 52%),
    linear-gradient(118deg, #050705 0%, #0a1208 42%, #071408 72%, #040804 100%);
}

.login-bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body.login-page .wrap-login,
body.login-page .login-footer {
  position: relative;
  z-index: 2;
}

body.login-page .login-footer {
  width: min(100%, 500px);
  max-width: 500px;
  margin: 0 auto;
  padding: 0 16px 20px;
}

body.login-page .login-card {
  background: rgba(18, 20, 16, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .login-bg-canvas {
    display: none;
  }
}

img { max-width: 100%; display: block; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 24px 20px 48px; }

.wrap-login {
  width: min(100%, 500px);
  max-width: 500px;
  margin: 0 auto;
  padding: 20px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
}

/* ——— Admin shell (sidebar layout) ——— */
.admin-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  max-width: 100%;
  overflow-x: hidden;
}

.admin-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #101210;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 120;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-tag {
  display: block;
  margin-top: 10px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}

.sidebar-nav { flex: 1; padding: 10px 0 14px; }

.sidebar-group + .sidebar-group { margin-top: 6px; }

.sidebar-group--flat {
  margin-bottom: 4px;
}

.sidebar-group-collapse {
  margin: 0;
  border: none;
}

.sidebar-group-collapse + .sidebar-group-collapse,
.sidebar-group--flat + .sidebar-group-collapse,
.sidebar-group-collapse + .sidebar-group--flat {
  margin-top: 2px;
}

.sidebar-group-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  list-style: none;
  cursor: pointer;
  user-select: none;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(156, 163, 175, 0.75);
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}

.sidebar-group-summary::-webkit-details-marker {
  display: none;
}

.sidebar-group-summary:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-group-collapse[open] > .sidebar-group-summary {
  color: rgba(200, 243, 29, 0.85);
}

.sidebar-group-summary-text {
  flex: 1;
  min-width: 0;
}

.sidebar-group-chevron {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  opacity: 0.75;
}

.sidebar-group-collapse[open] > .sidebar-group-summary .sidebar-group-chevron {
  transform: rotate(45deg);
}

.sidebar-group-items {
  padding: 2px 0 6px;
}

.sidebar-group-label {
  padding: 16px 18px 6px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(156, 163, 175, 0.75);
  font-weight: 700;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-icon {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.85;
}

.sidebar-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
  color: var(--accent-text);
  background: var(--accent);
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(200, 243, 29, 0.22);
}

.sidebar-link.active .sidebar-icon {
  opacity: 1;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 10px 18px;
  border-top: 1px solid var(--border);
}

.sidebar-link-ext { font-size: 0.84rem; }

.sidebar-logout { margin: 10px 10px 0; }

.sidebar-logout-btn { width: 100%; justify-content: center; }

.admin-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 110;
}

.admin-backdrop[hidden] {
  display: none !important;
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.admin-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  min-height: 58px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 15, 13, 0.94);
  backdrop-filter: blur(12px);
}

.admin-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
}

.admin-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.admin-breadcrumb a:hover { color: var(--accent); }

.admin-breadcrumb-sep { color: rgba(255, 255, 255, 0.25); }

.admin-breadcrumb-current {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s, background 0.15s;
}

.topbar-btn:hover {
  border-color: rgba(200, 243, 29, 0.35);
  background: rgba(200, 243, 29, 0.06);
}

.admin-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.admin-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-user-name {
  font-size: 0.84rem;
  font-weight: 600;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.admin-user-role {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
}

.admin-topbar-title h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
}

.admin-topbar-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(200, 243, 29, 0.35);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
  border-radius: 1px;
}

.admin-content {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px 36px;
}

.page-head {
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 700;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.page-hero {
  margin-bottom: 22px;
}

.page-hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  line-height: 1.2;
}

.page-hero p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 640px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.quick-actions .btn {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--accent-soft), rgba(200, 243, 29, 0.03));
  border: 1px solid rgba(200, 243, 29, 0.12);
}

.section-head-icon { font-size: 1.1rem; }

.section-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.top { margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }

.brand { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }

.brand-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.site-logo,
.brand-logo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.site-logo-sidebar,
.brand-logo .site-logo-sidebar {
  max-height: 76px;
}

.site-logo-login,
.login-page-brand .site-logo-login,
.login-page-logo .site-logo-login,
.portal-login-brand .site-logo-login {
  max-height: 260px;
  max-width: min(100%, 420px);
  margin: 0 auto;
  display: block;
}

.brand-logo img:not(.site-logo-login) { height: auto; max-height: 76px; width: auto; max-width: 100%; }

.brand h1 { margin: 0; font-size: 1.35rem; font-weight: 700; }

.brand p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }

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

.nav-link {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: .85rem;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.nav-link.active {
  background: rgba(200, 243, 29, 0.12);
  border-color: rgba(200, 243, 29, 0.35);
  color: var(--accent);
  font-weight: 600;
}

.logout-form { margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  min-width: 0;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
}

.kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat,
.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.stat::before,
.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 52%;
  background: linear-gradient(90deg, rgba(200, 243, 29, 0.2) 0%, rgba(200, 243, 29, 0.05) 55%, transparent 100%);
  pointer-events: none;
}

.stat:hover,
.stat-card:hover {
  border-color: rgba(200, 243, 29, 0.28);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.stat-body {
  position: relative;
  padding: 16px 12px 16px 18px;
  flex: 1;
  min-width: 0;
}

.stat-warn .stat-value { color: #ffb4b4; }

.stat-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.stat-value {
  display: block;
  position: relative;
  padding: 16px 18px 16px 0;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-hint {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 2px;
}

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

.span-2 { grid-column: span 2; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.two-col > .card {
  min-width: 0;
}

.two-col > .card:last-child,
.service-form-card {
  container-type: inline-size;
  container-name: form-panel;
  min-width: 0;
  overflow-x: clip;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; min-width: 0; }

@container form-panel (max-width: 639px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@container form-panel (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-grid .full { grid-column: 1 / -1; }

.timer-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.timer-card.running {
  border-color: rgba(200, 243, 29, 0.45);
  box-shadow: 0 0 24px rgba(200, 243, 29, 0.08);
}

.timer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.timer-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.timer-status {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.timer-status.active {
  color: var(--accent);
}

.timer-display {
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 10px;
}

.timer-hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.timer-actions {
  margin: 0;
}

.collapse-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  margin: 12px 0;
}

.collapse-panel > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}

.collapse-panel > summary::-webkit-details-marker { display: none; }

.collapse-panel > summary::after {
  content: '▸';
  color: var(--muted);
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.collapse-panel[open] > summary::after {
  transform: rotate(90deg);
  color: var(--accent);
}

.collapse-panel > summary:hover {
  color: var(--accent);
}

.collapse-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

.collapse-body > :first-child {
  margin-top: 14px;
}

.collapse-card {
  padding: 0;
  overflow: hidden;
}

.collapse-card > .collapse-panel {
  border: none;
  border-radius: 0;
  background: none;
  margin: 0;
}

.collapse-card > .collapse-panel > summary {
  padding: 18px 22px;
}

.collapse-card > .collapse-panel > .collapse-body {
  padding: 0 22px 20px;
}

.collapse-card > .collapse-panel summary h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 600;
}


.field span { display: block; margin-bottom: 6px; font-size: .85rem; color: var(--muted); }

.field {
  min-width: 0;
  display: block;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}

.field input[type="date"],
.field input[type="datetime-local"],
.field input[type="time"],
.field input[type="month"],
.field input[type="week"] {
  display: block;
  appearance: none;
  -webkit-appearance: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(200, 243, 29, 0.45);
}

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }

.table th,
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }

.table th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: 0.04em; }

.chart-wrap { position: relative; height: 260px; overflow: hidden; isolation: isolate; }

.chart-tall { height: 320px; }

.dash-coreui .chart-tall {
  height: 320px;
}

.dashboard-acc {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.dashboard-acc-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}

.dashboard-acc-head {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  background: linear-gradient(90deg, rgba(200, 243, 29, 0.08) 0%, transparent 55%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 0.2s, border-color 0.2s;
}

.dashboard-acc-head:hover {
  background: linear-gradient(90deg, rgba(200, 243, 29, 0.14) 0%, rgba(255, 255, 255, 0.02) 55%);
}

.dashboard-acc-item.is-open .dashboard-acc-head {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(200, 243, 29, 0.16) 0%, rgba(255, 255, 255, 0.02) 60%);
}

.dashboard-acc-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.dashboard-acc-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dashboard-acc-text strong {
  font-size: 1.02rem;
}

.dashboard-acc-text .muted {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-acc-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
  flex-shrink: 0;
  margin-left: 4px;
}

.dashboard-acc-item.is-open .dashboard-acc-chevron {
  transform: rotate(45deg);
}

.dashboard-acc-body {
  padding: 14px 16px 18px;
  animation: dashboardAccIn 0.28s ease;
}

.dashboard-acc-body[hidden] {
  display: none !important;
}

@keyframes dashboardAccIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 0;
}

.dashboard-charts-single {
  grid-template-columns: 1fr;
  max-width: 640px;
}

.page-hero-compact {
  margin-bottom: 12px;
}

.page-hero-compact h1 {
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  margin-bottom: 4px;
}

.page-hero-compact p {
  margin: 0;
}

.kpi-compact {
  margin-bottom: 12px;
}

.dashboard-acc-body .kpi-compact {
  margin-bottom: 14px;
}

.dashboard-charts .card {
  margin: 0;
}

.dashboard-charts .card h2 {
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.dashboard-charts .card > p.muted {
  margin: 0 0 10px;
  font-size: 0.82rem;
}

.dashboard-charts .chart-wrap {
  height: 200px;
}

.dashboard-charts .dashboard-chart-wide {
  grid-column: 1 / -1;
}

@media (min-width: 1280px) {
  .dashboard-charts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-charts .dashboard-chart-wide {
    grid-column: span 2;
  }
}

.muted { color: var(--muted); font-size: .88rem; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}

.btn:hover { transform: translateY(-1px); }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(200, 243, 29, 0.2);
}

.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 10px 28px rgba(200, 243, 29, 0.3);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.35);
  color: #ffb4b4;
}

.btn-sm { padding: 6px 12px; font-size: .78rem; }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(200, 243, 29, 0.12);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 600;
}

.badge-warn { background: rgba(255, 179, 71, 0.15); color: var(--warn); }

.badge-danger { background: rgba(255, 107, 107, 0.15); color: #ffb4b4; }

.badge-done { background: rgba(200, 243, 29, 0.12); color: #d7f95a; }

.badge-plan { background: rgba(255, 179, 71, 0.15); color: var(--warn); }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }

.alert-error { background: #3a1f1f; color: #ffb4b4; }

.alert-success { background: #1f3a28; color: #b4ffcf; }

.login-card {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 28px 26px 26px;
}

.login-card.card {
  margin-bottom: 0;
}

.login-card h2 {
  margin: 0 0 18px;
  font-size: 1.35rem;
  font-weight: 700;
}

.login-page-brand,
.portal-login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  text-align: center;
}

.login-page-logo,
.portal-login-brand .brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  line-height: 0;
  width: 100%;
}

.login-page-brand-tag,
.portal-login-brand-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(156, 163, 175, 0.85);
  font-weight: 700;
}

.login-brand {
  margin-bottom: 24px;
  text-align: center;
}

.login-brand img,
.login-brand .site-logo,
.login-brand .site-logo-login {
  margin: 0 auto;
  max-height: 260px;
  max-width: min(100%, 420px);
  width: auto;
  height: auto;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-form .field {
  display: block;
  margin: 0;
}

.login-form .field span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-form .field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  line-height: 1.4;
}

.login-form .field input:focus {
  outline: none;
  border-color: rgba(200, 243, 29, 0.45);
}

.login-form input:-webkit-autofill,
.login-form input:-webkit-autofill:hover,
.login-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--bg) inset;
  caret-color: var(--text);
  border: 1px solid var(--border);
}

.login-form .btn-accent {
  margin-top: 4px;
  width: 100%;
  padding: 12px 18px;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.wrap-login .alert {
  width: 100%;
  margin: 0;
}

.portal-box { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }

.client-import-panel {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(200, 243, 29, 0.04);
}

.client-import-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.client-import-panel .muted {
  margin: 0 0 12px;
}

.client-import-actions {
  flex-wrap: wrap;
}

.client-import-file {
  cursor: pointer;
}

.client-import-paste {
  margin-top: 12px;
}

.client-import-paste summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}

.client-import-paste textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.client-import-status--error {
  color: var(--danger);
}

.client-documents-box {
  margin: 18px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.client-documents-box h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.client-documents-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 12px;
}

.client-document-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
}

.client-document-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.client-document-head strong {
  word-break: break-word;
}

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

.client-document-remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--muted);
}

.client-document-remove input {
  width: auto;
  accent-color: var(--accent);
}

.client-document-preview {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.client-document-preview summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
}

.client-document-preview-frame {
  display: block;
  width: 100%;
  min-height: 420px;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.client-document-preview-image {
  display: block;
  width: 100%;
  max-height: 480px;
  margin-top: 10px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
}

.client-document-hint {
  margin: 8px 0 0;
  font-size: 0.82rem;
}

.planned-services-panel {
  margin-bottom: 18px;
}

.planned-services-panel .head-row h2 {
  margin: 0;
}

.portal-box h3 { margin: 0 0 10px; font-size: 1rem; }

.detail-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 12px; }
.detail-item { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.detail-item span { display: block; color: var(--muted); font-size: .82rem; margin-bottom: 4px; }
.detail-item strong { font-size: 1rem; word-break: break-word; }

.field-check { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: .9rem; }

.field-check input { width: auto; accent-color: var(--accent); }

.material-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: end; overflow: visible; }

.device-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  grid-template-areas:
    "picker picker picker remove"
    "name   model  serial ."
    "photo  photo  photo  photo";
  gap: 10px 12px;
  margin-bottom: 0;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.device-row > input[type="hidden"] {
  display: none;
}

.device-row > label.field:has(.device-equipment-select) {
  grid-area: picker;
}

.device-row > .device-name-field {
  grid-area: name;
}

.device-row > label.field:has(.device-model-input) {
  grid-area: model;
}

.device-row > label.field:has(.device-serial-input) {
  grid-area: serial;
}

.device-row > .device-photo-field {
  grid-area: photo;
}

.device-row > .device-remove {
  grid-area: remove;
  align-self: start;
  justify-self: end;
}

.device-row--picked {
  grid-template-areas:
    "picker picker picker remove"
    "model  serial serial ."
    "photo  photo  photo  photo";
}

.device-row--picked .device-name-field {
  display: none !important;
}

#serviceDevices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.device-row .field { overflow: visible; margin: 0; }

.device-photo-field .device-serial-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.device-photo-field .device-serial-photo-btn {
  flex: 1 1 160px;
  min-height: 44px;
}

.device-photo-field .device-serial-preview,
.device-photo-field .serial-photo-grid {
  margin-top: 8px;
}

.device-photo-field .service-photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}

.device-remove {
  align-self: end;
  min-height: 44px;
  min-width: 44px;
}

#add-device-row {
  margin-top: 4px;
}

.material-row .field { overflow: visible; }

.material-autocomplete { position: relative; min-width: 0; }

.material-autocomplete .mat-name { width: 100%; margin: 0; }

.material-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 220px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.material-suggestions[hidden] { display: none !important; }

.material-suggestions li {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.material-suggestions li:hover,
.material-suggestions li.active {
  background: rgba(200, 243, 29, 0.12);
  color: var(--accent);
}

.material-suggestions .s-meta {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.invoice-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
  gap: 10px 12px;
  align-items: end;
  margin-bottom: 12px;
}

.invoice-filter-bar .invoice-filter-search {
  grid-column: 1 / -1;
  min-width: 0;
}

@media (min-width: 992px) {
  .invoice-filter-bar {
    grid-template-columns: minmax(220px, 2fr) repeat(auto-fit, minmax(128px, 1fr)) auto;
  }

  .invoice-filter-bar .invoice-filter-search {
    grid-column: auto;
  }
}

.invoice-filter-bar .invoice-filter-perpage {
  margin: 0;
  min-width: 110px;
}

.invoice-filter-bar .invoice-filter-perpage select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.invoice-filter-summary {
  margin: 0 0 12px;
  font-size: 0.85rem;
}

.invoice-create-card {
  margin-bottom: 18px;
}

.invoice-due-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.invoice-due-row select {
  min-width: 120px;
}

.invoice-due-row input[type="date"] {
  flex: 1;
  min-width: 150px;
}

.invoice-due-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
}

.invoice-due-cell {
  min-width: 190px;
}

.invoice-due-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.invoice-due-form input[type="date"] {
  flex: 1;
  min-width: 130px;
}

.invoice-due-overdue {
  display: inline-block;
  margin-top: 4px;
}

.invoice-create-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.invoice-total-preview {
  margin: 0;
  flex: 1;
  min-width: 140px;
}

.invoice-service-pick {
  margin: 16px 0;
}

.invoice-service-items {
  margin-top: 12px;
}

.invoice-service-items-head {
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.invoice-ai-status[data-state="error"] {
  color: var(--danger, #c0392b);
}

.invoice-service-material-ai label {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.invoice-service-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.invoice-service-cross-hint {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
}

.invoice-service-check-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.invoice-service-material-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.invoice-service-material-item label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}

.invoice-service-material-item label:hover {
  border-color: var(--accent);
}

.invoice-service-material-item input {
  margin-top: 3px;
}

.table-sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.table-sort-link:hover {
  color: var(--accent);
}

.invoice-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
  justify-content: flex-start;
}

.ticket-thread { display: grid; gap: 12px; margin: 16px 0; }
.ticket-message {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
}
.ticket-message.admin { border-color: rgba(200, 243, 29, 0.25); background: rgba(200, 243, 29, 0.06); }
.ticket-message.client { border-color: var(--border); }
.ticket-message-head { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-bottom: 8px; font-size: 0.88rem; }
.ticket-message-body { line-height: 1.55; }
.ticket-reply-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.badge-low { background: rgba(255, 255, 255, 0.08); color: var(--muted); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }

.table-wrap .table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  vertical-align: top;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.table-actions { white-space: nowrap; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.table-actions .badge { font-size: 0.72rem; }

.text-fix-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }

.text-fix-hint { margin: 0; font-size: 0.82rem; color: var(--muted); flex: 1; min-width: 180px; }
.text-fix-status[data-state="ok"] { color: #8fd14f; }
.text-fix-status[data-state="warn"] { color: #e6c84b; }
.text-fix-status[data-state="error"] { color: #ff7b7b; }
.text-fix-status[data-state="busy"] { color: var(--muted); }
.text-fix-busy { opacity: 0.72; }

.service-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.service-photo-thumb {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.service-photo-thumb img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.photo-pending { border-style: dashed; opacity: 0.92; }

.photo-remove-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.photo-remove-check input { width: auto; accent-color: var(--accent); }

.photo-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  border: 0;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.photo-dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  margin-top: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.photo-dropzone.dragover,
.photo-dropzone:hover {
  border-color: rgba(200, 243, 29, 0.45);
  background: rgba(200, 243, 29, 0.04);
}

.photo-dropzone p { margin: 0 0 8px; }

.photo-file-inputs {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.photo-file-native {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.photo-dropzone .btn { margin: 4px; min-height: 40px; }

.photo-count-hint { margin-top: 8px; }

.equipment-used-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.equipment-used-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin-bottom: 12px;
  min-height: 44px;
}

.equipment-used-fields[hidden] {
  display: none !important;
}

.equipment-used-grid {
  margin-bottom: 12px;
}

.equipment-serial-photo-title {
  margin: 0 0 6px;
  font-size: 1rem;
}

.serial-photo-thumb {
  border-color: rgba(200, 243, 29, 0.25);
}

.device-stock-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.device-stock-preview {
  display: block;
  max-width: 240px;
  max-height: 180px;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.serial-photo-dropzone {
  margin-top: 10px;
}

.form-actions .btn { min-height: 44px; }

.footer-note { text-align: center; font-size: .75rem; color: var(--muted); margin-top: 24px; opacity: .8; }

/* ——— Pracovný kalendár (FullCalendar) ——— */
.calendar-card-head {
  align-items: flex-start;
}

.calendar-card-desc {
  margin: 4px 0 0;
  max-width: 680px;
}

.calendar-card-actions {
  margin: 0;
}

.calendar-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 0;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-2);
  min-height: 620px;
}

.calendar-main {
  padding: 14px 14px 18px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.calendar-main #workCalendar {
  margin-top: 0;
}

.calendar-agenda {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: #141614;
}

.calendar-agenda-toolbar {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px auto;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(200, 243, 29, 0.12), rgba(200, 243, 29, 0.02));
}

.calendar-agenda-range {
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  padding: 0 2px;
}

.calendar-agenda-nav {
  min-width: 34px;
  padding: 6px 0;
}

.calendar-agenda-summary {
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.calendar-agenda-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
  max-height: 420px;
}

.calendar-agenda-empty {
  margin: 0;
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.calendar-agenda-empty .muted {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
}

.calendar-agenda-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.calendar-agenda-item:hover,
.calendar-agenda-item.active {
  border-color: rgba(200, 243, 29, 0.35);
  background: rgba(200, 243, 29, 0.08);
}

.calendar-agenda-item-day {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.35;
}

.calendar-agenda-item-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.calendar-agenda-item-main strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-agenda-item-meta {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-agenda-hours {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.calendar-agenda-hours.muted {
  color: var(--muted);
  font-weight: 500;
}

.calendar-agenda-item-done { border-left: 3px solid #6b8f14; }

.calendar-agenda-item-plan { border-left: 3px solid #b87800; }

.calendar-agenda-item-late { border-left: 3px solid #b04040; }

.calendar-agenda-detail {
  border-top: 1px solid var(--border);
  padding: 12px 14px 14px;
  background: rgba(255, 255, 255, 0.02);
}

.calendar-agenda-detail[hidden] {
  display: none !important;
}

.calendar-agenda-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.calendar-agenda-detail-head strong {
  font-size: 0.92rem;
}

.calendar-agenda-detail-body {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-detail-row {
  display: grid;
  gap: 2px;
}

.calendar-detail-row span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-detail-row strong {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.calendar-detail-link {
  width: 100%;
  justify-content: center;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 14px 0 4px;
  font-size: 0.84rem;
  color: var(--muted);
}

.calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.calendar-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.calendar-dot-done { background: #6b8f14; }

.calendar-dot-plan { background: #b87800; }

.calendar-dot-late { background: #b04040; }

.calendar-dot-blocked { background: #6b6b78; }

.calendar-day-blocked .fc-daygrid-day-frame {
  background: repeating-linear-gradient(
    -45deg,
    rgba(120, 120, 140, 0.08),
    rgba(120, 120, 140, 0.08) 6px,
    rgba(80, 80, 95, 0.12) 6px,
    rgba(80, 80, 95, 0.12) 12px
  );
}

.calendar-day-blocked .fc-daygrid-day-number {
  color: var(--muted);
}

.fc .calendar-day-blocked-event {
  background: rgba(120, 120, 140, 0.22) !important;
  opacity: 1 !important;
}

.calendar-detail-card[hidden] { display: none !important; }

.fc {
  --fc-border-color: var(--border);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: rgba(255, 255, 255, 0.03);
  --fc-list-event-hover-bg-color: rgba(200, 243, 29, 0.08);
  --fc-today-bg-color: rgba(200, 243, 29, 0.07);
  color: var(--text);
}

.fc .fc-toolbar-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.fc .fc-col-header-cell {
  background: linear-gradient(180deg, rgba(200, 243, 29, 0.14), rgba(200, 243, 29, 0.04));
}

.fc .fc-col-header-cell-cushion {
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.fc .fc-button {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  text-transform: none;
  box-shadow: none;
}

.fc .fc-button:hover,
.fc .fc-button:focus {
  background: rgba(200, 243, 29, 0.1);
  border-color: rgba(200, 243, 29, 0.35);
  color: var(--text);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.fc-theme-standard td,
.fc-theme-standard th {
  border-color: var(--border);
}

.fc-theme-standard .fc-scrollgrid {
  border-color: var(--border);
}

.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
  color: var(--muted);
  text-decoration: none;
}

.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
  color: var(--accent);
  font-weight: 700;
}

.fc .fc-event {
  border-radius: 4px;
  padding: 1px 2px;
  font-size: 0.76rem;
  cursor: pointer;
}

.fc .fc-event .fc-event-title-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-tooltip {
  position: fixed;
  z-index: 10050;
  max-width: min(320px, calc(100vw - 16px));
  padding: 10px 12px;
  background: var(--surface, #1a1d21);
  color: var(--text, #e8eaed);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-line;
  pointer-events: none;
}

.calendar-event-tooltip[hidden] {
  display: none !important;
}

.fc .fc-list-event-title a {
  color: var(--text);
}

/* ——— AI pomocník ——— */
.ai-assistant-page { max-width: 100%; }

.ai-setup-steps {
  margin: 12px 0 16px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.ai-code-block {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
}

.ai-photo-box {
  margin: 14px 0;
  border: 1px dashed rgba(200, 243, 29, 0.35);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.ai-photo-actions { text-align: center; }

.ai-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 8px;
}

.ai-photo-preview img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #000;
}

.ai-result-body {
  line-height: 1.6;
  font-size: 0.92rem;
}

.ai-result-body h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
  color: var(--accent);
}

.ai-result-body h3:first-child { margin-top: 0; }

.ai-result-body h4 {
  margin: 12px 0 6px;
  font-size: 0.92rem;
}

.ai-result-actions { margin-top: 16px; }

.ai-provider-badge {
  margin: 0 0 12px;
  font-size: 0.84rem;
}

.ai-setup-details {
  margin-top: 14px;
  color: var(--muted);
}

.ai-setup-details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

#aiAnalyzeStatus[data-state="ok"] { color: #8fd14f; }
#aiAnalyzeStatus[data-state="error"] { color: #ff7b7b; }
#aiAnalyzeStatus[data-state="busy"] { color: var(--muted); }

@media (max-width: 900px) {
  .ai-assistant-grid.two-col .card:first-child,
  .ai-assistant-grid.two-col .card:last-child {
    order: unset;
  }
}

/* Kompaktný režim: tablet / menší notebook (sidebar do overlay) */
@media (max-width: 1199px) {
  .calendar-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .calendar-main {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .calendar-agenda-list {
    max-height: none;
  }

  .admin-shell {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100dvh;
    height: 100vh;
    width: min(292px, 88vw);
    max-width: 88vw;
    transform: translateX(-100%);
    transition: transform 0.22s ease, visibility 0.22s;
    visibility: hidden;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 200;
    flex-shrink: unset;
  }

  .admin-shell.sidebar-open .admin-sidebar {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .admin-backdrop {
    z-index: 190;
  }

  .sidebar-toggle { display: flex; }

  .admin-main {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
  }

  .admin-content {
    padding: 16px 14px 28px;
    max-width: 100%;
  }

  .admin-topbar {
    padding: 0 12px;
    gap: 8px;
    min-height: 54px;
    padding-left: max(12px, env(safe-area-inset-left, 0));
    padding-right: max(12px, env(safe-area-inset-right, 0));
  }

  .admin-topbar-actions { display: none; }

  .admin-breadcrumb {
    font-size: 0.82rem;
    min-width: 0;
  }

  .sidebar-link {
    min-height: 44px;
    margin: 2px 10px;
    padding: 12px 14px;
  }

  .sidebar-group-summary {
    min-height: 44px;
    margin: 2px 10px;
    padding: 12px 14px;
  }

  .sidebar-brand {
    padding-top: calc(16px + env(safe-area-inset-top, 0));
  }

  .page-hero {
    padding: 0 2px;
  }
}

.doc-preview { border: 1px solid var(--border); border-radius: 12px; padding: 20px; background: #fff; color: #111; }

.fiber-plan-box,
.fiber-plan-card {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2, rgba(255, 255, 255, 0.03));
}

.fiber-plan-toggle { margin-bottom: 12px; }

.fiber-plan-hint { font-size: 0.88rem; margin: 0 0 12px; }

.fiber-plan-table-wrap { margin-top: 8px; }

.fiber-plan-table th,
.fiber-plan-table td { vertical-align: middle; }

.fiber-color-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fiber-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.fiber-plan-input {
  width: 100%;
  min-width: 0;
}

.fiber-color--biela,
.fiber-color--zlta,
.fiber-color--oranzova {
  border-color: rgba(255, 255, 255, 0.35);
}

@media (max-width: 991px) {
  .grid, .two-col, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .dashboard-charts { grid-template-columns: 1fr; }
  .dashboard-charts .dashboard-chart-wide { grid-column: auto; }
  .material-row { grid-template-columns: 1fr 1fr; }
  .material-row .mat-remove { grid-column: 1 / -1; justify-self: start; min-height: 44px; min-width: 44px; }
  .two-col .card:first-child { order: 2; }
  .two-col .card:last-child { order: 1; }
}

@media (max-width: 991px) {
  .wrap { padding: 16px 14px 36px; }

  .wrap-login {
    width: min(100%, 500px);
    padding: 16px 14px;
  }

  .login-card {
    padding: 24px 20px 22px;
  }

  .login-page-brand,
  .portal-login-brand {
    margin-bottom: 16px;
    gap: 8px;
  }

  .site-logo-login,
  .login-page-brand .site-logo-login,
  .login-page-logo .site-logo-login,
  .login-page-logo img,
  .portal-login-brand .site-logo-login,
  .portal-login-brand .brand-logo img,
  .login-brand .site-logo-login {
    max-height: 150px;
    max-width: min(100%, 280px);
    width: auto;
    object-fit: contain;
    object-position: center top;
  }

  .portal-login-shell {
    padding: 14px 14px 20px;
    justify-content: flex-start;
    padding-top: max(14px, env(safe-area-inset-top, 0px));
    min-height: 100dvh;
  }

  body.portal-login-page .portal-login {
    padding: 22px 18px;
  }

  .brand { flex-direction: column; gap: 10px; }

  .brand h1 { font-size: 1.15rem; }

  .card { padding: 16px; border-radius: 14px; }

  .kpi {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .kpi .stat-card,
  .kpi .stat {
    min-height: 68px;
  }

  .kpi .stat-value {
    font-size: 1.15rem;
  }

  .page-head {
    margin-bottom: 16px;
  }

  .page-head h1 {
    font-size: 1.28rem;
    line-height: 1.25;
  }

  .page-head p {
    font-size: 0.86rem;
  }

  .page-hero h1 {
    font-size: 1.45rem;
  }

  .page-hero p {
    font-size: 0.88rem;
  }

  .quick-actions {
    gap: 8px;
    margin-bottom: 22px;
  }

  .quick-actions .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    justify-content: center;
    padding: 11px 12px;
    font-size: 0.82rem;
  }

  .section-head {
    margin-bottom: 14px;
    padding: 10px 12px;
  }

  .head-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .head-row .btn { width: 100%; justify-content: center; }

  .btn-row .btn, .form-actions .btn, .table-actions .btn { min-height: 44px; }

  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }

  .material-row { grid-template-columns: 1fr; }

  .device-row,
  .device-row--picked {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "picker remove"
      "name name"
      "model model"
      "serial serial"
      "photo photo";
  }

  .device-row--picked {
    grid-template-areas:
      "picker remove"
      "model model"
      "serial serial"
      "photo photo";
  }

  .device-row > .device-remove {
    width: 44px;
    justify-self: end;
  }

  .admin-page .table-scroll-only,
  .admin-page .table-wrap.table-scroll-wrap .table {
    font-size: 0.84rem;
    min-width: 480px;
  }

  .admin-page .table-wrap:not(.table-scroll-wrap) .table:not(.table-scroll-only) {
    font-size: 0.88rem;
  }

  .admin-page table.table.table-mobile-cards {
    font-size: 0.88rem;
  }

  .table th, .table td { padding: 10px 6px; }

  .table-wrap {
    margin: 0;
    padding: 0;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-item {
    padding: 12px;
  }

  .photo-dropzone { padding: 14px; }

  .photo-dropzone .btn { width: 100%; }

  .text-fix-row { flex-direction: column; align-items: stretch; }

  .text-fix-row .btn { width: 100%; min-height: 44px; }

  .text-fix-hint { min-width: 0; }

  .service-photo-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }

  .ticket-thread .ticket-message {
    padding: 12px;
  }

  .admin-breadcrumb-current {
    max-width: 52vw;
  }
}

@media (max-width: 420px) {
  .kpi { grid-template-columns: 1fr; }

  .admin-content { padding: 12px 10px 24px; }

  .card { padding: 14px; }

  .btn-row .btn { flex: 1 1 calc(50% - 4px); min-width: 0; }
}

.technician-map {
  width: 100%;
  height: min(62vh, 520px);
  min-height: 320px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.poloha-grid .span-2 { grid-column: span 2; }

.poloha-device-list,
.poloha-location-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.poloha-device-item,
.poloha-location-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.poloha-location-item.is-stale {
  border-color: rgba(255, 179, 71, 0.35);
  background: rgba(255, 179, 71, 0.06);
}

.poloha-map-link {
  margin-left: 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.poloha-map-link:hover {
  text-decoration: underline;
}

.poloha-toolbar {
  margin: 0;
  align-items: center;
}

.poloha-help-list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.55;
}

.poloha-help-list li + li {
  margin-top: 6px;
}

.poloha-marker-wrap {
  background: transparent;
  border: none;
}

.poloha-marker {
  display: block;
  width: 18px;
  height: 18px;
  margin: 5px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #0a0a0a;
  box-shadow: 0 0 0 2px rgba(200, 243, 29, 0.45);
}

.poloha-marker.is-stale {
  background: var(--warn);
  box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.45);
}

.technician-gps-status {
  margin: 0 10px 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.78rem;
  line-height: 1.35;
}

.technician-gps-status--ok {
  border-color: rgba(200, 243, 29, 0.35);
  color: var(--accent);
}

.technician-gps-status--error {
  border-color: rgba(255, 107, 107, 0.35);
  color: #ffb4b4;
}

.technician-gps-status--idle {
  color: var(--muted);
}

@media (max-width: 900px) {
  .poloha-grid .span-2 { grid-column: auto; }
  .technician-map { height: 48vh; min-height: 280px; }
}

.group-client-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2, rgba(255, 255, 255, 0.03));
}

.group-client-picker-tickets {
  max-height: 220px;
  margin-bottom: 4px;
}

.group-client-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.group-client-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.group-client-option input {
  margin-top: 3px;
}

.group-client-option code {
  margin-left: 6px;
  font-size: 0.82rem;
}

.group-sign-link {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.78rem;
}

.group-sign-table td {
  vertical-align: top;
}

/* ── Mobilný admin panel ── */

.admin-page {
  -webkit-tap-highlight-color: rgba(200, 243, 29, 0.15);
}

.admin-page .admin-content {
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0));
}

@media (max-width: 991px) {
  .admin-page input,
  .admin-page select,
  .admin-page textarea {
    font-size: 16px;
    min-height: 44px;
  }

  .admin-page .btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .admin-page .btn-row .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    justify-content: center;
  }

  .admin-page form.btn-row {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-page form.btn-row input,
  .admin-page form.btn-row select,
  .admin-page form.btn-row .btn {
    width: 100%;
    flex: none;
    min-width: 0;
  }

  .admin-page .head-row .btn-row .btn {
    flex: 1 1 100%;
  }

  .admin-page .head-row .btn-row {
    width: 100%;
  }

  .admin-page .dashboard-acc-head {
    min-height: 52px;
    padding: 14px 16px;
  }

  .admin-page .dashboard-acc-text .muted {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .admin-page .dashboard-acc-body {
    padding: 12px 12px 16px;
  }

  .admin-page .chart-wrap {
    height: 220px;
  }

  .admin-page .calendar-shell {
    min-height: 0;
  }

  .admin-page .calendar-main {
    padding: 10px 8px 14px;
  }

  .admin-page .calendar-agenda-toolbar {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }

  .admin-page .calendar-agenda-toolbar .btn:last-child {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }

  .admin-page .calendar-agenda-list {
    max-height: none;
  }

  .admin-page .technician-map {
    height: min(52vh, 420px);
    min-height: 260px;
  }

  .admin-page .collapse-panel > summary {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .admin-page table.table.table-mobile-cards {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .admin-page table.table.table-mobile-cards thead {
    display: none;
  }

  .admin-page table.table.table-mobile-cards tbody tr {
    display: block;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
  }

  .admin-page table.table.table-mobile-cards tbody tr.row-highlight {
    border-color: rgba(200, 243, 29, 0.35);
    background: rgba(200, 243, 29, 0.06);
  }

  .admin-page table.table.table-mobile-cards td {
    display: grid;
    grid-template-columns: minmax(96px, 34%) 1fr;
    gap: 8px 12px;
    align-items: start;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    white-space: normal;
  }

  .admin-page table.table.table-mobile-cards td:last-child {
    border-bottom: none;
  }

  .admin-page table.table.table-mobile-cards td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.35;
  }

  .admin-page table.table.table-mobile-cards td.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    white-space: normal;
  }

  .admin-page table.table.table-mobile-cards td.table-actions::before {
    flex: 1 1 100%;
    content: 'Akcie';
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.35;
  }

  .admin-page table.table.table-mobile-cards td.table-actions .btn {
    flex: 1 1 calc(50% - 4px);
    width: auto;
    min-width: 0;
    justify-content: center;
  }

  .admin-page table.table.table-mobile-cards td.table-actions form {
    flex: 1 1 calc(50% - 4px);
    width: auto;
    min-width: 0;
  }

  .admin-page table.table.table-mobile-cards td.table-actions form .btn {
    width: 100%;
  }

  .admin-page .table-wrap:not(.table-scroll-wrap) {
    overflow: visible;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
  }

  .admin-page .table-wrap.table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  .admin-page .table-wrap.table-scroll-wrap::after {
    content: 'Posuňte prstom do strany →';
    display: block;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: center;
  }

  .admin-page .table-wrap.table-scroll-wrap .table {
    min-width: 560px;
  }

  .admin-page .reschedule-dialog {
    width: calc(100vw - 24px);
    max-width: 26rem;
  }

  .admin-page .reschedule-dialog-inner .btn-row .btn {
    width: 100%;
  }

  .admin-page .alert {
    line-height: 1.45;
  }

  .admin-page .kpi .stat-hint {
    font-size: 0.72rem;
    line-height: 1.35;
  }
}

@media (max-width: 480px) {
  .admin-page .quick-actions .btn {
    flex: 1 1 100%;
    font-size: 0.88rem;
  }

  .admin-page .btn-row .btn {
    flex: 1 1 100%;
  }

  .admin-page .kpi {
    grid-template-columns: 1fr;
  }

  .admin-page table.table.table-mobile-cards td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .admin-page table.table.table-mobile-cards td[data-label]::before {
    margin-bottom: 2px;
  }

  .admin-page .admin-breadcrumb-current {
    max-width: 42vw;
  }
}

.calendar-shell-rental {
  grid-template-columns: minmax(0, 1fr) 280px;
}

.calendar-main-full #rentalCalendar {
  min-height: 520px;
}

.calendar-agenda-rental .calendar-agenda-detail {
  padding: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Dotykové zariadenia — Latitude 5290 2-in-1 a podobné tablety */
@media (hover: none), (pointer: coarse) {
  html.theme-modern {
    touch-action: manipulation;
  }

  .admin-page .btn,
  .admin-page .table-actions .btn,
  .admin-page .form-actions .btn,
  .admin-page .btn-row .btn {
    min-height: 44px;
  }

  .admin-page .btn-sm {
    min-height: 40px;
    padding: 8px 14px;
  }

  .admin-page input:not([type="checkbox"]):not([type="radio"]),
  .admin-page select,
  .admin-page textarea {
    font-size: 16px;
    min-height: 44px;
  }

  .admin-page textarea {
    min-height: 96px;
  }

  .admin-page input[type="checkbox"],
  .admin-page input[type="radio"] {
    width: 20px;
    height: 20px;
    min-height: 20px;
    accent-color: var(--accent);
  }

  .admin-page label:has(input[type="checkbox"]),
  .admin-page label:has(input[type="radio"]) {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
  }

  .sidebar-toggle {
    width: 48px;
    height: 48px;
  }

  .sidebar-link,
  .sidebar-group-summary {
    min-height: 48px;
    padding: 13px 16px;
  }

  .admin-page .table-sort-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 6px 0;
  }

  .admin-page .table-actions {
    gap: 8px;
  }

  .admin-page .table-actions .btn-sm {
    min-height: 44px;
    min-width: 44px;
  }

  .fc .fc-button {
    min-height: 44px;
    padding: 8px 14px;
  }

  .fc .fc-daygrid-day-number,
  .fc .fc-col-header-cell-cushion {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-page .dashboard-acc-head,
  .admin-page .collapse-panel > summary {
    min-height: 48px;
  }

  .admin-page .btn:hover {
    transform: none;
  }

  .admin-page .topbar-btn,
  .admin-page .admin-user-chip,
  .admin-page .sidebar-logout-btn {
    min-height: 44px;
  }

  .admin-page .sidebar-logout-btn {
    width: 100%;
  }
}

/* ── Responzívne vrstvy podľa zariadenia ── */

/* Notebook / tablet na šírku: sidebar skrytý, obsah stále viacstĺpcový */
@media (min-width: 992px) and (max-width: 1199px) {
  .admin-page .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-page .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-page .kpi {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .admin-page .material-row {
    grid-template-columns: 1.5fr 1fr 1fr;
  }

  .admin-page .material-row .mat-remove {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .admin-page .table-wrap.table-scroll-wrap .table {
    min-width: 640px;
  }
}

/* Telefón */
@media (max-width: 767px) {
  .admin-page .admin-content {
    padding: 14px 12px 28px;
  }

  .admin-page .card {
    padding: 14px;
    border-radius: 12px;
  }

  .admin-page .page-head h1 {
    font-size: 1.22rem;
  }

  .admin-page .head-row h2,
  .admin-page .card h2 {
    font-size: 1rem;
  }

  .admin-page .invoice-filter-bar {
    grid-template-columns: 1fr;
  }

  .admin-page .invoice-filter-bar .field,
  .admin-page .invoice-filter-bar .btn {
    width: 100%;
  }

  .admin-page .invoice-pagination {
    justify-content: center;
  }

  .admin-page .invoice-pagination .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    justify-content: center;
  }

  .admin-page table.table.table-mobile-cards td.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
  }

  .admin-page table.table.table-mobile-cards td.table-actions::before {
    flex: 1 1 100%;
    content: 'Akcie';
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }

  .admin-page table.table.table-mobile-cards td.table-actions .btn,
  .admin-page table.table.table-mobile-cards td.table-actions form {
    flex: 1 1 calc(50% - 4px);
    width: auto;
    min-width: 0;
  }

  .admin-page .device-row,
  .admin-page .material-row {
    padding: 10px;
  }

  .admin-page .timer-display {
    font-size: clamp(1.6rem, 8vw, 2.2rem);
  }
}

/* Veľmi úzke displeje */
@media (max-width: 480px) {
  .admin-page .admin-topbar {
    min-height: 50px;
  }

  .admin-page .admin-breadcrumb {
    font-size: 0.78rem;
  }

  .admin-page .stat-value {
    font-size: 1.35rem;
  }
}

/* html.layout-compact — trieda z admin-shell.js */
html.layout-compact .admin-page .two-col {
  grid-template-columns: 1fr;
}

html.layout-compact .admin-page .two-col .card:first-child {
  order: 2;
}

html.layout-compact .admin-page .two-col .card:last-child {
  order: 1;
}

html.layout-phone .admin-page .kpi {
  grid-template-columns: 1fr;
}

html.layout-phone .admin-page .quick-actions .btn,
html.layout-phone .admin-page .btn-row .btn {
  flex: 1 1 100%;
}

/* Kratší displej v landscape (5290: 1280px výška) */
@media (max-height: 860px) and (orientation: landscape) {
  .admin-page .admin-content {
    padding-top: 12px;
    padding-bottom: 20px;
  }

  .admin-page .page-head {
    margin-bottom: 12px;
  }

  .admin-page .quick-actions {
    margin-bottom: 16px;
  }

  .admin-page .kpi {
    gap: 8px;
  }

  .admin-page .technician-map {
    height: min(48vh, 380px);
    min-height: 240px;
  }
}

@media print {
  body { background: #fff; color: #000; }
  .admin-sidebar, .admin-topbar, .sidebar-toggle, .admin-backdrop,
  .btn-row, .head-row .btn, form:not(.doc-body) { display: none !important; }
  .admin-content { padding: 0; max-width: none; }
  .wrap { max-width: none; padding: 0; }
  .card { border: none; padding: 0; }
}
