@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --primary:        #009bca;
  --primary-hover:  #0083ab;
  --primary-light:  #e6f6fb;
  --surface:        #FFFFFF;
  --surface-alt:    #F9FAFB;
  --surface-hover:  #F3F4F6;
  --border:         #E5E7EB;
  --border-strong:  #D1D5DB;
  --text:           #111827;
  --text-secondary: #6B7280;
  --text-muted:     #9CA3AF;
  --error:          #DC2626;
  --error-light:    #FEF2F2;
  --success:        #059669;
  --warning-light:  #FFFBEB;
  --warning-text:   #92400E;
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

/* ── Dark theme — exact Claude.ai tokens ────────────────── */
[data-theme="dark"] {
  --primary:        #4cbdd9;
  --primary-hover:  #3aaac6;
  --primary-light:  rgba(76,189,217,.18);
  --surface:        #30302e;
  --surface-alt:    #262624;
  --surface-hover:  #3a3836;
  --border:         #3a3836;
  --border-strong:  #48463f;
  --text:           #faf9f5;
  --text-secondary: #c2c0b6;
  --text-muted:     #9c9a92;
  --error:          #e05d5d;
  --error-light:    rgba(224,93,93,.15);
  --success:        #4caf7d;
  --warning-light:  rgba(234,179,8,.12);
  --warning-text:   #eab308;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-alt);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: .5em 0; }
img { max-width: 100%; }

/* ── App layout (sidebar + content) ────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.content-area {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  height: 100vh;
  background: var(--surface-alt);
}

/* ── Page layout ────────────────────────────────────────── */
.page-container {
  max-width: 100%;
  padding: 0 24px 24px;
  overflow-x: auto;
}
.page-title {
  height: 52px;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 20px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.015em;
}

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin: 20px 0 !important;
  overflow-x: auto;
  max-width: 100%;
}
.card-body {
  padding: 16px 20px;
}
.card-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Filter form ────────────────────────────────────────── */
.filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
/* Explicit row — full-width, items fill available space */
.filter-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
}
/* Wrapping row for pages with many optional fields */
.filter-row-single {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 0 0 auto;
}

/* ── Filter row: selects grow to fill full width evenly ─── */
/* All select form-groups flex-grow (except anchored date-width) */
.filter-row .form-group:not(.fg-date-width):not(.fg-action):has(select) {
  flex: 1 1 110px;
  min-width: 0;
}
.filter-row .form-group:not(.fg-date-width):has(select) select {
  width: 100%;
}
/* Date range: fixed natural size (2 inputs + triggers + dash) */
.filter-row .form-group:has(.date-range-wrap) {
  flex: 0 0 auto;
}
/* Text inputs stay fixed unless .fg-grow */
.filter-row .form-group:not(.fg-grow):has(input[type="text"]:not(.date-pick)) input[type="text"] {
  width: 100px;
}

/* .fg-grow: fills remaining space (search fields, long text inputs) */
.fg-grow {
  flex: 1 1 auto !important;
  min-width: 140px;
}
.fg-grow input[type="text"],
.fg-grow input[type="search"],
.fg-grow textarea {
  width: 100%;
}

/* .fg-date-width: fixed width matching date-range footprint */
.fg-date-width {
  flex: 0 0 auto;
}
.fg-date-width select,
.fg-date-width input[type="text"] {
  min-width: 260px;
  width: 100%;
}

/* .fg-action: submit button, pushed to far right */
.fg-action {
  flex: 0 0 auto;
  align-self: flex-end;
  margin-left: auto;
}

/* ── Form labels ─────────────────────────────────────────── */
.form-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}
.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.filter-checkbox input { cursor: pointer; }

/* ── Legacy filter width overrides (kept for compat) ─────── */
.fg-date-width select[name="site"],
.fg-date-width select[name="id_org"] { min-width: 240px; }

