/* ==========================================================================
   AI & Robotics Events Calendar — Editorial UI Stylesheet
   Zero-dependency, crisp dark/light dual theme, responsive layout
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --max-width: 1440px;
  --transition-fast: 150ms cubic-bezier(0.2, 0, 0, 1);
  --transition-med: 220ms cubic-bezier(0.2, 0, 0, 1);
}

/* Dark Slate Editorial Theme (Default) */
:root[data-theme="dark"] {
  --bg: #080c15;
  --bg-elevated: #0f1625;
  --bg-surface: #151f33;
  --bg-surface-hover: #1b2842;
  --bg-cell-muted: #0b101d;
  --bg-input: #0c1220;

  --border: #1e293b;
  --border-subtle: #162033;
  --border-strong: #334155;

  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --accent-ring: rgba(99, 102, 241, 0.35);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --gold: #fbbf24;
  --gold-soft: rgba(251, 191, 36, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 20px 56px rgba(0, 0, 0, 0.6);

  --event-bar-bg-alpha: 0.18;
  --event-bar-hover-alpha: 0.30;
  --event-bar-text: #f8fafc;
}

/* Crisp Editorial Light Theme */
:root[data-theme="light"] {
  --bg: #f6f8fb;
  --bg-elevated: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-cell-muted: #f8fafc;
  --bg-input: #ffffff;

  --border: #e2e8f0;
  --border-subtle: #eef2f6;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.10);
  --accent-ring: rgba(79, 70, 229, 0.25);

  --success: #15803d;
  --success-soft: rgba(22, 163, 74, 0.12);
  --warning: #b45309;
  --warning-soft: rgba(217, 119, 6, 0.13);
  --gold: #d97706;
  --gold-soft: rgba(245, 158, 11, 0.15);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16);

  --event-bar-bg-alpha: 0.12;
  --event-bar-hover-alpha: 0.22;
  --event-bar-text: #0f172a;
}

/* Theme Icon Visibility */
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: transparent;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.hidden {
  display: none !important;
}

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

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.32);
}

.brand-copy h1 {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* View Switcher */
.view-switcher {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.view-btn.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 35px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.83rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.action-pill:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
}

.action-pill.active-watchlist {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}

.action-pill.active-watchlist svg {
  fill: var(--gold);
}

.pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.action-pill.active-watchlist .pill-count {
  background: var(--gold);
  color: #111827;
}

.icon-btn {
  width: 35px;
  height: 35px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-grid;
  place-items: center;
  transition: all var(--transition-fast);
}

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

/* Export Dropdown */
.export-menu-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 245px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}

.dropdown-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-surface);
}

.dropdown-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}

.dropdown-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Ecosystem External Links */
.ecosystem-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
}

.nav-ext-link {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-ext-link:hover {
  color: var(--text);
  background: var(--bg-surface);
}

/* ==========================================================================
   Controls / Filter Band
   ========================================================================== */
.controls-band {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.controls-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 24px 15px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.controls-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Search Input */
.search-box {
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
  max-width: 440px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 36px;
  padding: 0 36px 0 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.87rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#search-input::placeholder {
  color: var(--text-faint);
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* Remove native search cancel icon for custom crisp button */
#search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  display: grid;
  place-items: center;
}

.clear-search-btn:hover {
  background: var(--bg-surface);
  color: var(--text);
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
}

#search-input:focus ~ .search-kbd,
.search-box.has-value .search-kbd {
  display: none;
}

/* Selects & Confirmed Chip */
.select-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-wrap select {
  height: 36px;
  padding: 0 28px 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: border-color var(--transition-fast);
}

.select-wrap select:hover,
.select-wrap select:focus {
  border-color: var(--border-strong);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.83rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
}

.filter-chip.active {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.confirmed {
  background: var(--success);
}

.results-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.status-count {
  color: var(--text-muted);
  font-weight: 600;
}

.reset-link {
  color: var(--accent-hover);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
}

.reset-link:hover {
  filter: brightness(1.1);
}

/* Presets & Categories Rows */
.presets-row,
.categories-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.row-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding-top: 6px;
  min-width: 72px;
  flex-shrink: 0;
}

.categories-label-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 72px;
  flex-shrink: 0;
}

.categories-label-col .row-label {
  padding-top: 4px;
}

.cat-bulk-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.73rem;
}

