/* ----- Variables ----- */
:root {
  --bg: #f8f6f3;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --accent: #2d5a27;
  --accent-light: #e8f0e6;
  --accent-hover: #23491f;
  --danger: #c0392b;
  --danger-light: #fdeaea;
  --border: #e2dfd9;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
}

/* Primary color presets (light) – default green is :root above */
html[data-accent="green"] {
  --accent: #2d5a27;
  --accent-light: #e8f0e6;
  --accent-hover: #23491f;
}
html[data-accent="blue"] {
  --accent: #2563eb;
  --accent-light: #eef2ff;
  --accent-hover: #1d4ed8;
}
html[data-accent="purple"] {
  --accent: #7c3aed;
  --accent-light: #f5f3ff;
  --accent-hover: #6d28d9;
}
html[data-accent="teal"] {
  --accent: #0d9488;
  --accent-light: #ccfbf1;
  --accent-hover: #0f766e;
}
html[data-accent="orange"] {
  --accent: #ea580c;
  --accent-light: #ffedd5;
  --accent-hover: #c2410c;
}
html[data-accent="red"] {
  --accent: #dc2626;
  --accent-light: #fee2e2;
  --accent-hover: #b91c1c;
}
html[data-accent="pink"] {
  --accent: #db2777;
  --accent-light: #fce7f3;
  --accent-hover: #be185d;
}

/* Dark theme */
body.dark {
  --bg: #161618;
  --surface: #222225;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --accent: #5cb85c;
  --accent-light: #1e2e1e;
  --accent-hover: #6ed46e;
  --danger: #e05555;
  --danger-light: #2e1a1a;
  --border: #3f3f46;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* Dark theme + primary color presets (body is child of html) */
html[data-accent="green"] body.dark {
  --accent: #5cb85c;
  --accent-light: #1e2e1e;
  --accent-hover: #6ed46e;
}
html[data-accent="blue"] body.dark {
  --accent: #60a5fa;
  --accent-light: #1e293b;
  --accent-hover: #93c5fd;
}
html[data-accent="purple"] body.dark {
  --accent: #a78bfa;
  --accent-light: #2e1e3e;
  --accent-hover: #c4b5fd;
}
html[data-accent="teal"] body.dark {
  --accent: #2dd4bf;
  --accent-light: #1e2e2e;
  --accent-hover: #5eead4;
}
html[data-accent="orange"] body.dark {
  --accent: #fb923c;
  --accent-light: #2e221e;
  --accent-hover: #fdba74;
}
html[data-accent="red"] body.dark {
  --accent: #f81818;
  --accent-light: #2e1a1a;
  --accent-hover: #fca5a5;
}
html[data-accent="pink"] body.dark {
  --accent: #f472b6;
  --accent-light: #2e1a22;
  --accent-hover: #f9a8d4;
}

body.dark input,
body.dark textarea,
body.dark select {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border);
}
body.dark input::placeholder,
body.dark textarea::placeholder {
  color: var(--text-muted);
}

/* Password show/hide toggle (auth pages) */
.password-wrap {
  position: relative;
  margin-bottom: 1rem;
}
.password-wrap input {
  width: 100%;
  padding-right: 2.75rem;
  margin-bottom: 0;
}
.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.75rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 8px 8px 0;
  transition: color 0.15s;
}
.password-toggle:hover {
  color: var(--text);
}
.password-toggle:focus {
  outline: none;
  color: var(--accent);
}
[dir="rtl"] .password-wrap input {
  padding-right: 0.75rem;
  padding-left: 2.75rem;
}
[dir="rtl"] .password-toggle {
  right: auto;
  left: 0;
  border-radius: 8px 0 0 8px;
}
.password-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
  display: block;
  flex-shrink: 0;
  margin-bottom: 0.9rem;
}
.password-toggle .icon-eye-off {
  display: none;
}
.password-toggle.revealed .icon-eye {
  display: none;
}
.password-toggle.revealed .icon-eye-off {
  display: block;
}