/* ── Form elements ──────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  max-width: 100%;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,155,202,.15);
}
select { cursor: pointer; }
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input.error, select.error { border-color: var(--error) !important; }

/* ── Buttons ────────────────────────────────────────────── */
.btn, button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, box-shadow .15s, border-color .15s;
  text-decoration: none;
}
.btn-primary, input[type="submit"] {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover, input[type="submit"]:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  text-decoration: none;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  text-decoration: none;
}
.btn-danger {
  background: var(--surface);
  color: var(--error);
  border-color: #FECACA;
}
.btn-danger:hover { background: var(--error-light); text-decoration: none; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* ── Help badge ─────────────────────────────────────────── */
.help-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Order cards ────────────────────────────────────────── */
.order-list { display: flex; flex-direction: column; gap: 16px; }

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
}
.order-header {
  padding: 14px 20px 12px;
  background: var(--surface-alt);
  border-bottom: 2px solid var(--border);
}
.order-header-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 6px;
}
.order-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.order-date {
  font-size: 13px;
  color: var(--text-secondary);
}
.order-date strong { color: var(--text); font-weight: 500; }
.order-user {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.order-user a { color: var(--primary); }
.order-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--text-secondary);
}
.order-meta strong { color: var(--text); font-weight: 500; }
.order-total {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-blue    { background: var(--primary-light); color: var(--primary); }
.badge-yellow  { background: #FEF3C7; color: #92400E; }
.badge-red     { background: var(--error-light); color: var(--error); }
.badge-green   { background: #ECFDF5; color: var(--success); }
.badge-gray    { background: var(--surface-hover); color: var(--text-secondary); }

/* ── Order items (rows inside card) ─────────────────────── */
.order-items { border-top: 1px solid var(--border); }
.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.order-item:last-child { border-bottom: none; }
.order-item-info { flex: 1; min-width: 0; }
.order-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-item-name span { color: var(--text-secondary); font-weight: 400; }
.order-item-org { color: var(--text-muted); font-size: 11px; margin-left: 4px; font-weight: 400; }
.order-item-meta { font-size: 12px; color: var(--text-secondary); font-weight: 400; }
.order-item-meta strong { color: var(--text); font-weight: 500; }
.order-item-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn-disabled { opacity: 0.35; cursor: default; }
.icon-btn-disabled:hover { background: transparent; color: var(--text-secondary); }

/* ── Alert rows ─────────────────────────────────────────── */
.alert-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.alert-row-warning { background: var(--warning-light); color: var(--warning-text); }
.alert-row-info    { background: var(--surface-alt); color: var(--text-secondary); }
.alert-row-pink    { background: #FFF0F6; color: #9D174D; }

/* ── Section details (tourist vouchers, reservations) ───── */
.order-section {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.order-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.order-section p { margin: 2px 0; color: var(--text-secondary); }
.order-section p strong { color: var(--text); font-weight: 500; }
.order-section-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.order-error { font-size: 12px; font-weight: 600; color: var(--error); }
.order-error-msg { font-size: 12px; color: var(--error); margin-top: 2px; }

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 4px 0;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: all .15s;
}
.pagination a:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.pagination span.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination span.disabled { opacity: .4; cursor: default; }
.pagination-info { font-size: 12px; color: var(--text-secondary); }

/* ── Sidebar theme tokens ────────────────────────────────── */
:root {
  --sb-bg:          #262624;
  --sb-hover:       #30302e;
  --sb-border:      #3a3836;
  --sb-text:        #c2c0b6;
  --sb-text-hover:  #faf9f5;
  --sb-muted:       #9c9a92;
  --sb-logo-filter: brightness(0) invert(1) opacity(0.28);
}
[data-theme="light"] {
  --sb-bg:          #faf9f5;
  --sb-hover:       #f0ede6;
  --sb-border:      #e8e5de;
  --sb-text:        #3d3b36;
  --sb-text-hover:  #1c1a18;
  --sb-muted:       #9c9a92;
  --sb-logo-filter: brightness(0) opacity(0.55);
}

/* ── Sidebar — exact Claude.ai colors ───────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  width: 240px;
  min-width: 240px;
  height: 100vh;
  background: var(--sb-bg);
  font-family: var(--font);
  transition: width .2s ease, min-width .2s ease;
  position: sticky;
  top: 0;
}
.sidebar.collapsed {
  width: 52px;
  min-width: 52px;
}
.sidebar-header {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 6px 0 12px;
  flex-shrink: 0;
  gap: 4px;
  border-bottom: 1px solid var(--sb-border);
}
.sidebar-logo-img {
  flex: 1; min-width: 0; overflow: hidden;
  display: flex; align-items: center;
}
.sidebar-logo-img img {
  max-height: 26px;
  width: auto;
  filter: var(--sb-logo-filter);
  display: block;
}
.sidebar-collapse-btn {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 6px;
  background: transparent; border: none;
  cursor: pointer;
  color: var(--sb-muted);
  transition: background .15s, color .15s;
  padding: 0;
}
.sidebar-collapse-btn:hover { background: var(--sb-hover); color: var(--sb-text-hover); }
.sidebar-collapse-btn svg { width: 16px; height: 16px; display: block; transition: transform .2s ease; }

/* ── Collapsed sidebar ──────────────────────────────────── */
.sidebar.collapsed .sidebar-logo-img { display: none; }
.sidebar.collapsed .sidebar-header { padding: 0; justify-content: center; border-bottom: 1px solid var(--sb-border); }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: scaleX(-1); }
.sidebar.collapsed .nav-section-btn {
  padding: 9px 0;
  justify-content: center;
  border-radius: 6px;
  border: none;
}
.sidebar.collapsed .nav-section-btn:hover { background: var(--sb-hover); color: var(--sb-text-hover); }
.sidebar.collapsed .nav-section-btn:first-child { padding-top: 9px; }
.sidebar.collapsed .nav-section-btn-icon { width: 18px; height: 18px; opacity: 0.75; }
.sidebar.collapsed .nav-section-btn-icon svg { width: 16px; height: 16px; }
.sidebar.collapsed .nav-section-btn-label { display: none; }
.sidebar.collapsed .nav-chevron { display: none; }
.sidebar.collapsed .nav-group { display: none !important; max-height: 0 !important; overflow: hidden !important; }
.sidebar.collapsed .logout-btn span { display: none; }
.sidebar.collapsed .logout-btn { justify-content: center; padding: 7px 0; width: 100%; }
.sidebar.collapsed .sidebar-footer-row { flex-direction: column; align-items: center; gap: 4px; justify-content: center; }

/* Keep old .sidebar-logo for any pages not yet updated */
.sidebar-logo {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 14px;
  flex-shrink: 0;
}
.sidebar-logo img {
  max-height: 36px;
  width: auto;
  filter: var(--sb-logo-filter);
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--sb-border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sb-border); border-radius: 4px; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--sb-muted);
  padding: 18px 14px 4px;
  display: block;
}
.nav-section-label:first-child { padding-top: 10px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--sb-text);
  border-radius: 6px;
  margin: 1px 6px;
  transition: background .1s, color .1s;
  text-decoration: none;
  min-width: 0;
}
.nav-link-icon {
  flex-shrink: 0;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.55;
}
.nav-link-icon svg { width: 14px; height: 14px; display: block; }
.nav-link-text {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-link:hover { background: var(--sb-hover); color: var(--sb-text-hover); text-decoration: none; }
.nav-link.active { background: var(--sb-hover); color: var(--sb-text-hover); font-weight: 500; }
.sidebar-footer {
  border-top: 1px solid var(--sb-border);
  padding: 8px 6px;
  flex-shrink: 0;
}
.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 400;
  color: var(--sb-muted);
  border-radius: 6px;
  transition: background .1s, color .1s;
  text-decoration: none;
}
.logout-btn:hover { background: var(--sb-hover); color: var(--sb-text); text-decoration: none; }
.logout-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Theme toggle & footer row ──────────────────────────── */
.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--sb-muted);
  transition: background .1s, color .1s;
  flex-shrink: 0;
  padding: 0;
}
.theme-toggle:hover { background: var(--sb-hover); color: var(--sb-text); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }
.theme-toggle[data-theme="dark"] .icon-moon { display: block; }
.theme-toggle[data-theme="dark"] .icon-sun  { display: none; }

