/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font-family: inherit; }

:root {
  --bg: #07101d;
  --surface: #0c1c30;
  --surface2: #112236;
  --surface3: #162c44;
  --border: #1c3554;
  --border-hi: #2a4f78;
  --accent: #00b4d8;
  --accent-hover: #48cae4;
  --accent-dim: rgba(0,180,216,0.09);
  --text: #d8e6f0;
  --text-muted: #7a9ab5;
  --text-dim: #4a6880;
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.1);
  --red: #e05252;
  --red-dim: rgba(224,82,82,0.1);
  --yellow: #f0a500;
  --yellow-dim: rgba(240,165,0,0.1);
  --mena: #0f2a50;
  --latam: #0f2e1a;
  --extended: #3a2846;
  --header-bg: #050d18;
  --shadow: rgba(0,0,0,0.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 3px;
  --radius-lg: 5px;
  font-size: 15px;
}

[data-theme="light"] {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface2: #f2f4f7;
  --surface3: #e9ecf0;
  --border: #e2e5ea;
  --border-hi: #c8cdd4;
  --accent: #111827;
  --accent-hover: #1f2937;
  --accent-dim: rgba(17,24,39,0.04);
  --text: #111827;
  --text-muted: #4b5563;
  --text-dim: #9ca3af;
  --green: #059669;
  --green-dim: rgba(5,150,105,0.08);
  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.05);
  --yellow: #d97706;
  --yellow-dim: rgba(217,119,6,0.06);
  --mena: #eff6ff;
  --latam: #ecfdf5;
  --extended: #faf5ff;
  --header-bg: #ffffff;
  --shadow: rgba(0,0,0,0.04);
}

/* ===== LOGIN GATE ===== */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-gate.hidden { display: none; }
.login-card {
  text-align: center;
  padding: 48px 40px;
  max-width: 360px;
  width: 100%;
}
.login-logo {
  width: 56px;
  height: 56px;
  color: var(--accent);
  margin-bottom: 18px;
}
.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text);
  margin-bottom: 32px;
}
.login-year {
  font-weight: 400;
  opacity: 0.5;
  font-size: 1rem;
  margin-left: 4px;
}
.login-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.login-input:focus { outline: none; border-color: var(--accent); }
.login-input::placeholder { color: var(--text-dim); letter-spacing: 0.04em; }
.login-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.login-btn:hover { background: var(--accent-hover); }
[data-theme="light"] .login-btn { background: #111827; }
[data-theme="light"] .login-btn:hover { background: #1f2937; }
.login-error {
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--red);
  font-weight: 600;
}
.login-error.hidden { display: none; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.93rem;
  line-height: 1.6;
  min-height: 100vh;
  border-top: 2px solid var(--accent);
  transition: background 0.2s, color 0.2s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== HEADER ===== */
header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.2s;
}

[data-theme="light"] header { box-shadow: 0 1px 4px var(--shadow); }

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  color: var(--text);
  text-transform: uppercase;
  margin-right: 26px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.logo:focus { outline: none; }
.logo:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }

.logo-mark {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px var(--accent-dim));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.logo:hover .logo-mark {
  transform: rotate(-4deg) scale(1.05);
  filter: drop-shadow(0 0 10px rgba(0,180,216,0.35));
}

[data-theme="light"] .logo:hover .logo-mark {
  filter: drop-shadow(0 0 8px rgba(17,24,39,0.15));
}

.logo-text {
  background: linear-gradient(90deg, var(--text) 0%, var(--accent-hover) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .logo-text {
  background: linear-gradient(90deg, var(--text) 0%, #4b5563 120%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-year {
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.2em;
  padding-left: 7px;
  margin-left: 1px;
  border-left: 1px solid var(--border);
}

nav { display: flex; gap: 2px; height: 40px; align-items: center; }

/* ===== NAV DROPDOWN (hover reveal for top-level sections) ===== */
.nav-item { position: relative; display: flex; align-items: center; height: 40px; }
.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.2);
  z-index: 200;
  margin-top: 2px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
.nav-item.has-dropdown:hover .nav-dropdown,
.nav-item.has-dropdown:has(:focus-visible) .nav-dropdown {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
/* tiny invisible bridge so the dropdown doesn't disappear when moving cursor down */
.nav-dropdown::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 6px;
}
.nav-item.has-dropdown .nav-btn::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 5px;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 3px solid currentColor;
  opacity: 0.35;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.nav-item.has-dropdown:hover .nav-btn::after,
.nav-item.has-dropdown:has(:focus-visible) .nav-btn::after {
  transform: rotate(180deg);
  opacity: 0.7;
}
.nav-dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 14px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
  border-radius: 4px;
  font-family: inherit;
  transition: color 0.12s, background 0.12s;
}
.nav-dropdown-item:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

[data-theme="light"] .nav-dropdown {
  background: #fff;
  border-color: #e5e7eb;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
}
[data-theme="light"] .nav-dropdown-item { color: #6b7280; }
[data-theme="light"] .nav-dropdown-item:hover { color: #111827; background: #f3f4f6; }

.nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px 10px;
  height: 28px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.12s, background 0.12s;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.12s;
}

.nav-btn:hover { color: var(--text); background: var(--surface2); }
.nav-btn:hover .nav-icon { opacity: 0.8; }
.nav-btn.active { color: var(--accent); background: var(--accent-dim); }
.nav-btn.active .nav-icon { opacity: 1; }
.nav-btn:focus { outline: none; }
.nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 3px; }
.nav-dropdown-item:focus { outline: none; }
.nav-dropdown-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: all 0.12s;
  white-space: nowrap;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--text); }
.theme-toggle-icon { font-size: 0.75rem; line-height: 1; }

/* ===== MAIN ===== */
main { max-width: 1400px; margin: 0 auto; padding: 20px 20px; }

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ===== MAP VIEW ===== */
#view-map .view-header { margin-bottom: 8px; }
#view-map { margin: 0 -20px; padding: 0 20px; max-width: none; }

#map-container {
  position: relative;
  height: calc(100vh - 130px);
  min-height: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

#mapbox-map { width: 100%; height: 100%; }

.map-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  box-shadow: 0 2px 8px var(--shadow);
}
.map-marker:hover { transform: scale(1.3); border-color: var(--accent-hover); }
.map-marker.studied { border-color: var(--green); }
.map-marker.mena { background: var(--mena); }
.map-marker.latam { background: var(--latam); }
.map-marker.extended { background: var(--extended); }

.map-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 90%;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px;
  z-index: 10;
  transition: transform 0.2s;
}
.map-sidebar.hidden { transform: translateX(100%); pointer-events: none; }

.map-sidebar-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 11;
}
.map-sidebar-close:hover { color: var(--text); }

.map-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--accent);
}
.map-card-flag { font-size: 1.4rem; }
.map-card-title { font-size: 0.9rem; font-weight: 700; }
.map-card-sub { font-size: 0.65rem; color: var(--text-muted); }

.map-card-facts { margin-bottom: 8px; }
.map-card-facts .detail-row { padding: 2px 0; font-size: 0.72rem; }
.map-card-facts .row-label { font-size: 0.65rem; min-width: 80px; }

.map-card-keys { margin-bottom: 8px; }
.map-card-keys h4 {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
}
.map-card-keys ul { padding-left: 12px; font-size: 0.72rem; line-height: 1.5; }
.map-card-keys li { margin-bottom: 2px; color: var(--text); }

.map-card-open {
  display: block;
  width: 100%;
  padding: 6px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  transition: background 0.12s;
  margin-top: 8px;
}
.map-card-open:hover { background: var(--accent); color: #fff; }

.map-studied-badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--green-dim);
  color: var(--green);
  font-weight: 600;
  margin-left: 8px;
}

/* Mapbox popup override */
.mapboxgl-popup-content {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 8px 12px !important;
  font-size: 0.78rem !important;
  font-family: var(--font) !important;
  box-shadow: 0 4px 16px var(--shadow) !important;
}
.mapboxgl-popup-tip { border-top-color: var(--surface) !important; }
.mapboxgl-popup-close-button { color: var(--text-muted) !important; font-size: 1rem !important; }

h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

