/* ==========================================================================
   components.css — Reusable UI components
   Navbar · Buttons · Cards · Badges · Forms · Modal · Toast · Empty states
   ========================================================================== */

/* ==========================================================================
   NAVBAR  (fixed, appears on every page, responsive with hamburger)
   ========================================================================== */
.navbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--navbar-h);
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.navbar__inner {
  height: 100%;
  max-width: var(--container-nav, 1400px);
  margin-inline: auto;
  padding-inline: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Brand / logo */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 800;
  font-size: var(--fs-lg);
  color: var(--text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand__mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-primary);
  flex-shrink: 0;
}
.brand__mark svg { width: 22px; height: 22px; }
.brand span b { color: var(--primary); }

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.nav-links a {
  position: relative;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--primary); background: var(--primary-soft); }

/* Right-side controls */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Theme toggle button */
.theme-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-body);
  transition: var(--transition-fast);
}
.theme-toggle:hover { background: var(--surface-3); transform: translateY(-1px); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Hamburger (hidden on desktop, shown on mobile via responsive.css) */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  place-items: center;
}
.nav-toggle svg { width: 22px; height: 22px; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
              background var(--transition-fast), border-color var(--transition-fast);
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text-body);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-3); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); transform: translateY(-2px); }

.btn-sm { padding: 0.45rem 0.8rem; font-size: var(--fs-xs); }
.btn-lg { padding: 0.85rem 1.6rem; font-size: var(--fs-base); border-radius: var(--radius-sm); }
.btn-running {
  background: var(--warning) !important;
  color: #1c1917 !important;
  border-color: var(--warning) !important;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--warning) 30%, transparent) !important;
}
.btn-running:hover { filter: brightness(0.92); }
.btn-block { width: 100%; }

/* Icon-only button */
.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.icon-btn svg { width: 18px; height: 18px; }

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card--hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--purple-200);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.card__title { font-size: var(--fs-lg); display: flex; align-items: center; gap: var(--space-2); }

/* ==========================================================================
   BADGES & PILLS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.6;
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.badge-warning { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.badge-danger  { background: color-mix(in srgb, var(--danger) 15%, transparent);  color: var(--danger); }
.badge-muted   { background: var(--surface-2); color: var(--text-muted); }

/* Colored dot (subject color indicator) */
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Priority indicators */
.priority-high   { color: var(--danger); }
.priority-medium { color: var(--warning); }
.priority-low    { color: var(--success); }

/* ==========================================================================
   FORMS
   ========================================================================== */
.field { margin-bottom: var(--space-4); }
.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}
.field label .req { color: var(--danger); }

.input, .textarea, .select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.textarea { resize: vertical; min-height: 96px; }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6a86' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2.4rem;
}

/* Inline validation error message */
.field-error {
  display: none;
  color: var(--danger);
  font-size: var(--fs-xs);
  margin-top: 6px;
  font-weight: 600;
}
.field.invalid .input,
.field.invalid .textarea,
.field.invalid .select { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 15%, transparent); }
.field.invalid .field-error { display: block; }

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

/* Color swatch picker (Subjects form) */
.swatches { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.swatch {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 3px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
  position: relative;
}
.swatch:hover { transform: scale(1.12); }
.swatch.selected { border-color: var(--text); }
.swatch.selected::after {
  content: "";
  position: absolute; inset: 0;
  margin: auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}

/* Search input with leading icon */
.search {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-faint);
  pointer-events: none;
}
.search .input { padding-left: 2.6rem; }

/* Custom checkbox used to complete tasks */
.check {
  appearance: none;
  width: 22px; height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 7px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-fast);
}
.check:hover { border-color: var(--primary); }
.check:checked { background: var(--primary); border-color: var(--primary); }
.check:checked::after {
  content: "";
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* ==========================================================================
   MODAL  (used by Tasks, Subjects, Notes for add/edit + confirm dialogs)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(30, 20, 55, 0.5);
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; animation: fadeIn var(--transition) both; }
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: scaleIn var(--transition) both;
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.modal__body { padding: var(--space-5); }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   TOAST notifications
   ========================================================================== */
.toast-wrap {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 240px;
  max-width: 360px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  animation: slideInRight var(--transition) both;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--info); }
.toast svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ==========================================================================
   EMPTY STATES
   ========================================================================== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-6) var(--space-4);
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.empty__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: var(--space-3);
}
.empty__icon svg {
  width: 26px;
  height: 26px;
}
.empty h3 {
  font-size: var(--fs-lg);
  color: var(--text);
  margin-bottom: var(--space-2);
}
.empty p {
  color: var(--text-muted);
  max-width: 44ch;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* ==========================================================================
   NAV SEARCH BUTTON & GLOBAL SEARCH (Cmd+K)
   ========================================================================== */
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: var(--transition-fast);
  cursor: pointer;
}
.nav-search-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}
.nav-search-btn svg { width: 15px; height: 15px; }

