/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  color-scheme: light dark;

  /* spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* type scale */
  --text-xs: 11px;
  --text-sm: 12.5px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 21px;

  /* radius scale */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;

  /* motion */
  --transition-fast: 120ms ease;
  --transition-base: 180ms ease;

  /* shadows (light) */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, .09);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, .14);

  /* semantic colors (light) */
  --color-bg: #f4f5f7;
  --color-surface: #ffffff;
  --color-surface-raised: #fafbfc;
  --color-border: #dde1e6;
  --color-border-strong: #c2c8d1;
  --color-text: #1f2328;
  --color-text-muted: #656d78;
  --color-text-subtle: #97a0ab;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-active: #1e40af;
  --color-primary-subtle: #eaf0ff;
  --color-success: #15803d;
  --color-success-subtle: #eafbf0;
  --color-warning: #b45309;
  --color-warning-subtle: #fef3e2;
  --color-danger: #dc2626;
  --color-danger-subtle: #fdedec;
  --color-focus-ring: #2563eb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #14161a;
    --color-surface: #1c1f26;
    --color-surface-raised: #242832;
    --color-border: #333844;
    --color-border-strong: #454b58;
    --color-text: #e8eaed;
    --color-text-muted: #9aa1ab;
    --color-text-subtle: #6d7480;
    --color-primary: #6d97fb;
    --color-primary-hover: #8bacfc;
    --color-primary-active: #517fe8;
    --color-primary-subtle: #1c2a4d;
    --color-success: #4ade80;
    --color-success-subtle: #0e2f1c;
    --color-warning: #fbbf24;
    --color-warning-subtle: #3a2707;
    --color-danger: #f87171;
    --color-danger-subtle: #3a1414;
    --color-focus-ring: #8bacfc;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, .55);
  }
}

/* legacy aliases (kept in case any old class name lingers) */
:root {
  --bg: var(--color-bg);
  --panel: var(--color-surface);
  --border: var(--color-border);
  --text: var(--color-text);
  --muted: var(--color-text-muted);
  --primary: var(--color-primary);
  --primary-dark: var(--color-primary-hover);
  --danger: var(--color-danger);
  --badge-bg: var(--color-primary-subtle);
  --badge-text: var(--color-primary);
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-base);
  line-height: 1.6;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.skip-link:focus { left: var(--space-3); top: var(--space-3); }

.icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: -3px;
  flex-shrink: 0;
}
.icon-sm { width: 13px; height: 13px; vertical-align: -2px; }
.icon-lg { width: 22px; height: 22px; vertical-align: -5px; }

/* ==========================================================================
   Layout shell
   ========================================================================== */