h2 {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ===== SECTION LABEL (reusable eyebrow) ===== */
.section-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

/* ===== DASHBOARD ===== */
.dash-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.dash-date {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.dash-topbar-sep { color: var(--border-hi); font-size: 0.7rem; }

.dash-topbar-week {
  font-size: 0.62rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.dash-topbar-right { margin-left: auto; display: flex; gap: 4px; }

.dash-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.6rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-action-btn:hover { border-color: var(--accent); color: var(--accent); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-pace {
  font-size: 0.6rem;
  font-weight: 600;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 2px;
  display: inline-block;
}
.stat-pace.pace-ahead { background: var(--green-dim); color: var(--green); }
.stat-pace.pace-on-track { color: var(--text-dim); }
.stat-pace.pace-behind { background: var(--red-dim); color: var(--red); }

.stat-card {
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 14px 13px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 2px 6px rgba(0,0,0,0.18);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 50%, transparent);
  opacity: 0.35;
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-hi);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 4px 12px rgba(0,0,0,0.28);
}

.stat-label {
  font-size: 0.58rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 6px;
}

.stat-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-number {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat-of {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.stat-bar {
  height: 4px;
  background: var(--surface3);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 3px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--accent-dim);
}

/* Dashboard rows */
.dash-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
@media (max-width: 900px) { .dash-row-2 { grid-template-columns: 1fr; } }

.dash-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
@media (max-width: 900px) { .dash-row-3 { grid-template-columns: 1fr; } }

.dash-today-panel {
  border-left: 3px solid var(--green);
}

/* Calendar */
.dash-calendar-panel { min-width: 0; }

.cal-nav { display: flex; gap: 4px; }
.cal-nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  width: 22px;
  height: 22px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}
.cal-nav-btn:hover { color: var(--text); background: var(--surface2); }

.dash-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 4px 2px 2px;
}

.cal-header {
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-align: center;
  padding: 4px 0 10px;
}

.cal-day {
  position: relative;
  text-align: center;
  padding: 7px 0;
  font-size: 0.78rem;
  cursor: default;
  min-height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.cal-day .cal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cal-day.cal-other .cal-num { color: var(--text-dim); opacity: 0.3; }
.cal-day.cal-past .cal-num { color: var(--text-dim); }

/* Today: clean filled accent circle */
.cal-day.cal-today .cal-num {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 0 0 4px rgba(0,180,216,0.12);
}

/* Ambient "this week" band: the grid row that contains today gets a
   very quiet background wash so you can see your position in the plan
   at a glance without any list or badge. */
.cal-day.cal-in-current-week {
  background: linear-gradient(180deg, rgba(0,180,216,0.05) 0%, rgba(0,180,216,0.02) 100%);
}
.cal-day.cal-in-current-week:first-of-type,
.cal-day.cal-today.cal-in-current-week { }

/* Days with a real deadline: single 4px dot below the number, colored by
   the dominant category (writing/profile/admin). Quiet but unmistakable. */
.cal-mark {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cat, var(--accent));
  margin-top: 3px;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--cat, var(--accent)) 18%, transparent);
}
.cal-day.cal-past .cal-mark { opacity: 0.5; }
.cal-day.cal-today .cal-mark {
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
}

/* Hover: subtle brighten on days that have something */
.cal-day.cal-has-deadline { cursor: pointer; }
.cal-day.cal-has-deadline:hover {
  background: color-mix(in oklab, var(--cat, var(--accent)) 10%, transparent);
}
.cal-day.cal-has-deadline:hover .cal-num {
  color: var(--text);
}

/* Legend: very quiet, just enough to decode the dot colors */
.cal-legend {
  display: flex;
  gap: 18px;
  justify-content: center;
  padding: 12px 0 2px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}
.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.56rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.cal-legend-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

/* Clean tooltip — multi-line, wraps, minimal */
.cal-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 0.7rem;
  white-space: normal;
  min-width: 180px;
  max-width: 260px;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.32);
  color: var(--text);
  text-align: left;
  margin-bottom: 6px;
  line-height: 1.4;
}
.cal-tooltip-item {
  position: relative;
  padding-left: 10px;
  margin-bottom: 4px;
}
.cal-tooltip-item:last-child { margin-bottom: 0; }
.cal-tooltip-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--dot, var(--accent));
}

.cal-day:hover .cal-tooltip { display: block; }

.dash-task-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
}
.dash-task-chip:hover .dash-task-delete { opacity: 1; }
.dash-task-delete:hover { color: var(--red); }

.dash-add-task {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.dash-add-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.72rem;
  padding: 4px 8px;
}
.dash-add-input::placeholder { color: var(--text-dim); }
.dash-add-input:focus { outline: none; border-color: var(--accent); }

.dash-add-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  width: 26px;
  height: 26px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-add-btn:hover { background: var(--accent); color: #fff; }

.dash-activity-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 4px;
}
.dash-activity-header span {
  text-align: center;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.dash-panel {
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 140%);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 13px 15px 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 2px 8px rgba(0,0,0,0.2);
  transition: border-color 0.18s ease;
}

.dash-panel:hover { border-color: var(--border-hi); }

.dash-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.dash-panel-header h2 {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0;
}

.dash-notes-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 10px;
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
  transition: border-color 0.15s;
}
.dash-notes-textarea:focus { outline: none; border-color: var(--accent); }
[data-theme="light"] .dash-notes-textarea { background: #fff; border-color: #e5e7eb; }
[data-theme="light"] .dash-notes-textarea:focus { border-color: #111827; }

.daily-goals-est-dash {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-weight: 500;
}

.dashboard-sections {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) { .dashboard-sections { grid-template-columns: 1fr; } }

.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.item-list { display: flex; flex-direction: column; gap: 3px; }

.item-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 2px solid transparent;
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.12s, border-left-color 0.12s;
}

.item-chip:hover { border-color: var(--border-hi); border-left-color: var(--accent); }
.item-chip .chip-flag { font-size: 0.9em; }
.item-chip .chip-label { flex: 1; }
.item-chip .chip-due { font-size: 0.65rem; color: var(--yellow); }

.empty-state { color: var(--text-dim); font-size: 0.78rem; padding: 4px 0; font-style: italic; }

.plan-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-list li {
  font-size: 0.83rem;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
}

.plan-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; gap: 4px; flex-wrap: wrap; }

.filter-btn, .quiz-filter-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.12s;
}

.filter-btn:hover, .quiz-filter-btn:hover { border-color: var(--border-hi); color: var(--text); }
.filter-btn.active, .quiz-filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ===== CARD GRID ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid transparent;
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.12s, border-left-color 0.12s, background 0.12s;
  position: relative;
}

.profile-card:hover { border-color: var(--border-hi); border-left-color: var(--accent); background: var(--surface2); }

.profile-card .card-flag { font-size: 1.3rem; margin-bottom: 4px; }
.profile-card .card-name { font-weight: 600; font-size: 0.8rem; margin-bottom: 2px; color: var(--text); }
.profile-card .card-sub { font-size: 0.68rem; color: var(--text-dim); }

.profile-card .card-region {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 2px;
}

.region-MENA { background: var(--mena); color: #5ba3d4; border: 1px solid #1e4a7a; }
.region-LATAM { background: var(--latam); color: #4db87a; border: 1px solid #1a4e2a; }
.region-EXTENDED { background: var(--extended); color: #c084fc; border: 1px solid #5b2d7a; }

.studied-badge {
  position: absolute;
  bottom: 10px; right: 10px;
  font-size: 0.65rem;
  color: var(--green);
  letter-spacing: 0.05em;
}

/* ===== DETAIL VIEW ===== */
.btn-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 14px;
  transition: border-color 0.12s, color 0.12s;
}

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

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.detail-flag { font-size: 2rem; }

.detail-title h1 { margin-bottom: 2px; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.detail-title .detail-sub { color: var(--text-muted); font-size: 0.72rem; font-weight: 500; }

.detail-mark-btn {
  margin-left: auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 12px;
  border-radius: var(--radius);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.12s;
  white-space: nowrap;
}

.detail-mark-btn:hover { border-color: var(--green); color: var(--green); }
.detail-mark-btn.studied { background: var(--green-dim); border-color: var(--green); color: var(--green); }

.detail-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 768px) { .detail-body { grid-template-columns: 1fr; } }

.detail-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.detail-block.full-width { grid-column: 1 / -1; }

.detail-block h3 {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}

.detail-row:last-child { border-bottom: none; }
.detail-row .row-label { color: var(--text-dim); min-width: 90px; font-size: 0.72rem; font-weight: 500; }
.detail-row .row-value { text-align: right; color: var(--text); }

.key-facts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.key-facts-list li {
  font-size: 0.78rem;
  padding-left: 14px;
  position: relative;
  color: var(--text);
  line-height: 1.5;
}

.key-facts-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.tags-list { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mena-link {
  font-size: 0.855rem;
  color: var(--text);
  line-height: 1.7;
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 10px;
}

/* ===== COUNTRY PROFILE SECTIONS ===== */
.cp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
@media (max-width: 768px) { .cp-grid { grid-template-columns: 1fr; } }

.cp-col { display: flex; flex-direction: column; }

.cp-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 6px;
}

.cp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--accent);
}

.cp-section-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.cp-edit-btn {
  font-size: 0.6rem;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
}
.cp-edit-btn:hover { border-color: var(--accent); color: var(--accent); }

.cp-edit-area { margin-top: 6px; }

.cp-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.cp-reset-btn {
  font-size: 0.72rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
  text-decoration: underline;
}
.cp-reset-btn:hover { color: var(--text); }

.sup-text {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text);
}
.sup-text p { margin-bottom: 0.7em; }
.sup-text ul { padding-left: 1.3em; margin-bottom: 0.7em; }
.sup-text li { margin-bottom: 0.3em; line-height: 1.6; }

