/* ===================================================
   CrewBase — Design System
   Light: Arctic Pro · Dark: Midnight Control
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== LIGHT MODE — Arctic Pro ===== */
:root {
  /* Backgrounds */
  --bg:           #f4f6fa;
  --surface:      #ffffff;
  --surface-2:    #e6e9f0;

  /* Borders & text */
  --border:       #d0d5e3;
  --text:         #1a1d2e;
  --text-muted:   #8892aa;

  /* Brand */
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --primary-dim:    rgba(37, 99, 235, 0.13);

  /* Status */
  --success:  #16a34a;
  --warning:  #d97706;
  --danger:   #dc2626;

  /* Sidebar — always dark in both modes */
  --sidebar-bg:         #1a1d2e;
  --sidebar-border:     #252839;
  --sidebar-text:       rgba(244, 246, 250, 0.85);
  --sidebar-muted:      rgba(244, 246, 250, 0.40);
  --sidebar-active-bg:  rgba(37, 99, 235, 0.18);
  --sidebar-active:     #7eb3ff;

  /* Topbar (crew/frivillig pages) */
  --topbar-bg:      #1a1d2e;
  --topbar-text:    rgba(244, 246, 250, 0.9);
  --topbar-border:  #252839;

  /* Misc */
  --radius:     8px;
  --font-ui:    'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'IBM Plex Mono', monospace;

  /* Legacy aliases (for gradual migration) */
  --color-bg:           var(--bg);
  --color-surface:      var(--surface);
  --color-topbar:       var(--topbar-bg);
  --color-primary:      var(--primary);
  --color-primary-hover:var(--primary-hover);
  --color-text:         var(--text);
  --color-text-muted:   var(--text-muted);
  --color-danger:       var(--danger);
  --color-border:       var(--border);
  --font-family:        var(--font-ui);
}

/* ===== DARK MODE — Midnight Control ===== */
[data-theme="dark"] {
  --bg:           #0a0c12;
  --surface:      #13151f;
  --surface-2:    #1a1d2a;
  --border:       #1e2130;
  --text:         #e4e6ed;
  --text-muted:   #6b7094;

  --primary:        #4f8cff;
  --primary-hover:  #3a6fd8;
  --primary-dim:    rgba(79, 140, 255, 0.12);

  --success:  #22c55e;
  --warning:  #f59e0b;
  --danger:   #f43f5e;

  --sidebar-bg:         #0c0e18;
  --sidebar-border:     #1a1c28;
  --sidebar-text:       rgba(228, 230, 237, 0.85);
  --sidebar-muted:      rgba(228, 230, 237, 0.35);
  --sidebar-active-bg:  rgba(79, 140, 255, 0.12);
  --sidebar-active:     #4f8cff;

  --topbar-bg:      #0c0e18;
  --topbar-text:    rgba(228, 230, 237, 0.9);
  --topbar-border:  #1a1c28;

  --font-ui:    'Sora', -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  --color-bg:           var(--bg);
  --color-surface:      var(--surface);
  --color-topbar:       var(--topbar-bg);
  --color-primary:      var(--primary);
  --color-primary-hover:var(--primary-hover);
  --color-text:         var(--text);
  --color-text-muted:   var(--text-muted);
  --color-danger:       var(--danger);
  --color-border:       var(--border);
}

/* ===== RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
  /* Keep content clear of rounded corners and home indicator in PWA mode.
     Add 20px buffer ON TOP OF the safe-area value (not just max) so extreme
     corner curves on iPhone 16 Pro don't clip content near the edges. */
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* ===== TOPBAR (crew / frivillig pages) ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--topbar-bg);
  color: var(--topbar-text);
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-left: max(16px, calc(16px + env(safe-area-inset-left, 0px)));
  padding-right: max(16px, calc(16px + env(safe-area-inset-right, 0px)));
  border-bottom: 1px solid var(--topbar-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--topbar-text);
}

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--sidebar-muted);
  min-width: 0;
  flex-shrink: 1;
}

.topbar .user-info #user-display {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 160px;
}

/* Keep logout and action buttons from shrinking */
.topbar .user-info .btn-logout,
.topbar .user-info .theme-toggle-btn,
.topbar .user-info .checkin-toggle {
  flex-shrink: 0;
}