.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
.topbar h1 { font-size: var(--text-lg); margin: 0; font-weight: 700; }
.topbar h1 a { color: var(--color-text); display: flex; align-items: center; gap: var(--space-2); }
.topbar nav { display: flex; gap: var(--space-4); }
.topbar nav a {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.topbar nav a:hover { color: var(--color-primary); text-decoration: none; }
.topbar .logout-form { margin-left: auto; }

.container { max-width: 1320px; margin: 0 auto; padding: var(--space-5) var(--space-6) var(--space-12); }

.flash {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.flash li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
}

/* ==========================================================================
   Buttons / links
   ========================================================================== */
button, .button-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font-size: var(--text-sm);
  font-family: inherit;
  line-height: 1.4;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
button:hover, .button-link:hover {
  text-decoration: none;
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
}
button:active, .button-link:active { transform: translateY(1px); }
button:disabled, .button-link[disabled] { opacity: .4; cursor: not-allowed; transform: none; }

button.primary, .button-link.primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
button.primary:hover, .button-link.primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
button.primary:active, .button-link.primary:active { background: var(--color-primary-active); }

button.danger, .button-link.danger { color: var(--color-danger); border-color: var(--color-danger); }
button.danger:hover, .button-link.danger:hover { background: var(--color-danger-subtle); }

button.ghost, .button-link.ghost { border-color: transparent; background: transparent; }
button.ghost:hover, .button-link.ghost:hover { background: var(--color-surface-raised); }

button.small, .button-link.small { padding: var(--space-1) var(--space-2); font-size: var(--text-xs); }

.icon-button {
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  line-height: 1;
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.tab-strip {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.tab-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab-link:hover { color: var(--color-text); text-decoration: none; }
.tab-link.is-active { color: var(--color-primary); border-color: var(--color-primary); }

/* ==========================================================================
   Filter bar
   ========================================================================== */
.filter-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  position: sticky;
  top: var(--space-3);
  z-index: 20;
  transition: box-shadow var(--transition-base);
}
.filter-bar.is-stuck { box-shadow: var(--shadow-md); }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-end;
  margin-bottom: var(--space-2);
}
.filter-row label { display: flex; flex-direction: column; font-size: var(--text-xs); color: var(--color-text-muted); gap: var(--space-1); font-weight: 600; }
.filter-row select, .filter-row input[type="date"], .filter-row input[type="number"] {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  background: var(--color-surface);
  color: var(--color-text);
}

.facility-popover { position: relative; }
.facility-popover summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
}
.facility-popover summary::-webkit-details-marker { display: none; }
.facility-popover[open] summary { border-color: var(--color-primary); color: var(--color-primary); }
.facility-popover summary .chevron { transition: transform var(--transition-fast); }
.facility-popover[open] summary .chevron { transform: rotate(180deg); }
.facility-popover .selected-count {
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-xs);
  border-radius: var(--radius-full);
  padding: 0 var(--space-2);
  min-width: 18px;
  text-align: center;
}
.facility-popover-panel {
  position: absolute;
  z-index: 30;
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
  min-width: 320px;
}
.facility-checkboxes { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.alert-panel-row {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 40;
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.alert-panel { max-width: 320px; }
.alert-panel summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-danger);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}
.alert-panel summary::-webkit-details-marker { display: none; }
.alert-panel summary .chevron { transition: transform var(--transition-fast); }
.alert-panel[open] summary .chevron { transform: rotate(180deg); }
.alert-panel-count {
  background: var(--color-danger);
  color: #fff;
  font-size: var(--text-xs);
  border-radius: var(--radius-full);
  padding: 0 var(--space-2);
  min-width: 18px;
  text-align: center;
}
.alert-panel-list {
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  list-style: none;
}
.alert-panel-list li + li { border-top: 1px solid var(--color-border); }
.alert-panel-list a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-2);
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.alert-panel-list a:hover { background: var(--color-surface-raised); }
.alert-panel-date { font-size: var(--text-xs); font-weight: 700; color: var(--color-danger); }
.alert-panel-name { font-size: var(--text-sm); font-weight: 600; }
.alert-panel-channel { font-size: var(--text-xs); color: var(--color-text-muted); }

.planned-alert-panel summary { border-color: var(--color-warning); color: var(--color-warning); }
.planned-alert-panel .alert-panel-count { background: var(--color-warning); }
.planned-alert-panel .alert-panel-facilities { font-size: var(--text-xs); font-weight: 700; color: var(--color-warning); }

@media (max-width: 720px) {
  .alert-panel-row { position: static; flex-direction: column; margin-bottom: var(--space-4); }
  .alert-panel { max-width: none; }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text);
}
.chip:has(input:checked) { background: var(--color-primary-subtle); border-color: var(--color-primary); color: var(--color-primary); }
a.chip:hover { border-color: var(--color-primary); color: var(--color-primary); text-decoration: none; }
.chip-planned { background: var(--color-warning-subtle); border-color: var(--color-warning); color: var(--color-warning); font-weight: 600; }

.facility-chip-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.facility-chip-list.is-clamped { max-height: 54px; overflow: hidden; }
.chip-toggle { font-size: var(--text-xs); }

.filter-actions { align-items: center; }

.hint { color: var(--color-text-muted); font-size: var(--text-sm); margin: var(--space-1) 0 0; display: flex; align-items: flex-start; gap: var(--space-1); }

/* ==========================================================================
   Channel sections / promotion cards
   ========================================================================== */
.channel-group { margin-bottom: var(--space-4); }

