:root,
[data-theme="dark"] {
  --bg-main: #0b1120;
  --bg-elevated: #131c31;
  --bg-card: #17223b;
  --bg-card-hover: #1e2c4c;
  --bg-input: #0f172a;
  --border-subtle: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.32);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --hero-gradient: linear-gradient(135deg, #1e1b4b 0%, #172554 55%, #0f172a 100%);
  --hero-border: rgba(99, 102, 241, 0.35);
  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 24px 48px -12px rgba(0, 0, 0, 0.75);
}

[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #f8fafc;
  --border-subtle: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.2);
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-glow: rgba(79, 70, 229, 0.18);
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-cyan: #0891b2;
  --accent-purple: #9333ea;
  --hero-gradient: linear-gradient(135deg, #ffffff 0%, #eef2ff 55%, #e0e7ff 100%);
  --hero-border: rgba(79, 70, 229, 0.25);
  --shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 20px 40px -12px rgba(15, 23, 42, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html, body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px 36px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px 14px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  user-select: none;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  flex-shrink: 0;
}

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

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.group-badge {
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

[data-theme="light"] .group-badge {
  background: rgba(79, 70, 229, 0.12);
  color: #4f46e5;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 11px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

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

.icon-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

@media (max-width: 520px) {
  .icon-btn .btn-label {
    display: none;
  }
  .icon-btn {
    padding: 0 10px;
  }
}

/* Hero Live Board ("Табло") */
.hero-board {
  background: var(--hero-gradient);
  border: 1px solid var(--hero-border);
  border-radius: 20px;
  padding: 16px 18px 18px;
  color: #f8fafc;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.hero-board::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, transparent 70%);
  pointer-events: none;
}

.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.live-clock-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e2e8f0;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

.pulse-dot.waiting {
  background: #f59e0b;
  animation: pulseAmber 2s infinite;
}

.pulse-dot.idle {
  background: #64748b;
  animation: none;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseAmber {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { box-shadow: 0 0 0 7px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Week Switcher */
.week-switcher-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.week-segmented {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  padding: 3px;
}

.week-seg-btn {
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.week-seg-btn.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.45);
}

.week-mode-pill {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.week-mode-pill:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.week-mode-pill.manual {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fcd34d;
}

/* Hero Status Content */
.hero-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
  margin-bottom: 8px;
}

.hero-status-badge.waiting {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
}

.hero-status-badge.done {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.3);
}

.hero-main-title {
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 8px;
  color: #ffffff;
}

.hero-main-title .countdown-highlight {
  color: #fbbf24;
  font-variant-numeric: tabular-nums;
}

.hero-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: #e2e8f0;
  margin-bottom: 12px;
}

.hero-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.81rem;
}

/* Progress Bar */
.hero-progress-wrap {
  margin-top: 8px;
  margin-bottom: 10px;
}

.hero-progress-track {
  width: 100%;
  height: 10px;
  background: rgba(15, 23, 42, 0.65);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #34d399 50%, #fbbf24 100%);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.hero-progress-fill.break-fill {
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.hero-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

.hero-next-preview {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* Light theme overrides for Hero Live Board */
[data-theme="light"] .hero-board {
  color: #0f172a;
}

[data-theme="light"] .live-clock-chip {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(79, 70, 229, 0.2);
  color: #1e293b;
}

[data-theme="light"] .week-segmented {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(79, 70, 229, 0.2);
}

[data-theme="light"] .week-seg-btn {
  color: #475569;
}

[data-theme="light"] .week-seg-btn.active {
  color: #ffffff;
}

[data-theme="light"] .week-mode-pill {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(79, 70, 229, 0.2);
  color: #475569;
}

[data-theme="light"] .week-mode-pill:hover {
  background: #ffffff;
  color: #0f172a;
}

[data-theme="light"] .week-mode-pill.manual {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(217, 119, 6, 0.45);
  color: #b45309;
}

[data-theme="light"] .hero-status-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
}

[data-theme="light"] .hero-status-badge.waiting {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.35);
}

[data-theme="light"] .hero-status-badge.done {
  background: rgba(100, 116, 139, 0.14);
  color: #334155;
  border-color: rgba(100, 116, 139, 0.3);
}

[data-theme="light"] .hero-main-title {
  color: #0f172a;
}

[data-theme="light"] .hero-main-title .countdown-highlight {
  color: #4f46e5;
}

[data-theme="light"] .hero-meta-row {
  color: #334155;
}

[data-theme="light"] .hero-meta-pill {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(79, 70, 229, 0.18);
  color: #1e293b;
}

[data-theme="light"] .hero-progress-track {
  background: rgba(15, 23, 42, 0.1);
  border-color: rgba(79, 70, 229, 0.15);
}

[data-theme="light"] .hero-progress-labels {
  color: #475569;
}

[data-theme="light"] .hero-next-preview {
  border-top-color: rgba(79, 70, 229, 0.15);
  color: #334155;
}

/* Editor Banner */
.editor-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px dashed rgba(245, 158, 11, 0.5);
  border-radius: 14px;
  padding: 11px 14px;
  margin-bottom: 14px;
}

.editor-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
}

.editor-banner-icon {
  font-size: 1.2rem;
}

.editor-banner-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.editor-banner-actions {
  display: flex;
  gap: 8px;
}

/* Day Tabs (Пн–Сб) */
.day-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.day-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 9px 4px;
  border-radius: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.day-tab:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.day-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.day-tab-short {
  font-size: 0.92rem;
  font-weight: 800;
}

.day-tab-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 600;
}