/* ── Collapsible nav groups ──────────────────────────────── */
.nav-section-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 18px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--sb-muted);
  transition: color .1s;
  height: auto;
  border-radius: 0;
}
.nav-section-btn:first-child { padding-top: 10px; }
.nav-section-btn:hover { color: var(--sb-text); background: none; }
.nav-section-btn-icon {
  flex-shrink: 0;
  width: 15px; height: 15px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.6;
}
.nav-section-btn-icon svg { width: 13px; height: 13px; display: block; }
.nav-section-btn-label { flex: 1; text-align: left; }
.nav-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform .2s ease;
  color: var(--sb-muted);
}
.nav-section-btn.collapsed .nav-chevron { transform: rotate(-90deg); }

/* ── Dashboard (index.tpl) ──────────────────────────────── */
.dash-section { margin-bottom: 20px; }
.dash-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border);
}
.dash-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 12px 20px;
}
.login-row {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.login-row:last-child { border-bottom: none; }
.login-ok { color: var(--success); font-weight: 500; }
.login-err { color: var(--error); font-weight: 500; }

/* ── Scorecards ─────────────────────────────────────────── */
.scorecard-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.scorecard {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.scorecard:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.scorecard-today {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-alt));
}
.scorecard-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.scorecard-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.scorecard-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}
@media (max-width: 900px) {
  .scorecard-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 600px) {
  .scorecard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Form tables (label + input two-column layout) ──────── */
.card-body form table,
.card-body > table {
  width: auto;
  min-width: 480px;
  max-width: 100%;
}
.card-body form table td,
.card-body > table td {
  border-bottom: none;
  padding: 6px 8px 6px 0;
  vertical-align: middle;
}
.card-body form table tr:hover > td,
.card-body > table tr:hover > td { background: transparent; }
.card-body form table td:first-child,
.card-body > table td:first-child {
  width: 220px;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 13px;
}
.card-body form table td:last-child input[type="text"],
.card-body form table td:last-child input[type="password"],
.card-body form table td:last-child input[type="email"],
.card-body form table td:last-child select,
.card-body form table td:last-child textarea,
.card-body > table td:last-child input[type="text"],
.card-body > table td:last-child select {
  width: 280px;
  max-width: 100%;
}
.card-body form table td[colspan] { padding-top: 4px; padding-bottom: 4px; }
.card-body form table hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Legacy classes (kept for compatibility) ─────────────── */
.content_page { max-width: 100%; }
.HeadLine {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border);
}
.HeadLine #left, .HeadLine #right { display: none; }
.HeadLine #center { font-weight: 600; font-size: 13px; }
.SearchMenu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}
.btm { display: none; }
.clear { clear: both; }
.infoB {
  background: var(--primary-light);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 8px 0;
  font-size: 13px;
}
div.errorI { color: var(--error); font-weight: 500; font-size: 13px; }
div.infoI  { color: var(--primary); font-size: 13px; }
.comments {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.UserInfo { font-size: 13px; color: var(--text); }

/* ── Legacy template classes ─────────────────────────────── */
.Telo {
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}
.Perf {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
}
.Perf:last-child { border-bottom: none; }
.Perf .date {
  min-width: 80px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.Perf .info { flex: 1; min-width: 0; }
.Perf .addTo { flex-shrink: 0; }
.Perf .addTo img { opacity: 0.7; transition: opacity .15s; }
.Perf .addTo img:hover { opacity: 1; }
.Predstava {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.Predstava:hover { text-decoration: underline; }
.Prireditelj {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
}
.Prireditelj:hover { color: var(--text); text-decoration: underline; }
.Telo_besedilo { color: var(--text); font-weight: 500; }
.SearchMenuOffers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.SearchMenuOffers > div { float: none !important; display: flex; align-items: center; gap: 4px; height: auto !important; }
.SearchMenuOffers input[type="text"] {
  background: var(--surface-alt);
  border: 1px solid var(--border) !important;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  width: auto !important;
  min-width: 90px;
}
.SearchMenuOffers input[type="image"] {
  display: none;
}
.SearchMenuOffers input[type="image"] + .search-svg,
.SearchMenuOffers::after {
  display: none;
}
/* Replace old search icon gif with a submit button */
.SearchMenuOffers div:last-child {
  width: auto !important;
}
.SearchMenuOffers input[name="imageField"] {
  display: none;
}
.smo-field {
  display: flex;
  align-items: center;
  gap: 6px;
}
.smo-field label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.smo-field input[type="text"] {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  min-width: 90px;
}
.smo-search input[type="text"] { min-width: 200px; flex: 1; }
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color .15s, background .15s;
}
.icon-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}
.DTTRA { color: var(--text); font-size: 13px; }
.DTTable {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
  font-size: 13px;
}
.DTTable td, .DTTable th {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.DTTable th {
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
}

table { border-collapse: collapse; width: 100%; }
th {
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover > td { background: var(--surface-alt); }
.suggestionsBox {
  position: absolute; z-index: 999;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  min-width: 260px; overflow: hidden;
}
.suggestionList { margin: 0; padding: 4px 0; list-style: none; }
.suggestionList li { padding: 7px 14px; cursor: pointer; font-size: 13px; }
.suggestionList li:hover { background: var(--primary-light); color: var(--primary); }
.PredstaveMenu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}
div.pagination { padding: 12px 0; text-align: right; }
div.pagination a, div.pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 6px; margin: 0 2px;
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); text-decoration: none;
  transition: all .12s;
}
div.pagination a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
div.pagination span.current { background: var(--primary); color: #fff; border-color: var(--primary); }
div.pagination span.disabled { opacity: .4; }

/* ── Login ──────────────────────────────────────────────── */
body.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--surface-alt);
}
#login {
  width: 360px; background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 36px 36px 28px;
  text-align: center;
}
#login img { max-width: 160px; margin-bottom: 24px; }
#login table { width: 100%; border-collapse: collapse; }
#login td { padding: 5px 0; text-align: left; border: none; }
#login td[align="right"] { text-align: right; padding-right: 10px; color: var(--text-secondary); font-size: 13px; white-space: nowrap; }
#login input[type="text"], #login input[type="password"] { width: 100%; }
#login input[type="submit"] { width: 100%; margin-top: 8px; }
.login-body tr:hover > td { background: transparent; }