.channel-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  position: sticky;
  top: 62px;
  z-index: 10;
  background: var(--color-bg);
}
.channel-section > summary::-webkit-details-marker { display: none; }
.channel-heading {
  font-size: var(--text-lg);
  margin: 0;
  padding-left: var(--space-3);
  border-left: 4px solid var(--color-primary);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex: 1;
}
.channel-heading .count {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: normal;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 1px var(--space-2);
}
.channel-section .chevron { color: var(--color-text-muted); transition: transform var(--transition-base); }
.channel-section[open] .chevron { transform: rotate(180deg); }

.promo-list { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-2); }

.promo-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
  scroll-margin-top: 140px;
  transition: box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-base);
}
.promo-card:hover { box-shadow: var(--shadow-sm); border-color: var(--color-border-strong); }
.promo-card:target { background: var(--color-primary-subtle); border-color: var(--color-primary); }

.promo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.promo-title { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.promo-name { font-size: var(--text-md); font-weight: 600; color: var(--color-text); display: inline-flex; align-items: center; gap: var(--space-1); }
a.promo-name:hover { color: var(--color-primary); text-decoration: underline; }

.promo-actions { display: flex; gap: var(--space-1); align-items: center; flex-shrink: 0; }

.promo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.meta-item { display: inline-flex; align-items: center; gap: var(--space-1); }
.meta-item.is-warning { color: var(--color-warning); font-weight: 600; }

.promo-summary {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-raised);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  white-space: pre-wrap;
  color: var(--color-text);
}
.promo-summary-details { margin-top: var(--space-2); }
.promo-summary-details summary { cursor: pointer; font-size: var(--text-sm); color: var(--color-text-muted); }
.promo-summary-details[open] summary { margin-bottom: var(--space-1); }

.promo-facilities { margin-top: var(--space-3); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  font-size: var(--text-xs);
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.badge-new {
  background: var(--color-danger);
  color: #fff;
  font-weight: 700;
  animation: badge-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badge-pop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); }
}

.badge-urgent {
  background: var(--color-danger);
  color: #fff;
  font-weight: 700;
  animation: badge-pulse 1.6s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

.badge-ended {
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  font-weight: 600;
}

/* ==========================================================================
   Generic tables (masters, facility-form-table)
   ========================================================================== */
table { width: 100%; border-collapse: collapse; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
th, td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: top; font-size: var(--text-sm); }
th { background: var(--color-surface-raised); color: var(--color-text-muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--color-surface-raised); }

.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.inline-form { display: inline-flex; gap: var(--space-1); align-items: center; margin: 0; }

.muted { color: var(--color-text-muted); }
.empty {
  color: var(--color-text-muted);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

/* ==========================================================================
   Forms (promotion add/edit)
   ========================================================================== */
.promo-form { display: flex; flex-direction: column; gap: var(--space-4); max-width: 1100px; padding-bottom: var(--space-16); }
.form-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.form-grid label { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 600; }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}

.period-fieldset, .facility-fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: 0;
  background: var(--color-surface);
}
.period-fieldset legend, .facility-fieldset legend {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0 var(--space-1);
}
.period-row { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-end; }
.period-row .grow { flex: 1; min-width: 240px; }

.parse-btn { display: inline-flex; align-items: center; gap: var(--space-1); white-space: nowrap; }

.facility-fieldset-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.facility-form-table th, .facility-form-table td { border-bottom: 1px solid var(--color-border); }
.facility-form-table tr.is-hidden { display: none; }
.wide-input { width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); }

.form-actions {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  position: sticky;
  bottom: var(--space-3);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Masters
   ========================================================================== */
.master-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  max-width: 760px;
}
.master-table input[type="text"] { padding: var(--space-1) var(--space-2); border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); }
.reorder-cell { display: flex; flex-direction: column; gap: 2px; }
.reorder-cell button:disabled { opacity: .3; cursor: not-allowed; }
.add-form { margin-top: var(--space-3); }

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
}
.switch .thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-base);
}
.switch input:checked + .track { background: var(--color-success); }
.switch input:checked + .track + .thumb { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--color-focus-ring); outline-offset: 2px; }