.text-btn {
  color: var(--text-muted);
  font-weight: 600;
  padding: 1px 2px;
}

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

.sep {
  color: var(--text-faint);
}

.presets-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-pill {
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.79rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.preset-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

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

.category-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  user-select: none;
}

.cat-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.cat-pill.active {
  border-color: color-mix(in srgb, var(--cat-color) 55%, var(--border));
  background: color-mix(in srgb, var(--cat-color) 13%, var(--bg-elevated));
  color: var(--text);
}

.cat-pill:not(.active) {
  opacity: 0.45;
}

.cat-pill:not(.active):hover {
  opacity: 0.8;
}

.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat-color);
  flex-shrink: 0;
}

.cat-pill-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding-left: 1px;
}

/* ==========================================================================
   Month Scrubber Bar
   ========================================================================== */
.month-scrubber-band {
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
}

.month-scrubber-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-arrow-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

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

.nav-arrow-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.month-scrubber {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  padding: 1px 0;
}

.month-scrubber::-webkit-scrollbar {
  display: none;
}

.month-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.month-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.month-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.32);
}

.month-pill.zero-events:not(.active) {
  opacity: 0.45;
}

.month-pill-count {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-muted);
}

.month-pill.active .month-pill-count {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.month-pill-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2.5px;
  background: var(--accent);
  opacity: 0.65;
  transition: width var(--transition-med);
}

.month-pill.active .month-pill-bar {
  background: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-content {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 24px 40px;
}

/* Month Toolbar */
.month-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.month-heading-wrap {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.month-title {
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.month-count-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}

.month-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.79rem;
  color: var(--text-muted);
}

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

.legend-sample {
  display: inline-block;
  width: 18px;
  height: 9px;
  border-radius: 3px;
}

.confirmed-sample {
  background: rgba(99, 102, 241, 0.28);
  border-left: 3px solid #6366f1;
}

.estimated-sample {
  background: rgba(99, 102, 241, 0.12);
  border: 1px dashed #6366f1;
}

.subtle-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.subtle-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
}

.primary-btn-sm {
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background var(--transition-fast);
}

.primary-btn-sm:hover {
  background: var(--accent-hover);
}

/* Empty Inline Banner */
.empty-inline-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.empty-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Month Grid Calendar (True Week-Row Multi-Day Spanning Layout)
   ========================================================================== */
.calendar-grid-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.weekday-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.weekday-header > div {
  padding: 10px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
}

.month-weeks-container {
  display: flex;
  flex-direction: column;
}

.week-row {
  position: relative;
  border-bottom: 1px solid var(--border);
}

.week-row:last-child {
  border-bottom: none;
}

.week-days-bg {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-height: var(--week-min-h, 132px);
}

.day-cell {
  border-right: 1px solid var(--border-subtle);
  padding: 7px 8px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  transition: background var(--transition-fast);
}

.day-cell:last-child {
  border-right: none;
}

.day-cell.other-month {
  background: var(--bg-cell-muted);
}

.day-cell.other-month .day-num {
  color: var(--text-faint);
  opacity: 0.65;
}

.day-cell.is-today {
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-elevated));
}

.day-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  height: 24px;
}

.day-num-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  font-size: 0.81rem;
  font-weight: 650;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.day-num-btn:hover {
  background: var(--bg-surface);
  color: var(--text);
}

.day-cell.is-today .day-num-btn {
  background: var(--accent);
  color: #ffffff;
}

.today-tag {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-hover);
}

