/* ==========================================================================
   LibSpace · Modern Utility Design System
   Visual Style: Quiet, Efficient, Reliable Modern Desktop & Mobile UI
   ========================================================================== */

:root {
  /* Color Palette - Light Theme (Default) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-surface-elevated: #ffffff;
  --bg-surface-hover: #f8fafc;
  
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;
  --bg-input-disabled: #f1f5f9;

  --border-subtle: #e2e8f0;
  --border-default: #cbd5e1;
  --border-strong: #94a3b8;
  --border-focus: #6366f1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-disabled: #94a3b8;
  --text-inverse: #ffffff;

  /* Sole Primary Accent: Indigo / Blue-Violet */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-glow: rgba(99, 102, 241, 0.18);

  /* Semantic Feedback Colors */
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --success-600: #059669;
  --success-700: #047857;

  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-600: #d97706;
  --warning-700: #b45309;

  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;

  /* Typography & Sizing */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-base: 14px;
  --font-size-md: 15px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Elevation Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

  /* Transitions */
  --motion-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --motion-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Palette */
[data-theme="dark"] {
  --bg-app: #0b0f19;
  --bg-surface: #131b2e;
  --bg-surface-subtle: #1a243b;
  --bg-surface-elevated: #1e293b;
  --bg-surface-hover: #222f4b;

  --bg-input: #0e1626;
  --bg-input-focus: #111a2e;
  --bg-input-disabled: #182236;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-default: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.25);
  --border-focus: #818cf8;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-disabled: #64748b;
  --text-inverse: #0b0f19;

  --primary-50: rgba(99, 102, 241, 0.15);
  --primary-100: rgba(99, 102, 241, 0.25);
  --primary-200: rgba(99, 102, 241, 0.4);
  --primary-500: #818cf8;
  --primary-600: #6366f1;
  --primary-700: #4f46e5;
  --primary-glow: rgba(129, 140, 248, 0.25);

  --success-50: rgba(16, 185, 129, 0.15);
  --success-100: rgba(16, 185, 129, 0.25);
  --success-600: #34d399;
  --success-700: #10b981;

  --warning-50: rgba(245, 158, 11, 0.15);
  --warning-100: rgba(245, 158, 11, 0.25);
  --warning-600: #fbbf24;
  --warning-700: #f59e0b;

  --danger-50: rgba(239, 68, 68, 0.15);
  --danger-100: rgba(239, 68, 68, 0.25);
  --danger-600: #f87171;
  --danger-700: #ef4444;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.65), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

/* Base Reset & Document Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Utility Helpers */
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-center { text-align: center; }
.flex-1 { flex: 1; min-width: 0; }

.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 14px; }
.mt-lg { margin-top: 20px; }

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ==========================================================================
   App Layout
   ========================================================================== */

.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 20px 24px;
  gap: 14px;
}

/* ==========================================================================
   Header Navbar (One Clean, Unified Row)
   ========================================================================== */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-height: 56px;
}

/* Nav Left: Brand */
.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--primary-600);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo svg {
  width: 18px;
  height: 18px;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

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

.brand-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.status-online {
  background: var(--success-50);
  color: var(--success-600);
  border: 1px solid var(--success-100);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success-600);
}

.brand-sub {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  line-height: 1.2;
}

/* Nav Center: Reservation status & Countdown */
.nav-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.nav-status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-live {
  background: var(--success-600);
}

.dot-none {
  background: var(--text-disabled);
}

.chip-label {
  color: var(--text-primary);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.countdown-chip {
  background: var(--warning-50);
  border-color: var(--warning-100);
  color: var(--warning-700);
}

.countdown-chip .chip-label {
  color: var(--warning-700);
  font-weight: 600;
}

.chip-icon {
  width: 14px;
  height: 14px;
  color: var(--warning-600);
  flex-shrink: 0;
}

.btn-chip-action {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--motion-fast);
}

.btn-danger-subtle {
  background: var(--danger-50);
  color: var(--danger-600);
  border: 1px solid var(--danger-100);
}

.btn-danger-subtle:hover {
  background: var(--danger-600);
  color: #ffffff;
}

/* Nav Right: Clock, Theme Toggle, User Profile */
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-clock {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 500;
}

.btn-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.btn-icon-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-icon-btn:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

.btn-icon-btn svg {
  width: 16px;
  height: 16px;
}

.btn-icon-btn.btn-sm {
  width: 28px;
  height: 28px;
}
.btn-icon-btn.btn-sm svg {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.user-profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 4px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-600);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
}

.user-name {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-primary);
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-tag {
  font-size: 11px;
  padding: 0 5px;
  border-radius: var(--radius-xs);
  background: var(--primary-50);
  color: var(--primary-600);
  font-weight: 600;
}

.user-subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.1;
}

.btn-user-logout {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: color var(--motion-fast);
}

.btn-user-logout:hover {
  color: var(--danger-600);
}

.btn-user-logout svg {
  width: 14px;
  height: 14px;
}