/* ==========================================================================
   Reservation calendar (Gantt-style: dates as columns, channels as row-groups)
   ========================================================================== */
.gantt-scroll {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.gantt-calendar { border-collapse: collapse; width: max-content; }
.gantt-calendar th, .gantt-calendar td {
  border: 1px solid var(--color-border);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  text-align: center;
  white-space: nowrap;
}
.gantt-date-header {
  background: var(--color-surface-raised);
  position: sticky;
  top: 0;
  z-index: 3;
  min-width: 84px;
  font-weight: 600;
}
.gantt-date-header a { color: var(--color-text); }
.gantt-date-header a:hover { color: var(--color-primary); }
.gantt-date-header.is-today { background: var(--color-primary-subtle); }
.gantt-col-channel {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 76px;
  min-width: 76px;
  max-width: 76px;
}
.gantt-col-label {
  position: sticky;
  left: 76px;
  z-index: 2;
  width: 96px;
  min-width: 96px;
  max-width: 96px;
}
.gantt-corner { background: var(--color-surface-raised); z-index: 4; top: 0; position: sticky; }
.gantt-channel-name {
  background: var(--color-surface-raised);
  font-weight: 600;
  vertical-align: middle;
}
.gantt-channel-name.is-unmapped { color: var(--color-warning); }
.gantt-row-label {
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  text-align: left;
  font-weight: normal;
}
.gantt-cell { min-width: 96px; max-width: 150px; vertical-align: top; white-space: normal; }
.gantt-cell.has-promo { background: var(--color-primary-subtle); }
.gantt-promo-pill {
  display: block;
  max-width: 142px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 1px 4px;
  margin-bottom: 2px;
  font-weight: 600;
  text-decoration: none;
}
.gantt-promo-pill:hover { background: var(--color-primary-subtle); text-decoration: underline; }
.gantt-promo-pill:last-child { margin-bottom: 0; }
.gantt-row-count td.gantt-cell { color: var(--color-text); font-weight: 600; text-align: center; }
.gantt-percentage { font-size: 9px; font-weight: normal; color: var(--color-text-muted); }
.gantt-row-total th, .gantt-row-total td {
  background: var(--color-surface-raised);
  border-top: 2px solid var(--color-border-strong);
  border-bottom: 2px solid var(--color-border-strong);
  font-weight: 700;
}
.gantt-row-total .gantt-cell { color: var(--color-primary); text-align: center; }
.gantt-always-details { margin-top: 2px; }
.gantt-always-details summary {
  list-style: none;
  cursor: pointer;
  font-size: 9px;
  font-weight: normal;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 4px;
  display: inline-block;
}
.gantt-always-details summary::-webkit-details-marker { display: none; }
.gantt-always-details[open] summary { border-color: var(--color-primary); color: var(--color-primary); }
.gantt-always-panel {
  position: absolute;
  z-index: 5;
  margin-top: 2px;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
  max-width: 240px;
  white-space: normal;
}
.gantt-always-panel a { font-size: var(--text-xs); }

/* ==========================================================================
   Auth (login)
   ========================================================================== */
.auth-shell { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: var(--space-6); }
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8) var(--space-6);
}
.auth-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-4);
}
.auth-title { font-size: var(--text-lg); text-align: center; margin: 0 0 var(--space-6); }
.auth-field { position: relative; display: flex; flex-direction: column; gap: var(--space-1); }
.auth-field label { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); }
.auth-field input {
  padding: var(--space-3) var(--space-10) var(--space-3) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  background: var(--color-surface);
  color: var(--color-text);
}
.auth-toggle-visibility {
  position: absolute;
  right: var(--space-1);
  bottom: var(--space-1);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  padding: var(--space-2);
}
.alert {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  margin: var(--space-3) 0;
}
.alert-danger { background: var(--color-danger-subtle); color: var(--color-danger); }
.auth-card .form-actions { position: static; box-shadow: none; border: none; padding: 0; margin-top: var(--space-4); }
.auth-card .form-actions button { width: 100%; justify-content: center; }