.day-tab.active .day-tab-count {
  color: rgba(255, 255, 255, 0.85);
}

.day-tab-today-dot {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.day-tab.active .day-tab-today-dot {
  background: #fbbf24;
}

/* Day Section Header */
.day-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.day-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-section-title {
  font-size: 1.08rem;
  font-weight: 800;
}

.day-today-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.day-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.show-all-weeks-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.show-all-weeks-toggle input {
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Schedule List & Lesson Cards */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: stretch;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 13px 14px;
  gap: 13px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  position: relative;
}

.lesson-card.editable {
  grid-template-columns: 86px 1fr auto;
  cursor: pointer;
}

.lesson-card.editable:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.lesson-card.is-running {
  border-color: #10b981;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.3), var(--shadow-card);
}

.lesson-card.is-past {
  opacity: 0.68;
}

.lesson-card.is-canceled {
  opacity: 0.6;
  border-style: dashed;
  border-color: var(--accent-rose);
}

.lesson-card.is-other-week {
  opacity: 0.55;
  border-style: dashed;
}

.lesson-time-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.lesson-slot-num {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 3px;
}

.lesson-time-start {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
}

.lesson-time-end {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.lesson-info-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.lesson-badges-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  line-height: 1.3;
}

.badge-lecture {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
[data-theme="light"] .badge-lecture {
  color: #2563eb;
}

.badge-practice {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
[data-theme="light"] .badge-practice {
  color: #059669;
}

.badge-lab {
  background: rgba(168, 85, 247, 0.16);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}
[data-theme="light"] .badge-lab {
  color: #7e22ce;
}

.badge-mixed {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
[data-theme="light"] .badge-mixed {
  color: #d97706;
}

.badge-week-odd {
  background: rgba(99, 102, 241, 0.16);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.32);
}
[data-theme="light"] .badge-week-odd {
  color: #4f46e5;
}

.badge-week-even {
  background: rgba(6, 182, 212, 0.16);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.32);
}
[data-theme="light"] .badge-week-even {
  color: #0891b2;
}

.badge-running {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.badge-canceled {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.badge-override {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.lesson-subject {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 5px;
  word-wrap: break-word;
}

.lesson-card.is-canceled .lesson-subject {
  text-decoration: line-through;
}

.lesson-details-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 0.81rem;
  color: var(--text-secondary);
}

.lesson-detail-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lesson-room-pill {
  font-weight: 700;
  color: var(--text-main);
}

.lesson-edit-col {
  display: flex;
  align-items: center;
}

.card-edit-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-edit-btn:hover,
.lesson-card.editable:hover .card-edit-btn {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}

/* Break divider between lessons */
.break-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.break-divider::before,
.break-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* Empty Day State */
.empty-day-card {
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-day-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.empty-day-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

/* Footer */
.app-footer {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-link-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
}

.footer-link-btn:hover {
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 11px;
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.79rem;
  border-radius: 9px;
}

.btn-lg {
  padding: 12px 18px;
  font-size: 0.94rem;
  border-radius: 13px;
}

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

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

.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fb7185;
}

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

.btn-danger-outline {
  background: transparent;
  border-color: rgba(244, 63, 94, 0.4);
  color: #fb7185;
  font-size: 0.78rem;
  padding: 7px 11px;
}

.btn-link-danger {
  background: none;
  border: none;
  color: #fb7185;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.78rem;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 1000;
  overflow-y: auto;
}

.modal-backdrop[hidden] {
  display: none !important;
}

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

.modal-card-lg {
  max-width: 560px;
}

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 800;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
}

.modal-close-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Forms */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--accent-primary);
}

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

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 480px) {
  .form-row-2, .form-row-3 {
    grid-template-columns: 1fr;
  }
}

.type-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -4px;
  margin-bottom: 12px;
}

.chip-btn {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
}

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

.week-radio-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.radio-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.radio-card input {
  accent-color: var(--accent-primary);
}

.temp-override-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.temp-override-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-amber);
  margin-bottom: 8px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.81rem;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 6px;
}

.checkbox-row:last-child {
  margin-bottom: 0;
}

.checkbox-row input {
  margin-top: 3px;
  accent-color: var(--accent-amber);
}

.temp-override-active-notice {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(245, 158, 11, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--accent-amber);
}

/* Bell Schedule Editor */
.bells-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.form-hint {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.bells-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.bell-row {
  display: grid;
  grid-template-columns: 70px 1fr auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 7px 10px;
  border-radius: 11px;
}

.bell-row-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.bell-break-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 68px;
  text-align: right;
}

.bell-calc-details {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
}

.bell-calc-details summary {
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-secondary);
}

.bell-calc-body {
  margin-top: 10px;
}

/* Share & QR Modal */
.share-subtitle {
  font-size: 0.84rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 14px;
}

.qr-box-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.qr-box {
  width: 240px;
  height: 240px;
  background: #ffffff;
  border-radius: 18px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-loading {
  color: #334155;
  font-size: 0.85rem;
  font-weight: 600;
}

.qr-group-caption {
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.share-url-preview {
  margin-bottom: 12px;
}

.share-url-input {
  font-size: 0.78rem;
  text-align: center;
  color: var(--text-secondary);
  user-select: all;
}

.share-main-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 440px) {
  .share-main-buttons {
    grid-template-columns: 1fr;
  }
}

.json-backup-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.json-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.json-file-btns {
  display: flex;
  gap: 6px;
}

.file-upload-label {
  cursor: pointer;
}

.json-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.4;
  margin-bottom: 8px;
  resize: vertical;
}

.json-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  animation: toastIn 0.2s ease;
}

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