/* ==========================================================================
   KALENDER MICROSTOCK — MODERN WEB APP CALENDAR DESIGN SYSTEM
   Inspired by: Notion Calendar, Cron, Linear, Apple Calendar
   Aesthetic: Ultra-Clean SaaS, Hairline Borders, Responsive Fullscreen Canvas
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
  /* Surfaces (Clean Light) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-hover: #f8fafc;
  --bg-surface-active: #e2e8f0;

  /* Borders */
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;
  --border-focus: #2563eb;

  /* Typography */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  /* Brand Colors */
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-primary-subtle: #eff6ff;
  --accent-primary-text: #ffffff;

  /* Commercial Urgency */
  --mega-bg: #fef2f2;
  --mega-border: #fecaca;
  --mega-text: #991b1b;
  --mega-dot: #ef4444;

  --high-bg: #fffbeb;
  --high-border: #fde68a;
  --high-text: #92400e;
  --high-dot: #f59e0b;

  --normal-bg: #f0fdf4;
  --normal-border: #bbf7d0;
  --normal-text: #166534;
  --normal-dot: #22c55e;

  --upload-bg: #ecfdf5;
  --upload-border: #a7f3d0;
  --upload-text: #065f46;
  --upload-dot: #10b981;

  /* Fonts */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

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

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-drawer: -6px 0 30px rgba(15, 23, 42, 0.12), -1px 0 0 rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 24px 60px -12px rgba(15, 23, 42, 0.22);

  /* Transitions */
  --ease-fast: 0.12s ease;
  --ease-normal: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   CLEAN DARK THEME
   ========================================================================== */
[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-surface: #101726;
  --bg-surface-elevated: #172033;
  --bg-surface-hover: #1b263b;
  --bg-surface-active: #24324d;

  --border-subtle: #1e293b;
  --border-medium: #334155;
  --border-strong: #475569;
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #60a5fa;
  --accent-primary-subtle: rgba(59, 130, 246, 0.14);
  --accent-primary-text: #ffffff;

  --mega-bg: rgba(239, 68, 68, 0.14);
  --mega-border: rgba(239, 68, 68, 0.35);
  --mega-text: #fca5a5;
  --mega-dot: #ef4444;

  --high-bg: rgba(245, 158, 11, 0.14);
  --high-border: rgba(245, 158, 11, 0.35);
  --high-text: #fde68a;
  --high-dot: #f59e0b;

  --normal-bg: rgba(34, 197, 94, 0.12);
  --normal-border: rgba(34, 197, 94, 0.30);
  --normal-text: #86efac;
  --normal-dot: #22c55e;

  --upload-bg: rgba(16, 185, 129, 0.14);
  --upload-border: rgba(16, 185, 129, 0.35);
  --upload-text: #6ee7b7;
  --upload-dot: #10b981;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
  --shadow-drawer: -6px 0 35px rgba(0, 0, 0, 0.6), -1px 0 0 rgba(255, 255, 255, 0.08);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.85);
}

/* ==========================================================================
   2. RESET & WEB APP BODY SHELL
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  background-color: var(--bg-app);
  height: 100%;
}

.webapp-body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Clean Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ==========================================================================
   3. WEB APP TOPBAR (56px)
   ========================================================================== */
.app-topbar {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon-sidebar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--ease-fast);
}

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

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

/* Topbar Center: Navigator */
.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-nav-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px 8px;
}

.cal-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--ease-fast);
}

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

.btn-today-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.74rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--ease-fast);
}

.btn-today-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.current-month-heading {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
  min-width: 130px;
  text-align: center;
  letter-spacing: -0.2px;
  padding: 0 4px;
}

/* Topbar Right: Mode Switcher & Tools */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Topbar Right: Tools & Actions */

/* Quick Search Box */
.quick-search-box {
  position: relative;
  width: 190px;
}

.quick-search-box input {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 5px 44px 5px 28px;
  font-size: 0.76rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--ease-fast);
}

.quick-search-box input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.quick-search-box svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.kbd-badge {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.62rem;
  font-family: var(--font-mono);
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  display: none;
}

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

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

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

/* ==========================================================================
   4. MAIN WORKSPACE AREA (SIDEBAR + CALENDAR + INSPECTOR)
   ========================================================================== */