/* Mobile Nav Tabs (Hidden on Desktop) */
.mobile-nav-tabs {
  display: none;
}

/* ==========================================================================
   UNLOGGED FOCUSED VIEW (Clean & Dedicated)
   ========================================================================== */

.auth-gate-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  min-height: calc(100vh - 120px);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
}

.auth-card-head {
  text-align: center;
  margin-bottom: 24px;
}

.auth-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--primary-50);
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.auth-card-icon svg {
  width: 24px;
  height: 24px;
}

.auth-card-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.auth-card-desc {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}

.segmented-switch {
  display: flex;
  background: var(--bg-surface-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 3px;
}

.seg-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.auth-security-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  line-height: 1.4;
}

.auth-security-notice svg {
  width: 16px;
  height: 16px;
  color: var(--success-600);
  flex-shrink: 0;
}

/* ==========================================================================
   WORKSPACE GRID (Desktop 2-Column Dashboard)
   ========================================================================== */

.workspace-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 16px;
  align-items: start;
}

.col-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.col-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 14px;
}

/* ==========================================================================
   PANEL CARD DESIGN
   ========================================================================== */

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.panel-card:hover {
  border-color: var(--border-default);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.panel-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.step-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary-600);
  font-size: var(--font-size-xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary-100);
}

.badge-count {
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   FORM CONTROLS & MATRIX
   ========================================================================== */

.form-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.label-with-hint {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.form-sublabel {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-row-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 10px;
}

.form-input, .form-select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-base);
  outline: none;
  transition: all var(--motion-fast);
}

.form-input:hover, .form-select:hover {
  border-color: var(--border-strong);
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input:disabled, .form-select:disabled {
  background: var(--bg-input-disabled);
  color: var(--text-disabled);
  cursor: not-allowed;
}

.time-range-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-separator {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  font-weight: 500;
}

/* Date Preset Pills */
.date-preset-group {
  display: flex;
  gap: 4px;
}

.preset-pill {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.preset-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.preset-pill.active {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
}

/* Seat validation status */
.seat-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.seat-validation-tag {
  position: absolute;
  right: 10px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.seat-valid-hint {
  font-size: var(--font-size-xs);
  min-height: 18px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.seat-valid-hint.ok {
  color: var(--success-600);
  font-weight: 500;
}

.seat-valid-hint.bad {
  color: var(--danger-600);
  font-weight: 500;
}

.seat-valid-hint:empty {
  display: none;
}

/* ==========================================================================
   ACCOUNT MANAGEMENT & SWITCHING (Clean Pill Chips)
   ========================================================================== */

.account-session-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.acc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.acc-pill:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}

.acc-pill.active {
  background: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-700);
  font-weight: 600;
}

.acc-pill-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 14px;
  cursor: pointer;
  transition: color var(--motion-fast);
}

.acc-pill-del:hover {
  color: var(--danger-600);
}

.active-account-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  font-size: var(--font-size-xs);
}

.active-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success-600);
  flex-shrink: 0;
}

.active-account-text {
  color: var(--text-secondary);
  font-weight: 500;
}

.account-empty-tip {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  padding: 4px 0;
}

/* ==========================================================================
   LIVE NATURAL LANGUAGE SUMMARY CARD
   ========================================================================== */

.task-summary-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
}

.summary-icon {
  width: 18px;
  height: 18px;
  color: var(--primary-600);
  margin-top: 1px;
  flex-shrink: 0;
}

.summary-icon svg {
  width: 18px;
  height: 18px;
}

.summary-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.summary-text {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: 1.4;
  font-weight: 500;
}

/* ==========================================================================
   BUTTON SYSTEM
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--motion-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: var(--font-size-xs); }
.btn-xs { padding: 3px 8px; font-size: var(--font-size-xs); }
.btn-lg { height: 42px; padding: 0 16px; font-size: var(--font-size-base); }

.btn-primary {
  background: var(--primary-600);
  color: #ffffff;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-700);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-600);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-700);
}

.btn-icon {
  width: 16px;
  height: 16px;
}

.form-actions-row {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   TASK MONITOR BOARD (Scannable Cards)
   ========================================================================== */

.panel-board {
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

.board-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-switch {
  display: flex;
  background: var(--bg-surface-subtle);
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.filter-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--motion-fast);
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.board-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 2px;
}

/* Task Item Card */
.task-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.task-card-item:hover {
  border-color: var(--border-default);
  background: var(--bg-surface-hover);
}

.task-card-item.selected {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 1px var(--primary-500);
  background: var(--primary-50);
}

.task-card-item.editing {
  border-color: var(--warning-600);
  box-shadow: 0 0 0 1px var(--warning-600);
}

.task-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.seat-badge-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.seat-badge-box .seat-num {
  font-family: var(--font-mono);
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.seat-badge-box .seat-tag {
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1;
  margin-top: 2px;
}

.task-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.task-headline-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-user-tag {
  font-size: var(--font-size-xs);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--primary-50);
  color: var(--primary-600);
  font-weight: 500;
  flex-shrink: 0;
}

