/* ============================================================
   TankerMade Dev — Design System & Application Styles
   Single source of truth. Replaces all previous CSS files.
   Theme: Refined dark app (dark chrome, off-white content)
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Chrome */
  --chrome-header:          #111827;
  --chrome-sidebar:         #1a2233;
  --chrome-sidebar-hover:   #243044;
  --chrome-border:          rgba(255,255,255,0.07);

  /* Content surfaces */
  --surface-page:           #eef2f7;
  --surface-card:           #ffffff;
  --surface-input:          #ffffff;
  --surface-overlay:        rgba(0,0,0,0.55);

  /* Accent */
  --accent:                 #6366f1;
  --accent-hover:           #4f46e5;
  --accent-subtle:          rgba(99,102,241,0.12);
  --accent-text:            #c7d2fe;

  /* Status */
  --status-success:         #10b981;
  --status-warn:            #f59e0b;
  --status-error:           #ef4444;
  --status-info:            #3b82f6;

  /* Text on dark chrome */
  --text-chrome-primary:    rgba(255,255,255,0.92);
  --text-chrome-secondary:  rgba(255,255,255,0.50);
  --text-chrome-muted:      rgba(255,255,255,0.28);

  /* Text on light surfaces */
  --text-primary:           #0f172a;
  --text-secondary:         #64748b;
  --text-muted:             #94a3b8;

  /* Borders */
  --border:                 #e2e8f0;
  --border-focus:           #6366f1;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 2px 6px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 14px rgba(0,0,0,0.10);
  --shadow-lg:  0 12px 28px rgba(0,0,0,0.14);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;

  /* Type scale */
  --text-xs:   0.6875rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-md:   1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  1.875rem;

  /* Spacing */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;
  --sp-4: 1rem;     --sp-5: 1.25rem;  --sp-6: 1.5rem;
  --sp-8: 2rem;     --sp-10: 2.5rem;  --sp-12: 3rem;

  /* Layout */
  --header-h:     60px;
  --sidebar-w:    228px;
  --footer-h:     44px;
  --bottom-nav-h: 60px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Transitions */
  --ease-fast:   150ms ease;
  --ease-normal: 260ms ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { line-height: 1.5; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: var(--surface-page);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Skip Link ─────────────────────────────────────────────── */
.skip-link {
  position: absolute; top: -48px; left: 8px;
  background: var(--accent); color: #fff;
  padding: var(--sp-2) var(--sp-4);
  text-decoration: none; border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 600;
  z-index: 9999; transition: top var(--ease-fast);
}
.skip-link:focus { top: 8px; }

/* ── Application Header ────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--chrome-header);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-6);
  z-index: 200;
  border-bottom: 1px solid var(--chrome-border);
}

.logo {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-md); font-weight: 700;
  color: var(--text-chrome-primary);
  letter-spacing: -0.02em; white-space: nowrap; text-decoration: none;
}
.logo-mark {
  width: 26px; height: 26px;
  background: var(--accent); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark svg { display: block; }

.header-left  { display: flex; align-items: center; gap: var(--sp-5); flex: 1; min-width: 0; }
.header-center { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 0 var(--sp-4); }
.header-right  { display: flex; align-items: center; gap: var(--sp-2); flex: 1; justify-content: flex-end; }

/* Breadcrumb */
.breadcrumb ol { display: flex; list-style: none; gap: var(--sp-1); align-items: center; }
.breadcrumb li:not(:first-child)::before {
  content: '/'; margin-right: var(--sp-1);
  color: var(--text-chrome-muted); font-size: var(--text-xs);
}
.breadcrumb a {
  color: var(--text-chrome-secondary); text-decoration: none;
  font-size: var(--text-sm); transition: color var(--ease-fast);
}
.breadcrumb a:hover { color: var(--text-chrome-primary); }
.breadcrumb [aria-current="page"] { color: var(--text-chrome-primary); font-size: var(--text-sm); }

/* Status pill */
.status-overview {
  display: flex; align-items: center; gap: var(--sp-3);
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--chrome-border);
  border-radius: 999px; padding: var(--sp-2) var(--sp-4);
}
.current-phase { font-size: var(--text-sm); font-weight: 600; color: var(--text-chrome-primary); white-space: nowrap; }
.progress-mini {
  width: 80px; height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px; overflow: hidden; flex-shrink: 0;
}
.progress-mini .progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; transition: width var(--ease-normal);
}
.progress-text { font-size: var(--text-xs); color: var(--text-chrome-secondary); white-space: nowrap; }

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: none; border: 1px solid var(--chrome-border);
  border-radius: var(--radius-sm); color: var(--text-chrome-primary);
  cursor: pointer; transition: background var(--ease-fast);
}
.mobile-menu-toggle:hover { background: rgba(255,255,255,0.07); }
.hamburger-icon { font-size: var(--text-md); line-height: 1; }

/* ── GitHub Auth Widgets ────────────────────────────────────── */
.auth-section { display: flex; align-items: center; }