.webapp-main-area {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   5. LEFT SIDEBAR (MINI CALENDAR & FILTERS)
   ========================================================================== */
.webapp-sidebar {
  width: 250px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex-shrink: 0;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), padding 0.22s, opacity 0.22s;
}

.webapp-sidebar.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  border-right: none;
}



/* Month Stats */
.sidebar-stat-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.stat-val {
  font-family: var(--font-heading);
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--accent-primary);
}
/* Quick Microstock Filter: Upload Now Button */
.btn-filter-upload-now {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.14) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--ease-fast);
  user-select: none;
}

.btn-filter-upload-now:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16) 0%, rgba(5, 150, 105, 0.22) 100%);
  border-color: rgba(16, 185, 129, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.18);
}

.btn-filter-upload-now.active {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: #059669;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.filter-upload-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rocket-anim-icon {
  font-size: 1.15rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s ease;
}

.btn-filter-upload-now:hover .rocket-anim-icon {
  transform: translateY(-2px) scale(1.1);
}

.filter-upload-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.filter-main-title {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: #065f46;
  line-height: 1.2;
}

[data-theme="dark"] .filter-main-title {
  color: #6ee7b7;
}

.btn-filter-upload-now.active .filter-main-title {
  color: #ffffff;
}

.filter-sub-desc {
  font-size: 0.65rem;
  color: #047857;
  font-weight: 500;
  opacity: 0.9;
}

[data-theme="dark"] .filter-sub-desc {
  color: #a7f3d0;
}

.btn-filter-upload-now.active .filter-sub-desc {
  color: rgba(255, 255, 255, 0.92);
}

.toggle-indicator-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.35);
  border: 1.5px solid rgba(16, 185, 129, 0.85);
  transition: all var(--ease-fast);
  flex-shrink: 0;
}

.btn-filter-upload-now.active .toggle-indicator-dot {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.95);
}

/* Quick Microstock Filter: Mega Demand Only Button */
.btn-filter-mega-demand {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(244, 63, 94, 0.14) 100%);
  border: 1.5px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--ease-fast);
  user-select: none;
}

.btn-filter-mega-demand:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.16) 0%, rgba(244, 63, 94, 0.22) 100%);
  border-color: rgba(239, 68, 68, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.18);
}

.btn-filter-mega-demand.active {
  background: linear-gradient(135deg, #dc2626 0%, #f43f5e 100%);
  border-color: #dc2626;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.filter-mega-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.fire-anim-icon {
  font-size: 1.15rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s ease;
}

.btn-filter-mega-demand:hover .fire-anim-icon {
  transform: translateY(-2px) scale(1.15);
}

.filter-mega-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.filter-mega-title {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: #991b1b;
  line-height: 1.2;
}

[data-theme="dark"] .filter-mega-title {
  color: #fca5a5;
}

.btn-filter-mega-demand.active .filter-mega-title {
  color: #ffffff;
}

.filter-mega-sub {
  font-size: 0.65rem;
  color: #b91c1c;
  font-weight: 500;
  opacity: 0.9;
}

[data-theme="dark"] .filter-mega-sub {
  color: #fecaca;
}

.btn-filter-mega-demand.active .filter-mega-sub {
  color: rgba(255, 255, 255, 0.92);
}

.toggle-indicator-dot-mega {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.35);
  border: 1.5px solid rgba(239, 68, 68, 0.85);
  transition: all var(--ease-fast);
  flex-shrink: 0;
}

.btn-filter-mega-demand.active .toggle-indicator-dot-mega {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.95);
}

/* Category Filter List */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-section-heading {
  font-size: 0.68rem;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.category-filters-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-filter-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.74rem;
  font-family: var(--font-heading);
  color: var(--text-secondary);
  transition: all var(--ease-fast);
  text-align: left;
}

.cat-filter-item:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.cat-filter-item.active {
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  font-weight: 700;
}

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

/* Strategy Box */
.sidebar-strategy-box {
  margin-top: auto;
  background: var(--upload-bg);
  border: 1px solid var(--upload-border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.strategy-badge {
  font-size: 0.68rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--upload-text);
  text-transform: uppercase;
}

.strategy-text {
  font-size: 0.70rem;
  color: var(--upload-text);
  line-height: 1.4;
}

/* ==========================================================================
   6. CENTER CALENDAR CANVAS (THE REAL FULLSCREEN CALENDAR)
   ========================================================================== */
.calendar-canvas-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
}