/* SVG icons (outline, no fill colors – inherit currentColor) */
.icon-svg {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  vertical-align: middle;
  color: inherit;
  fill: none;
  stroke: currentColor;
}
.tab-icon .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}
.navbar-nav .tab-icon .icon-svg {
  width: 1rem;
  height: 1rem;
}
.btn-icon .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}
.empty-icon .icon-svg {
  width: 3rem;
  height: 3rem;
  display: block;
  margin: 0 auto;
  color: var(--text-muted);
}
.fab-icon .icon-svg {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
}
.schedule-switcher-icon .icon-svg {
  width: 1rem;
  height: 1rem;
}
.schedule-switcher-chevron .icon-svg,
.navbar-user-chevron .icon-svg,
.icon-chevron {
  width: 0.55rem;
  height: 0.55rem;
}
.icon-inline {
  width: 1em;
  height: 1em;
  margin-right: 0.25em;
  vertical-align: -0.2em;
}
.class-card-meta .icon-svg {
  width: 1em;
  height: 1em;
  margin-right: 0.2em;
  vertical-align: -0.15em;
}
.class-card-actions .icon-svg {
  width: 1.125rem;
  height: 1.125rem;
  display: block;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  padding-bottom: calc(2rem + 72px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* ----- Navbar (redesigned) ----- */
.navbar {
  width: 100%;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.navbar-brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.navbar-brand:hover {
  color: var(--accent-hover);
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
  justify-content: center;
}

.navbar-nav .tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  min-height: 36px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.navbar-nav .tab:hover {
  color: var(--text);
  background: var(--accent-light);
}

.navbar-nav .tab.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-light);
}

.navbar-nav .tab-icon {
  font-size: 1rem;
  line-height: 1;
}

/* Schedule view switcher (when others have shared with you) */
.schedule-switcher-dropdown {
  position: relative;
  flex-shrink: 0;
}
.schedule-switcher-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  min-width: 160px;
  max-width: 220px;
}
.schedule-switcher-trigger:hover {
  color: var(--accent);
  border-color: var(--text-muted);
}
.schedule-switcher-dropdown.open .schedule-switcher-trigger {
  color: var(--accent);
  background: var(--accent-light);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.schedule-switcher-icon {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.9;
}
.schedule-switcher-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.schedule-switcher-chevron {
  font-size: 0.55rem;
  opacity: 0.8;
  transition: transform 0.2s;
}
.schedule-switcher-dropdown.open .schedule-switcher-chevron {
  transform: rotate(180deg);
}
.schedule-switcher-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.35rem);
  min-width: 100%;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}
.schedule-switcher-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-switcher-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.schedule-switcher-item.selected {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.schedule-switcher-item.selected:hover {
  background: var(--accent-light);
  color: var(--accent);
}

body.viewing-my-schedule .viewing-shared-banner {
  display: none !important;
}
.viewing-shared-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.viewing-shared-text {
  font-weight: 500;
  color: var(--text);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}

/* User dropdown (desktop: on the right) */
.navbar-user-dropdown {
  position: relative;
}

.navbar-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.navbar-user-trigger:hover {
  color: var(--text);
  background: var(--bg);
  border-color: var(--border);
}

.navbar-user-trigger[aria-expanded="true"] {
  color: var(--accent);
  background: var(--accent-light);
  border-color: var(--accent);
}

.navbar-user-trigger .user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-user-chevron {
  font-size: 0.6rem;
  opacity: 0.7;
  transition: transform 0.2s;
}

.navbar-user-dropdown.open .navbar-user-chevron {
  transform: rotate(180deg);
}

.navbar-user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 140px;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 100;
  display: none;
}

.navbar-user-dropdown.open .navbar-user-menu {
  display: block;
}

.navbar-user-item {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s;
}