@media (max-width: 420px) {
  .topbar .user-info #user-display {
    max-width: 100px;
  }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  transition: background 0.15s, opacity 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:active {
  background: var(--primary-hover);
}

.btn-logout {
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 0.8rem;
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
}

.btn-logout:hover { color: var(--danger); border-color: rgba(220,38,38,0.3); }

/* Theme toggle button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--sidebar-muted);
  border-radius: 5px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.theme-toggle-btn:hover { color: var(--sidebar-text); border-color: rgba(255,255,255,0.3); }

/* ===== LANGUAGE PICKER ===== */
.lang-picker {
  position: relative;
  display: inline-flex;
}

.lang-picker-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}

.lang-picker-btn:hover {
  border-color: rgba(255,255,255,0.3);
}

.lang-picker-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 500;
  min-width: 140px;
  padding: 4px;
  display: none;
}

.lang-picker-dropdown.open {
  display: block;
}

.lang-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.1s;
}

.lang-picker-option:hover {
  background: var(--surface-2);
}

.lang-picker-option.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}

.lang-flag-img {
  display: inline-block;
  width: 20px;
  height: 14px;
  border-radius: 2px;
  vertical-align: middle;
  object-fit: cover;
}

.lang-label {
  white-space: nowrap;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .login-card {
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
}

.login-logo {
  width: 52px;
  height: 52px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 20px;
  letter-spacing: 0.05em;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 0.9rem;
}

.login-card .btn {
  width: 100%;
  font-size: 0.95rem;
  gap: 10px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 4px 0;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-microsoft {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-microsoft:hover,
.btn-microsoft:active {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

.login-footer {
  position: fixed;
  top: 16px;
  right: 16px;
}

/* ===== MESSAGES ===== */
.message {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-top: 16px;
  font-size: 0.875rem;
  text-align: left;
}

.message-error {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.message-info {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

/* ===== PAGE CONTENT ===== */
.page-content {
  padding: 24px 20px;
  max-width: 800px;
  margin: 0 auto;
}

/* ===== LOADING ===== */
@keyframes cb-dot-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.3; }
  30%            { transform: translateY(-11px); opacity: 1;   }
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 60vh;
}

.loading > span {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
  animation: cb-dot-bounce 1.3s ease-in-out infinite;
}

.loading > span:nth-child(2) { animation-delay: 0.18s; }
.loading > span:nth-child(3) { animation-delay: 0.36s; }

@media (prefers-reduced-motion: reduce) {
  .loading > span { animation: none; opacity: 0.6; }
}

/* ===== UTILS ===== */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85em; }

.form-fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0;
}
.form-fieldset legend {
  font-weight: 600;
  font-size: 0.95em;
  padding: 0 6px;
}

/* ===== CUSTOM TIME PICKER ===== */

.time-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tp-sep {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 2px;
  user-select: none;
}

.tp-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  width: 54px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tp-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.datetime-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tp-date {
  flex: 1;
  min-width: 130px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tp-date:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

/* ===== SW UPDATE BANNER ===== */
#sw-update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  padding-left: max(16px, calc(16px + env(safe-area-inset-left, 0px)));
  padding-right: max(16px, calc(16px + env(safe-area-inset-right, 0px)));
  font-size: 0.85rem;
  font-weight: 500;
  animation: swBannerIn 0.3s ease;
}

@keyframes swBannerIn {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

#sw-update-banner span { flex: 1; }

.sw-update-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.5);
  color: #fff;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.sw-update-btn:hover { background: rgba(255,255,255,0.35); }

.sw-dismiss-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}


/* ===== TIMELINE FORM SECTIONS ===== */
.tl-form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface-alt, rgba(128,128,128,0.05));
  margin-top: 2px;
}
.tl-form-section + .tl-form-section { margin-top: 8px; }
.tl-form-section-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.tl-form-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.tl-form-section-hint { font-size: 0.75rem; color: var(--text-muted); }

/* Station checkboxes row in timeline form */
.tl-station-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 6px 0 8px;
  transition: opacity 0.15s;
}
.tl-station-checks.disabled { opacity: 0.35; pointer-events: none; }