.cal-canvas-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.cal-header-col {
  padding: 8px;
  text-align: center;
  font-size: 0.70rem;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.cal-header-col.weekend {
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.015);
}

[data-theme="dark"] .cal-header-col.weekend {
  background: rgba(255, 255, 255, 0.015);
}

/* Dynamic Days Grid */
.cal-canvas-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(110px, 1fr);
  overflow-y: auto;
  background: var(--border-subtle);
  gap: 1px;
}

.cal-day-box {
  background: var(--bg-surface);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background var(--ease-fast);
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.cal-day-box:hover {
  background: var(--bg-surface-hover);
}

.cal-day-box.dimmed {
  background: var(--bg-app);
  opacity: 0.42;
}

.cal-day-box.active-day {
  box-shadow: inset 0 0 0 2px var(--accent-primary);
}

.cal-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.day-number-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
}

/* ==========================================================================
   TODAY CELL HIGHLIGHT (HIGHLY PROMINENT & EYE-CATCHING)
   ========================================================================== */
.cal-day-box.is-today {
  background: linear-gradient(180deg, #eff6ff 0%, #f4f8ff 100%);
  box-shadow: inset 0 3px 0 0 #2563eb, inset 0 0 0 1.5px rgba(37, 99, 235, 0.40), 0 2px 10px rgba(37, 99, 235, 0.12);
  z-index: 5;
}

[data-theme="dark"] .cal-day-box.is-today {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.20) 0%, rgba(37, 99, 235, 0.08) 100%);
  box-shadow: inset 0 3px 0 0 #3b82f6, inset 0 0 0 1.5px rgba(59, 130, 246, 0.50), 0 2px 12px rgba(0, 0, 0, 0.4);
}

.day-number-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.today-ribbon-tag {
  background: #2563eb;
  color: #ffffff;
  font-size: 0.60rem;
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
  animation: todayPulse 2.5s infinite;
  white-space: nowrap;
}

[data-theme="dark"] .today-ribbon-tag {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.5);
}

@keyframes todayPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.6);
  }
}

.cal-day-box.is-today .day-number-circle {
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.82rem;
  width: 24px;
  height: 24px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

[data-theme="dark"] .cal-day-box.is-today .day-number-circle {
  background: #3b82f6;
}

.day-events-counter.today-counter {
  color: #1d4ed8;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.12);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

[data-theme="dark"] .day-events-counter.today-counter {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.25);
}

.cal-day-box.is-today .event-canvas-pill {
  background: var(--bg-surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  border-color: rgba(37, 99, 235, 0.25);
}

/* Event Pills inside Day Cell */
.day-events-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.event-canvas-pill {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 2px 5px;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.25;
  transition: all var(--ease-fast);
  width: 100%;
  min-width: 0;
}

.event-canvas-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.event-canvas-pill.pill-mega {
  background: var(--mega-bg);
  border-color: var(--mega-border);
  color: var(--mega-text);
  font-weight: 600;
}

.event-canvas-pill.pill-high {
  background: var(--high-bg);
  border-color: var(--high-border);
  color: var(--high-text);
  font-weight: 600;
}

.event-canvas-pill.pill-upload-mode {
  border-left: 2px solid var(--upload-dot);
}

.event-canvas-pill.pill-upload-now {
  border-left: 3px solid #10b981;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.14) 0%, var(--bg-surface-elevated) 100%);
}

.pill-rocket-tag {
  font-size: 0.68rem;
  line-height: 1;
  flex-shrink: 0;
  display: inline-block;
}

.pill-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.more-events-pill {
  font-size: 0.64rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 1px 4px;
  text-align: center;
  cursor: pointer;
  transition: all var(--ease-fast);
}

.more-events-pill:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* ==========================================================================
   7. RIGHT SLIDE-OVER INSPECTOR PANEL (NOTION CALENDAR STYLE)
   ========================================================================== */
.event-inspector-drawer {
  width: 380px;
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.event-inspector-drawer.active {
  transform: translateX(0);
}

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

.inspector-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-close-inspector {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: all var(--ease-fast);
}

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

.inspector-body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.insp-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insp-event-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}

.insp-event-desc {
  font-size: 0.80rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.insp-upload-banner {
  background: var(--upload-bg);
  border: 1px solid var(--upload-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.insp-banner-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.insp-banner-info {
  display: flex;
  flex-direction: column;
}

.insp-banner-info .lbl {
  font-size: 0.65rem;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--upload-text);
}

.insp-banner-info .val {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--upload-text);
}

.insp-banner-info .sub {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--upload-text);
  opacity: 0.9;
}

.insp-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insp-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.hint-small {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-weight: normal;
}

.insp-title-val {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.4;
}

.btn-copy-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  padding: 2px 7px;
  font-size: 0.68rem;
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease-fast);
}