kbd, .kbd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 2px 5px;
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  box-shadow: 0 1px 0 var(--border-strong);
}

/* Global Search Modal Overlay */
.global-search-overlay {
  padding-top: 10vh;
  align-items: flex-start;
}
.global-search-box {
  max-width: 600px;
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.global-search__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.global-search__head .search-icon {
  width: 22px;
  height: 22px;
  color: var(--primary);
  flex-shrink: 0;
}
.global-search__input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
  outline: none;
}
.global-search__input::placeholder { color: var(--text-faint); }
.global-search__results {
  max-height: 380px;
  overflow-y: auto;
  padding: var(--space-3);
}
.search-empty-hint {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.search-quick-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}
.search-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-body);
  transition: var(--transition-fast);
}
.search-chip:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}
.search-group-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: var(--space-2) var(--space-3) 4px;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.search-result-item:hover, .search-result-item.active {
  background: var(--surface-2);
  transform: translateX(3px);
}
.search-item__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.search-item__info {
  flex: 1;
  min-width: 0;
}
.search-item__title {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item__title.line-through {
  text-decoration: line-through;
  color: var(--text-faint);
}
.search-item__sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.global-search__foot {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-faint);
}
.global-search__foot span { display: flex; align-items: center; gap: 4px; }

/* ==========================================================================
   CATEGORY & ESTIMATE BADGES
   ========================================================================== */
.badge-category {
  background: var(--surface-2);
  color: var(--text-body);
  border: 1px solid var(--border);
  font-weight: 600;
}
.badge-estimate {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.badge-overdue {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
  font-weight: 700;
}

/* ==========================================================================
   QUICK ACTIONS (DASHBOARD & WIDGETS)
   ========================================================================== */
.quick-actions-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.quick-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-body);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}
.quick-action-btn:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.quick-action-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ==========================================================================
   ACTIVITY FEED
   ========================================================================== */
.activity-list,
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  transition: var(--transition-fast);
}
.activity-item:hover { background: var(--surface-2); }
.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: var(--surface-2);
  color: var(--primary);
  flex-shrink: 0;
}
.activity-content { flex: 1; min-width: 0; }
.activity-title { font-weight: 600; color: var(--text); }
.activity-time { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 2px; }

/* ==========================================================================
   SETTINGS SWITCH & FORMS
   ========================================================================== */
.settings-group {
  margin-bottom: var(--space-6);
}
.settings-group h3 {
  font-size: var(--fs-base);
  color: var(--text);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  gap: var(--space-4);
}
.settings-row:last-child { border-bottom: none; }
.settings-row__info { flex: 1; }
.settings-row__title { font-weight: 600; color: var(--text); }
.settings-row__desc { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

.settings-card {
  border-radius: var(--radius);
}
.danger-card {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: color-mix(in srgb, var(--danger) 2.5%, var(--surface));
}

.theme-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
.theme-option {
  position: relative;
  cursor: pointer;
  display: block;
}
.theme-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.theme-option-box {
  padding: var(--space-4);
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.theme-option-box:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.theme-option input:checked + .theme-option-box {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-sm);
}
.theme-option input:focus-visible + .theme-option-box {
  outline: 3px solid var(--purple-400);
  outline-offset: 2px;
}
.theme-icon {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 2px;
}
.theme-option-box b {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
}
.theme-option-box small {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.theme-options {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.theme-opt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.theme-opt-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.theme-opt-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--surface-3);
  border: 1.5px solid var(--border-strong);
  border-radius: 26px;
  transition: .3s;
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2.5px;
  background-color: #fff;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-slider {
  background-color: var(--primary);
  border-color: var(--primary);
}
.switch input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   SETTINGS ENHANCEMENTS (PHASE 7)
   ========================================================================== */
.goal-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.goal-preset-btn {
  padding: 4px 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.goal-preset-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}
.goal-preset-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
}

/* Storage Diagnostics */
.diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.diagnostics-tile {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.diagnostics-num {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}
.diagnostics-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.diagnostics-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.diagnostics-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Import Preview Table */
.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-3) 0 var(--space-4);
  font-size: var(--fs-sm);
}
.import-preview-table th,
.import-preview-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.import-preview-table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.import-preview-table td:nth-child(2),
.import-preview-table td:nth-child(3) {
  text-align: right;
  font-family: var(--font-mono, monospace);
}
.import-preview-table th:nth-child(2),
.import-preview-table th:nth-child(3) {
  text-align: right;
}