/* Crew picker */
.tl-crew-picker { margin-top: 8px; }
.tl-crew-picker-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 5px;
  display: block;
}
.tl-crew-tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; margin-bottom: 5px; }
.tl-crew-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 9px;
  font-size: 0.77rem;
  border-radius: 20px;
}
.tl-crew-tag-remove {
  cursor: pointer;
  opacity: 0.55;
  font-size: 1em;
  line-height: 1;
  border: none;
  background: none;
  padding: 0;
  color: inherit;
}
.tl-crew-tag-remove:hover { opacity: 1; }
.tl-crew-search-wrap { position: relative; }
.tl-crew-search {
  width: 100%;
  padding: 5px 8px;
  font-size: 0.84rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}
.tl-crew-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 150px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.tl-crew-dropdown.open { display: block; }
.tl-crew-dropdown-item { padding: 6px 10px; font-size: 0.84rem; cursor: pointer; }
.tl-crew-dropdown-item:hover { background: var(--hover, rgba(128,128,128,0.1)); }
.tl-crew-dropdown-empty { padding: 8px 10px; font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

/* Responsible badge in crew timeline view */
.tl-event-responsible-badge { background: var(--warning, #f59e0b); color: #fff; }
.tl-inline-status { font-size: 0.78rem; padding: 2px 4px; margin-top: 4px; }

/* Event type badge in admin timeline list */
.tl-event-type-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 5px;
  vertical-align: middle;
  background: var(--surface-2, #2a2a3a);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tl-et-show       { background: #7c3aed22; color: #a855f7; }
.tl-et-soundcheck { background: #1d4ed822; color: #60a5fa; }
.tl-et-transport  { background: #c2410c22; color: #fb923c; }
.tl-et-meal       { background: #15803d22; color: #4ade80; }
.tl-et-production { background: #71717a22; color: #a1a1aa; }
.tl-et-venue      { background: #0e749022; color: #22d3ee; }
.tl-et-other      { background: var(--surface-2, #2a2a3a); color: var(--text-muted); }

/* Artist programme info in artist form */
.artist-programme-row .artist-programme-info { padding: 6px 0; font-size: 0.9rem; }
.artist-programme-val { font-weight: 600; }
.artist-programme-source { font-size: 0.78rem; color: var(--text-muted); margin-left: 4px; }

/* Admin artist table — meal schedule line under show time */
.prog-meals-line { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; font-weight: 400; }

/* ===== TIMELINE — RESPONSIBILITY TYPE TOGGLE ===== */
.tl-resp-type-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
}
.tl-resp-type-btn {
  padding: 5px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.13s, color 0.13s;
  font-family: inherit;
}
.tl-resp-type-btn + .tl-resp-type-btn {
  border-left: 1px solid var(--border);
}
.tl-resp-type-btn.active {
  background: var(--primary, #2563eb);
  color: #fff;
}
.tl-resp-type-btn:not(.active):hover {
  background: var(--hover, rgba(128,128,128,0.1));
  color: var(--text);
}

/* ===== DISPLAY THEME EDITOR (revamped) ===== */

/* Theme gallery — horizontal scroll strip */
.tsc-gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 10px;
  margin-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: #1c2436 transparent;
  -webkit-overflow-scrolling: touch;
}
.tsc-gallery::-webkit-scrollbar { height: 4px; }
.tsc-gallery::-webkit-scrollbar-track { background: transparent; }
.tsc-gallery::-webkit-scrollbar-thumb { background: #1c2436; border-radius: 2px; }

/* Preset thumbnail — mini menu preview */
.tsc-thumb {
  flex: 0 0 120px;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #0a0d16;
  cursor: pointer;
  transition: border-color 0.14s, box-shadow 0.14s;
  overflow: hidden;
  font-family: inherit;
  text-align: left;
  padding: 0;
}
.tsc-thumb:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.12);
}
.tsc-thumb.tsc-thumb--active {
  border-color: #3b82f6;
  box-shadow: 0 0 8px rgba(59,130,246,0.25);
}
.tsc-thumb-screen {
  position: relative;
  height: 68px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tsc-thumb-header {
  padding: 4px 6px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.tsc-thumb-title {
  font-size: 0.45rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.tsc-thumb-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px 5px;
  align-content: start;
}
.tsc-thumb-card {
  border-radius: 2px;
  padding: 3px 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-width: 1px;
  border-style: solid;
}
.tsc-thumb-card-name {
  font-size: 0.35rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tsc-thumb-card-price {
  font-size: 0.38rem;
  font-weight: 800;
}
.tsc-thumb-label {
  padding: 5px 7px 6px;
  background: #0a0d16;
}
.tsc-thumb-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: #7090b8;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tsc-thumb-desc {
  font-size: 0.55rem;
  color: #2c3d5a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Full-width preview */
.tsc-preview-full {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #171e2c;
  margin-bottom: 12px;
  background: #070911;
}
.tsc-preview-full .tsc-preview-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  transform: scale(0.5);
  transform-origin: top left;
  border: none;
}

/* Compact customize panel */
.tsc-customize {
  border: 1px solid #171e2c;
  border-radius: 8px;
  background: #0b0e16;
  overflow: hidden;
  margin-bottom: 12px;
}
.tsc-customize-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.14s;
}
.tsc-customize-toggle:hover { background: rgba(59,130,246,0.04); }
.tsc-customize-toggle-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4a6080;
}
.tsc-customize-toggle-arrow {
  font-size: 0.6rem;
  color: #3a5070;
  transition: transform 0.2s;
}
.tsc-customize-toggle-arrow.open { transform: rotate(90deg); }
.tsc-customize-body {
  padding: 0 14px 14px;
  display: none;
}
.tsc-customize-body.open { display: block; }

/* Customize sub-sections */
.tsc-section-header {
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3a4558;
  margin: 12px 0 6px;
  font-family: sans-serif;
}
.tsc-section-header:first-child { margin-top: 0; }

/* Keep existing color picker / input styles but make them shareable */
.tsc-color-row { display: flex; gap: 7px; flex-wrap: wrap; }
.tsc-swatch { display: flex; flex-direction: column; gap: 3px; }
.tsc-swatch-lbl { font-size: 0.59rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #3a4558; font-family: sans-serif; }
.tsc-swatch-input { display: flex; align-items: center; height: 29px; background: #090c12; border: 1px solid #1c2030; border-radius: 4px; overflow: hidden; transition: border-color 0.15s; }
.tsc-swatch-input:focus-within { border-color: #3b82f6; }
.tsc-swatch-input input[type=color] { width: 29px; height: 29px; border: none; background: none; cursor: pointer; padding: 2px 3px; flex-shrink: 0; }
.tsc-hash { font-size: 0.7rem; color: #242c3a; font-family: monospace; padding: 0 0 0 2px; user-select: none; }
.tsc-hex-inp { width: 50px; border: none; background: transparent; color: #8090a8; font-size: 0.74rem; font-family: monospace; padding: 0 4px 0 0; outline: none; }
.tsc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.tsc-logo-row { display: grid; grid-template-columns: 3fr 2fr; gap: 8px; margin-bottom: 7px; }
.tsc-slider-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tsc-slider { -webkit-appearance: none; flex: 1; height: 3px; border-radius: 2px; background: #1c2030; outline: none; cursor: pointer; }
.tsc-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #3b82f6; cursor: pointer; }
.tsc-slider-val { font-size: 0.72rem; font-family: monospace; color: #3a5070; min-width: 28px; text-align: right; }
.tsc-select { font-size: 0.78rem; background: #090c12; border: 1px solid #1c2030; border-radius: 4px; color: #b0bac8; padding: 5px 8px; width: 100%; box-sizing: border-box; cursor: pointer; outline: none; margin-bottom: 8px; }
.tsc-font-row { display: grid; grid-template-columns: 1fr 120px; gap: 6px; margin-bottom: 6px; align-items: end; }
.tsc-inp { width: 100%; box-sizing: border-box; font-size: 0.79rem; background: #090c12; border: 1px solid #1c2030; border-radius: 4px; color: #b8c4d4; padding: 5px 8px; outline: none; font-family: inherit; transition: border-color 0.15s; }
.tsc-inp:focus { border-color: #3b82f6; }
.tsc-lbl { font-size: 0.63rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #3a4558; margin-bottom: 3px; font-family: sans-serif; }
.tsc-sep { height: 1px; background: linear-gradient(90deg, transparent, #111820 30%, #111820 70%, transparent); margin: 12px 0 0; }
.tsc-hint { font-size: 0.68rem; color: #2a3850; font-family: sans-serif; margin-top: 2px; }

/* Preview scale label */
.tsc-scale-label {
  font-size: 0.55rem;
  color: #141c28;
  text-align: center;
  font-family: monospace;
  padding-top: 4px;
}
.tsc-tab-bar {
  display: flex;
  gap: 2px;
  margin: 14px 0 0;
  border-bottom: 1px solid #151c28;
}
.tsc-tab-btn {
  padding: 6px 13px;
  border: none;
  border-radius: 4px 4px 0 0;
  background: transparent;
  color: #3a4a60;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.13s, background 0.13s;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tsc-tab-btn:hover { color: #5a7aaa; background: #0d1420; }
.tsc-tab-btn.active { color: #90b8e8; border-bottom-color: #3b82f6; background: #0d1a2a; }
.tsc-tab-panel {
  padding: 12px 0 4px;
}
.tl-status-update { margin-top: 4px; }

/* ===== CATERING STATUS BADGES (admin) ===== */
.catering-status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: 600;
}
.catering-status-badge.catering-received { color: #3b82f6; background: rgba(59,130,246,0.12); }
.catering-status-badge.catering-cooking  { color: #f59e0b; background: rgba(245,158,11,0.12); }
.catering-status-badge.catering-done     { color: #22c55e; background: rgba(34,197,94,0.12); }

/* Facility form chip group */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-label {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  background: var(--surface-2, #f0f2f5); border: 1px solid var(--border, #ddd); border-radius: 6px;
  font-size: 0.85rem; cursor: pointer; user-select: none;
}
.chip-label input[type="checkbox"] { margin: 0; }

/* Meal choice portions input */
.meal-choice-fields { display: flex; gap: 6px; align-items: center; flex: 1; }
.meal-choice-fields select { flex: 1; }
.meal-choice-portions { width: 70px; text-align: center; }

/* Artist meal choice dynamic rows (admin modal) */
.artist-mcr { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.artist-mcr-slot { flex: 1; }
.artist-mcr-item { flex: 1.5; }
.artist-mcr-portions { width: 64px; text-align: center; }
.artist-mcr-add-btn { margin-top: 4px; }
@media (max-width: 600px) {
  .artist-mcr { flex-wrap: wrap; }
  .artist-mcr-slot { flex: 1 1 100%; }
  .artist-mcr-item { flex: 1 1 calc(100% - 80px); }
}

/* Adhoc catering section (food station) */
.adhoc-catering-section { border-left: 3px solid #f59e0b; padding: 10px 12px; margin-bottom: 12px; background: rgba(245,158,11,0.06); border-radius: 0 6px 6px 0; }
.adhoc-catering-header { font-weight: 600; font-size: 0.9rem; color: #b45309; margin-bottom: 8px; }
.catering-adhoc-time { font-size: 0.8rem; font-weight: 600; color: #f59e0b; }

/* ===== AUDIT LOG ===== */
.audit-filter-bar { padding: 12px 0 8px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); font-size: 0.8rem; cursor: pointer; transition: background 0.15s, color 0.15s; }
.filter-chip:hover { background: var(--bg-hover); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.audit-log-list { display: flex; flex-direction: column; gap: 0; }
.audit-entry { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.audit-entry:last-child { border-bottom: none; }
.audit-entry-icon { font-size: 1.1rem; flex-shrink: 0; width: 28px; text-align: center; padding-top: 2px; }
.audit-entry-body { flex: 1; min-width: 0; }
.audit-entry-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.audit-entry-time { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
.audit-entry-user { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.audit-entry-desc { font-size: 0.85rem; color: var(--text-secondary); word-break: break-word; }
.audit-entry-actions { flex-shrink: 0; }
.audit-link-btn { font-size: 0.8rem; padding: 2px 8px; }

/* ===== INVENTORY ITEM FORM ===== */

.inv-form { display: flex; flex-direction: column; gap: 0; }

/* Identity block — emoji + name/description */
.inv-identity {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 4px 0 20px;
}
.inv-emoji-field {
  width: 52px;
  height: 52px;
  font-size: 1.6rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, var(--bg));
  flex-shrink: 0;
  padding: 0;
  line-height: 52px;
}
.inv-name-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.inv-name-input {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--surface-2, var(--bg));
  width: 100%;
}
.inv-desc-input {
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 10px;
  background: transparent;
  width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
.inv-desc-input:focus { border-color: var(--border); background: var(--surface-2, var(--bg)); }

/* Station pills */
.inv-block { margin-bottom: 18px; }
.inv-block-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.inv-station-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-station-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  user-select: none;
}
.inv-station-pill input[type="checkbox"] { display: none; }
.inv-station-pill:hover { border-color: var(--primary); color: var(--text); }
.inv-station-pill.is-on {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

/* Contextual sections — slide in when station activated */
.inv-ctx {
  border-top: 1px solid var(--border);
  padding: 14px 0 4px;
  margin-bottom: 14px;
  animation: inv-ctx-in 0.18s ease;
}
.inv-ctx.hidden { display: none; }
@keyframes inv-ctx-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.inv-ctx-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.inv-ctx-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.inv-allergen-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.inv-allergen-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: transparent;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  user-select: none;
}
.inv-allergen-pill input[type="checkbox"] { display: none; }
.inv-allergen-pill.is-on {
  border-color: #2ecc71;
  color: #2ecc71;
  background: rgba(46,204,113,0.08);
}

/* Prices + stock compact grid */
.inv-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.inv-numbers-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.inv-num-field { display: flex; flex-direction: column; gap: 4px; }
.inv-num-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.inv-num-wrap { position: relative; display: flex; align-items: center; }
.inv-num-wrap input { padding-right: 28px; width: 100%; }
.inv-num-suffix {
  position: absolute;
  right: 9px;
  font-size: 0.7rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* Advanced section */
.inv-advanced {
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.inv-advanced summary {
  padding: 10px 0;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.inv-advanced summary::before { content: '▶'; font-size: 0.6rem; transition: transform 0.15s; }
.inv-advanced[open] summary::before { transform: rotate(90deg); }
.inv-advanced summary::-webkit-details-marker { display: none; }
.inv-advanced-body { padding: 6px 0 12px; display: flex; flex-direction: column; gap: 10px; }
.inv-inline-toggle { display: flex; align-items: center; gap: 7px; font-size: 0.875rem; cursor: pointer; }

@media (max-width: 480px) {
  .inv-numbers { grid-template-columns: 1fr 1fr; }
}

/* All text/number inputs inside inv-form number fields */
.inv-num-field input:not([type="hidden"]),
.inv-numbers-2 input:not([type="hidden"]) {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.inv-num-field input:not([type="hidden"]):focus,
.inv-numbers-2 input:not([type="hidden"]):focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

/* Toggle switch for inventory form checkboxes */
.inv-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  user-select: none;
}

.inv-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.inv-toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.inv-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  transition: background 0.2s;
  cursor: pointer;
}

.inv-toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}

.inv-toggle-switch input:checked + .inv-toggle-track { background: var(--primary); }
.inv-toggle-switch input:checked + .inv-toggle-track::after { transform: translateX(16px); }

/* ===== INVENTORY CUSTOM SELECT ===== */

.inv-custom-select { position: relative; }

.inv-cs-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.inv-cs-trigger:hover { border-color: var(--text-muted); }

.inv-custom-select.is-open .inv-cs-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
  outline: none;
}

.inv-cs-chevron {
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.inv-custom-select.is-open .inv-cs-chevron { transform: rotate(180deg); }

.inv-cs-placeholder { color: var(--text-muted); }

.inv-cs-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  overflow-y: auto;
  max-height: 200px;
  display: none;
}

[data-theme="dark"] .inv-cs-dropdown { box-shadow: 0 8px 24px rgba(0,0,0,0.25); }

.inv-custom-select.is-open .inv-cs-dropdown { display: block; }

.inv-cs-option {
  padding: 7px 12px;
  font-size: 0.875rem;
  font-family: var(--font-ui);
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}

.inv-cs-option:hover { background: var(--surface-2); }
.inv-cs-option.is-selected { color: var(--primary); font-weight: 600; }
.inv-cs-option.is-placeholder { color: var(--text-muted); }