.navbar-user-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.navbar-user-item-logout {
  color: var(--danger);
}
.navbar-user-item-logout:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.navbar-user-lang {
  padding: 0.35rem 0.75rem 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}
.navbar-user-lang-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.navbar-user-lang .lang-option {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}
[dir="rtl"] .navbar-user-lang .lang-option {
  text-align: right;
}

.theme-switcher {
  flex-shrink: 0;
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid var(--border);
}

.theme-option {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.theme-option:hover {
  color: var(--text);
}

.theme-option.active {
  background: var(--accent);
  color: white;
}

.lang-switcher {
  flex-shrink: 0;
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid var(--border);
}

.lang-option {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.lang-option:hover {
  color: var(--text);
}

.lang-option.active {
  background: var(--accent);
  color: white;
}

/* ----- Dashboard ----- */
.dashboard-view {
  margin-bottom: 1.5rem;
}

.dashboard-view.hidden {
  display: none !important;
}

.dashboard-view.animate-in,
.schedule-section.animate-in,
.week-view.animate-in,
.calendar-view.animate-in {
  animation: view-fade-in 0.3s ease both;
}

@keyframes view-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.announcements-banner {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--accent-light);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
}
.announcement-item {
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}
.announcement-item:last-child {
  margin-bottom: 0;
}
.announcement-item strong {
  color: var(--accent);
}
.announcement-body {
  color: var(--text-muted);
}

.dashboard-welcome {
  margin-bottom: 1.5rem;
}

.dashboard-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.dashboard-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.dashboard-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  min-width: 120px;
  overflow: hidden;
}

.dashboard-stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dashboard-stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.dashboard-today {
  margin-bottom: 1.5rem;
}

.dashboard-week {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.dashboard-week-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.dashboard-week-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 56px;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}
.dashboard-week-bar-wrap.non-working-day {
  opacity: 0.7;
}
.dashboard-week-bar-wrap.non-working-day .dashboard-week-bar-fill {
  background: var(--text-muted);
}
.dashboard-week-bar-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.dashboard-week-bar {
  width: 100%;
  max-width: 28px;
  height: 48px;
  background: var(--border);
  border-radius: 6px 6px 0 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  margin: 0 auto;
}
.dashboard-week-bar-fill {
  width: 100%;
  height: var(--bar-height, 0);
  min-height: 0;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  transition: height 0.2s ease;
}
.dashboard-week-bar-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dashboard-week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
}

.dashboard-week-day.non-working-day {
  opacity: 0.75;
  color: var(--text-muted);
}
.dashboard-week-day {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent-light);
  border-radius: 8px;
  font-size: 0.875rem;
  overflow: hidden;
  min-width: 0;
}

.dashboard-week-day-name {
  color: var(--text);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-week-day-count {
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  text-align: right;
}

.dashboard-holidays {
  margin-top: 1rem;
}
.dashboard-holidays .btn {
  font-size: 0.875rem;
}

/* ----- Holidays (no-class days) modal ----- */
.modal-holidays {
  max-width: 420px;
  padding: 0;
  overflow: hidden;
}
.modal-holidays .modal-header {
  padding: 1.25rem 1.5rem 0;
}
.holidays-modal-body {
  padding: 1rem 1.5rem 1.5rem;
}
.holidays-intro {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  padding-left: 0.25rem;
}
.holidays-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.holidays-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.holidays-form-row label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}
.holidays-label-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}
.holidays-form input[type="date"],
.holidays-form input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.holidays-form input[type="date"]:focus,
.holidays-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.holidays-add-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-radius: 10px;
  margin-top: 0.25rem;
}
.holidays-list-wrap {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}
.holidays-list-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.holidays-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.holidays-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--accent-light);
  border-radius: 10px;
  font-size: 0.9375rem;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.holidays-list-item:hover {
  background: var(--surface);
  border-color: var(--border);
}
.holidays-list-date {
  font-weight: 600;
  color: var(--accent);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.holidays-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.holidays-remove:hover {
  color: var(--text);
  background: var(--border);
}
.holidays-list-empty {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border-radius: 10px;
  border: 1px dashed var(--border);
}
.holidays-list-empty .icon-svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0 auto 0.5rem;
  opacity: 0.7;
  color: var(--text-muted);
}