.btn-copy-chip:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.insp-kw-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  max-height: 110px;
  overflow-y: auto;
}

.kw-tag-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--ease-fast);
}

.kw-tag-item:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.inspector-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   8. BUTTONS & BADGES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-family: var(--font-heading);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--ease-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.24);
}
.btn-primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.32);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.badge-cat {
  font-size: 0.65rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}

.badge-urgency {
  font-size: 0.65rem;
  font-family: var(--font-heading);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}
.badge-urgency.badge-mega {
  background: var(--mega-bg);
  border: 1px solid var(--mega-border);
  color: var(--mega-text);
}
.badge-urgency.badge-high {
  background: var(--high-bg);
  border: 1px solid var(--high-border);
  color: var(--high-text);
}

/* ==========================================================================
   9. MODALS (DAY OVERVIEW & CALCULATOR)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--ease-fast);
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.80);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  transform: scale(0.97) translateY(4px);
  transition: all var(--ease-normal);
}

.modal-card-sm {
  max-width: 460px;
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

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

.modal-title-clean {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle-clean {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.modal-btn-close {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

/* Day Overview List */
.day-overview-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
}

.day-event-overview-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all var(--ease-fast);
}

.day-event-overview-item:hover {
  background: var(--bg-surface);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.day-event-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.day-event-overview-title {
  font-family: var(--font-heading);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
}

.day-event-overview-timing {
  font-size: 0.70rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Calculator Form */
.calc-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.calc-input-row {
  display: flex;
  gap: 8px;
}

.calc-input-field {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.80rem;
  outline: none;
}

.calc-input-field:focus {
  border-color: var(--accent-primary);
  background: var(--bg-surface);
}

.calc-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.calc-step-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.calc-step-card.golden-border {
  background: var(--upload-bg);
  border-color: var(--upload-border);
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.step-num.golden-badge {
  background: var(--upload-dot);
  color: #ffffff;
  border-color: var(--upload-dot);
}

.step-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.step-tag {
  font-size: 0.70rem;
  color: var(--text-muted);
}

.step-date-txt {
  font-size: 0.80rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.step-tag.golden-text, .step-date-txt.golden-text {
  color: var(--upload-text);
  font-weight: 700;
}

.step-note {
  font-size: 0.66rem;
  color: var(--upload-dot);
  font-weight: 600;
}

/* Toast */
.toast-wrapper {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: var(--bg-surface);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-family: var(--font-heading);
  font-weight: 600;
  box-shadow: var(--shadow-modal);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlide 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

[data-theme="dark"] .toast {
  background: #ffffff;
  color: #090d16;
}

@keyframes toastSlide {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   10. RESPONSIVE BREAKPOINTS (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 900px) {
  .webapp-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    box-shadow: 6px 0 25px rgba(15, 23, 42, 0.15);
  }
  .webapp-sidebar.collapsed {
    transform: translateX(-100%);
    width: 250px;
    padding: 16px;
    opacity: 1;
  }
  .quick-search-box {
    display: none;
  }
}

@media (max-width: 680px) {
  .app-topbar {
    padding: 0 10px;
    gap: 8px;
  }
  .topbar-brand .brand-name {
    display: none;
  }
  .current-month-heading {
    font-size: 0.82rem;
    min-width: 100px;
  }
  .planning-mode-toggle span:not(.mode-icon) {
    display: none;
  }
  .event-inspector-drawer {
    width: 100%;
  }
  .cal-canvas-grid {
    grid-auto-rows: minmax(75px, 1fr);
  }
  .cal-day-box {
    padding: 3px 4px;
  }
  .pill-text {
    font-size: 0.62rem;
  }
}