/* ── DatePicker overrides ────────────────────────────────── */
#dp-popup { position: absolute !important; z-index: 9999 !important; }
div.dp-popup { width: auto !important; }
table.jCalendar { width: auto !important; border-collapse: separate !important; }
table.jCalendar th,
table.jCalendar td { padding: 4px 7px !important; border-bottom: none !important; font-size: 12px !important; text-align: center !important; }
table.jCalendar tr:hover > td { background: inherit !important; }
table.jCalendar td:hover, table.jCalendar td.dp-hover { background: var(--primary) !important; color: #fff !important; border-radius: 4px; }
table.jCalendar td.selected { background: var(--primary) !important; color: #fff !important; }
table.jCalendar td.today { background: rgba(76,189,217,.18) !important; color: var(--primary) !important; font-weight: 700; outline: 2px solid var(--primary); outline-offset: -2px; }
/* ── Dark-theme contrast fixes ─────────────────────────── */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] input[type="submit"] { color: #0a2e38; }
[data-theme="dark"] .pagination span.current { color: #0a2e38; }
[data-theme="dark"] div.pagination span.current { color: #0a2e38; }
[data-theme="dark"] .nav-btns span { color: #0a2e38; }
[data-theme="dark"] table.jCalendar td:hover,
[data-theme="dark"] table.jCalendar td.dp-hover,
[data-theme="dark"] table.jCalendar td.selected { color: #0a2e38 !important; }

/* ── Dark-theme color overrides for light-only values ──── */
[data-theme="dark"] .badge-yellow  { background: rgba(234,179,8,.15);  color: #eab308; }
[data-theme="dark"] .badge-green   { background: rgba(76,175,125,.15); color: var(--success); }
[data-theme="dark"] .alert-row-pink { background: rgba(157,23,77,.15); color: #f472b6; }
[data-theme="dark"] .btn-danger    { border-color: rgba(224,93,93,.35); }
[data-theme="dark"] .infoB         { border-color: rgba(76,189,217,.3); background: var(--primary-light); }
[data-theme="dark"] .rating-2 { background: rgba(234,88,12,.15);  color: #fb923c; }
[data-theme="dark"] .rating-3 { background: rgba(202,138,4,.15);  color: #eab308; }
[data-theme="dark"] .rating-4 { background: rgba(22,163,74,.15);  color: #4ade80; }
[data-theme="dark"] .rating-5 { background: rgba(22,163,74,.2);   color: #22c55e; }

[data-theme="dark"] div.dp-popup { background: var(--surface-alt) !important; border: 1px solid var(--border) !important; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4) !important; }
[data-theme="dark"] table.jCalendar { background: transparent !important; border-color: var(--border) !important; }
[data-theme="dark"] table.jCalendar th { background: var(--surface-hover) !important; color: var(--text-secondary) !important; }
[data-theme="dark"] table.jCalendar td { background: transparent !important; color: var(--text) !important; }
[data-theme="dark"] table.jCalendar td.other-month { color: var(--text-muted) !important; }
[data-theme="dark"] div.dp-popup h2 { color: var(--text) !important; }
[data-theme="dark"] div.dp-popup a { color: var(--text-secondary) !important; }

/* ── Date range pair ────────────────────────────────────── */
.date-range-wrap { display: flex; align-items: center; gap: 6px; }
.date-range-sep { color: var(--text-muted); font-size: 13px; flex-shrink: 0; user-select: none; }

/* ── Date input + trigger inline ────────────────────────── */
/* Universal: standalone date inputs (no date-range-wrap) inline the trigger */
.form-group:has(input.date-pick) {
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: flex-start !important;
  gap: 4px 0 !important;
}
.form-group:has(input.date-pick) > label { width: 100%; margin-bottom: 0; flex-shrink: 0; }

/* Override for date-range-wrap groups inside filter rows:
   use clean column layout — label above, date-range-wrap below.
   The label width:100% trick causes a circular max-content sizing bug. */
.filter-row .form-group:has(.date-range-wrap),
.filter-row-single .form-group:has(.date-range-wrap) {
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
  gap: 5px !important;
  flex: 0 0 auto;
}
.filter-row .form-group:has(.date-range-wrap) > label,
.filter-row-single .form-group:has(.date-range-wrap) > label {
  width: auto !important;
}

/* Old-structure fix: date form-groups directly in filter-grid must also
   use column layout (same circular max-content bug prevention) */
.filter-grid > .form-group:has(input.date-pick) {
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
  gap: 5px !important;
  flex: 0 0 auto;
}
.filter-grid > .form-group:has(input.date-pick) > label {
  width: auto !important;
}

/* Old-structure: selects grow to fill available row space */
.filter-grid > .form-group:not(.fg-date-width):not(.fg-action):has(select) {
  flex: 1 1 110px;
  min-width: 0;
}
.filter-grid > .form-group:not(.fg-date-width):has(select) select {
  width: 100%;
}

/* ── Checkbox row (filter-003 style) ─────────────────────── */
.filter-checkbox-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
  width: 100%;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.filter-checkbox-row .filter-checkbox { font-size: 12px; }

.form-group:has(input.date-pick) input.dp-applied {
  float: none !important;
  width: 110px !important;
  border-radius: 6px 0 0 6px !important;
  border-right: none !important;
}
/* Explicit wrapper (menuItem-001) */
.date-wrap { display: flex; align-items: stretch; }
.date-wrap input.date-pick,
.date-wrap input.dp-applied {
  float: none !important;
  width: 110px !important;
  border-radius: 6px 0 0 6px !important;
  border-right: none !important;
}
a.dp-choose-date {
  display: inline-flex !important;
  float: none !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  width: 32px !important;
  height: auto !important;
  min-height: 32px;
  border-radius: 0 6px 6px 0 !important;
  border: 1px solid var(--border) !important;
  background: var(--surface-alt) !important;
  font-size: 0 !important;
  text-indent: 0 !important;
  overflow: visible !important;
  padding: 0 !important;
  margin-top: 0 !important;
  cursor: pointer;
  transition: background 0.15s;
}
a.dp-choose-date:hover { background: var(--hover) !important; }
a.dp-choose-date::after {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}
[data-theme="dark"] a.dp-choose-date::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}
[data-theme="light"] a.dp-choose-date::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

/* ── Stats row (reviews page) ────────────────────────────── */
.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  min-width: 180px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* ── Rating badge ────────────────────────────────────────── */
.rating-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
}
.rating-1 { background: var(--error-light);   color: var(--error); }
.rating-2 { background: rgba(234,88,12,.12);  color: #ea580c; }
.rating-3 { background: rgba(202,138,4,.12);  color: #ca8a04; }
.rating-4 { background: rgba(22,163,74,.12);  color: #16a34a; }
.rating-5 { background: rgba(22,163,74,.18);  color: #15803d; }

/* ── Pagination nav-bar ──────────────────────────────────── */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.nav-info {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.nav-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}
/* Style the old GIF-based nav links as pill buttons */
.nav-btns a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all .12s;
}
.nav-btns a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-btns a img { display: none; } /* hide old GIFs, show only link text via ::after */
.nav-btns a[href*="page="]::after { content: attr(title); }
.nav-btns span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
}

.mceText {
  width: 100% !important;
}

.mceLayout table {
  min-width: unset !important;
}

/* ── Collapsible filter (mobile only) ────────────────────── */
.filter-toggle { display: none; }
.filter-collapsible { /* no-op on desktop */ }

/* ── Responsive — mobile (< 768px) ──────────────────────── */
.mobile-menu-btn { display: none; }
.mobile-topbar { display: none; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
}
.sidebar-backdrop.active { display: block; }

@media (max-width: 768px) {
  /* Sidebar: fixed overlay, hidden by default */
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 260px;
    min-width: 260px;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar.collapsed {
    width: 260px;
    min-width: 260px;
  }
  .sidebar.collapsed .sidebar-logo-img,
  .sidebar.collapsed .nav-section-btn-label,
  .sidebar.collapsed .nav-link-text,
  .sidebar.collapsed .nav-chevron,
  .sidebar.collapsed .nav-group,
  .sidebar.collapsed .sidebar-footer-label { display: flex; visibility: visible; }

  /* Mobile top bar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .mobile-topbar-logo {
    height: 20px;
    width: auto;
    margin-left: 8px;
    filter: var(--sb-logo-filter);
  }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-menu-btn:active { background: var(--surface-hover); }

  /* Content area takes full width */
  .app-layout { display: block; }
  .content-area { width: 100%; }
  .page-container { padding: 0 12px 16px; overflow-x: hidden; max-width: 100vw; }
  .content-area { overflow-x: hidden; }
  body { overflow-x: hidden; max-width: 100vw; }
  html { overflow-x: hidden; }
  .page-title { font-size: 1.1rem; display: flex; align-items: center; gap: 4px; }

  /* Filter forms: stack vertically */
  .filter-row { flex-direction: column; gap: 8px; }
  .filter-row .form-group { min-width: 0 !important; flex: none !important; width: 100%; }
  .filter-row .form-group:has(select) { flex: none !important; width: 100%; }
  .filter-row .form-group select { width: 100% !important; max-width: 100%; }
  .filter-row-single { flex-direction: column; gap: 8px; }
  .filter-grid { gap: 8px; }
  .form-group.fg-grow { width: 100%; }
  .form-group.fg-action { width: auto; align-self: flex-start; }
  .form-group.fg-action > label[aria-hidden] { display: none; }
  .fg-date-width { width: 100% !important; min-width: 0 !important; }
  .fg-date-width select { min-width: 0 !important; width: 100% !important; }
  .date-range-wrap { flex-wrap: wrap; }
  .filter-row input[type="text"] { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
  .card { overflow: hidden; }
  .card-body { overflow: hidden; }

  /* Form tables: single column on mobile */
  .card-body form table,
  .card-body > table { min-width: auto; width: 100%; }
  .card-body form table td:first-child,
  .card-body > table td:first-child { width: auto; white-space: normal; display: block; padding-bottom: 2px; }
  .card-body form table td:last-child,
  .card-body > table td:last-child { display: block; }
  .card-body form table td:last-child input[type="text"],
  .card-body form table td:last-child input[type="password"],
  .card-body form table td:last-child input[type="email"],
  .card-body form table td:last-child select,
  .card-body form table td:last-child textarea,
  .card-body > table td:last-child input[type="text"],
  .card-body > table td:last-child select { width: 100%; }
  .card-body form table tr,
  .card-body > table tr { display: block; margin-bottom: 8px; }

  /* Legacy content page */
  .content_page { width: auto !important; max-width: 100%; }

  /* Cards + order list */
  .card { margin: 0 -4px; border-radius: var(--radius); }
  .card-body { padding: 12px; }
  .order-header { flex-direction: column; gap: 4px; padding: 10px 12px; }
  .order-total { margin-left: 0; }
  .order-card { overflow: hidden; word-break: break-word; }
  .order-item { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; padding: 10px 12px; }
  .order-item-info { flex: none; width: 100%; }
  .order-item-name { white-space: normal; word-break: break-word; overflow-wrap: break-word; text-overflow: clip; }
  .order-item-actions { align-self: flex-end; }

  /* Collapsible filter on mobile */
  .filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--surface);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .filter-toggle svg:first-child { color: var(--text-muted); flex-shrink: 0; }
  .filter-toggle span { flex: 1; text-align: left; }
  .filter-toggle-chevron { color: var(--text-muted); flex-shrink: 0; transition: transform .2s; }
  .filter-card.filter-collapsed .filter-toggle-chevron { transform: rotate(-90deg); }
  .filter-card.filter-collapsed .filter-collapsible { display: none; }
  .filter-card { overflow: hidden; }
  .page-title { display: none; }

  /* Scorecard grid */
  .scorecard-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .scorecard { padding: 10px 8px; }
  .scorecard-value { font-size: 1.4rem; }

  /* Tables: horizontal scroll */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  thead, tbody, tfoot { display: table; width: 100%; }

  /* Sidebar footer */
  .sidebar-footer { padding: 8px; }

  /* Dashboard sections */
  .dash-section { margin: 0 -4px; }

  /* Perf listings */
  .Perf { flex-direction: column; gap: 6px; }
  .Perf .info { width: auto !important; }
  .Perf .addTo { align-self: flex-end; }

  /* Search menu offers */
  .SearchMenuOffers { flex-direction: column; gap: 8px; }
  .smo-field { width: 100%; }
  .smo-search input[type="text"] { min-width: 0; width: 100%; }
}

/* ── Responsive — small phones (< 480px) ─────────────────── */
@media (max-width: 480px) {
  .scorecard-grid { grid-template-columns: repeat(2, 1fr); }
  .page-container { padding: 0 8px 12px; }
  .sidebar { width: 240px; min-width: 240px; }
  .filter-row .date-range-wrap { flex-direction: column; gap: 4px; }
  .date-range-sep { display: none; }
}/* sdmenu styles are now defined inline in menu.tpl */
table.jCalendar{border:1px solid #000;background:#aaa;border-collapse:separate;border-spacing:2px;font-size:11px}
table.jCalendar th{background:#333;color:#fff;font-weight:700;padding:3px 5px}
table.jCalendar td{background:#ccc;color:#000;text-align:center;padding:3px 5px}
table.jCalendar td.other-month{background:#ddd;color:#aaa}
table.jCalendar td.today{background:#666;color:#fff}
table.jCalendar td.selected{background:#f66;color:#fff}
table.jCalendar td.selected:hover{background:#f33;color:#fff}
table.jCalendar td:hover,table.jCalendar td.dp-hover{background:#fff;color:#000}
table.jCalendar td.disabled,table.jCalendar td.disabled:hover{background:#bbb;color:#888}
div.dp-popup{position:relative;background:#ccc;font-size:10px;font-family:arial, sans-serif;width:171px;line-height:1.2em;padding:2px}
div#dp-popup{position:absolute;z-index:199}
div.dp-popup h2{font-size:12px;text-align:center;margin:2px 0;padding:0}
a#dp-close{font-size:11px;text-align:center;display:block;padding:4px 0}
a#dp-close:hover{text-decoration:underline}
div.dp-popup a{color:#000;text-decoration:none;padding:3px 2px 0}
div.dp-popup div.dp-nav-prev{position:absolute;top:2px;left:4px;width:100px}
div.dp-popup div.dp-nav-prev a{float:left}
div.dp-popup div.dp-nav-next{position:absolute;top:2px;right:4px;width:100px}
div.dp-popup div.dp-nav-next a{float:right}
div.dp-popup a.disabled{cursor:default;color:#aaa}
a.dp-choose-date{float:left;width:16px;height:16px;display:block;text-indent:-2000px;overflow:hidden;background:url(img/calendar.png) no-repeat;padding:0;margin-top:2px}
a.dp-choose-date.dp-disabled{background-position:0 -20px;cursor:default}
input.dp-applied{width:80px;float:left}
div.dp-popup div.dp-nav-prev a,div.dp-popup div.dp-nav-next a,div.dp-popup td{cursor:pointer}
div.dp-popup div.dp-nav-prev a.disabled,div.dp-popup div.dp-nav-next a.disabled,div.dp-popup td.disabled{cursor:default}