.task-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.task-meta-msg {
  color: var(--danger-600);
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Status Badges with Icon + Text + Color */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.status-badge svg {
  width: 12px;
  height: 12px;
}

.status-running {
  background: var(--primary-50);
  color: var(--primary-600);
  border: 1px solid var(--primary-100);
}

.status-waiting {
  background: var(--warning-50);
  color: var(--warning-700);
  border: 1px solid var(--warning-100);
}

.status-ok {
  background: var(--success-50);
  color: var(--success-700);
  border: 1px solid var(--success-100);
}

.status-paused {
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.status-stopped, .status-fail {
  background: var(--danger-50);
  color: var(--danger-700);
  border: 1px solid var(--danger-100);
}

.task-action-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-task-action {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--motion-fast);
}

.btn-task-action:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

/* Empty State */
.empty-state-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-subtle);
  color: var(--text-disabled);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.empty-state-icon svg {
  width: 24px;
  height: 24px;
}

.empty-state-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state-desc {
  font-size: var(--font-size-xs);
  max-width: 320px;
  margin-top: 4px;
  line-height: 1.5;
}

/* ==========================================================================
   RUNNING LOGS CONSOLE (Clean, Non-Cockpit Style)
   ========================================================================== */

.panel-logs {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.logs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.logs-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.logs-header-icon {
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
}

.logs-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.logs-scope-hint {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  padding: 1px 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.logs-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  accent-color: var(--primary-600);
}

.logs-output-body {
  padding: 12px 14px;
  background: var(--bg-surface);
  min-height: 140px;
  max-height: 200px;
  overflow-y: auto;
}

.logs-pre {
  font-size: var(--font-size-xs);
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ==========================================================================
   MODAL WINDOW & BACKDROP
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn var(--motion-fast) ease-out;
}

.modal-dialog {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: scaleUp var(--motion-normal) cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUp {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--primary-50);
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon svg {
  width: 18px;
  height: 18px;
}

.modal-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.btn-modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--motion-fast);
}

.btn-modal-close:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.modal-content {
  padding: 18px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  background: var(--bg-surface-subtle);
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   TOAST NOTIFICATION HUB
   ========================================================================== */

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-card {
  pointer-events: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  animation: slideIn var(--motion-normal) cubic-bezier(0.16, 1, 0.3, 1);
  transition: all var(--motion-normal);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast-info .toast-icon { color: var(--primary-600); }
.toast-success .toast-icon { color: var(--success-600); }
.toast-warning .toast-icon { color: var(--warning-600); }
.toast-error .toast-icon { color: var(--danger-600); }

.toast-info { border-left: 3px solid var(--primary-600); }
.toast-success { border-left: 3px solid var(--success-600); }
.toast-warning { border-left: 3px solid var(--warning-600); }
.toast-error { border-left: 3px solid var(--danger-600); }

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.toast-message {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.3;
  margin-top: 1px;
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE ADAPTATION
   ========================================================================== */

/* Large Tablets & Small Laptops (<= 1024px) */
@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 400px 1fr;
    gap: 12px;
  }
}

/* Mobile & Small Tablets (< 840px) */
@media (max-width: 839px) {
  .app-layout {
    padding: 8px 10px 24px;
    gap: 10px;
  }

  .navbar {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 10px;
  }

  .nav-left {
    order: 1;
  }

  .nav-right {
    order: 2;
  }

  .nav-center {
    order: 3;
    width: 100%;
    justify-content: space-between;
    padding-top: 4px;
    border-top: 1px solid var(--border-subtle);
  }

  .header-clock {
    display: none;
  }

  /* Mobile Segmented Tab Bar */
  .mobile-nav-tabs {
    display: flex;
    background: var(--bg-surface);
    padding: 4px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    gap: 4px;
  }

  .mobile-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px; /* Accessible 44px touch target */
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--motion-fast);
  }

  .mobile-tab-btn svg {
    width: 16px;
    height: 16px;
  }

  .mobile-tab-btn.active {
    background: var(--primary-600);
    color: #ffffff;
    box-shadow: var(--shadow-xs);
  }

  .tab-counter-badge {
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-size: 11px;
    background: rgba(255, 255, 255, 0.25);
    color: inherit;
    font-weight: 700;
  }

  .mobile-tab-btn:not(.active) .tab-counter-badge {
    background: var(--bg-surface-subtle);
    color: var(--text-secondary);
  }

  /* Workspace Layout on Mobile */
  .workspace-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .col-right {
    position: static;
  }

  .mobile-tab-pane {
    display: none !important;
  }

  .mobile-tab-pane.active {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  /* Form adapt on mobile */
  .form-row-2col, .form-row-3col {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .form-actions-row {
    flex-direction: column;
  }

  .btn-lg {
    min-height: 44px;
  }

  .toast-stack {
    top: auto;
    bottom: 16px;
    left: 12px;
    right: 12px;
  }

  .toast-card {
    min-width: 0;
    max-width: 100%;
  }

  /* Mobile Bottom-Sheet for Modals */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-dialog {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}