/* ----- Today ----- */
.today-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.today-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.today-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.today-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0 0.75rem 0.75rem;
  border-left: 4px solid var(--class-accent, var(--accent));
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s;
  min-width: 0;
  overflow: hidden;
}

.today-item:hover {
  background: var(--class-accent-light, var(--accent-light));
}

.today-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.today-time {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--class-accent, var(--accent));
  min-width: 4.5rem;
  flex-shrink: 0;
}

.today-name {
  font-weight: 500;
  flex: 1;
}

.today-room {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.today-empty {
  font-size: 0.9375rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}
.today-day-off {
  color: var(--accent);
  font-weight: 500;
}

/* ----- Tab bar (mobile bottom nav) ----- */
.tab-bar-mobile {
  display: none;
}

/* ----- Tab bar (clean bottom nav) ----- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  justify-content: center;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 0.5rem calc(0.5rem + env(safe-area-inset-bottom)) 0.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.06);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.6rem 0.4rem 0.7rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  min-height: 56px;
  position: relative;
}

.tab-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: block;
  transition: transform 0.2s;
}

.tab-label {
  display: block;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
  background: var(--accent-light);
}

.tab.active {
  color: var(--accent);
  font-weight: 600;
}

.tab.active .tab-icon {
  transform: scale(1.06);
}

/* Active indicator: thin line under tab */
.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
}

/* ----- Buttons ----- */
.btn {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--border);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #a03022;
}

.btn-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
}

/* ----- Schedule section ----- */
.schedule-section,
.week-view {
  min-height: 200px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: minmax(240px, auto);
  gap: 1rem;
  align-items: stretch;
}

/* Read-only: card is direct grid child */
.schedule-grid > .class-card {
  min-height: 240px;
}

.class-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-color: var(--class-accent, var(--accent));
  transition: box-shadow 0.2s, transform 0.2s;
  overflow: hidden;
  min-width: 0;
  min-height: 240px;
  display: flex;
  flex-direction: column;
}

.class-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.class-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  min-width: 0;
}

.class-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.class-card-actions {
  display: flex;
  gap: 0.25rem;
}

.class-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.class-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.class-card-lecture {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--accent-light);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.4;
}

.class-card-lecture strong {
  color: var(--accent);
  font-size: 0.8125rem;
}