.sup-analysis-box {
  font-size: 0.855rem;
  color: var(--text);
  line-height: 1.7;
  background: var(--surface2);
  border-left: 3px solid var(--border);
  padding: 10px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.notes-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.78rem;
  padding: 10px;
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
  transition: border-color 0.15s;
}

.notes-textarea:focus { outline: none; border-color: var(--accent); }

.notes-save-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
  padding: 6px 18px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 8px;
  transition: background 0.15s, color 0.15s;
}

.notes-save-btn:hover { background: var(--accent); color: #fff; }
.notes-saved { color: var(--green); font-size: 0.78rem; margin-top: 6px; }

/* ===== QUIZ ===== */
#quiz-start { text-align: center; padding: 40px 0; }

.quiz-info {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 12px 36px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s;
}

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

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
  margin-left: 12px;
}

.btn-secondary:hover { border-color: var(--border-hi); color: var(--text); }

.quiz-progress-bar {
  height: 3px;
  background: var(--surface2);
  margin-bottom: 24px;
  overflow: hidden;
}

#quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}

.quiz-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 24px;
  letter-spacing: 0.06em;
}

.flashcard { max-width: 680px; margin: 0 auto; }

.flashcard-front, .flashcard-back {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
}

.card-source {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 24px;
}

.card-question {
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.7;
  margin-bottom: 32px;
  color: var(--text);
}

.btn-reveal {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px 28px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.15s;
}

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

.card-answer {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 32px;
  text-align: left;
}

.result-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-wrong {
  background: var(--red-dim);
  border: 1px solid var(--red);
  color: var(--red);
  cursor: pointer;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.15s;
}
.btn-wrong:hover { background: rgba(224,82,82,0.2); }

.btn-hard {
  background: var(--yellow-dim);
  border: 1px solid var(--yellow);
  color: var(--yellow);
  cursor: pointer;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.15s;
}
.btn-hard:hover { background: rgba(240,165,0,0.2); }

.btn-correct {
  background: var(--green-dim);
  border: 1px solid var(--green);
  color: var(--green);
  cursor: pointer;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.15s;
}
.btn-correct:hover { background: rgba(34,197,94,0.2); }

/* ===== QUIZ DONE ===== */
#quiz-done { text-align: center; padding: 40px 0; }
#quiz-done h2 { font-size: 1.2rem; margin-bottom: 28px; letter-spacing: 0.1em; }

.quiz-results {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 28px 48px;
}

.result-stat { text-align: center; }
.result-stat .num { font-size: 2rem; font-weight: 700; font-family: var(--mono); }
.result-stat .lbl { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-top: 6px; }
.result-correct .num { color: var(--green); }
.result-hard .num { color: var(--yellow); }
.result-wrong .num { color: var(--red); }

/* ===== WEEK ACTIVITY LOG ===== */
.dash-activity-panel { min-width: 0; }

.week-activity-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
@media (max-width: 768px) { .week-activity-row { grid-template-columns: repeat(4, 1fr); } }

.week-activity-day {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface2);
  min-height: 52px;
}

.week-activity-day.activity-today { background: var(--accent-dim); border: 1px solid var(--accent); }
.week-activity-day.activity-future { opacity: 0.35; }

.activity-day-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-dim);
}
.activity-today .activity-day-label { color: var(--accent); }

.activity-tags { display: flex; flex-wrap: wrap; gap: 3px; }

.activity-tag {
  font-size: 0.55rem;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--green-dim);
  color: var(--green);
}

.activity-empty {
  font-size: 0.58rem;
  color: var(--text-dim);
  font-style: italic;
}

/* ===== SCHEDULE DEADLINES ===== */
.schedule-deadlines-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.schedule-deadlines-list { display: flex; flex-direction: column; gap: 4px; }

.deadline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: var(--radius);
  font-size: 0.78rem;
}
.deadline-item:hover { background: var(--surface2); }

.deadline-date {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 56px;
  white-space: nowrap;
}

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

.deadline-label {
  flex: 1;
  color: var(--text);
}

.deadline-week {
  font-size: 0.6rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ===== BOOK NOTES PROMPT ===== */
.notes-prompt {
  background: var(--green-dim);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.notes-prompt-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.notes-prompt-text {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
}
.notes-prompt-text strong { color: var(--green); }

.notes-prompt-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.notes-prompt-go {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s;
}
.notes-prompt-go:hover { opacity: 0.85; }

.notes-prompt-dismiss {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: color 0.12s;
}
.notes-prompt-dismiss:hover { color: var(--text); }

/* ===== UTILS ===== */
.hidden { display: none !important; }

/* ===== SOURCE LINE ===== */
.source-line {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 2px;
  letter-spacing: 0.03em;
}

/* ===== TEMPLATE SECTIONS ===== */
.template-section {
  position: relative;
  border-top: 2px solid var(--accent) !important;
}

.template-section-label {
  position: absolute;
  top: -1px; right: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 0 0 5px 5px;
}

.template-row-inline {
  display: flex;
  gap: 12px;
  font-size: 0.855rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.template-row-inline:last-child { border-bottom: none; }
.template-row-inline .tlabel {
  color: var(--text-dim);
  min-width: 160px;
  font-size: 0.78rem;
  font-weight: 600;
}

.notes-template-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 8px;
}

/* ===== NEWS TAB ===== */
.news-meta-line {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}

.news-feed {
  flex: 1;
  min-height: 0;
}

.news-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  height: calc(100vh - 220px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.news-list-col {
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.news-list-item {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-left-color 0.12s;
}

.news-list-item:hover {
  background: var(--surface2);
  border-left-color: var(--border-hi);
}

.news-list-item.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.news-list-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.news-list-title {
  font-size: 0.865rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}

.news-list-item.active .news-list-title { color: var(--accent-hover); }

.news-detail-col {
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--surface);
}

.news-detail-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 60px 0;
  font-style: italic;
}

.news-detail-header { margin-bottom: 18px; }

.news-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.news-detail-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
}

.news-detail-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.news-detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.news-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.news-detail-summary {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--text);
}

.news-detail-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.news-read-link {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.news-read-link:hover { color: var(--accent-hover); }

.tts-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.tts-btn:hover { border-color: var(--border-hi); color: var(--text); }

.tts-btn.tts-playing {
  background: rgba(0,180,216,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* Implications section */
.impl-bullet {
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text);
  padding: 5px 0 5px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.impl-bullet:last-child { border-bottom: none; }
.impl-bullet::before {
  content: '•';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-size: 1rem;
  line-height: 1.75;
}
.impl-loading {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  padding: 4px 0;
}
.impl-error {
  font-size: 0.8rem;
  color: var(--yellow);
  padding: 4px 0;
}
.impl-setup {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.impl-setup-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
}
.impl-setup-btn {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.impl-setup-btn:hover { border-color: var(--accent); }
.impl-key-form { display: flex; flex-direction: column; gap: 10px; }
.impl-key-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}
.impl-key-hint a { color: var(--accent); }
.impl-key-row { display: flex; gap: 8px; align-items: center; }
.impl-key-input {
  flex: 1;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 0.8rem;
  padding: 6px 10px;
  outline: none;
}
.impl-key-input:focus { border-color: var(--accent); }

.news-loading {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 32px 0;
  text-align: center;
}

.news-source-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid rgba(0,180,216,0.2);
}

.news-tag {
  font-size: 0.65rem;
  background: var(--surface2);
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.news-date {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.news-filter-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 14px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.15s;
}

.news-filter-btn:hover { border-color: var(--border-hi); color: var(--text); }
.news-filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ===== NOTES TOOLBAR & MARKDOWN PREVIEW ===== */
.notes-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.notes-mode-btn {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 11px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.notes-mode-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.notes-mode-btn:not(.active):hover {
  border-color: var(--border-hi);
  color: var(--text-muted);
}

.notes-preview-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-height: 180px;
  cursor: text;
  transition: border-color 0.15s;
}

.notes-preview-panel:hover { border-color: var(--border-hi); }

/* Markdown rendered elements */
.md-h2 {
  display: block;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: #1a1200;
  background: rgba(240, 165, 0, 0.82);
  padding: 3px 10px 3px 8px;
  border-radius: 3px;
  margin: 18px 0 9px;
  text-transform: uppercase;
}

.md-h2:first-child { margin-top: 0; }

.md-h3 {
  display: block;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 14px 0 6px;
}

.md-p {
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 6px;
}

.md-list {
  padding-left: 16px;
  margin-bottom: 8px;
}

.md-list li {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 3px;
}

.md-code {
  font-size: 0.8em;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0 4px;
  color: var(--accent);
}

.md-spacer { height: 6px; }

.md-empty {
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.875rem;
  padding: 8px 0;
}

/* ===== NOTES ACTIONS & DOWNLOAD ===== */
.notes-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.download-group { display: flex; gap: 8px; }

.btn-download {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.15s;
}

.btn-download:hover { border-color: var(--border-hi); color: var(--text); }

/* ===== BOOKS LIST ===== */
.book-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, border-left-color 0.15s;
}

.book-card:hover { border-color: var(--border-hi); border-left-color: var(--accent); }
.book-card.book-finished { border-left-color: var(--green); }
.book-card.book-finished .book-title { color: var(--text-muted); }

.book-card-top {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.book-category-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 700;
  border: 1px solid rgba(0,180,216,0.2);
}

.book-month-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface2);
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 3px;
}
.book-month-tag.shifted {
  background: rgba(240,165,0,0.15);
  color: var(--yellow);
  border: 1px solid rgba(240,165,0,0.3);
}
.shifted-marker {
  font-style: normal;
  opacity: 0.8;
}
.rescheduled-note {
  font-size: 0.75em;
  color: var(--yellow);
  font-style: italic;
}