.day-more-btn {
  align-self: flex-start;
  margin-top: auto;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-hover);
  background: var(--accent-soft);
  transition: all var(--transition-fast);
  z-index: 3;
}

.day-more-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

/* Spanning Event Bars Layer */
.week-events-layer {
  position: absolute;
  top: 34px;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 23px;
  row-gap: 4px;
  pointer-events: none;
  z-index: 2;
}

.event-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  margin: 0 3px;
  padding: 0 7px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--ev-color) 18%, var(--bg-elevated));
  border-left: 3px solid var(--ev-color);
  color: var(--event-bar-text);
  font-size: 0.74rem;
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  transition: transform 110ms ease, background var(--transition-fast), box-shadow var(--transition-fast);
}

:root[data-theme="light"] .event-bar {
  background: color-mix(in srgb, var(--ev-color) 13%, #ffffff);
}

.event-bar:hover {
  background: color-mix(in srgb, var(--ev-color) 30%, var(--bg-elevated));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
  z-index: 5;
}

:root[data-theme="light"] .event-bar:hover {
  background: color-mix(in srgb, var(--ev-color) 22%, #ffffff);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.event-bar.is-estimated {
  border-top: 1px dashed color-mix(in srgb, var(--ev-color) 65%, transparent);
  border-right: 1px dashed color-mix(in srgb, var(--ev-color) 65%, transparent);
  border-bottom: 1px dashed color-mix(in srgb, var(--ev-color) 65%, transparent);
  background: color-mix(in srgb, var(--ev-color) 10%, var(--bg-elevated));
}

.event-bar.cont-left {
  margin-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left-width: 2px;
  border-left-style: dotted;
}

.event-bar.cont-right {
  margin-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.event-bar-star {
  color: var(--gold);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.event-bar-est {
  color: var(--text-muted);
  font-weight: 700;
  flex-shrink: 0;
}

.event-bar-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-bar-city {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
  padding-left: 6px;
}

/* ==========================================================================
   Agenda / Chronological List View
   ========================================================================== */
.agenda-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.agenda-month-group {
  scroll-margin-top: 140px;
}

.agenda-month-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.agenda-month-header h2 {
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.agenda-month-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.agenda-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agenda-card {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ev-color);
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.agenda-card:hover {
  border-color: var(--border-strong);
  border-left-color: var(--ev-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.agenda-date-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agenda-date-main {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.status-badge.confirmed {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.estimated {
  background: var(--warning-soft);
  color: var(--warning);
}

.agenda-body-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.agenda-top-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agenda-title-btn {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  letter-spacing: -0.01em;
  transition: color var(--transition-fast);
}

.agenda-title-btn:hover {
  color: var(--accent-hover);
}

.cat-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--ev-color) 14%, var(--bg-surface));
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
}

.agenda-meta-line {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.agenda-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.agenda-notes-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.price-pill.tier-free {
  background: var(--success-soft);
  border-color: transparent;
  color: var(--success);
}

.agenda-actions-col {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.card-action-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.card-action-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
  color: var(--text);
}

.card-action-btn.icon-only {
  width: 32px;
  padding: 0;
  justify-content: center;
}

.card-action-btn.bookmarked {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}

.card-action-btn.bookmarked svg {
  fill: var(--gold);
}

.card-action-btn.primary-link {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-hover);
}

.card-action-btn.primary-link:hover {
  background: var(--accent);
  color: #ffffff;
}

/* ==========================================================================
   Year / 13-Month Overview
   ========================================================================== */
.year-density-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 22px;
}

.year-density-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.year-density-head h2 {
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.muted-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.year-summary-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.stat-chip-val {
  font-size: 1rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-chip-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.year-density-bars {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  height: 128px;
  padding-top: 12px;
}

.density-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.density-col:hover {
  background: var(--bg-surface);
}

.density-count {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.density-bar-track {
  width: 100%;
  max-width: 34px;
  height: 76px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.density-bar-fill {
  width: 100%;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  min-height: 4px;
  transition: height 260ms ease;
}

.density-col.is-zero .density-bar-fill {
  background: var(--border);
  opacity: 0.45;
}

.density-lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 13-Month Cards Grid */
.year-months-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.year-month-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.year-month-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.year-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.year-card-title-btn {
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.year-card-title-btn:hover {
  color: var(--accent-hover);
}

.year-card-count {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.category-mix-bar {
  display: flex;
  height: 6px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--bg-surface);
  gap: 1px;
}

.mix-segment {
  height: 100%;
  min-width: 3px;
}

.year-events-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.year-ev-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: var(--radius-xs);
  text-align: left;
  transition: background var(--transition-fast);
}

.year-ev-row:hover {
  background: var(--bg-surface);
}

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

.year-ev-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.year-ev-date {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.year-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
}

.year-card-more {
  color: var(--text-muted);
  font-weight: 500;
}

.year-open-link {
  color: var(--accent-hover);
  font-weight: 600;
}

.year-open-link:hover {
  text-decoration: underline;
}

/* Global Empty State */
.empty-state-card {
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state-card h3 {
  font-size: 1.08rem;
  font-weight: 700;
}

.empty-state-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 420px;
}

/* ==========================================================================
   Event Detail Drawer & Day Modal
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 15, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 150ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.event-drawer {
  position: relative;
  width: min(520px, 100vw);
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInRight 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { transform: translateX(32px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-accent {
  height: 4px;
  width: 100%;
  background: var(--accent);
  flex-shrink: 0;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 12px;
}

.drawer-badges {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-title {
  font-size: 1.4rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.meta-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.meta-box.full-span {
  grid-column: 1 / -1;
}

.meta-box-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.meta-box-value {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text);
  line-height: 1.35;
}

.meta-box-sub {
  font-size: 0.77rem;
  color: var(--text-muted);
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.drawer-notes {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.drawer-tags {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.tag-chip {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.77rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.tag-chip:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-soft);
}

.drawer-footer {
  padding: 15px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 650;
  transition: background var(--transition-fast);
}

.primary-btn:hover {
  background: var(--accent-hover);
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.83rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

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

.secondary-btn.bookmarked {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}

.secondary-btn.bookmarked svg {
  fill: var(--gold);
}

/* Day Overflow Centered Modal */
#day-modal-backdrop {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.day-modal {
  width: min(480px, 100%);
  max-height: 80vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.day-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.day-modal-header h3 {
  font-size: 1.05rem;
  font-weight: 750;
}

.day-modal-list {
  padding: 12px 16px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-modal-item {
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ev-color);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.day-modal-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
  border-left-color: var(--ev-color);
}

.day-modal-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.day-modal-item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Footer & Toast
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--accent-hover);
  font-weight: 600;
}

.footer-links a:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 140;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-size: 0.84rem;
  font-weight: 650;
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 1080px) {
  .ecosystem-links {
    display: none;
  }

  .agenda-card {
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .agenda-actions-col {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
  }
}

@media (max-width: 820px) {
  .header-inner,
  .controls-inner,
  .month-scrubber-inner,
  .main-content,
  .footer-inner {
    padding-left: 14px;
    padding-right: 14px;
  }

  .presets-row,
  .categories-row {
    flex-direction: column;
    gap: 6px;
  }

  .categories-label-col {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .row-label {
    padding-top: 0;
  }

  .results-status {
    margin-left: 0;
  }

  .weekday-header > div {
    padding: 8px 4px;
    text-align: center;
    font-size: 0.68rem;
  }

  .day-cell {
    padding: 5px 4px 4px;
  }

  .event-bar {
    font-size: 0.68rem;
    padding: 0 4px;
    margin: 0 2px;
  }

  .event-bar-city {
    display: none;
  }

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

  .year-density-bars {
    overflow-x: auto;
    grid-template-columns: repeat(13, minmax(46px, 1fr));
  }

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