.class-card-notes {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-height: 3em;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----- Empty state ----- */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.empty-state h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ----- Week view ----- */
.week-view.hidden {
  display: none;
}

/* ----- Calendar view ----- */
.calendar-view {
  margin-bottom: 1.5rem;
}

.calendar-view.hidden {
  display: none !important;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.calendar-month-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.calendar-nav {
  min-width: 40px;
  padding: 0.4rem;
}
.calendar-nav .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
}

.calendar-back-today {
  margin-bottom: 0.75rem;
  text-align: center;
  overflow: hidden;
  max-height: 80px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease, margin 0.35s ease;
}

.calendar-back-today.hidden {
  max-height: 0;
  margin-bottom: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  pointer-events: none;
}

.calendar-back-today .btn {
  font-size: 0.8125rem;
  animation: calendar-btn-in 0.4s ease 0.1s both;
}

.calendar-back-today.hidden .btn {
  animation: none;
}

@keyframes calendar-btn-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-day-header {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.5rem;
  text-align: center;
}

.calendar-day {
  background: var(--surface);
  min-height: 64px;
  padding: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
}

.calendar-day-num {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-day-classes {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.calendar-day-class {
  font-size: 0.6875rem;
  padding: 0.2rem 0.35rem;
  background: var(--class-accent-light, var(--accent-light));
  color: var(--class-accent, var(--accent));
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid var(--class-accent, var(--accent));
  cursor: grab;
}

.calendar-day.no-class {
  background: var(--surface-muted, rgba(0, 0, 0, 0.04));
  opacity: 0.85;
}
body.dark .calendar-day.no-class {
  background: rgba(255, 255, 255, 0.06);
}
.calendar-day.non-working-day {
  opacity: 0.7;
  background: var(--surface-muted, rgba(0, 0, 0, 0.03));
}
body.dark .calendar-day.non-working-day {
  background: rgba(255, 255, 255, 0.04);
}
.calendar-day-off {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 500;
}
.calendar-day.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}
.calendar-day-class.dragging {
  opacity: 0.5;
}

.calendar-day.other-month .calendar-day-num {
  color: var(--text-muted);
  opacity: 0.6;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.75rem;
}

.week-day.non-working-day {
  opacity: 0.75;
  background: var(--surface-muted, rgba(0, 0, 0, 0.04));
}
body.dark .week-day.non-working-day {
  background: rgba(255, 255, 255, 0.05);
}
.week-day {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  min-height: 120px;
  overflow: hidden;
  min-width: 0;
}

.week-day-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.week-day-classes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.week-day-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.week-class-item {
  font-size: 0.8125rem;
  padding: 0.5rem;
  background: var(--class-accent-light, var(--accent-light));
  border-radius: 8px;
  color: var(--class-accent, var(--accent));
  font-weight: 500;
  cursor: grab;
  border-left: 3px solid var(--class-accent, var(--accent));
}
.week-class-item:active {
  cursor: grabbing;
}
.week-class-item.dragging {
  opacity: 0.5;
}
.week-day.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.week-class-time {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ----- Modal ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s;
}

.modal-overlay.show {
  opacity: 1;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  z-index: 101;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}

.modal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal.hidden {
  display: none;
}

.modal-sm {
  max-width: 360px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}
.modal-close .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-form {
  padding: 1.5rem;
}

.modal-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  background: var(--surface);
  color: var(--text);
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Time wheel picker (iPhone-style scroll) – add/edit class modal */
.modal-form .time-wheel-wrap {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-form .time-wheel-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.modal-form .time-wheel-mask {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  position: relative;
}
.modal-form .time-wheel-mask::before,
.modal-form .time-wheel-mask::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 40px;
  pointer-events: none;
  z-index: 1;
}
.modal-form .time-wheel-mask::before {
  top: 0;
  background: linear-gradient(to bottom, var(--surface) 0%, transparent 100%);
}
.modal-form .time-wheel-mask::after {
  bottom: 0;
  background: linear-gradient(to top, var(--surface) 0%, transparent 100%);
}
.modal-form .time-wheel-column {
  flex: 1;
  min-width: 0;
  max-height: 7.5em;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  touch-action: pan-y;
}
.modal-form .time-wheel-column::-webkit-scrollbar {
  display: none;
}
.modal-form .time-wheel-item {
  height: 40px;
  line-height: 40px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s;
  cursor: default;
  user-select: none;
}
.modal-form .time-wheel-item.selected {
  color: var(--text);
  font-weight: 600;
}
.modal-form .time-wheel-column .time-wheel-spacer {
  height: 40px;
  scroll-snap-align: center;
}
.modal-form .time-wheel-sep {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  padding: 0 0.15rem;
  flex-shrink: 0;
}
.modal-form .time-wheel-period {
  flex: 0 0 auto;
  min-width: 3.5em;
}
[dir="rtl"] .modal-form .time-wheel-sep {
  order: 0;
}
[dir="rtl"] .modal-form .time-wheel-column {
  text-align: center;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.delete-message {
  padding: 0 1.5rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.delete-modal .modal-actions {
  padding: 1rem 1.5rem;
}

/* ----- Undo toast ----- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 1rem;
  right: 1rem;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--text);
  color: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 102;
  transform: translateY(100px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s ease;
}
.toast.toast-visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}
.toast-message {
  font-size: 0.9375rem;
  font-weight: 500;
}
.toast-undo {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.25);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.toast-undo:hover {
  background: rgba(255, 255, 255, 0.4);
}
@media (max-width: 768px) {
  .toast {
    bottom: calc(72px + 1rem + env(safe-area-inset-bottom));
  }
}

/* ----- Skeleton loading ----- */
.skeleton-loading {
  display: none;
  padding-bottom: 1rem;
}

.skeleton-loading.visible {
  display: block;
}

.main.content-loading .dashboard-view,
.main.content-loading .schedule-section,
.main.content-loading .week-view,
.main.content-loading .calendar-view,
.main.content-loading .tab-bar-mobile {
  visibility: hidden;
  position: absolute;
  left: -9999px;
}

@keyframes skeleton-shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}

.skeleton-line,
.skeleton-block,
.skeleton-row,
.skeleton-week-day,
.skeleton-card {
  background: linear-gradient(
    90deg,
    var(--border) 0%,
    var(--surface) 40%,
    var(--border) 80%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton-welcome {
  margin-bottom: 1.5rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 70%;
  max-width: 280px;
  margin-bottom: 0.5rem;
}

.skeleton-subtitle {
  height: 0.9375rem;
  width: 50%;
  max-width: 180px;
}

.skeleton-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  width: 140px;
}

.skeleton-value {
  height: 1.75rem;
  width: 3rem;
  margin-bottom: 0.5rem;
}

.skeleton-label {
  height: 0.8125rem;
  width: 5rem;
}

.skeleton-today {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.skeleton-today .skeleton-heading {
  height: 1rem;
  width: 4rem;
  margin-bottom: 0.75rem;
}

.skeleton-row {
  height: 3rem;
  margin-bottom: 0.5rem;
}

.skeleton-row:last-of-type {
  margin-bottom: 0;
}

.skeleton-week {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.skeleton-week .skeleton-heading {
  height: 0.9375rem;
  width: 5rem;
  margin-bottom: 0.75rem;
}

.skeleton-week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
}

.skeleton-week-day {
  height: 2.5rem;
}

.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.skeleton-card {
  height: 140px;
}

/* Step-by-step content reveal */
.content-reveal-step {
  opacity: 0;
  animation: content-reveal 0.4s ease forwards;
}

@keyframes content-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal-step-1 { animation-delay: 0.05s; }
.reveal-step-2 { animation-delay: 0.15s; }
.reveal-step-3 { animation-delay: 0.25s; }
.reveal-step-4 { animation-delay: 0.35s; }
.reveal-step-5 { animation-delay: 0.45s; }

/* ----- App open animation ----- */
body.app-initial .navbar {
  opacity: 0;
  transform: translateY(-12px);
}
body.app-initial .app {
  opacity: 0;
  transform: translateY(20px);
}
.navbar {
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.app {
  transition: opacity 0.5s ease 0.08s, transform 0.5s ease 0.08s;
}
body.app-initial .navbar,
body.app-initial .app {
  pointer-events: none;
}

/* ----- FAB (mobile Add class) ----- */
.fab {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(45, 90, 39, 0.4);
  z-index: 50;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}

.fab:hover {
  background: var(--accent-hover);
}

.fab:active {
  transform: scale(0.95);
}

.fab-icon {
  display: block;
}

/* ----- Utility ----- */
.hidden {
  display: none !important;
}

/* ----- Desktop ----- */
@media (min-width: 769px) {
  .app {
    padding: 0 2rem 2.5rem;
    max-width: 1000px;
    padding-bottom: 2.5rem;
  }

  .navbar-inner {
    max-width: 1000px;
    padding: 0.75rem 2rem;
    flex-wrap: nowrap;
  }

  .navbar-nav {
    display: flex;
  }

  .navbar-actions .btn-add-class {
    display: none;
  }

  .tab-bar-mobile {
    display: none !important;
  }

  .fab {
    display: flex;
    bottom: 1.5rem;
    right: 2rem;
  }

  .dashboard-view,
  .schedule-section,
  .week-view,
  .calendar-view {
    padding-top: 0.25rem;
  }

  .schedule-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
  }

  .class-card {
    padding: 1.5rem;
  }

  .week-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
  }

  .week-day {
    min-height: 140px;
    padding: 1.25rem;
  }

  .calendar-header {
    margin-bottom: 1.25rem;
  }

  .calendar-month-title {
    font-size: 1.25rem;
  }

  .calendar-grid {
    gap: 3px;
  }

  .calendar-day {
    min-height: 72px;
    padding: 0.5rem;
    font-size: 0.8125rem;
  }

  .dashboard-stat {
    min-width: 140px;
  }

  .dashboard-title {
    font-size: 1.25rem;
  }
}

/* ----- Mobile: hide navbar tabs, show bottom tab bar ----- */
@media (max-width: 768px) {
  .navbar-nav {
    display: none !important;
  }

  .tab-bar-mobile {
    display: flex !important;
  }

  /* Row 1: brand + actions. Row 2: search full width */
  .navbar-inner {
    gap: 0.75rem;
    padding: 0.65rem 1rem;
  }

  .navbar-actions .btn-add-class {
    display: none;
  }

  .navbar-user-trigger .user-name {
    max-width: 100px;
  }

  .schedule-switcher-trigger {
    min-width: 140px;
    max-width: 180px;
    padding: 0.35rem 0.6rem;
  }
}

/* ----- Mobile ----- */
@media (max-width: 640px) {
  .app {
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) calc(1rem + 72px + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }

  .navbar-inner {
    padding: 0.6rem 1rem;
  }

  .header {
    margin-bottom: 1.5rem;
  }

  .logo {
    font-size: 1.5rem;
  }

  .theme-option {
    min-height: 44px;
    padding: 0.65rem 1.1rem;
  }

  .today-section {
    padding: 1rem;
    margin-bottom: 1.25rem;
  }

  .today-item {
    min-height: 48px;
    padding: 0.85rem 0;
  }

  .actions .btn-add-class {
    display: none;
  }

  .fab {
    display: flex;
    bottom: calc(72px + 0.75rem + env(safe-area-inset-bottom));
    right: max(1rem, env(safe-area-inset-right));
  }

  .tab-bar .tab {
    min-height: 56px;
    padding: 0.55rem 0.3rem 0.65rem;
    font-size: 0.65rem;
  }

  .tab-bar .tab-icon {
    font-size: 1.2rem;
  }

  .week-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .calendar-day {
    min-height: 52px;
    padding: 0.25rem;
    font-size: 0.6875rem;
  }

  .calendar-day-class {
    font-size: 0.6rem;
    padding: 0.15rem 0.25rem;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .class-card-actions .btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
  }

  .modal-close {
    min-width: 44px;
    min-height: 44px;
  }

  .modal-actions .btn {
    min-height: 48px;
    padding: 0.85rem 1.25rem;
  }
}

/* ----- RTL (Arabic) ----- */
[dir="rtl"] .navbar-inner {
  flex-direction: row-reverse;
}

[dir="rtl"] .navbar-nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .navbar-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .theme-switcher,
[dir="rtl"] .lang-switcher {
  flex-direction: row-reverse;
}

[dir="rtl"] .modal-header,
[dir="rtl"] .modal-form,
[dir="rtl"] .modal-actions {
  text-align: right;
}

[dir="rtl"] .class-card-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .class-card-meta span {
  flex-direction: row-reverse;
}

[dir="rtl"] .dashboard-stats {
  flex-direction: row-reverse;
}

[dir="rtl"] .modal-actions {
  flex-direction: row-reverse;
}