/* Keyboard Shortcuts Reference */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
.shortcut-card {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shortcut-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.shortcut-keys {
  display: flex;
  gap: 4px;
  align-items: center;
}
.shortcut-keys kbd {
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 2px 7px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}
.shortcut-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-muted);
  font-weight: 600;
}
.shortcut-desc {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   TIMER / STUDY SESSION STYLES
   ========================================================================== */
.timer-container {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}
.timer-modes {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.timer-mode-btn {
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: var(--transition-fast);
  cursor: pointer;
}
.timer-mode-btn:hover { color: var(--text); background: var(--surface-3); }
.timer-mode-btn.active {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}

.timer-circle-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  margin: var(--space-4) auto var(--space-6);
}
.timer-svg {
  transform: rotate(-90deg);
}
.timer-track {
  fill: none;
  stroke: var(--surface-3);
}
.timer-bar {
  fill: none;
  stroke: url(#timerGradient);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}
.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.timer-time {
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.timer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.timer-card .field {
  text-align: left;
}
.timer-circle {
  position: relative;
  display: grid;
  place-items: center;
}
.timer-sublabel,
.timer-status {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-weight: 600;
  margin-top: var(--space-2);
  letter-spacing: 0.02em;
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.timer-btn-main {
  min-width: 140px;
  font-size: var(--fs-base);
  padding: 0.85rem 2rem;
  border-radius: var(--radius-pill);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-5);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.footer b { color: var(--primary); }

/* ==========================================================================
   AUTHENTICATION & USER IDENTITY (StudyFlow v2.0 Phase B)
   ========================================================================== */

/* Navbar Auth Area */
.nav-auth {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.nav-auth-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-xs);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-auth-btn svg { width: 15px; height: 15px; }

/* User Account Menu in Navbar */
.nav-user-menu {
  position: relative;
  flex-shrink: 0;
}
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 3px 12px 3px 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-user-btn:hover,
.nav-user-menu.open .nav-user-btn {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.user-avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.nav-user-name {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chevron-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}
.nav-user-menu.open .chevron-icon {
  transform: rotate(180deg);
}

/* User Dropdown */
.nav-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 150;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: fadeIn var(--transition-fast) both;
}
.nav-user-menu.open .nav-user-dropdown {
  display: flex;
}
.dropdown-header {
  padding: 8px 10px;
}
.dropdown-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.dropdown-email {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  word-break: break-all;
  margin-top: 2px;
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-body);
  border: none;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.dropdown-item:hover,
.dropdown-item:focus-visible {
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.dropdown-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.dropdown-logout {
  color: var(--danger) !important;
}
.dropdown-logout:hover,
.dropdown-logout:focus-visible {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface)) !important;
  color: var(--danger) !important;
}
.dropdown-logout svg {
  color: var(--danger) !important;
}

/* Auth Page Specifics */
.auth-page-wrap {
  min-height: calc(100vh - var(--navbar-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.auth-container {
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
}
.auth-card {
  padding: 36px 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  gap: 4px;
}
.auth-tab {
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
}
.auth-tab:hover {
  color: var(--text);
}
.auth-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.auth-view__head {
  margin-bottom: 22px;
}
.auth-title {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.auth-subtitle {
  font-size: var(--fs-sm);
}
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}
.field-label-row label {
  margin-bottom: 0;
}
.link-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  font-size: var(--fs-xs);
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}
.link-btn:hover {
  text-decoration: underline;
}
.password-wrap {
  position: relative;
  width: 100%;
}
.password-wrap .input {
  padding-right: 44px;
}
.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  border-radius: 6px;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.password-toggle-btn:hover {
  color: var(--text);
  background: var(--surface-3);
}
.password-toggle-btn svg {
  width: 17px;
  height: 17px;
}
.auth-submit-btn {
  margin-top: 20px;
  position: relative;
}
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes authSpin {
  to { transform: rotate(360deg); }
}
.auth-switch {
  margin-top: 22px;
  text-align: center;
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.auth-alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.auth-alert .alert-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.auth-alert.alert-danger {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border: 1px solid var(--danger);
  color: var(--danger);
}
.auth-alert.alert-success {
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  border: 1px solid var(--success);
  color: var(--success);
}
.auth-notice-view {
  text-align: center;
  padding: 16px 8px 8px;
}
.notice-icon-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}
.notice-icon-badge svg {
  width: 32px;
  height: 32px;
}
.notice-icon-badge.success {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}
.auth-notice-actions {
  margin-top: 24px;
}
.auth-privacy-foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-align: center;
}
.auth-privacy-foot svg {
  width: 15px;
  height: 15px;
  color: var(--success);
  flex-shrink: 0;
}

/* Settings Account Section */
.account-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.account-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
}
.account-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.account-detail-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.account-detail-value {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.account-status-badge-active {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}
.account-status-badge-local {
  background: var(--surface-2);
  color: var(--text-muted);
}