.github-login-btn {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-4); height: 34px;
  background: #24292f; color: #f0f6fc;
  border: 1px solid rgba(240,246,252,0.1);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 500; font-family: var(--font-sans);
  cursor: pointer; text-decoration: none;
  transition: background var(--ease-fast), border-color var(--ease-fast);
}
.github-login-btn:hover { background: #32383f; border-color: rgba(240,246,252,0.2); }
.github-login-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.github-icon { fill: currentColor; flex-shrink: 0; }

.user-info {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-3);
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--chrome-border); border-radius: 999px;
}
.user-avatar { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.2); flex-shrink: 0; }
.user-details { display: flex; align-items: center; gap: var(--sp-2); }
.user-name { color: var(--text-chrome-primary); font-size: var(--text-sm); font-weight: 500; }
.logout-btn {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; background: none; border: none;
  color: var(--text-chrome-secondary); cursor: pointer;
  border-radius: 4px; transition: color var(--ease-fast), background var(--ease-fast);
}
.logout-btn:hover { background: rgba(255,255,255,0.10); color: var(--text-chrome-primary); }
.logout-btn svg { fill: currentColor; }

/* ── Application Shell ─────────────────────────────────────── */
.app-container {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  background: var(--chrome-sidebar);
  border-right: 1px solid var(--chrome-border);
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto; overflow-x: hidden;
  padding: var(--sp-4) 0 var(--sp-8);
  display: flex; flex-direction: column;
  transition: transform var(--ease-normal);
}

.nav-section { padding: 0 var(--sp-3); margin-bottom: var(--sp-2); }
.nav-section + .nav-section {
  margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px solid var(--chrome-border);
}
.nav-section-title {
  font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-chrome-muted);
  padding: 0 var(--sp-3); margin-bottom: var(--sp-2);
}
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); margin-bottom: 1px;
  color: var(--text-chrome-secondary); text-decoration: none;
  border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 500;
  transition: background var(--ease-fast), color var(--ease-fast);
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; position: relative; min-height: 36px;
}
.nav-item:hover { background: var(--chrome-sidebar-hover); color: var(--text-chrome-primary); }
.nav-item.active { background: var(--accent-subtle); color: #a5b4fc; }
.nav-item.active::before {
  content: ''; position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.nav-icon {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0; opacity: 0.70;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto; background: var(--status-error); color: #fff;
  font-size: var(--text-xs); font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 var(--sp-1);
}

/* Auth prompt in sidebar */
.auth-prompt-card {
  background: rgba(255,255,255,0.04); border: 1px solid var(--chrome-border);
  border-radius: var(--radius-md); padding: var(--sp-4);
  text-align: center; margin: var(--sp-3);
}
.auth-prompt-icon { font-size: 1.75rem; margin-bottom: var(--sp-2); }
.auth-prompt-card h3 { color: var(--text-chrome-primary); font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--sp-2); }
.auth-prompt-card p  { color: var(--text-chrome-secondary); font-size: var(--text-xs); line-height: 1.5; margin-bottom: var(--sp-4); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  position: fixed; inset: 0; top: var(--header-h);
  background: var(--surface-overlay); z-index: 195;
  opacity: 0; visibility: hidden;
  transition: opacity var(--ease-normal), visibility var(--ease-normal);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content { padding: var(--sp-6); overflow-y: auto; min-width: 0; }
#content-container {
  background: var(--surface-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden; min-height: 500px;
}

/* ── Loading / Error States ────────────────────────────────── */
.loading-indicator {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--sp-4); padding: var(--sp-12); color: var(--text-secondary);
}
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--sp-4); padding: var(--sp-12); text-align: center;
}
.error-icon { font-size: 2.5rem; }
.retry-btn {
  background: var(--accent); color: #fff; border: none;
  padding: var(--sp-2) var(--sp-5); border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 500; font-size: var(--text-sm);
  font-family: var(--font-sans); transition: background var(--ease-fast);
}
.retry-btn:hover { background: var(--accent-hover); }

/* Section-level loading (within content-container) */
.dashboard-loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 400px; padding: var(--sp-8);
}
.loading-spinner { text-align: center; }
.loading-spinner p { color: var(--text-secondary); margin-top: var(--sp-4); }

/* ── Footer ─────────────────────────────────────────────────── */
.app-footer {
  height: var(--footer-h); background: var(--chrome-header);
  border-top: 1px solid var(--chrome-border);
  display: flex; align-items: center; justify-content: center; padding: 0 var(--sp-6);
}
.footer-content {
  display: flex; gap: var(--sp-6);
  font-size: var(--text-xs); color: var(--text-chrome-muted);
}

/* ── Bottom Navigation (Mobile) ────────────────────────────── */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h); background: var(--chrome-header);
  border-top: 1px solid var(--chrome-border); z-index: 190;
  align-items: center;
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-chrome-muted); text-decoration: none;
  padding: var(--sp-2); flex: 1; transition: color var(--ease-fast);
  position: relative; min-height: 44px;
}
.bottom-nav-item.active { color: var(--accent-text); }
.bottom-nav-icon { font-size: 1.1rem; line-height: 1; }
.bottom-nav-text { font-size: 10px; font-weight: 500; }
.bottom-nav-protected { display: flex; flex: 1; }
.bottom-nav-badge {
  position: absolute; top: 6px; right: calc(50% - 22px);
  background: var(--status-error); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 14px; height: 14px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* ── Search Modal ───────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: var(--surface-overlay);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 80px; z-index: 300;
  opacity: 0; visibility: hidden;
  transition: opacity var(--ease-normal), visibility var(--ease-normal);
}
.modal.active { opacity: 1; visibility: visible; }
.modal-content {
  background: var(--surface-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 90%; max-width: 560px; max-height: 72vh;
  overflow: hidden;
  transform: translateY(-8px) scale(0.98); transition: transform var(--ease-normal);
}
.modal.active .modal-content { transform: none; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: var(--text-md); font-weight: 600; color: var(--text-primary); }
.modal-close {
  background: none; border: none; font-size: var(--text-xl);
  color: var(--text-secondary); cursor: pointer;
  padding: var(--sp-1); border-radius: 4px; line-height: 1;
  transition: color var(--ease-fast);
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: var(--sp-5) var(--sp-6); overflow-y: auto; max-height: calc(72vh - 80px); }

#search-input {
  width: 100%; padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-base); font-family: var(--font-sans);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-input); color: var(--text-primary);
  margin-bottom: var(--sp-4); transition: border-color var(--ease-fast);
}
#search-input:focus { outline: none; border-color: var(--border-focus); }