.book-title {
  font-size: 0.935rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.4;
}

.book-author {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.book-meta-row {
  display: flex;
  gap: 16px;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.book-progress-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.book-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.book-card.book-finished .book-progress-fill { background: var(--green); }

.book-progress-label {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.book-card.book-finished .book-progress-label { color: var(--green); }

.book-has-notes {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ===== BOOK DETAIL - PROGRESS TRACKER ===== */
.progress-tracker { display: flex; flex-direction: column; gap: 14px; }

.progress-bar-lg {
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill-lg {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-numbers { font-size: 0.83rem; color: var(--text-muted); }

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

.progress-input-row label { font-size: 0.78rem; color: var(--text-muted); }

.page-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  padding: 5px 10px;
  width: 90px;
  transition: border-color 0.15s;
}

.page-input:focus { outline: none; border-color: var(--accent); }

.weekly-breakdown { margin-top: 4px; }

.weekly-breakdown h4 {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.week-grid { display: flex; flex-direction: column; gap: 3px; }

.week-row {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.8rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.week-row:last-child { border-bottom: none; }
.week-label { color: var(--text-dim); min-width: 60px; font-size: 0.72rem; }
.week-pages { color: var(--text); flex: 1; }
.week-target { color: var(--text-dim); font-size: 0.72rem; }

/* ===== SCHEDULE TAB ===== */

/* Daily Goals */
.daily-goals-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.daily-goals-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.daily-goals-eyebrow {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 2px;
}

.daily-goals-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.daily-goals-est {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.daily-goals-list { display: flex; flex-direction: column; gap: 4px; }

.daily-goal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius);
  transition: background 0.12s;
}
.daily-goal-item:hover { background: var(--surface2); }
.daily-goal-item.goal-done { opacity: 0.5; }
.daily-goal-item.goal-done .daily-goal-label { text-decoration: line-through; }

.daily-goal-check {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
  flex-shrink: 0;
  cursor: pointer;
}

.daily-goal-badge {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.daily-goal-label {
  font-size: 0.78rem;
  color: var(--text);
  flex: 1;
}

.daily-goal-mins {
  font-size: 0.62rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Weekly Goal */
.this-week-goal {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius);
  margin-bottom: 12px;
  border-left: 2px solid var(--accent);
}

.this-week-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.this-week-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.this-week-eyebrow {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 4px;
}

.this-week-dates {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.this-week-progress {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.week-progress-track {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 18px;
}

.week-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.schedule-task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.schedule-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.schedule-task-item:hover { border-color: var(--border-hi); }

.schedule-task-item.task-done { opacity: 0.45; }
.schedule-task-item.task-done .task-label { text-decoration: line-through; color: var(--text-dim); }

.task-checkbox {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.task-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.task-label {
  font-size: 0.855rem;
  color: var(--text);
  cursor: pointer;
  flex: 1;
  line-height: 1.45;
}

.daily-log-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.daily-log-panel h2 { margin-bottom: 6px; }

.log-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-style: italic;
}

.log-response {
  margin-top: 12px;
  font-size: 0.855rem;
  line-height: 1.65;
}

.log-response-good {
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--green);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.log-response-remind {
  background: var(--yellow-dim);
  border: 1px solid rgba(240,165,0,0.3);
  color: var(--text);
  padding: 14px 16px;
  border-radius: var(--radius);
}

.log-response-remind strong { color: var(--yellow); display: block; margin-bottom: 10px; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.log-response-remind ul { padding-left: 18px; }
.log-response-remind li { margin-bottom: 5px; font-size: 0.83rem; }
.log-response-remind p { margin-top: 10px; color: var(--text-muted); font-size: 0.78rem; font-style: italic; }

.all-weeks-section { margin-top: 8px; }
.all-weeks-section h2 { margin-bottom: 14px; }
.all-weeks-list { display: flex; flex-direction: column; gap: 6px; }

.week-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.week-panel.week-current { border-color: rgba(0,180,216,0.35); }
.week-panel.week-past { opacity: 0.65; }

.week-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 16px;
}

.week-panel-header:hover { background: var(--surface2); }

.week-panel-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.week-panel-label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
}

.week-panel-dates {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.week-panel-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.week-mini-progress {
  width: 56px;
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}

.week-mini-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.week-panel-count {
  font-size: 0.72rem;
  color: var(--text-dim);
  min-width: 28px;
  text-align: right;
}

.week-panel-count.count-complete { color: var(--green); }

.week-expand-arrow {
  font-size: 1rem;
  color: var(--text-dim);
  transition: transform 0.2s;
}

.week-panel.expanded .week-expand-arrow { transform: rotate(90deg); }

.week-panel-tasks {
  display: none;
  padding: 4px 12px 12px;
  flex-direction: column;
  gap: 5px;
}

.week-panel.expanded .week-panel-tasks { display: flex; }

/* ===== DASHBOARD — FOCUS CARD ===== */
.dash-focus {
  margin-bottom: 16px;
}

.focus-card {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.focus-eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.focus-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.focus-type-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  margin-top: 2px;
}

.focus-task-text {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.4;
  font-weight: 500;
}

.focus-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.focus-complete {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
}

.focus-complete-icon {
  font-size: 1.4rem;
  color: var(--green);
  flex-shrink: 0;
}

.focus-complete-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green);
}

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

/* ===== DASHBOARD — THIS WEEK (legacy compat) ===== */
.dash-week-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.dash-week-main-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-week-main-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.dash-week-task-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

/* ===== DASHBOARD — SECONDARY ROW ===== */
.dash-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) { .dash-secondary { grid-template-columns: 1fr; } }

.dash-sec-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.dash-sec-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* ===== DASHBOARD SCHEDULE WIDGET ===== */
.dash-week-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.dash-week-track {
  flex: 1;
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.dash-week-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.dash-week-count {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.dash-task-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  transition: border-color 0.15s;
}

.dash-task-chip.done-chip {
  opacity: 0.4;
}

.dash-task-chip.done-chip .dash-task-label {
  text-decoration: line-through;
  color: var(--text-dim);
}

.dash-task-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
}

.dash-task-label { flex: 1; color: var(--text); line-height: 1.35; }

.dash-task-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.dash-schedule-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 8px 0 0;
  letter-spacing: 0.05em;
  display: block;
}

.dash-schedule-link:hover { color: var(--accent-hover); }

/* ===== DASHBOARD — STUDIED & BOOKS ===== */
.studied-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s;
  font-size: 0.82rem;
  margin-bottom: 5px;
}
.studied-chip:hover { border-color: var(--accent); }
.studied-chip .chip-flag { font-size: 1rem; flex-shrink: 0; }
.studied-chip .chip-label { flex: 1; color: var(--text); }
.studied-chip-group .chip-label { color: var(--text-muted); }

.dash-books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.dash-book-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-book-card:hover { border-color: var(--accent); }
.dash-book-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dash-book-author {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-book-status {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.dash-book-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-book-badge.finished { background: var(--green-dim); color: var(--green); }
.dash-book-badge.noted { background: var(--accent-dim); color: var(--accent); }
.dash-book-badge.needs-notes { background: var(--yellow-dim); color: var(--yellow); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ===== LIGHT THEME ===== */

/* Body & frame */
[data-theme="light"] body { border-top: 2px solid #111827; }

/* Header — clean, weightless */
[data-theme="light"] header { background: #fff; border-bottom: 1px solid #e5e7eb; box-shadow: none; }
[data-theme="light"] .logo { color: #111827; }
[data-theme="light"] .logo-year { color: #9ca3af; font-weight: 500; }
[data-theme="light"] .logo-mark { color: #111827; }

/* Navigation — subtle, confident */
[data-theme="light"] .nav-btn { color: #9ca3af; }
[data-theme="light"] .nav-btn:hover { color: #374151; background: #f3f4f6; }
[data-theme="light"] .nav-btn.active { color: #111827; background: #f0f1f3; }
[data-theme="light"] .nav-icon { opacity: 0.3; }
[data-theme="light"] .nav-btn:hover .nav-icon { opacity: 0.6; }
[data-theme="light"] .nav-btn.active .nav-icon { opacity: 0.8; }

/* Theme toggle */
[data-theme="light"] .theme-toggle { background: #f3f4f6; border-color: #e5e7eb; color: #6b7280; }

/* Cards — elevated, clean */
[data-theme="light"] .profile-card { border-color: #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
[data-theme="light"] .profile-card:hover { border-color: #d1d5db; box-shadow: 0 4px 12px rgba(0,0,0,0.06); transform: translateY(-1px); }
[data-theme="light"] .stat-card { border-color: #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,0.03); border-left-color: #111827; }
[data-theme="light"] .dash-panel { border-color: #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
[data-theme="light"] .cp-section { border-color: #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
[data-theme="light"] .detail-block { border-color: #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
[data-theme="light"] .flashcard { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

/* Filters — sharp inverted active state */
[data-theme="light"] .filter-btn, [data-theme="light"] .quiz-filter-btn { border-color: #e5e7eb; background: #fff; color: #6b7280; }
[data-theme="light"] .filter-btn:hover, [data-theme="light"] .quiz-filter-btn:hover { background: #f9fafb; color: #374151; }
[data-theme="light"] .filter-btn.active, [data-theme="light"] .quiz-filter-btn.active { background: #111827; color: #fff; border-color: #111827; }

/* Region badges */
[data-theme="light"] .region-MENA { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
[data-theme="light"] .region-LATAM { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
[data-theme="light"] .region-EXTENDED { background: #faf5ff; color: #6b21a8; border-color: #e9d5ff; }

/* Content text — crisp, readable */
[data-theme="light"] .sup-text, [data-theme="light"] .sup-text p { color: #1f2937; }
[data-theme="light"] .sup-analysis-box { background: #f9fafb; border-left-color: #d1d5db; }
[data-theme="light"] .notes-textarea { background: #fff; border-color: #e5e7eb; color: #111827; }
[data-theme="light"] .notes-textarea:focus { border-color: #111827; box-shadow: 0 0 0 2px rgba(17,24,39,0.06); }

/* Profile sections */
[data-theme="light"] .cp-section-header { border-bottom-color: #e5e7eb; }
[data-theme="light"] .cp-section-label { color: #374151; }
[data-theme="light"] .detail-header { border-bottom-color: #e5e7eb; }
[data-theme="light"] .cp-edit-btn { border-color: #e5e7eb; color: #9ca3af; }
[data-theme="light"] .cp-edit-btn:hover { border-color: #111827; color: #111827; }

/* Top bar */
[data-theme="light"] .dash-topbar { border-bottom-color: #e5e7eb; }
[data-theme="light"] .dash-topbar-week { color: #374151; }

/* Buttons — clean, decisive */
[data-theme="light"] .dash-action-btn { border-color: #e5e7eb; color: #6b7280; }
[data-theme="light"] .dash-action-btn:hover { background: #111827; color: #fff; border-color: #111827; }
[data-theme="light"] .btn-primary { background: #111827; color: #fff; }
[data-theme="light"] .btn-primary:hover { background: #1f2937; }
[data-theme="light"] .detail-mark-btn { border-color: #e5e7eb; }
[data-theme="light"] .detail-mark-btn:hover { border-color: var(--green); color: var(--green); }

/* Today panel */
[data-theme="light"] .dash-today-panel { border-left-color: #059669; }

/* Calendar */
[data-theme="light"] .cal-day.cal-today .cal-num {
  background: #111827;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(17,24,39,0.06);
}
[data-theme="light"] .cal-day.cal-in-current-week {
  background: linear-gradient(180deg, rgba(17,24,39,0.04) 0%, rgba(17,24,39,0.01) 100%);
}
[data-theme="light"] .cal-day.cal-has-deadline:hover { background: rgba(17,24,39,0.04); }
[data-theme="light"] .cal-day.cal-has-deadline:hover .cal-num { color: #111827; }
[data-theme="light"] .cal-tooltip { background: #fff; border-color: #e5e7eb; box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
[data-theme="light"] .cal-tooltip-item::before { background: var(--dot, #111827); }
[data-theme="light"] .cal-nav-btn { border-color: #e5e7eb; color: #6b7280; }
[data-theme="light"] .cal-nav-btn:hover { background: #f3f4f6; color: #111827; }

/* Week activity */
[data-theme="light"] .week-activity-day { background: #f3f4f6; }
[data-theme="light"] .week-activity-day.activity-today { background: #111827; border-color: #111827; }
[data-theme="light"] .activity-today .activity-day-label { color: #fff; }
[data-theme="light"] .week-activity-day.activity-today .activity-tag { background: rgba(255,255,255,0.15); color: #d1fae5; }

/* Map */
[data-theme="light"] .mapboxgl-popup-content { background: #fff !important; color: #111827 !important; border-color: #e5e7eb !important; box-shadow: 0 8px 24px rgba(0,0,0,0.08) !important; }
[data-theme="light"] .mapboxgl-popup-tip { border-top-color: #fff !important; }
[data-theme="light"] .map-card-open:hover { background: #111827; color: #fff; }
[data-theme="light"] .map-marker { border-color: #111827; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
[data-theme="light"] .map-marker.studied { border-color: #059669; }
[data-theme="light"] .map-sidebar { box-shadow: -4px 0 16px rgba(0,0,0,0.06); }

/* Schedule panels */
[data-theme="light"] .this-week-panel { border-color: #e5e7eb; border-top-color: #111827; }
[data-theme="light"] .daily-goals-panel { border-color: #e5e7eb; border-left-color: #059669; }
[data-theme="light"] .schedule-deadlines-panel { border-color: #e5e7eb; }

/* Deadlines */
[data-theme="light"] .deadline-item:hover { background: #f9fafb; }

/* Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #d1d5db; }
[data-theme="light"] ::-webkit-scrollbar-track { background: #f8f9fb; }

/* Progress bars */
[data-theme="light"] .stat-bar { background: #e5e7eb; }
[data-theme="light"] .stat-bar-fill { background: #111827; }
[data-theme="light"] .week-progress-track { background: #e5e7eb; }
[data-theme="light"] .week-progress-fill { background: #111827; }

/* Numbers */
[data-theme="light"] .stat-number { color: #6b7280; font-size: 1.1rem; }
[data-theme="light"] .stat-of { color: #d1d5db; }
[data-theme="light"] .stat-label { color: #9ca3af; }

/* Focus — green today items pop */
[data-theme="light"] .daily-goal-badge { font-weight: 600; }
[data-theme="light"] .activity-tag { background: #ecfdf5; color: #059669; font-weight: 600; }

/* ===== WORLD GEOGRAPHY TAB ===== */
.world-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.world-search {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.world-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.world-stats {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  white-space: nowrap;
}
.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.world-card {
  display: flex;
  align-items: center;
  gap: 11px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 140%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s, border-left-color 0.15s, transform 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.world-card:hover {
  border-color: var(--border-hi);
  border-left-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.world-card-flag {
  width: 46px;
  height: 32px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--surface3);
  border: 1px solid var(--border);
}
.world-card-text {
  min-width: 0;
  flex: 1;
}
.world-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}
.world-card-capital {
  font-size: 0.68rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.world-card-capital::before {
  content: "⌂ ";
  opacity: 0.45;
  margin-right: 2px;
}

.world-modal.hidden { display: none; }
.world-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: wm-fade 0.18s ease;
}
@keyframes wm-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.world-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.world-modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 26px 26px;
  max-width: 520px;
  width: 92%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  max-height: 90vh;
  overflow-y: auto;
}
.world-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 4px;
}
.world-modal-close:hover { color: var(--text); background: var(--surface2); }
.world-modal-flag {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  margin-bottom: 16px;
  padding: 8px;
}
.world-modal-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.world-modal-meta {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 4px 12px;
  font-size: 0.8rem;
  margin-bottom: 14px;
}
.world-modal-meta dt {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  font-weight: 600;
  padding-top: 3px;
}
.world-modal-meta dd {
  color: var(--text);
  font-weight: 500;
}
.world-modal-meta dd.capital { color: var(--accent); font-weight: 600; }
.world-modal-map {
  width: 100%;
  height: 260px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
  background: var(--surface2);
  overflow: hidden;
  position: relative;
}
.world-modal-map-hint {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin-top: 6px;
  font-weight: 500;
}
.world-mini-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(0,180,216,0.25), 0 2px 6px rgba(0,0,0,0.5);
  cursor: pointer;
}

.world-filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 11px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
}
.world-filter-btn:hover { color: var(--text); border-color: var(--border-hi); }
.world-filter-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="light"] .world-card { box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
[data-theme="light"] .world-card:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.08); }
[data-theme="light"] .world-modal-card { box-shadow: 0 20px 50px rgba(0,0,0,0.18); }
[data-theme="light"] .world-filter-btn { border-color: #e5e7eb; background: #fff; color: #6b7280; }
[data-theme="light"] .world-filter-btn:hover { background: #f9fafb; color: #374151; }
[data-theme="light"] .world-filter-btn.active { background: #111827; color: #fff; border-color: #111827; }

/* ===== SUB-NAV BAR — clean underline tabs ===== */
.sub-nav {
  display: none;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 40px;
  z-index: 95;
}
.sub-nav.visible {
  display: flex;
  gap: 0;
  align-items: flex-end;
  padding: 0 20px;
  height: 44px;
  max-width: 1400px;
  margin: 0 auto;
  animation: sub-nav-fade 0.18s ease-out;
}
@keyframes sub-nav-fade {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.sub-nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 18px 12px;
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: inherit;
  position: relative;
  transition: color 0.15s;
}
.sub-nav-btn::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.18s ease;
}
.sub-nav-btn:hover { color: var(--text); }
.sub-nav-btn.active {
  color: var(--accent);
}
.sub-nav-btn.active::after {
  transform: scaleX(1);
}

[data-theme="light"] .sub-nav {
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
[data-theme="light"] .sub-nav-btn.active { color: #111827; }
[data-theme="light"] .sub-nav-btn.active::after { background: #111827; }

/* ===== STUDY SIDEBAR ===== */
.study-sidebar {
  display: none;
  position: fixed;
  left: 0;
  top: 74px;
  bottom: 0;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 80;
}
body.study-active .study-sidebar { display: block; }
body.study-active #app {
  padding-left: 260px;
  max-width: none;
}
.study-sidebar-inner { padding: 14px 10px 30px; }
.study-browse-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 12px;
  text-align: left;
  font-family: inherit;
  transition: all 0.12s;
}
.study-browse-btn:hover { color: var(--text); border-color: var(--border-hi); }
.study-section { margin-bottom: 6px; }
.study-section-toggle {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.study-section-toggle:hover { color: var(--text); }
.study-caret {
  font-size: 0.55rem;
  transition: transform 0.15s;
  display: inline-block;
}
.study-section.collapsed .study-caret { transform: rotate(-90deg); }
.study-section.collapsed .study-nav-list { display: none; }
.study-section-label { flex: 1; text-align: left; }
.study-section-count {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.58rem;
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 8px;
}
.study-nav-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 10px;
}
.study-nav-item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 6px 10px 6px 22px;
  font-size: 0.76rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 2px solid transparent;
  text-align: left;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.study-nav-item:hover { background: var(--surface2); color: var(--text); }
.study-nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.study-nav-flag { font-size: 0.9rem; flex-shrink: 0; }
.study-nav-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-nav-check { color: var(--green); font-size: 0.7rem; }

/* ===== WRITING TAB ===== */
.writing-mode-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.writing-mode-btn:hover { color: var(--text); border-color: var(--border-hi); }
.writing-mode-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.writing-mode-pane { margin-bottom: 14px; }
.writing-mode-pane.hidden { display: none; }
.writing-exercise-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.writing-select {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
}
.writing-select:focus { outline: none; border-color: var(--accent); }
.writing-select:disabled { color: var(--text-dim); }
.writing-add-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.writing-add-btn:hover { background: var(--accent); color: #fff; }
.writing-exercise-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.writing-empty-state { text-align: center; padding: 40px 20px; }
.writing-empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.writing-empty-body {
  font-size: 0.82rem;
  color: var(--text-dim);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}
.writing-exercise-content.hidden { display: none; }
.writing-exercise-chapter {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 4px;
}
.writing-exercise-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.writing-exercise-skill {
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 12px;
  font-weight: 500;
}
.writing-exercise-prompt {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.65;
  padding: 12px 14px;
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  margin-bottom: 10px;
}
.writing-exercise-notes {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  margin-top: 8px;
}
.writing-prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.writing-prompt-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 6px;
}
.writing-prompt-text {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.6;
}

/* Writing editor */
.writing-editor-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 14px;
}
.writing-editor-wrap.hidden { display: none; }
.writing-editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.writing-title-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 0;
}
.writing-title-input:focus { outline: none; }
.writing-title-input::placeholder { color: var(--text-dim); font-weight: 500; }
.writing-editor-stats {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.writing-stat-sep { margin: 0 4px; opacity: 0.4; }
.writing-template-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.writing-template-label {
  font-size: 0.58rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-right: 2px;
}
.writing-template-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.writing-template-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.writing-editor {
  width: 100%;
  min-height: 380px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  padding: 16px 18px;
  resize: vertical;
}
.writing-editor:focus { outline: none; border-color: var(--accent); }
.writing-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* Writing drafts */
.writing-drafts-list { display: flex; flex-direction: column; gap: 10px; }
.writing-draft-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}
.writing-draft-card:hover { border-color: var(--border-hi); }
.writing-draft-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.writing-draft-title { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.writing-draft-meta { font-size: 0.62rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.writing-draft-exercise { font-size: 0.7rem; color: var(--accent); margin-bottom: 6px; }
.writing-draft-preview {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}
.writing-draft-actions { display: flex; gap: 6px; }
.writing-draft-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 10px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.writing-draft-btn:hover { color: var(--text); border-color: var(--border-hi); }
.writing-draft-btn-danger:hover { color: var(--red); border-color: var(--red); }

/* ===== INTERVIEW TAB ===== */
.interview-tab-btn,
.sf86-tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.interview-tab-btn:hover,
.sf86-tab-btn:hover { color: var(--text); border-color: var(--border-hi); }
.interview-tab-btn.active,
.sf86-tab-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.interview-pane.hidden { display: none; }
.sf86-intro {
  font-size: 0.78rem;
  color: var(--text-muted);
  border-left: 2px solid var(--accent);
  background: var(--accent-dim);
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 0 4px 4px 0;
  line-height: 1.55;
}
.sf86-add-bar .sf-date { min-width: 130px; }
.sf86-add-bar input[type="date"] { color-scheme: dark; }
[data-theme="light"] .sf86-add-bar input[type="date"] { color-scheme: light; }
.interview-add-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.iv-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 11px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-family: inherit;
  flex: 1;
  min-width: 140px;
}
.iv-input:focus { outline: none; border-color: var(--accent); }
.iv-input-wide { flex: 3; }
.iv-select { flex: 0 0 140px; }
.iv-add-btn { padding: 8px 16px; font-size: 0.7rem; letter-spacing: 0.06em; white-space: nowrap; }
.iv-list { display: flex; flex-direction: column; gap: 10px; }
.iv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  transition: border-left-color 0.15s;
}
.iv-card:hover { border-left-color: var(--accent); }
.iv-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.iv-card-title { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.iv-card-sub { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 8px; }
.iv-card-sub a { color: var(--accent); text-decoration: none; }
.iv-card-sub a:hover { text-decoration: underline; }
.iv-card-date {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  flex-shrink: 0;
}
.iv-card-notes {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.55;
  border-radius: 4px;
  resize: vertical;
  min-height: 50px;
}
.iv-card-notes:focus { outline: none; border-color: var(--accent); }
.iv-card-notes-tall { min-height: 120px; }
.iv-card-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.iv-del-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 10px;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.iv-del-btn:hover { color: var(--red); border-color: var(--red); }
.iv-status {
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 3px;
}
.iv-status-interested { background: var(--accent-dim); color: var(--accent); }
.iv-status-watching { background: var(--yellow-dim); color: var(--yellow); }
.iv-status-applied { background: rgba(139,92,246,0.15); color: #a78bfa; }
.iv-status-interview { background: var(--green-dim); color: var(--green); }
.iv-status-closed { background: var(--red-dim); color: var(--red); }
.iv-status-tourism { background: var(--accent-dim); color: var(--accent); }
.iv-status-business { background: rgba(139,92,246,0.15); color: #a78bfa; }
.iv-status-family { background: var(--yellow-dim); color: var(--yellow); }
.iv-status-study { background: var(--green-dim); color: var(--green); }
.iv-status-conference { background: rgba(56,189,248,0.15); color: #38bdf8; }
.iv-status-other { background: var(--border); color: var(--text-muted); }
.iv-status-ongoing { background: var(--green-dim); color: var(--green); }
.iv-status-occasional { background: var(--yellow-dim); color: var(--yellow); }
.iv-status-ended { background: var(--border); color: var(--text-muted); }
.iv-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

/* Light theme overrides */
[data-theme="light"] .writing-editor { background: #fff; }
[data-theme="light"] .iv-card-notes { background: #fff; }
[data-theme="light"] .writing-mode-btn.active,
[data-theme="light"] .interview-tab-btn.active,
[data-theme="light"] .sf86-tab-btn.active { background: #111827; color: #fff; border-color: #111827; }

/* ===== COACHING ROOM ===== */
.coaching-wrap { display: flex; flex-direction: column; gap: 14px; }
.coaching-info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
}
.coaching-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.coaching-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.coaching-schedule { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.coaching-next {
  margin-top: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}
.coaching-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.coaching-link-display {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 5px 12px;
  border-radius: 4px;
  user-select: all;
}
.coaching-link-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.coaching-copy-btn { padding: 5px 14px; font-size: 0.68rem; }
.coaching-actions { display: flex; gap: 10px; }
.coaching-join-btn {
  padding: 16px 40px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 8px;
  width: 100%;
  text-align: center;
}

/* ===== AGENCIES (IC STRUCTURE) ===== */
.agencies-wrap { display: flex; flex-direction: column; gap: 22px; }

.ic-head-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--accent);
  border-radius: 9px;
  padding: 20px 24px;
  max-width: 760px;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0,180,216,0.12), 0 1px 0 rgba(255,255,255,0.03) inset;
  text-align: center;
  position: relative;
}
.ic-head-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 50%, transparent);
  border-radius: 9px 9px 0 0;
}
.ic-head-label {
  font-size: 0.58rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  margin-bottom: 6px;
}
.ic-head-acronym {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1;
}
.ic-head-full {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}
.ic-head-desc {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.6;
  margin-top: 12px;
  text-align: left;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
.ic-head-meta {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.ic-head-meta strong {
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  margin-right: 5px;
}

.ic-connector {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 600px;
  margin: 0 auto;
}
.ic-connector-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hi), transparent);
}
.ic-connector-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  white-space: nowrap;
}

.ic-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.ic-group {
  background: transparent;
}
.ic-group-header {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.ic-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}
.ic-group-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.ic-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.ic-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 140%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, border-left-color 0.15s, transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ic-card:hover {
  border-color: var(--border-hi);
  border-left-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.28);
}
.ic-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.ic-card-acronym {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.ic-card-founded {
  font-size: 0.6rem;
  color: var(--text-dim);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ic-card-full {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  font-weight: 500;
}
.ic-card-hq {
  font-size: 0.64rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ic-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.ic-chip {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0,180,216,0.25);
}

/* Agency modal */
.agency-modal-card { max-width: 560px; }
.agency-modal-acronym {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.agency-modal-full {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 2px;
  margin-bottom: 10px;
  font-weight: 500;
}
.agency-modal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
}
.agency-modal-desc {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 16px;
}
.agency-modal-meta {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 5px 12px;
  font-size: 0.78rem;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.agency-modal-meta dt {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  padding-top: 2px;
}
.agency-modal-meta dd { color: var(--text); font-weight: 500; }

/* Light theme overrides */
[data-theme="light"] .ic-head-card {
  background: #ffffff;
  border-color: #111827;
  box-shadow: 0 4px 20px rgba(17,24,39,0.08);
}
[data-theme="light"] .ic-head-label { color: #111827; }
[data-theme="light"] .ic-head-card::before { background: linear-gradient(90deg, transparent, #111827 50%, transparent); }
[data-theme="light"] .ic-card { box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
[data-theme="light"] .ic-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
[data-theme="light"] .ic-chip { background: #f3f4f6; color: #374151; border-color: #e5e7eb; }

/* ===== IC TREE / ORGANIGRAM ===== */
.ic-tree-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.ic-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.ic-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.ic-legend-dot.pres { background: #f59e0b; }
.ic-legend-dot.dni { background: var(--accent); }
.ic-legend-dot.dept { background: #8b5cf6; }
.ic-legend-dot.agency { background: var(--text-muted); }

.ic-tree {
  padding: 8px 0 20px;
  font-size: 0.82rem;
  color: var(--text);
  max-width: 900px;
  margin: 0 auto;
}
.ic-tree ul {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.ic-tree > ul > li > ul {
  padding-left: 40px;
  margin-top: 8px;
}
.ic-tree ul ul ul {
  padding-left: 28px;
  margin-top: 4px;
}
.ic-tree ul ul ul ul {
  padding-left: 26px;
}
/* Vertical connector line down the left of each nested ul */
.ic-tree ul ul::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 0;
  bottom: 22px;
  border-left: 1.5px solid var(--border-hi);
}
.ic-tree ul ul ul::before {
  left: 11px;
  border-left: 1px solid var(--border);
}
.ic-tree li {
  position: relative;
  padding: 6px 0;
}
/* Horizontal connector from vertical line to each node */
.ic-tree ul ul > li::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 22px;
  width: 27px;
  border-top: 1.5px solid var(--border-hi);
}
.ic-tree ul ul ul > li::before {
  left: -17px;
  width: 17px;
  border-top: 1px solid var(--border);
}

/* Node boxes */
.ic-tree-node {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
  flex-wrap: wrap;
  max-width: 100%;
}

.level-president {
  background: linear-gradient(135deg, rgba(245,158,11,0.15) 0%, rgba(245,158,11,0.04) 100%);
  border: 1px solid #f59e0b;
  box-shadow: 0 2px 12px rgba(245,158,11,0.14), 0 1px 0 rgba(255,255,255,0.03) inset;
  padding: 12px 20px;
}
.level-president .ic-tree-role {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.level-president .ic-tree-dept {
  font-size: 0.64rem;
  color: #f59e0b;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.ic-tree-crown {
  font-size: 1rem;
  color: #f59e0b;
  flex-shrink: 0;
}

.level-dni {
  background: linear-gradient(135deg, var(--accent-dim) 0%, rgba(0,180,216,0.02) 100%);
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(0,180,216,0.14), 0 1px 0 rgba(255,255,255,0.03) inset;
}
.level-dni .ic-tree-role {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.level-dni .ic-tree-dept {
  font-size: 0.62rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  padding: 2px 8px;
  background: var(--accent-dim);
  border-radius: 3px;
}
.level-dni .ic-tree-note {
  width: 100%;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

.level-dept {
  background: linear-gradient(135deg, rgba(139,92,246,0.12) 0%, rgba(139,92,246,0.02) 100%);
  border-color: #8b5cf6;
}
.level-dept .ic-tree-role {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}
.level-dept .ic-tree-dept {
  font-size: 0.6rem;
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  padding: 2px 8px;
  background: rgba(139,92,246,0.15);
  border-radius: 3px;
}

.level-subgroup {
  background: transparent;
  border: 1px dashed var(--border);
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 4px;
}

.level-agency {
  cursor: pointer;
  padding: 7px 13px;
  min-height: 34px;
}
.level-agency:hover {
  border-color: var(--accent);
  transform: translateX(3px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.22);
}
.level-agency:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.ic-tree-acronym {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.ic-tree-full {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}
.ic-tree-chips {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}
.ic-tree-chips .ic-chip {
  font-size: 0.52rem;
  padding: 1px 6px;
}

.ic-tree-hint {
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.ic-tree-hint strong { color: var(--text); }
.ic-tree-hint em { color: var(--accent); font-style: normal; font-weight: 500; }

/* Light theme */
[data-theme="light"] .ic-tree ul ul::before { border-color: #d1d5db; }
[data-theme="light"] .ic-tree ul ul ul::before { border-color: #e5e7eb; }
[data-theme="light"] .ic-tree ul ul > li::before { border-color: #d1d5db; }
[data-theme="light"] .ic-tree ul ul ul > li::before { border-color: #e5e7eb; }
[data-theme="light"] .level-president {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
  box-shadow: 0 2px 10px rgba(245,158,11,0.1);
}
[data-theme="light"] .level-dni {
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
  border-color: #111827;
  box-shadow: 0 2px 10px rgba(17,24,39,0.06);
}
[data-theme="light"] .level-dni .ic-tree-dept {
  color: #111827;
  background: #f3f4f6;
}
[data-theme="light"] .level-dept {
  background: linear-gradient(135deg, #faf5ff 0%, #ffffff 100%);
  border-color: #8b5cf6;
}

/* ===== THREE-BRANCH GOV OVERVIEW ===== */
.agencies-section-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.gov-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 10px;
}
.gov-root {
  background: linear-gradient(135deg, rgba(245,158,11,0.14) 0%, rgba(245,158,11,0.02) 100%);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 28px;
  text-align: center;
  box-shadow: 0 3px 14px rgba(245,158,11,0.12);
  min-width: 280px;
}
.gov-root-label {
  font-size: 0.56rem;
  color: #f59e0b;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  margin-bottom: 3px;
}
.gov-root-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.gov-connector-fan {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: 36px;
}
.gov-connector-vert {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1.5px;
  height: 14px;
  background: var(--border-hi);
  transform: translateX(-50%);
}
.gov-connector-horiz {
  position: absolute;
  left: 16.66%;
  right: 16.66%;
  top: 14px;
  height: 1.5px;
  background: var(--border-hi);
}
.gov-connector-drop {
  position: absolute;
  top: 14px;
  width: 1.5px;
  height: 22px;
  background: var(--border-hi);
}
.gov-drop-left { left: 16.66%; }
.gov-drop-mid { left: 50%; transform: translateX(-50%); }
.gov-drop-right { right: 16.66%; }

.gov-branches {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  width: 100%;
  max-width: 1100px;
}
.gov-branch {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  border-radius: 7px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.gov-executive    { border-top-color: #f59e0b; }
.gov-legislative  { border-top-color: #8b5cf6; }
.gov-judicial     { border-top-color: var(--green); }

.gov-branch-header {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--text-muted);
}
.gov-executive    .gov-branch-header { color: #f59e0b; }
.gov-legislative  .gov-branch-header { color: #a78bfa; }
.gov-judicial     .gov-branch-header { color: var(--green); }

.gov-branch-head {
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border);
}
.gov-branch-head-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.gov-branch-head-role {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 3px;
}
.gov-branch-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.gov-branch-elements-label {
  font-size: 0.56rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-top: 4px;
}
.gov-branch-elements {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gov-element {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 10px;
}
.gov-element-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}
.gov-element-note {
  font-size: 0.66rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

/* Responsive fallback: stack on narrow screens */
@media (max-width: 900px) {
  .gov-branches { grid-template-columns: 1fr; }
  .gov-connector-horiz,
  .gov-connector-drop { display: none; }
}

/* Light theme */
[data-theme="light"] .gov-root {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
  box-shadow: 0 3px 14px rgba(245,158,11,0.1);
}
[data-theme="light"] .gov-connector-vert,
[data-theme="light"] .gov-connector-horiz,
[data-theme="light"] .gov-connector-drop { background: #d1d5db; }
[data-theme="light"] .gov-branch { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
[data-theme="light"] .gov-element { background: #f9fafb; border-color: #e5e7eb; }

/* ===== DISCIPLINES REFERENCE CARDS ===== */
.ic-disciplines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.ic-discipline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 11px 14px;
}
.ic-discipline-abbr {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
  font-family: 'Inter', -apple-system, sans-serif;
}
.ic-discipline-name {
  font-size: 0.7rem;
  color: var(--text);
  font-weight: 600;
  margin: 2px 0 5px;
}
.ic-discipline-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== SUBENTITY NODES (ODNI centers, CIA directorates) ===== */
.level-subentity {
  cursor: pointer;
  padding: 6px 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--border-hi);
  min-height: 30px;
  transition: border-color 0.12s, transform 0.12s;
}
.level-subentity:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}
.level-subentity .ic-tree-acronym {
  font-size: 0.72rem;
  font-weight: 700;
}
.level-subentity .ic-tree-full {
  font-size: 0.64rem;
}
.level-subentity .ic-chip {
  font-size: 0.5rem;
}

/* ODNI mission center variant — teal accent */
.level-subentity.level-odni {
  border-left-color: var(--accent);
}
.level-subentity.level-odni .ic-tree-acronym {
  color: var(--accent-hover);
}

/* CIA directorate variant — amber accent */
.level-subentity.level-cia {
  border-left-color: #f59e0b;
}
.level-subentity.level-cia .ic-tree-acronym {
  color: #fbbf24;
}

/* CIA DA — highlighted as her target workplace */
.level-subentity.level-cia-da {
  border-left: 3px solid #22c55e;
  background: rgba(34,197,94,0.08);
  box-shadow: 0 0 0 1px rgba(34,197,94,0.2);
}
.level-subentity.level-cia-da .ic-tree-acronym {
  color: #4ade80;
}
.level-subentity.level-cia-da::after {
  content: "★ Your target";
  font-size: 0.5rem;
  color: #22c55e;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 2px 7px;
  background: rgba(34,197,94,0.12);
  border-radius: 10px;
  margin-left: 6px;
  flex-shrink: 0;
}

[data-theme="light"] .level-subentity { background: #f9fafb; }
[data-theme="light"] .level-subentity.level-cia-da {
  background: #f0fdf4;
  box-shadow: 0 0 0 1px rgba(5,150,105,0.25);
}
[data-theme="light"] .ic-discipline-card { box-shadow: 0 1px 2px rgba(0,0,0,0.03); }

/* ===== BUFFER WEEKS + WEEK-OFF TOGGLE ===== */
.week-badge {
  display: inline-block;
  font-size: 0.52rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}
.week-badge-buffer {
  background: rgba(240,165,0,0.15);
  color: var(--yellow);
  border: 1px solid rgba(240,165,0,0.35);
}
.week-badge-off {
  background: rgba(224,82,82,0.15);
  color: var(--red);
  border: 1px solid rgba(224,82,82,0.35);
}

.week-panel.week-buffer {
  border-left: 3px solid var(--yellow);
}
.week-panel.week-buffer .week-panel-label {
  color: var(--yellow);
}

.week-panel.week-off {
  opacity: 0.5;
  filter: grayscale(0.4);
}
.week-panel.week-off .week-panel-label {
  text-decoration: line-through;
  color: var(--text-dim);
}
.week-panel.week-off.week-buffer .week-panel-label {
  color: var(--text-dim);
}

.week-off-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 9px;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
  margin-left: 4px;
}
.week-off-btn:hover {
  border-color: var(--red);
  color: var(--red);
}
.week-off-btn.active {
  background: rgba(224,82,82,0.12);
  border-color: var(--red);
  color: var(--red);
}
.week-off-btn.active:hover {
  background: rgba(224,82,82,0.2);
}

[data-theme="light"] .week-badge-buffer {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}
[data-theme="light"] .week-badge-off {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}
[data-theme="light"] .week-panel.week-buffer .week-panel-label { color: #b45309; }

/* Moved-task indicator (tasks relocated from an off week) */
.schedule-task-item.task-moved {
  border-left: 2px solid var(--yellow);
  padding-left: 8px;
  background: rgba(240,165,0,0.06);
  border-radius: 0 4px 4px 0;
}
.task-moved-badge {
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--yellow);
  padding: 2px 7px;
  border: 1px solid rgba(240,165,0,0.4);
  border-radius: 3px;
  white-space: nowrap;
  margin-left: auto;
}
[data-theme="light"] .schedule-task-item.task-moved { background: #fef9ed; }
[data-theme="light"] .task-moved-badge { color: #b45309; border-color: #fcd34d; }

/* ===== YEARLY GOALS PANEL (Dashboard) ===== */
.goals-panel {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 140%);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 18px 20px 20px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2), 0 1px 0 rgba(255,255,255,0.02) inset;
  position: relative;
  overflow: hidden;
}
.goals-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 50%, transparent);
  opacity: 0.35;
  pointer-events: none;
}

.goals-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.goals-title-block {
  min-width: 0;
}
.goals-eyebrow {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3px;
}
.goals-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.goals-progress {
  flex-shrink: 0;
  min-width: 160px;
  text-align: right;
}
.goals-progress-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.goals-progress-count .goals-progress-of {
  color: var(--text-dim);
  font-weight: 500;
  margin: 0 2px;
}
.goals-progress-count span:first-child {
  color: var(--text);
  font-weight: 700;
  font-size: 0.82rem;
}
.goals-progress-bar {
  height: 4px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}
.goals-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 3px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--accent-dim);
}

.goals-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}
.goals-filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 11px;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.goals-filter-btn:hover { color: var(--text); border-color: var(--border-hi); }
.goals-filter-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.goals-add-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.goals-add-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.goals-add-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.goals-add-category {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
}
.goals-add-category:focus { outline: none; border-color: var(--accent); }
.goals-add-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.goals-add-btn:hover { background: var(--accent-hover); }

.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.goals-empty {
  grid-column: 1 / -1;
  padding: 24px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.goal-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--goal-color, var(--border));
  border-radius: 6px;
  padding: 11px 12px 11px 13px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.goal-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.22);
}
.goal-card.goal-done {
  opacity: 0.6;
}
.goal-card.goal-done .goal-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.goal-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-hi);
  background: transparent;
  color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all 0.15s;
  padding: 0;
  margin-top: 1px;
}
.goal-check:hover {
  border-color: var(--goal-color, var(--accent));
}
.goal-card.goal-done .goal-check {
  background: var(--goal-color, var(--accent));
  border-color: var(--goal-color, var(--accent));
  color: #fff;
}

.goal-body {
  flex: 1;
  min-width: 0;
}
.goal-text {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
  font-weight: 500;
  word-wrap: break-word;
}
.goal-meta {
  margin-top: 6px;
}
.goal-category {
  display: inline-block;
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  background: color-mix(in oklab, var(--goal-color, var(--accent)) 15%, transparent);
  color: var(--goal-color, var(--accent));
  border: 1px solid color-mix(in oklab, var(--goal-color, var(--accent)) 30%, transparent);
}

.goal-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  padding: 0;
  font-family: inherit;
}
.goal-card:hover .goal-delete { opacity: 1; }
.goal-delete:hover {
  color: var(--red);
  background: rgba(224,82,82,0.1);
}

/* Light theme */
[data-theme="light"] .goals-panel {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
[data-theme="light"] .goals-add-btn { background: #111827; border-color: #111827; }
[data-theme="light"] .goals-add-btn:hover { background: #1f2937; }
[data-theme="light"] .goals-filter-btn.active { background: #111827; color: #fff; border-color: #111827; }
[data-theme="light"] .goal-card { box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