.search-result {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--ease-fast); margin-bottom: var(--sp-1);
}
.search-result:hover { background: var(--surface-page); }
.search-result-title { font-weight: 600; font-size: var(--text-sm); color: var(--text-primary); margin-bottom: 2px; }
.search-result-excerpt { font-size: var(--text-xs); color: var(--text-secondary); line-height: 1.4; }
.search-result-section {
  display: inline-block; background: var(--surface-page); color: var(--text-muted);
  font-size: var(--text-xs); padding: 2px var(--sp-2); border-radius: 4px; margin-top: var(--sp-1);
}

/* ── Card Components ────────────────────────────────────────── */
.card {
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--ease-fast), transform var(--ease-fast);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.card-header h2 {
  font-size: var(--text-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
}
.card-body { color: var(--text-secondary); }

/* ── Button System ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm); font-weight: 500; font-family: var(--font-sans);
  line-height: 1; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: all var(--ease-fast); min-height: 36px;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-page); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline   { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-page); color: var(--text-primary); }
.btn-danger    { background: var(--status-error); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: var(--text-xs); min-height: 28px; }
.btn-lg { padding: var(--sp-3) var(--sp-6); font-size: var(--text-base); min-height: 44px; }

/* ── Badge System ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px var(--sp-2); font-size: var(--text-xs); font-weight: 600;
  border-radius: 4px; line-height: 1.4;
}
.badge-success { background: rgba(16,185,129,0.12);  color: #059669; }
.badge-warning { background: rgba(245,158,11,0.12);  color: #d97706; }
.badge-error   { background: rgba(239,68,68,0.12);   color: #dc2626; }
.badge-info    { background: rgba(59,130,246,0.12);  color: #2563eb; }
.badge-neutral { background: var(--surface-page); color: var(--text-secondary); }

/* ── Progress Bars ───────────────────────────────────────────── */
.progress-bar {
  width: 100%; height: 6px;
  background: var(--surface-page); border-radius: 3px; overflow: hidden;
}
.progress-bar .progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 3px; transition: width var(--ease-normal);
}
.progress-bar.mini { height: 4px; }
.progress-bar.success .progress-fill { background: var(--status-success); }
.progress-bar.warn    .progress-fill { background: var(--status-warn); }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm);
  border-left: 3px solid; font-size: var(--text-sm); line-height: 1.5;
}
.alert-success { background: rgba(16,185,129,0.08);  border-left-color: var(--status-success); color: #047857; }
.alert-warning { background: rgba(245,158,11,0.08);  border-left-color: var(--status-warn);    color: #b45309; }
.alert-error   { background: rgba(239,68,68,0.08);   border-left-color: var(--status-error);   color: #b91c1c; }
.alert-info    { background: rgba(59,130,246,0.08);  border-left-color: var(--status-info);    color: #1d4ed8; }

/* ── Toast Notifications ─────────────────────────────────────── */
.toast {
  position: fixed; top: calc(var(--header-h) + var(--sp-4)); right: var(--sp-6);
  z-index: 500; min-width: 280px; max-width: 380px;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500;
  box-shadow: var(--shadow-lg); border-left: 4px solid;
  animation: toast-in var(--ease-normal) forwards;
}
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.toast-success { background: #f0fdf4; border-left-color: var(--status-success); color: #15803d; }
.toast-error   { background: #fef2f2; border-left-color: var(--status-error);   color: #b91c1c; }
.toast-info    { background: #eff6ff; border-left-color: var(--status-info);    color: #1d4ed8; }

/* ── Form Elements ───────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-4); }
.form-label { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); margin-bottom: var(--sp-2); }
.form-input {
  width: 100%; padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-base); font-family: var(--font-sans);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-input); color: var(--text-primary);
  transition: border-color var(--ease-fast);
}
.form-input:focus { outline: none; border-color: var(--border-focus); }
.form-help  { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--sp-1); }
.form-error { font-size: var(--text-xs); color: var(--status-error); margin-top: var(--sp-1); }

/* ── Dashboard ───────────────────────────────────────────────── */
.dashboard-container { padding: var(--sp-6); max-width: 1440px; margin: 0 auto; }
.dashboard-header { margin-bottom: var(--sp-6); }
.dashboard-header h1 { font-size: var(--text-xl); font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.dashboard-subtitle { color: var(--text-secondary); font-size: var(--text-sm); margin-top: var(--sp-1); }

.dashboard-grid-row { display: grid; gap: var(--sp-5); margin-bottom: var(--sp-5); }
.dashboard-top-row   { grid-template-columns: 1fr 1fr 1fr; }
.dashboard-focus-row { grid-template-columns: 4fr 1fr; align-items: stretch; }

.dashboard-card { transition: box-shadow var(--ease-fast), transform var(--ease-fast); }
.dashboard-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.current-focus-card { min-height: 480px; }
.current-focus-body { display: flex; gap: var(--sp-5); height: 100%; }
.focus-column {
  flex: 1; display: flex; flex-direction: column;
  gap: var(--sp-4); overflow-y: auto;
  max-height: 420px; padding-right: var(--sp-1);
}
.focus-section { background: var(--surface-page); border-radius: var(--radius-sm); padding: var(--sp-4); }
.focus-section-title {
  font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-secondary); margin-bottom: var(--sp-3);
}
.focus-content { display: flex; flex-direction: column; gap: var(--sp-2); }

/* Shared row items */
.task-item, .env-status-item, .next-task, .activity-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm);
  background: var(--surface-card); border: 1px solid var(--border);
}
.task-info, .status-info, .activity-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.task-title, .status-title { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.task-meta, .status-meta, .activity-time { font-size: var(--text-xs); color: var(--text-secondary); }
.task-status { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.task-status.active    { background: var(--status-warn); }
.task-status.completed { background: var(--status-success); }
.task-status.pending   { background: var(--text-muted); }
.status-indicator { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.status-indicator.online  { background: var(--status-success); }
.status-indicator.offline { background: var(--status-error); }

.phase-mini-card {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm);
  background: var(--surface-card); border: 1px solid var(--border);
}
.phase-mini-card.upcoming { opacity: 0.6; }
.phase-mini-card .phase-number {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 700; flex-shrink: 0;
}
.phase-mini-card.upcoming .phase-number { background: var(--text-muted); }
.phase-mini-info { flex: 1; min-width: 0; }
.phase-mini-title { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); display: block; margin-bottom: 4px; }
.phase-mini-progress { display: flex; align-items: center; gap: var(--sp-2); }

.week-stat {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--sp-3); border-radius: var(--radius-sm);
  background: var(--surface-card); border: 1px solid var(--border); flex: 1;
}
.week-stat-value { font-size: var(--text-lg); font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.week-stat-label { font-size: var(--text-xs); color: var(--text-secondary); }

.next-task { justify-content: space-between; align-items: center; }
.next-task-title { font-size: var(--text-sm); color: var(--text-primary); }
.next-task-phase {
  font-size: var(--text-xs); color: var(--text-secondary);
  background: var(--surface-page); border: 1px solid var(--border);
  padding: 2px var(--sp-2); border-radius: 4px;
}

.recent-activity-card { min-height: 480px; }
.recent-activity-body { height: 100%; }
.activity-feed { display: flex; flex-direction: column; gap: var(--sp-2); overflow-y: auto; max-height: 420px; padding-right: var(--sp-1); }
.activity-icon { font-size: var(--text-sm); flex-shrink: 0; margin-top: 2px; }
.activity-title { font-size: var(--text-xs); font-weight: 500; color: var(--text-primary); line-height: 1.4; }

/* Progress card */
.progress-card .progress-overview { display: flex; flex-direction: column; gap: var(--sp-4); }
.progress-card .progress-stats { display: flex; justify-content: space-between; align-items: baseline; }
.progress-card .progress-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.progress-card .progress-stat .stat-value { font-size: var(--text-lg); font-weight: 700; color: var(--text-primary); }
.progress-card .progress-stat .stat-label { font-size: var(--text-xs); color: var(--text-secondary); }
.progress-card .progress-bar-container { display: flex; align-items: center; gap: var(--sp-3); }
.progress-card .progress-bar { flex: 1; height: 8px; }
.progress-card .progress-percentage { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; }

/* ── Dev Tracker ─────────────────────────────────────────────── */
.dev-tracker-container { padding: var(--sp-6); }
.dev-tracker-header { margin-bottom: var(--sp-6); }
.dev-tracker-header h1 { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; }
.dev-tracker-subtitle { font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--sp-1); }

.overall-progress-display { display: flex; align-items: center; gap: var(--sp-6); margin-bottom: var(--sp-6); }
.progress-circle { width: 80px; height: 80px; position: relative; }
.progress-circle .progress-fill { width: 80px; height: 80px; border-radius: 50%; }
.progress-circle .progress-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.progress-percentage { font-size: var(--text-md); font-weight: 700; color: var(--text-primary); }
.progress-label { font-size: var(--text-xs); color: var(--text-secondary); }
.progress-details h2 { font-size: var(--text-lg); font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.stat-card {
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-3);
}
.stat-icon { font-size: 1.4rem; flex-shrink: 0; }
.stat-value { font-size: var(--text-xl); font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: var(--text-xs); color: var(--text-secondary); font-weight: 500; }
.stat-sublabel { font-size: var(--text-xs); color: var(--text-muted); }

.timeline-section, .phases-section { margin-bottom: var(--sp-6); }
.timeline-section h3, .phases-section h3 { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--sp-3); }

.week-tracker { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.week-item { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 44px; }
.week-item .week-number {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 600;
  background: var(--surface-page); border: 1.5px solid var(--border);
  color: var(--text-muted); transition: all var(--ease-fast);
}
.week-item.completed .week-number { background: var(--accent); border-color: var(--accent); color: #fff; }
.week-item.current  .week-number  { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }
.week-item .week-label { font-size: 9px; color: var(--text-muted); }

.phases-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.phase-card {
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
  cursor: pointer; transition: box-shadow var(--ease-fast), transform var(--ease-fast);
}
.phase-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.phase-card.active { border-color: var(--accent); }
.phase-header { padding: var(--sp-4); display: flex; align-items: center; gap: var(--sp-3); border-bottom: 1px solid var(--border); }
.phase-header .phase-number {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--phase-color, var(--accent)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 700; flex-shrink: 0;
}
.phase-header .phase-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); flex: 1; }
.phase-status-badge { font-size: var(--text-xs); font-weight: 600; padding: 2px var(--sp-2); border-radius: 4px; }
.phase-status-badge.active   { background: rgba(99,102,241,0.12); color: var(--accent); }
.phase-status-badge.completed { background: rgba(34,197,94,0.14); color: #16a34a; }
.phase-status-badge.upcoming { background: var(--surface-page); color: var(--text-muted); }
.phase-body { padding: var(--sp-4); }
.phase-description { font-size: var(--text-xs); color: var(--text-secondary); margin-bottom: var(--sp-3); line-height: 1.5; }
.phase-stats { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-3); }
.phase-stats .stat { display: flex; flex-direction: column; gap: 2px; }
.phase-stats .stat-label { font-size: var(--text-xs); color: var(--text-muted); }
.phase-stats .stat-value { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.phase-progress { display: flex; align-items: center; gap: var(--sp-3); }
.phase-progress .progress-bar { flex: 1; }
.phase-progress .progress-text { font-size: var(--text-xs); color: var(--text-secondary); white-space: nowrap; }
.phase-footer { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.phase-btn { width: 100%; }

/* ── Task completion ─────────────────────────────────────────── */
.task-completed .task-title,
.task-completed .task-label { text-decoration: line-through; opacity: 0.55; }
.task-feedback {
  position: absolute; right: -20px; top: 0;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  animation: feedback-pop 1.8s ease-out forwards;
}
.task-feedback.success { background: var(--status-success); color: #fff; }
.task-feedback.error   { background: var(--status-error);   color: #fff; }
@keyframes feedback-pop {
  0%   { transform: scale(0); opacity: 0; }
  40%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* ── Scrollbars ──────────────────────────────────────────────── */
.sidebar::-webkit-scrollbar,
.focus-column::-webkit-scrollbar,
.activity-feed::-webkit-scrollbar,
.modal-body::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track,
.focus-column::-webkit-scrollbar-track,
.activity-feed::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }
.focus-column::-webkit-scrollbar-thumb,
.activity-feed::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }

/* ── Utility ─────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.text-sm        { font-size: var(--text-sm); }
.text-xs        { font-size: var(--text-xs); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.font-medium    { font-weight: 500; }
.font-semibold  { font-weight: 600; }
.font-bold      { font-weight: 700; }
.mt-4           { margin-top: var(--sp-4); }
.mb-4           { margin-bottom: var(--sp-4); }
.hidden         { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
  .dashboard-top-row   { grid-template-columns: 1fr 1fr; }
  .incidents-card      { grid-column: span 2; }
  .dashboard-focus-row { grid-template-columns: 1fr; }
  .recent-activity-card { min-height: 300px; }
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .phases-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  :root { --header-h: 52px; }
  .app-header { padding: 0 var(--sp-4); }
  .header-center { display: none; }
  .logo { font-size: var(--text-base); }
  .breadcrumb { display: none; }
  .mobile-menu-toggle { display: flex; }
  .app-container { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0;
    bottom: var(--bottom-nav-h); width: 260px;
    z-index: 196; height: auto;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: none; }
  .main-content { padding: var(--sp-4); padding-bottom: calc(var(--bottom-nav-h) + var(--sp-4)); }
  #content-container { border-radius: var(--radius-md); }
  .bottom-nav { display: flex; }
  .app-footer { margin-bottom: var(--bottom-nav-h); }
  .footer-content { flex-direction: column; gap: var(--sp-1); text-align: center; }
  .dashboard-container { padding: var(--sp-4); }
  .dashboard-top-row { grid-template-columns: 1fr !important; }
  .incidents-card { grid-column: span 1; }
  .dashboard-focus-row { grid-template-columns: 1fr; }
  .current-focus-body { flex-direction: column; }
  .focus-column { max-height: 280px; }
  .stats-grid  { grid-template-columns: 1fr 1fr; }
  .phases-grid { grid-template-columns: 1fr; }
  .modal { align-items: flex-end; padding-top: 0; }
  .modal-content { width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 80vh; }
  .user-name { display: none; }
  .auth-prompt-card h3, .auth-prompt-card p { font-size: var(--text-xs); }
}

@media (hover: none) and (pointer: coarse) {
  .nav-item { min-height: 44px; }
  .btn      { min-height: 44px; }
  .btn-sm   { min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .spinner { animation: none; border-color: var(--accent); }
}

@media print {
  .app-header, .sidebar, .bottom-nav, .app-footer { display: none !important; }
  .app-container { grid-template-columns: 1fr; }
  .main-content { padding: 0; }
  #content-container { box-shadow: none; }
}

/* ============================================================
   Modern refresh
   Sleek local-first workbench style layered over the shared app.
   ============================================================ */

:root {
  --chrome-header: #0c1117;
  --chrome-sidebar: rgba(13, 18, 25, 0.88);
  --chrome-sidebar-hover: rgba(255, 255, 255, 0.06);
  --chrome-border: rgba(255, 255, 255, 0.08);

  --surface-page: #0f151d;
  --surface-card: rgba(25, 33, 43, 0.86);
  --surface-input: #111821;
  --surface-overlay: rgba(0, 0, 0, 0.62);

  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-subtle: rgba(45, 212, 191, 0.13);
  --accent-text: #7dd3fc;

  --status-success: #22c55e;
  --status-warn: #f59e0b;
  --status-error: #f87171;
  --status-info: #60a5fa;

  --text-chrome-primary: #edf5f2;
  --text-chrome-secondary: #a8b3c1;
  --text-chrome-muted: #667789;

  --text-primary: #edf5f2;
  --text-secondary: #a8b3c1;
  --text-muted: #748497;

  --border: rgba(255, 255, 255, 0.1);
  --border-focus: #2dd4bf;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-sm: 0 14px 36px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 22px 54px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.44);

  --header-h: 68px;
  --sidebar-w: 248px;
  --footer-h: 38px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;

  --color-primary: var(--accent);
  --color-border: var(--border);
  --color-bg-secondary: #141c25;
  --color-text-primary: var(--text-primary);
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(45, 212, 191, 0.14), transparent 31rem),
    radial-gradient(circle at 96% 88%, rgba(245, 158, 11, 0.11), transparent 34rem),
    linear-gradient(135deg, #0b1017 0%, #101720 52%, #14120f 100%);
  color: var(--text-primary);
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.58), transparent 68%);
}

.app-header {
  background: rgba(12, 17, 23, 0.82);
  backdrop-filter: blur(22px);
  border-bottom: 1px solid var(--chrome-border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
}

.logo,
.dashboard-header h1,
.dev-tracker-header h1,
.workbench-header h1,
.architecture-header h1 {
  letter-spacing: 0;
}

.logo {
  color: var(--text-chrome-primary);
  font-size: 1rem;
  font-weight: 750;
}

.logo-mark {
  width: 30px;
  height: 30px;
  background:
    linear-gradient(135deg, #0f766e 0%, #14b8a6 55%, #f59e0b 125%);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
}

.breadcrumb [aria-current="page"],
.breadcrumb a,
.current-phase,
.progress-text,
.user-name {
  color: var(--text-chrome-secondary);
}

.breadcrumb [aria-current="page"],
.current-phase {
  color: var(--text-primary);
}

.breadcrumb {
  display: none;
}

.status-overview,
.user-info {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.progress-mini {
  background: rgba(255, 255, 255, 0.1);
}

.progress-mini .progress-fill,
.progress-bar .progress-fill {
  background: linear-gradient(90deg, #0f766e 0%, #14b8a6 72%, #f59e0b 100%);
}

.github-login-btn {
  background: #171f2b;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  white-space: nowrap;
}

.github-login-btn:hover {
  background: #202b3a;
  border-color: rgba(45, 212, 191, 0.22);
}

.mobile-menu-toggle {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text-chrome-primary);
}

.unified-nav {
  flex: 0 1 auto;
  gap: var(--sp-1);
  padding: 4px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.unified-nav .nav-item {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0 var(--sp-3);
  white-space: nowrap;
  color: var(--text-chrome-secondary);
  flex-shrink: 0;
}

.unified-nav .nav-item.active {
  background: rgba(45, 212, 191, 0.14);
  color: var(--accent);
  box-shadow: none;
}

.unified-nav .nav-item.active::before {
  display: none;
}

.unified-nav .nav-badge {
  position: static;
  margin-left: var(--sp-2);
}

.unified-nav .nav-auth-required {
  display: none;
}

body.is-authenticated .unified-nav .nav-auth-required {
  display: flex;
}

.app-container {
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
}

.unified-shell {
  display: block;
}

.unified-shell .sidebar,
.bottom-nav {
  display: none !important;
}

.sidebar {
  background: var(--chrome-sidebar);
  backdrop-filter: blur(22px);
  border-right: 1px solid var(--chrome-border);
  padding: var(--sp-5) var(--sp-3) var(--sp-8);
}

.nav-section {
  padding: 0;
}

.nav-section + .nav-section {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.nav-section-title {
  color: var(--text-chrome-muted);
  padding: 0 var(--sp-3);
}

.nav-item {
  color: var(--text-secondary);
  border-radius: 8px;
  min-height: 40px;
  font-weight: 620;
}

.nav-item:hover {
  background: var(--chrome-sidebar-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(45, 212, 191, 0.1);
  color: var(--accent);
  box-shadow: var(--shadow-xs), inset 0 0 0 1px rgba(45, 212, 191, 0.2);
}

.nav-item.active::before {
  left: auto;
  right: 9px;
  top: 12px;
  bottom: 12px;
  width: 5px;
  border-radius: 999px;
}

.auth-prompt-card {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-xs);
  text-align: left;
}

.auth-prompt-icon {
  display: none;
}

.auth-prompt-card h3 {
  color: var(--text-chrome-primary);
  font-size: var(--text-sm);
}

.auth-prompt-card p {
  color: var(--text-chrome-secondary);
}

.main-content {
  padding: var(--sp-8);
  max-width: 1440px;
  margin: 0 auto;
}

.main-content:focus {
  outline: none;
}

#content-container {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  min-height: 0;
}

.app-footer {
  background: transparent;
  border-top: 0;
}

.footer-content {
  color: var(--text-muted);
}

.card {
  background: var(--surface-card);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.dashboard-card:hover,
.phase-card:hover,
.workbench-card:hover,
.architecture-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  margin-bottom: var(--sp-4);
}

.card-header h2,
.card-header h3,
.card-title {
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 720;
  text-transform: none;
  letter-spacing: 0;
}

.btn {
  border-radius: 7px;
  font-weight: 650;
}

.btn-primary {
  background: var(--accent);
  color: #06211e;
  box-shadow: 0 10px 24px rgba(45, 212, 191, 0.14);
}

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

.btn-secondary,
.btn-outline {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover,
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
}

.badge {
  border-radius: 999px;
  padding: 3px var(--sp-2);
}

.badge-success { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge-error { background: rgba(248, 113, 113, 0.14); color: #fecaca; }
.badge-info { background: rgba(96, 165, 250, 0.14); color: #bfdbfe; }
.badge-neutral { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }

.dashboard-container,
.dev-tracker-container,
.workbench-header,
.architecture-header,
.architecture-container,
.aie-tracker-container,
.incident-header,
.phase-detail-header,
.workbench-section-header {
  max-width: 1360px;
  margin-left: auto;
  margin-right: auto;
}

.dashboard-container,
.dev-tracker-container {
  padding: 0;
}

.dashboard-header,
.dev-tracker-header,
.workbench-header,
.architecture-header,
.aie-tracker-header,
.incident-header,
.phase-detail-header,
.workbench-section-header {
  padding: var(--sp-5) 0 var(--sp-6);
  margin-bottom: var(--sp-2);
}

.dashboard-header h1,
.dev-tracker-header h1,
.workbench-header h1,
.architecture-header h1,
.aie-tracker-header h1,
.incident-header h1,
.phase-detail-header h1,
.workbench-section-header h1 {
  color: var(--text-primary);
  font-size: clamp(1.55rem, 2vw, 2rem);
  line-height: 1.15;
  font-weight: 780;
}

.dashboard-subtitle,
.dev-tracker-subtitle,
.workbench-header p,
.architecture-header p {
  max-width: 760px;
  color: var(--text-secondary);
  font-size: var(--text-base);
}

.dashboard-grid-row {
  gap: var(--sp-5);
}

.dashboard-top-row {
  grid-template-columns: minmax(260px, 1.15fr) minmax(260px, 1fr) minmax(230px, 0.8fr);
}

.dashboard-focus-row {
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
}

.dashboard-section-title {
  margin: var(--sp-8) 0 var(--sp-4);
}

.dashboard-section-title h2 {
  font-size: var(--text-lg);
  font-weight: 780;
  margin-bottom: var(--sp-1);
}

.dashboard-section-title p {
  color: var(--text-secondary);
}

.dashboard-focus-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-5);
}

.public-roadmap-section {
  margin-top: var(--sp-5);
  max-width: 720px;
}

.public-glimpse-card p {
  line-height: 1.6;
}

.focus-panel {
  min-height: 0;
}

.focus-panel-wide {
  grid-column: span 2;
}

.progress-card .progress-stat .stat-value,
.week-stat-value,
.stat-value {
  color: var(--text-primary);
}

.current-phase-info .phase-title {
  color: var(--text-primary);
  font-size: var(--text-lg);
  font-weight: 720;
  margin-bottom: var(--sp-2);
}

.current-phase-info .phase-description {
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
}

.phase-details-btn {
  margin-top: var(--sp-4);
}

.focus-section {
  background: rgba(10, 15, 22, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.focus-section-title {
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--text-sm);
}

.task-item,
.env-status-item,
.next-task,
.activity-item,
.phase-mini-card,
.week-stat,
.stat-card {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.task-status,
.status-indicator {
  width: 8px;
  height: 8px;
}

.task-status.active { background: #d97706; }
.task-status.completed,
.status-indicator.online { background: #16a34a; }

.phase-mini-card .phase-number,
.phase-header .phase-number,
.week-item.completed .week-number {
  background: var(--accent);
}

.phase-mini-card.upcoming .phase-number {
  background: #64748b;
}

.recent-activity-card,
.current-focus-card {
  min-height: 0;
}

.week-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.progress-header {
  background: rgba(25, 33, 43, 0.76);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-sm);
}

.progress-circle .progress-fill {
  background: conic-gradient(var(--accent) var(--progress, 0%), rgba(255, 255, 255, 0.1) 0);
}

.progress-circle::after {
  content: "";
  position: absolute;
  inset: 9px;
  background: #121a24;
  border-radius: 50%;
}

.progress-circle .progress-text {
  z-index: 1;
}

.stats-grid,
.phases-grid,
.week-tracker {
  gap: var(--sp-4);
}

.stat-card {
  box-shadow: var(--shadow-xs);
}

.stat-icon,
.activity-icon,
.bottom-nav-icon {
  display: none;
}

.week-item .week-number {
  border-radius: 8px;
}

.phase-card {
  border-radius: 8px;
}

.phase-card.active {
  border-color: rgba(15, 118, 110, 0.44);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.09), var(--shadow-sm);
}

.phase-footer {
  background: rgba(255, 255, 255, 0.025);
}

.modal-content {
  border-radius: 10px;
  border: 1px solid var(--border);
}

#search-input,
.form-input {
  border-radius: 8px;
}

.search-result:hover {
  background: rgba(255, 255, 255, 0.06);
}

.bottom-nav {
  background: rgba(12, 17, 23, 0.92);
  backdrop-filter: blur(18px);
  border-top-color: var(--border);
}

.bottom-nav-item {
  color: var(--text-muted);
}

.bottom-nav-item.active {
  color: var(--accent);
}

/* Lightweight utility classes used by section fragments. */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-content { justify-content: center; }
.space-y-2 > * + * { margin-top: var(--sp-2); }
.w-full { width: 100%; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.rounded-full { border-radius: 999px; }
.bg-primary { background: var(--accent); }
.bg-secondary { background: #667085; }
.bg-red-50 { background: rgba(220, 38, 38, 0.08); }
.p-3 { padding: var(--sp-3); }
.py-8 { padding-top: var(--sp-8); padding-bottom: var(--sp-8); }
.py-12 { padding-top: var(--sp-12); padding-bottom: var(--sp-12); }
.rounded-lg { border-radius: 8px; }
.text-center { text-align: center; }
.text-white { color: #ffffff; }
.text-primary { color: var(--accent); }
.text-success { color: var(--status-success); }
.text-warning { color: var(--status-warn); }
.text-error { color: var(--status-error); }
.text-info { color: var(--status-info); }
.text-lg { font-size: var(--text-lg); }
.text-2xl { font-size: var(--text-2xl); }
.text-4xl { font-size: 2.25rem; }
.font-semibold { font-weight: 700; }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-6 { margin-bottom: var(--sp-6); }
.mt-6 { margin-top: var(--sp-6); }
.hover\:underline:hover { text-decoration: underline; }

.workbench-card,
.architecture-card {
  min-height: 178px;
  cursor: pointer;
}

.page-panel {
  background: var(--surface-card);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: var(--sp-5);
}

.section-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 var(--sp-4);
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
}

.section-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.055);
}

.section-tab.active {
  color: #06211e;
  background: var(--accent);
}

.architecture-container {
  max-width: 1360px;
  margin: 0 auto;
}

.architecture-workspace {
  padding: 0;
  overflow: hidden;
}

.architecture-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-6);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
}

.architecture-toolbar h2 {
  font-size: var(--text-lg);
  font-weight: 780;
  margin-bottom: var(--sp-1);
}

.architecture-toolbar p {
  color: var(--text-secondary);
  max-width: 680px;
}

.architecture-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.architecture-canvas {
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-8);
  background:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 36px 36px;
}

.architecture-canvas h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--sp-2);
}

.architecture-canvas p {
  color: var(--text-secondary);
}

.phase-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(280px, 0.8fr);
  gap: var(--sp-5);
}

.phase-task-panel,
.phase-notes-panel {
  padding: var(--sp-5);
}

.phase-detail-panel-header {
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.phase-detail-panel-header h2 {
  font-size: var(--text-lg);
  font-weight: 780;
  margin-bottom: var(--sp-1);
}

.phase-detail-panel-header p {
  color: var(--text-secondary);
}

.roadmap-task-list {
  display: grid;
  gap: var(--sp-2);
}

.roadmap-task {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.roadmap-task-check {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 800;
}

.roadmap-task.is-done .roadmap-task-check {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
}

.roadmap-task-title {
  color: var(--text-primary);
  font-weight: 650;
}

.roadmap-task-meta,
.phase-note-label {
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.phase-note-list {
  display: grid;
  gap: var(--sp-3);
}

.phase-note {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.architecture-mini-map,
.architecture-flow-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

.architecture-mini-map span,
.architecture-flow-list span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(45, 212, 191, 0.08);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 700;
}

.workbench-card .card-header,
.architecture-card .card-header {
  margin-bottom: var(--sp-2);
}

.visualization-area {
  border-color: rgba(45, 212, 191, 0.18) !important;
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.07), rgba(245, 158, 11, 0.06)),
    rgba(255, 255, 255, 0.035) !important;
}

@media (max-width: 1024px) {
  .app-header {
    gap: var(--sp-3);
  }

  .header-left {
    flex: 0 0 auto;
  }

  .header-center {
    flex: 1 1 auto;
    min-width: 0;
  }

  .unified-nav {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .github-login-btn {
    width: 42px;
    padding: 0;
    font-size: 0;
    justify-content: center;
  }

  .github-login-btn .github-icon {
    width: 18px;
    height: 18px;
  }

  .main-content {
    padding: var(--sp-6);
  }

  .dashboard-focus-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .focus-panel-wide {
    grid-column: span 2;
  }

  .grid-cols-4,
  .grid-cols-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 58px;
  }

  .main-content {
    padding: var(--sp-4);
    padding-bottom: var(--sp-4);
  }

  .app-header {
    height: auto;
    min-height: var(--header-h);
    flex-wrap: wrap;
    gap: var(--sp-3);
    padding-top: var(--sp-3);
    padding-bottom: var(--sp-3);
  }

  .header-left,
  .header-right {
    flex: 1 1 auto;
  }

  .unified-nav {
    order: 3;
    flex: 1 0 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .mobile-menu-toggle {
    display: none;
  }

  .sidebar {
    background: rgba(12, 17, 23, 0.96);
    width: min(280px, 86vw);
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4,
  .grid-cols-5,
  .stats-grid,
  .phases-grid,
  .dashboard-focus-panels {
    grid-template-columns: 1fr;
  }

  .focus-panel-wide {
    grid-column: span 1;
  }

  .dashboard-header,
  .dev-tracker-header,
  .workbench-header,
  .architecture-header {
    padding-top: var(--sp-3);
  }

  .card {
    padding: var(--sp-4);
  }

  .architecture-workspace,
  .architecture-canvas {
    padding: var(--sp-4);
  }

  .architecture-toolbar {
    flex-direction: column;
  }

  .architecture-actions {
    justify-content: flex-start;
  }

  .phase-detail-grid {
    grid-template-columns: 1fr;
  }

  .roadmap-task {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .roadmap-task .badge {
    grid-column: 2;
    justify-self: flex-start;
  }

  .current-focus-body {
    gap: var(--sp-4);
  }

  .week-summary-grid {
    grid-template-columns: 1fr;
  }
}
