/* ============================================================
   BoardOps Design System v3.0 (merged)
   Consolidated from design-system.css + design-enhancements.css
   Single source of truth for all dashboard styles
   ============================================================ */

/* ── View Transitions (smooth workspace switching) ── */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: sidebar; }
.mobile-tab-bar { view-transition-name: mobile-tab; }
.mobile-ws-pill { view-transition-name: ws-pill; }
::view-transition-old(sidebar) { animation: none; }
::view-transition-new(sidebar) { animation: none; }
::view-transition-old(main-content) { animation: fade-out 120ms ease; }
::view-transition-new(main-content) { animation: fade-in 120ms ease; }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design Tokens ── */
:root {
  /* ── Backgrounds (Apple grouped style) ── */
  --bg-0: #f2f2f7;
  --bg-1: #f2f2f7;
  --bg-2: #ffffff;
  --bg-3: #e5e5ea;
  --bg-4: #d1d1d6;
  --bg-5: #c7c7cc;

  --brand: #007aff;
  --brand-hover: #0071e3;
  --brand-dim: rgba(0, 122, 255, 0.10);
  --brand-dimmer: rgba(0, 122, 255, 0.05);
  --brand-glow: rgba(0, 122, 255, 0.15);

  --accent: #5ac8fa;
  --accent-dim: rgba(90, 200, 250, 0.10);

  --green: #34c759;
  --green-dim: rgba(52, 199, 89, 0.10);
  --green-glow: rgba(52, 199, 89, 0.15);
  --red: #ff3b30;
  --red-dim: rgba(255, 59, 48, 0.10);
  --red-glow: rgba(255, 59, 48, 0.15);
  --amber: #ff9500;
  --amber-dim: rgba(255, 149, 0, 0.10);
  --amber-glow: rgba(255, 149, 0, 0.15);
  --purple: #af52de;
  --purple-dim: rgba(175, 82, 222, 0.10);
  --blue: #007aff;
  --blue-dim: rgba(0, 122, 255, 0.10);

  --text-primary: #000000;
  --text-secondary: rgba(60, 60, 67, 0.6);
  --text-tertiary: rgba(60, 60, 67, 0.3);
  --text-muted: #8e8e93;
  --text-ghost: #c7c7cc;

  --border-subtle: rgba(60, 60, 67, 0.06);
  --border-default: rgba(60, 60, 67, 0.12);
  --border-hover: rgba(60, 60, 67, 0.18);
  --border-focus: rgba(0, 122, 255, 0.5);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 11px; --text-sm: 12px; --text-base: 13px; --text-md: 14px;
  --text-lg: 16px; --text-xl: 20px; --text-2xl: 24px; --text-3xl: 32px;

  --leading-tight: 1.3; --leading-normal: 1.5; --leading-relaxed: 1.6;
  --weight-normal: 400; --weight-medium: 500; --weight-semibold: 600; --weight-bold: 700;

  --radius-xs: 4px; --radius-sm: 6px; --radius-md: 10px;
  --radius-lg: 12px; --radius-xl: 16px; --radius-full: 9999px;

  --shadow-xs: 0 0.5px 1px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.08);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.10);
  --shadow-card: 0 0.5px 1px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-glow-brand: 0 0 8px rgba(0,122,255,0.10);
  --shadow-glow-green: 0 0 6px rgba(52,199,89,0.10);
  --shadow-glow-red: 0 0 6px rgba(255,59,48,0.10);

  --ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --duration-fast: 150ms; --duration-normal: 250ms; --duration-slow: 350ms;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body { font-family: var(--font-sans); background: var(--bg-0); color: var(--text-primary); line-height: var(--leading-normal); font-size: var(--text-base); min-height: 100vh; }
a { color: var(--brand); text-decoration: none; transition: color var(--duration-fast) var(--ease-default); }
a:hover { color: var(--brand-hover); }
::selection { background: var(--brand-dim); color: var(--brand); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--bg-5); }

/* ── Layout (two-pane: 64px rail + 220px panel) ── */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 284px; padding: 0; display: flex; flex-direction: row; position: fixed; top: 0; left: 0; bottom: 0; z-index: 10; transition: width var(--duration-normal) var(--ease-default); background: transparent; border-right: none; overflow: visible; }
body.panel-collapsed .sidebar { width: 64px; }
body.panel-collapsed .sidebar-panel { display: none; }
.main { margin-left: 284px; flex: 1; padding: var(--sp-6) var(--sp-8); min-height: 100vh; max-width: 1140px; view-transition-name: main-content; transition: margin-left var(--duration-normal) var(--ease-default); }
body.panel-collapsed .main { margin-left: 64px; }

/* ── Primary rail (64px) ── */
/* overflow: visible — the workspace dropdown anchors inside `.rail-ws` and
   extends 72px to the right; clipping it would hide the dropdown labels. */
.sidebar-rail { width: 64px; flex-shrink: 0; background: var(--bg-2); border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; align-items: stretch; padding: 10px 0; gap: 2px; overflow: visible; }
.rail-ws { display: flex; justify-content: center; padding: 4px 0 6px; position: relative; }
.rail-logo-wrap { width: 40px; height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background var(--duration-fast) var(--ease-default); overflow: hidden; }
.rail-logo-wrap:hover { background: var(--bg-3); }
.rail-logo { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-weight: var(--weight-bold); font-size: 13px; color: white; }
.rail-divider { height: 1px; background: var(--border-subtle); margin: 6px 12px; flex-shrink: 0; }
.rail-pillars { display: flex; flex-direction: column; gap: 2px; padding: 2px 0; }
.rail-icon { width: 44px; height: 44px; margin: 0 auto; border: none; background: transparent; color: var(--text-muted); border-radius: 9px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default); padding: 0; position: relative; }
.rail-icon:hover { background: var(--bg-3); color: var(--text-primary); }
.rail-icon.active { background: var(--brand-dim); color: var(--brand); }
.rail-icon svg { width: 22px; height: 22px; }
.rail-spacer { flex: 1; }
.rail-instances { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.rail-instance { width: 44px; height: 32px; margin: 0 auto; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 11px; font-weight: var(--weight-semibold); cursor: pointer; transition: background var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default); text-decoration: none; position: relative; }
.rail-instance:hover { background: var(--bg-3); color: var(--text-primary); }
.rail-instance.active { background: var(--brand-dim); color: var(--brand); }
.rail-instance .instance-dot { position: absolute; bottom: 4px; right: 8px; width: 6px; height: 6px; border-radius: 50%; }
.rail-toggle { width: 44px; height: 32px; margin: 6px auto 2px; border: none; background: transparent; color: var(--text-muted); border-radius: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default); }
.rail-toggle:hover { background: var(--bg-3); color: var(--text-primary); }
.rail-toggle svg { transition: transform var(--duration-fast) var(--ease-default); }
body.panel-collapsed .rail-toggle svg { transform: rotate(180deg); }

/* ── Secondary panel (220px) ── */
/* Scoped under .sidebar-panel to avoid collision with .panel-* classes used
   by backlog.html's three-column layout. */
.sidebar-panel { flex: 1; min-width: 0; background: var(--bg-1); border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-panel .panel-header { padding: 16px 16px 8px; flex-shrink: 0; border-bottom: none; margin-bottom: 0; position: static; background: transparent; }
.sidebar-panel .panel-title { font-size: var(--text-md); font-weight: var(--weight-bold); color: var(--text-primary); margin: 0; letter-spacing: -0.2px; text-transform: none; }
.sidebar-panel .panel-body { flex: 1; overflow-y: auto; padding: 4px 10px 12px; gap: 0; }

/* Workspace dropdown — anchored from rail */
.ws-dropdown { position: absolute; top: 4px; left: calc(100% + 8px); background: var(--bg-3); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 6px; min-width: 220px; box-shadow: var(--shadow-lg); z-index: 50; max-height: 80vh; overflow-y: auto; }

/* Sub-group + items inside panel */
.sidebar-logo { display: none; }
.logo-icon { display: none; }
.logo-text { display: none; }
.nav-section { margin-bottom: var(--sp-3); }
.nav-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); padding: var(--sp-1) var(--sp-2); margin-bottom: var(--sp-1); font-weight: var(--weight-medium); }
.nav-sublabel { font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-ghost, var(--text-muted)); padding: 10px 8px 2px; font-weight: var(--weight-bold); opacity: 0.65; }
.nav-sublabel:first-child { padding-top: 4px; }
.nav-item { display: flex; align-items: center; gap: var(--sp-2); padding: 7px 10px; min-height: 32px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: var(--text-base); transition: background var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default); position: relative; }
.nav-item:hover { background: var(--bg-3); color: var(--text-primary); }
.nav-item.active { background: var(--brand-dim); color: var(--brand); font-weight: var(--weight-medium); }
.nav-item.dim { color: var(--text-muted); }
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }
.nav-bottom { margin-top: auto; }
.nav-divider { height: 1px; background: var(--border-subtle); margin: var(--sp-2) 0; }
.badge { background: var(--brand); color: white; font-size: 10px; padding: 1px 7px; border-radius: var(--radius-full); margin-left: auto; font-weight: var(--weight-medium); }
.hq-pill { font-size: 9px; padding: 1px 5px; border-radius: var(--radius-full); margin-left: auto; font-weight: var(--weight-medium); background: rgba(255,255,255,0.06); color: var(--text-muted); letter-spacing: 0.5px; flex-shrink: 0; }
@keyframes badge-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--brand-glow); } 50% { box-shadow: 0 0 0 4px transparent; } }

/* ── Page Header ── */
.page-title { font-size: var(--text-2xl); font-weight: var(--weight-semibold); margin-bottom: var(--sp-5); letter-spacing: -0.5px; color: var(--text-primary); }
.page-subtitle { font-size: var(--text-md); color: var(--text-secondary); margin-top: calc(-1 * var(--sp-3)); margin-bottom: var(--sp-5); }

/* ── Stat Cards ── */
.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.card { background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--sp-4); transition: all var(--duration-normal) var(--ease-default); position: relative; overflow: hidden; box-shadow: var(--shadow-xs); }
.card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); }
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(0,0,0,0.03), transparent); }
.card-label { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--sp-1); text-transform: uppercase; letter-spacing: 0.5px; font-weight: var(--weight-medium); }
.card-value { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -0.5px; color: var(--text-primary); }
.card-sub { font-size: var(--text-xs); color: var(--text-secondary); margin-top: var(--sp-1); }
.card-trend { display: inline-flex; align-items: center; gap: 3px; font-size: var(--text-xs); font-weight: var(--weight-medium); padding: 1px 6px; border-radius: var(--radius-xs); }
.card-trend.up { color: var(--green); background: var(--green-dim); }
.card-trend.down { color: var(--red); background: var(--red-dim); }
.card-trend.neutral { color: var(--text-tertiary); background: var(--bg-4); }

/* ── Section Headers ── */
.section-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-3); margin-top: var(--sp-6); }
.section-row:first-of-type { margin-top: 0; }
.section-label { font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.section-link { font-size: var(--text-xs); color: var(--brand); font-weight: var(--weight-medium); }
.section-link:hover { color: var(--brand-hover); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: 7px 14px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--weight-medium); border: none; cursor: pointer; transition: all var(--duration-fast) var(--ease-default); font-family: var(--font-sans); min-height: 32px; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: #007aff; color: white; box-shadow: var(--shadow-xs), 0 0 8px rgba(0,114,222,0.15); }
.btn-primary:hover { box-shadow: var(--shadow-sm), 0 0 16px rgba(0,114,222,0.2); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-4); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-5); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-3); color: var(--text-primary); }
.btn-success { background: var(--green-dim); color: var(--green); }
.btn-success:hover { background: rgba(13, 144, 79, 0.15); }
.btn-danger { background: var(--red-dim); color: var(--red); }
.btn-danger:hover { background: rgba(217, 48, 37, 0.15); }
.btn-add { background: var(--brand-dim); color: var(--brand); }
.btn-add:hover { background: rgba(0, 114, 222, 0.18); }

/* ── Attention Banner ── */
.attention-banner { background: linear-gradient(135deg, var(--amber-dim), rgba(227, 116, 0, 0.04)); border: 1px solid rgba(227, 116, 0, 0.15); border-radius: var(--radius-lg); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-5); display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-base); color: var(--amber); cursor: pointer; transition: all var(--duration-normal) var(--ease-default); }
.attention-banner:hover { background: linear-gradient(135deg, rgba(227, 116, 0, 0.12), var(--amber-dim)); border-color: rgba(227, 116, 0, 0.25); }
.attention-banner.hidden { display: none; }

/* ── Task Items ── */
.task-list { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.task-item { background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: var(--sp-2) var(--sp-3); display: flex; justify-content: space-between; align-items: center; transition: all var(--duration-fast) var(--ease-default); box-shadow: var(--shadow-xs); }
.task-item:hover { background: var(--bg-3); border-color: var(--border-hover); }
.task-item.status-running { border-left: 3px solid var(--green); }
.task-item.status-queued { border-left: 3px solid var(--text-muted); }
.task-left { flex: 1; min-width: 0; }
.task-desc { font-size: var(--text-base); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.task-right { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; margin-left: var(--sp-3); }
.task-status { font-size: 10px; padding: 2px 8px; border-radius: var(--radius-full); font-weight: var(--weight-medium); text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.task-status.running { background: var(--green-dim); color: var(--green); box-shadow: var(--shadow-glow-green); animation: pulse-glow 2s ease-in-out infinite; }
.task-status.queued { background: var(--bg-4); color: var(--text-secondary); }
.task-status.failed { background: var(--red-dim); color: var(--red); }
.task-status.completed { background: var(--green-dim); color: var(--green); }
@keyframes pulse-glow { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ── Priority Items ── */
.priority-list { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.priority-item { display: flex; align-items: center; gap: var(--sp-2); padding: 8px var(--sp-3); background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-sm); font-size: var(--text-base); transition: all var(--duration-fast) var(--ease-default); box-shadow: var(--shadow-xs); }
.priority-item:hover { background: var(--bg-3); border-color: var(--border-hover); }
.priority-num { font-size: 10px; font-weight: var(--weight-bold); color: var(--text-muted); width: 22px; text-align: center; flex-shrink: 0; background: var(--bg-4); border-radius: var(--radius-xs); padding: 2px 0; }
.priority-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Type Badges ── */
.type-badge { font-size: 9px; padding: 2px 7px; border-radius: var(--radius-xs); font-weight: var(--weight-medium); text-transform: uppercase; letter-spacing: 0.3px; flex-shrink: 0; }
.type-badge.bug { background: var(--red-dim); color: var(--red); }
.type-badge.feature { background: var(--blue-dim); color: var(--blue); }
.type-badge.improvement { background: var(--purple-dim); color: var(--purple); }

/* ── Server Chips ── */
.server-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-4); }
.server-chip { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-3); background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-md); font-size: var(--text-sm); cursor: pointer; transition: all var(--duration-normal) var(--ease-default); text-decoration: none; color: inherit; box-shadow: var(--shadow-xs); }
.server-chip:hover { background: var(--bg-3); border-color: var(--border-hover); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.server-chip-top { display: flex; align-items: center; gap: var(--sp-2); }
.server-chip .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.server-chip .dot.online { background: var(--green); box-shadow: var(--shadow-glow-green); }
.server-chip .dot.offline { background: var(--red); box-shadow: var(--shadow-glow-red); }
.server-chip .dot.working { background: var(--amber); box-shadow: var(--amber-glow); animation: pulse-glow 1.5s infinite; }
.server-chip .name { font-weight: var(--weight-medium); flex: 1; font-size: var(--text-base); }
.server-chip .latency { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.server-chip-status { font-size: 10px; color: var(--text-muted); }

/* ── Brand Cards ── */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.brand-card { background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--sp-4); border-left: 3px solid var(--brand); cursor: pointer; transition: all var(--duration-normal) var(--ease-default); text-decoration: none; color: inherit; box-shadow: var(--shadow-xs); }
.brand-card:hover { background: var(--bg-3); border-color: var(--border-hover); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.brand-name { font-weight: var(--weight-semibold); font-size: var(--text-md); margin-bottom: var(--sp-1); }
.brand-meta { font-size: var(--text-xs); color: var(--text-secondary); }
.progress-bar { height: 3px; background: var(--bg-4); border-radius: var(--radius-full); margin-top: var(--sp-2); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: var(--radius-full); transition: width 0.5s var(--ease-default); }

/* ── Activity Feed ── */
.activity-feed { position: relative; }
.activity-item { display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-2); border-radius: var(--radius-sm); transition: background var(--duration-fast) var(--ease-default); }
.activity-item:hover { background: var(--bg-2); }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.activity-content { flex: 1; min-width: 0; }
.activity-title { font-size: var(--text-sm); }
.activity-time { font-size: 10px; color: var(--text-muted); }
.activity-badge { font-size: 10px; padding: 1px 7px; border-radius: var(--radius-xs); background: var(--brand-dim); color: var(--brand); font-weight: var(--weight-medium); }
.activity-error-badge { background: var(--red-dim); color: var(--red); }

/* ── Filter Pills ── */
.filter-pills { display: flex; gap: var(--sp-1); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.pill { padding: 6px 14px; border-radius: var(--radius-full); font-size: var(--text-xs); min-height: 30px; background: var(--bg-3); color: var(--text-secondary); cursor: pointer; border: 1px solid transparent; transition: all var(--duration-fast) var(--ease-default); font-family: var(--font-sans); font-weight: var(--weight-medium); }
.pill:hover { background: var(--bg-4); color: var(--text-primary); }
.pill.active { background: var(--brand-dim); color: var(--brand); border-color: rgba(0, 114, 222, 0.2); }

/* ── Instance Badge ── */
.instance-badge { font-size: 10px; padding: 2px 7px; border-radius: var(--radius-xs); font-weight: var(--weight-medium); }
.instance-badge.commander { background: rgba(26, 115, 232, 0.10); color: #1a73e8; }
.instance-badge.sentinel { background: rgba(123, 31, 162, 0.10); color: #7b1fa2; }
.instance-badge.praising-ai, .instance-badge.praising { background: rgba(227, 116, 0, 0.10); color: #e37400; }
.instance-badge.medic { background: rgba(0, 150, 199, 0.10); color: #0096c7; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: var(--sp-3); text-align: left; font-size: var(--text-base); border-bottom: 1px solid var(--border-subtle); }
.table th { color: var(--text-muted); font-weight: var(--weight-medium); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.5px; }
.table tr:hover td { background: var(--bg-3); }
.table .mono { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-secondary); }

/* ── Modals ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; visibility: hidden; transition: all var(--duration-normal) var(--ease-default); }
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal { background: var(--bg-2); border: 1px solid var(--border-hover); border-radius: var(--radius-xl); padding: var(--sp-6); width: 90%; max-width: 480px; box-shadow: var(--shadow-xl); animation: modal-enter 0.25s var(--ease-spring); }
@keyframes modal-enter { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal h3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin-bottom: var(--sp-4); color: var(--text-primary); }
.modal label { display: block; font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--sp-1); margin-top: var(--sp-3); font-weight: var(--weight-medium); }
.modal select, .modal textarea, .modal input[type="text"], .modal input[type="password"], .modal input[type="email"], .modal input[type="url"], .modal input[type="number"] { width: 100%; background: var(--bg-0); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); font-size: var(--text-base); padding: 10px var(--sp-3); font-family: var(--font-sans); transition: border-color var(--duration-fast) var(--ease-default), box-shadow var(--duration-fast) var(--ease-default); }
.modal select:focus, .modal textarea:focus, .modal input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dimmer); }
.modal textarea { min-height: 80px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-5); }

/* ── FAB ── */
.fab { position: fixed; bottom: var(--sp-6); right: var(--sp-6); width: 48px; height: 48px; border-radius: 50%; background: #007aff; color: white; border: none; font-size: 22px; cursor: pointer; box-shadow: var(--shadow-lg), 0 0 16px rgba(0, 114, 222, 0.2); z-index: 50; display: flex; align-items: center; justify-content: center; transition: all var(--duration-normal) var(--ease-spring); }
.fab:hover { transform: scale(1.1) translateY(-2px); box-shadow: var(--shadow-xl), 0 0 24px rgba(0, 114, 222, 0.3); }
.fab:active { transform: scale(0.95); }

/* ── Skeleton Loading ── */
.skeleton { background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 50%, var(--bg-3) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: var(--radius-sm); }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.long { width: 85%; }
.skeleton-heading { height: 22px; width: 50%; margin-bottom: 12px; }
.skeleton-card { height: 80px; border-radius: var(--radius-lg); }
.skeleton-avatar { width: 32px; height: 32px; border-radius: 50%; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ── Empty States ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--sp-10) var(--sp-4); color: var(--text-muted); text-align: center; }
.empty-state-icon { font-size: 40px; margin-bottom: var(--sp-3); opacity: 0.3; }
.empty-state-title { font-size: var(--text-md); font-weight: var(--weight-medium); color: var(--text-tertiary); margin-bottom: var(--sp-1); }
.empty-state-desc { font-size: var(--text-sm); color: var(--text-muted); max-width: 280px; }

/* ── Toast Notifications ── */
.toast-container { position: fixed; top: var(--sp-4); right: var(--sp-4); z-index: 200; display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--bg-2); border: 1px solid var(--border-hover); border-radius: var(--radius-md); font-size: var(--text-sm); box-shadow: var(--shadow-lg); min-width: 280px; max-width: 420px; animation: toast-in 0.3s var(--ease-spring); }
.toast.toast-exit { animation: toast-out 0.2s var(--ease-default) forwards; }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; font-size: 14px; }
.toast.toast-success { border-left: 3px solid var(--green); }
.toast.toast-error { border-left: 3px solid var(--red); }
.toast.toast-info { border-left: 3px solid var(--brand); }
.toast.toast-warning { border-left: 3px solid var(--amber); }
.toast-progress { position: absolute; bottom: 0; left: 0; height: 2px; background: var(--brand); border-radius: 0 0 var(--radius-md) var(--radius-md); animation: toast-progress-bar 4s linear forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(100%) scale(0.9); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(100%) scale(0.9); } }
@keyframes toast-progress-bar { from { width: 100%; } to { width: 0%; } }

/* ── Command Palette ── */
.cmd-palette-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(8px); z-index: 300; display: flex; align-items: flex-start; justify-content: center; padding-top: 20vh; opacity: 0; visibility: hidden; transition: all var(--duration-fast) var(--ease-default); }
.cmd-palette-overlay.visible { opacity: 1; visibility: visible; }
.cmd-palette { width: 90%; max-width: 560px; background: var(--bg-2); border: 1px solid var(--border-hover); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); overflow: hidden; animation: modal-enter 0.2s var(--ease-spring); }
.cmd-palette-input { width: 100%; padding: var(--sp-4) var(--sp-5); background: transparent; border: none; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); font-size: var(--text-lg); font-family: var(--font-sans); outline: none; }
.cmd-palette-input::placeholder { color: var(--text-muted); }
.cmd-palette-results { max-height: 320px; overflow-y: auto; padding: var(--sp-2); }
.cmd-palette-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-base); color: var(--text-secondary); }
.cmd-palette-item:hover, .cmd-palette-item.selected { background: var(--brand-dim); color: var(--brand); }
.cmd-palette-item-icon { width: 20px; text-align: center; opacity: 0.6; }
.cmd-palette-item-label { flex: 1; }
.cmd-palette-item-shortcut { font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); }
.cmd-palette-footer { padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--border-subtle); display: flex; gap: var(--sp-4); font-size: var(--text-xs); color: var(--text-muted); }
.cmd-palette-footer kbd { background: var(--bg-4); padding: 1px 5px; border-radius: 3px; font-family: var(--font-mono); font-size: 10px; }

/* ── Entrance Animations ── */
@keyframes fade-in-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.animate-in { animation: fade-in-up 0.4s var(--ease-out) both; }
.animate-in-1 { animation-delay: 0.05s; }
.animate-in-2 { animation-delay: 0.1s; }
.animate-in-3 { animation-delay: 0.15s; }
.animate-in-4 { animation-delay: 0.2s; }
.animate-in-5 { animation-delay: 0.25s; }
.animate-in-6 { animation-delay: 0.3s; }

/* ── Status badges ── */
.status-badge { font-size: 10px; padding: 2px 8px; border-radius: var(--radius-full); font-weight: var(--weight-medium); text-transform: uppercase; letter-spacing: 0.3px; }
.status-badge.healthy, .status-badge.online, .status-badge.active { background: var(--green-dim); color: var(--green); }
.status-badge.degraded, .status-badge.warning { background: var(--amber-dim); color: var(--amber); }
.status-badge.error, .status-badge.offline, .status-badge.failed { background: var(--red-dim); color: var(--red); }

/* ── Breadcrumbs ── */
.breadcrumb { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--sp-2); display: flex; align-items: center; gap: var(--sp-1); }
.breadcrumb a { color: var(--text-tertiary); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb-sep { color: var(--text-ghost); }

/* ── Toggle Switch ── */
.toggle { position: relative; width: 36px; height: 20px; border-radius: var(--radius-full); background: var(--bg-4); cursor: pointer; transition: background var(--duration-fast) var(--ease-default); border: none; padding: 0; }
.toggle.on { background: var(--brand); }
.toggle::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: white; top: 2px; left: 2px; transition: transform var(--duration-fast) var(--ease-spring); box-shadow: var(--shadow-xs); }
.toggle.on::after { transform: translateX(16px); }

/* ── Tabs ── */
.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--sp-5); position: relative; }
.tab-item { padding: var(--sp-3) var(--sp-4); font-size: var(--text-base); color: var(--text-secondary); cursor: pointer; border: none; background: none; font-family: var(--font-sans); font-weight: var(--weight-medium); position: relative; transition: color var(--duration-fast) var(--ease-default); }
.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--brand); }
.tab-item.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--brand); border-radius: 1px 1px 0 0; animation: tab-underline 0.2s var(--ease-default); }
@keyframes tab-underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ── Forms (shared) ── */
.form-input, .form-select, .form-textarea { width: 100%; background: var(--bg-0); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); font-size: var(--text-base); padding: 10px var(--sp-3); font-family: var(--font-sans); transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dimmer); }
.form-label { display: block; font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--sp-1); font-weight: var(--weight-medium); }

/* ── Mobile ── */
/* ══════════════════════════════════════════
   MOBILE — iOS-style Tab Bar + Sheet Nav
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Hide desktop sidebar */
  .sidebar { display: none; }

  /* Main content — full width */
  .main {
    margin-left: 0;
    padding: 38px 14px 62px 14px;
    max-width: 100%;
  }

  html, body { overflow-x: hidden; max-width: 100vw; }

  /* ── iOS Tab Bar — 5 fixed items ── */
  .mobile-tab-bar {
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(50px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    background: rgba(249,249,249,0.94);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.33px solid rgba(0,0,0,0.15);
    z-index: 200;
    -webkit-tap-highlight-color: transparent;
  }
  [data-theme=dark] .mobile-tab-bar {
    background: rgba(30,30,30,0.94);
    border-top-color: rgba(255,255,255,0.08);
  }

  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    flex: 1;
    padding: 4px 0 2px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  .tab-item svg {
    width: 22px;
    height: 22px;
    stroke: #999;
    fill: none;
    stroke-width: 1.5;
  }
  .tab-item .tab-label {
    font-size: 10px;
    color: #999;
    font-weight: 500;
    letter-spacing: -0.1px;
    line-height: 1;
  }
  .tab-item.active svg { stroke: var(--brand); }
  .tab-item.active .tab-label { color: var(--brand); }
  [data-theme=dark] .tab-item svg { stroke: #7c7c7c; }
  [data-theme=dark] .tab-item .tab-label { color: #7c7c7c; }
  [data-theme=dark] .tab-item.active svg { stroke: #0a84ff; }
  [data-theme=dark] .tab-item.active .tab-label { color: #0a84ff; }

  /* Badge on tab */
  .tab-badge {
    position: absolute;
    top: 2px;
    right: 50%;
    margin-right: -16px;
    min-width: 16px;
    height: 16px;
    background: #ff3b30;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
  }

  /* ── Workspace Switcher (iOS action sheet) ── */
  .mobile-ws-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    z-index: 400;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-ws-modal .ws-modal-card {
    background: var(--bg-2);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 8px;
  }
  .mobile-ws-modal .ws-modal-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    padding: 14px 16px 6px;
    text-align: center;
  }
  .mobile-ws-modal .ws-modal-item {
    -webkit-user-select: none; user-select: none;
    display: flex;
    align-items: center;
    padding: 13px 16px;
    cursor: pointer;
    border-top: 0.33px solid rgba(60,60,67,0.1);
  }
  .mobile-ws-modal .ws-modal-item:first-child { border-top: none; }
  .mobile-ws-modal .ws-modal-item:active { background: var(--bg-3); }
  .mobile-ws-modal .ws-modal-item .ws-item-dot {
    width: 10px; height: 10px; border-radius: 50%; margin-right: 12px; flex-shrink: 0;
  }
  .mobile-ws-modal .ws-modal-item .ws-item-info { flex: 1; }
  .mobile-ws-modal .ws-modal-item .ws-item-name {
    font-size: 17px; font-weight: 400; color: var(--text-primary);
  }
  .mobile-ws-modal .ws-modal-item .ws-item-desc {
    font-size: 12px; color: var(--text-muted); margin-top: 1px;
  }
  .mobile-ws-modal .ws-modal-cancel {
    background: var(--bg-2);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: var(--brand);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-ws-modal .ws-modal-cancel:active { background: var(--bg-3); }

  /* ── More nav card (inside backdrop overlay) ── */
  /* ── Workspace pill — sticky top bar on mobile ── */
  .mobile-ws-pill {
    -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 8px;
    background: rgba(249,249,249,0.88);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border: 0.33px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  }
  .mobile-ws-pill span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
  }
  .mobile-ws-pill svg {
    opacity: 0.4;
  }
  [data-theme=dark] .mobile-ws-pill {
    background: rgba(44,44,46,0.88);
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  }

  /* ── More menu: backdrop + card ── */
  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 300;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav-card {
    background: var(--bg-0);
    border-radius: 16px 16px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 calc(60px + env(safe-area-inset-bottom, 0px));
  }
  [data-theme=dark] .mobile-nav-backdrop {
    background: rgba(0,0,0,0.6);
  }
  .mobile-nav-card .mnp-section {
    padding: 0 14px;
  }
  .mobile-nav-card .mnp-section-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted);
    padding: 14px 2px 5px;
  }
  .mobile-nav-card .mnp-group {
    background: var(--bg-2);
    border-radius: 10px;
    overflow: hidden;
  }
  .mobile-nav-card .mnp-item {
    -webkit-user-select: none; user-select: none;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    color: var(--text-primary); text-decoration: none;
    font-size: 15px;
    border-bottom: 0.33px solid rgba(60,60,67,0.08);
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav-card .mnp-item:last-child { border-bottom: none; }
  .mobile-nav-card .mnp-item:active { background: rgba(0,0,0,0.04); }
  [data-theme=dark] .mobile-nav-card .mnp-item:active { background: rgba(255,255,255,0.06); }
  .mobile-nav-card .mnp-item.active { color: var(--brand); font-weight: 500; }
  .mobile-nav-card .mnp-item svg {
    width: 18px; height: 18px; flex-shrink: 0; opacity: 0.4;
  }
  .mobile-nav-card .mnp-item.active svg { opacity: 0.9; stroke: var(--brand); }
  .mobile-nav-card .mnp-item .mnp-chevron {
    margin-left: auto; color: rgba(60,60,67,0.15); font-size: 16px; font-weight: 300;
  }
  [data-theme=dark] .mobile-nav-card .mnp-item .mnp-chevron { color: rgba(235,235,245,0.15); }

  /* ── Responsive Grids ── */
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card-grid .card { padding: 12px; }
  .card-value { font-size: 22px; }
  .brand-grid { grid-template-columns: 1fr; }
  .server-row { grid-template-columns: repeat(2, 1fr); }

  /* ── Pillar Tabs (horizontal scroll) ── */
  .brand-tabs, .pillar-tabs {
    display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 0; margin: 0 -14px 12px; padding: 0 14px;
    scrollbar-width: none; border-bottom: 0.33px solid rgba(60,60,67,0.15);
  }
  .brand-tabs::-webkit-scrollbar, .pillar-tabs::-webkit-scrollbar { display: none; }
  .brand-tabs .tab, .pillar-tabs .tab,
  .brand-tabs a, .pillar-tabs a,
  .brand-tabs button, .pillar-tabs button {
    white-space: nowrap; flex-shrink: 0; font-size: 13px; padding: 8px 12px;
  }

  .section-row { margin-top: 16px; }
  .page-title { font-size: 20px; margin-bottom: 10px; }
  .main > a[href="/"] { display: none; }
  .fab { bottom: 62px; right: 14px; width: 42px; height: 42px; font-size: 18px; }
  .attention-banner { font-size: 12px; padding: 8px 10px; }
  .table th, .table td { padding: 6px 8px; font-size: 12px; }
  .modal { width: 95%; padding: 16px; }
  .toast-container { left: 12px; right: 12px; top: 8px; }
  .toast { min-width: auto; }
  .overview-bottom-grid { grid-template-columns: 1fr; }
  .priority-item { font-size: 12px; }
  .mobile-ws-bar { display: none; }
  .mobile-header { display: none; }
}
/* ── Workspace Switcher (Phase 5b) ── */
.workspace-switcher {
  position: relative;
  margin-bottom: 8px;
}
.workspace-switcher .sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.workspace-switcher .sidebar-logo:hover {
  background: rgba(0,0,0,0.04);
}
.ws-dropdown {
  position: absolute;
  top: 100%;
  left: 8px;
  right: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 6px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
}
.ws-dropdown-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.ws-dropdown-item:hover {
  background: rgba(0,0,0,0.04);
}
.ws-dropdown-item.active {
  background: rgba(0,0,0,0.03);
}

/* ── Pillar descriptions ── */
.pillar-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-2);
  border-radius: 8px;
  border-left: 3px solid rgba(0,114,222,0.4);
  box-shadow: var(--shadow-xs);
}
.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.list-row:last-child { border-bottom: none; }
.list-row .dim { color: var(--text-secondary); font-size: 12px; }

/* ── Pillar Nav (Aceternity-style grouped sidebar) ── */
.pillar-section {
  margin: 0;
}
.pillar-section:first-of-type {
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
  padding-top: 4px;
}
.pillar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
  opacity: 0.6;
  padding: 8px 16px;
  transition: all 0.15s;
  color: var(--text-primary);
}
.pillar-header:hover {
  opacity: 1;
}
.pillar-header.expanded {
  opacity: 0.9;
}
.pillar-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
  opacity: 0.35;
  width: 10px;
  height: 10px;
  margin-left: auto;
}
.pillar-header.expanded .pillar-chevron {
  transform: rotate(180deg);
  opacity: 0.5;
}
.pillar-children {
  padding: 0 0 4px 0;
  overflow: hidden;
}
.pillar-children .nav-item {
  font-size: 12.5px;
  padding: 6px 16px 6px 40px;
  opacity: 0.4;
  font-weight: 400;
  position: relative;
}
.pillar-children .nav-item svg {
  display: inline;
  width: 14px;
  height: 14px;
  opacity: 0.5;
  flex-shrink: 0;
}
.pillar-children .nav-item::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(0,0,0,0.06);
}
.pillar-children .nav-item:last-child::before {
  bottom: 50%;
}
.pillar-children .nav-item:hover {
  opacity: 0.8;
}
.pillar-children .nav-item.active {
  opacity: 1;
  font-weight: 500;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════
   DARK MODE — Apple Dark
   ══════════════════════════════════════════ */
[data-theme=dark] {
  --bg-0: #000000; --bg-1: #1c1c1e; --bg-2: #2c2c2e;
  --bg-3: #3a3a3c; --bg-4: #48484a; --bg-5: #636366;

  --brand: #0a84ff; --brand-hover: #409cff;
  --brand-dim: rgba(10,132,255,0.15); --brand-dimmer: rgba(10,132,255,0.08);
  --brand-glow: rgba(10,132,255,0.2);

  --accent: #64d2ff; --accent-dim: rgba(100,210,255,0.12);

  --green: #30d158; --green-dim: rgba(48,209,88,0.15); --green-glow: rgba(48,209,88,0.2);
  --red: #ff453a; --red-dim: rgba(255,69,58,0.15); --red-glow: rgba(255,69,58,0.2);
  --amber: #ff9f0a; --amber-dim: rgba(255,159,10,0.15); --amber-glow: rgba(255,159,10,0.2);
  --purple: #bf5af2; --purple-dim: rgba(191,90,242,0.15);
  --blue: #0a84ff; --blue-dim: rgba(10,132,255,0.15);

  --text-primary: #ffffff; --text-secondary: rgba(235,235,245,0.6);
  --text-tertiary: rgba(235,235,245,0.3); --text-muted: #8e8e93; --text-ghost: #48484a;

  --border-subtle: rgba(255,255,255,0.04); --border-default: rgba(84,84,88,0.65);
  --border-hover: rgba(255,255,255,0.15); --border-focus: rgba(10,132,255,0.6);

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.7);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-glow-brand: 0 0 12px rgba(10,132,255,0.2);

  color-scheme: dark;
}
[data-theme=dark] body { background: var(--bg-0); color: var(--text-primary); }
[data-theme=dark] input, [data-theme=dark] select, [data-theme=dark] textarea {
  background: var(--bg-1); color: var(--text-primary); border-color: var(--border-default);
}
[data-theme=dark] input::placeholder, [data-theme=dark] textarea::placeholder { color: var(--text-ghost); }
[data-theme=dark] ::-webkit-scrollbar-thumb { background: var(--bg-4); }
[data-theme=dark] ::-webkit-scrollbar-track { background: var(--bg-1); }
[data-theme=dark] .page-title {
  background: linear-gradient(135deg, var(--text-primary), var(--brand));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
[data-theme=dark] .logo-icon { background: var(--brand); }
[data-theme=dark] .login-box { background: rgba(44,44,46,0.95); border-color: var(--border-hover); }
[data-theme=dark] .pillar-children .nav-item::before { background: rgba(255,255,255,0.06); }

.theme-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; cursor: pointer; font-size: 12px;
  color: var(--text-muted); border-radius: var(--radius-sm); transition: background 0.15s;
}
.theme-toggle:hover { background: rgba(0,0,0,0.04); }
[data-theme=dark] .theme-toggle:hover { background: rgba(255,255,255,0.06); }
.theme-toggle-icon { font-size: 16px; line-height: 1; }

/* ══════════════════════════════════════════════════════════════
   ENHANCEMENTS (formerly design-enhancements.css)
   ══════════════════════════════════════════════════════════════ */

/* ── Enhanced Typography ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&display=swap');

:root {
  /* Upgraded borders — current 0.04 is too faint */
  --border-subtle: rgba(0, 0, 0, 0.04);
  --border-default: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.12);

  /* Enhanced shadows with brand tint */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 8px 25px rgba(0, 0, 0, 0.08), 0 3px 8px rgba(0, 0, 0, 0.04);
  --shadow-glow-subtle: 0 0 0 1px rgba(0, 114, 222, 0.06);

  /* Card accent top gradients */
  --accent-green-top: linear-gradient(90deg, rgba(13, 144, 79, 0.3), rgba(13, 144, 79, 0.05), transparent);
  --accent-amber-top: linear-gradient(90deg, rgba(227, 116, 0, 0.3), rgba(227, 116, 0, 0.05), transparent);
  --accent-red-top: linear-gradient(90deg, rgba(217, 48, 37, 0.3), rgba(217, 48, 37, 0.05), transparent);
  --accent-brand-top: linear-gradient(90deg, rgba(0, 114, 222, 0.5), rgba(0, 114, 222, 0.1), transparent);
  --accent-blue-top: linear-gradient(90deg, rgba(26, 115, 232, 0.3), rgba(26, 115, 232, 0.05), transparent);
}

/* ── Page Title Enhancement ── */
.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Stat Cards — Premium Feel ── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-4);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-default);
  box-shadow: var(--shadow-card);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-brand-top);
  opacity: 0.8;
}
.card[data-accent="green"]::before { background: var(--accent-green-top); }
.card[data-accent="amber"]::before { background: var(--accent-amber-top); }
.card[data-accent="red"]::before { background: var(--accent-red-top); }
.card[data-accent="blue"]::before { background: var(--accent-blue-top); }

.card-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.card-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: var(--weight-medium);
}
.card-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--sp-2);
}

/* ── Server Chips — Command Center Feel ── */
.server-chip {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  background: var(--bg-2);
  box-shadow: var(--shadow-card);
  transition: all var(--duration-normal) var(--ease-default);
}
.server-chip:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}
.server-chip .name {
  font-size: 15px;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.2px;
}
.server-chip .latency {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-3);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}
.server-chip .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.server-chip .dot.online {
  background: var(--green);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.4), 0 0 2px rgba(52, 211, 153, 0.8);
}
.server-chip .dot.working {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.4), 0 0 2px rgba(251, 191, 36, 0.8);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
.server-chip .dot.offline {
  background: var(--red);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.4);
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ── Task Items — Better Visual Hierarchy ── */
.task-item {
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
  margin-bottom: 2px;
}
.task-item.status-running {
  border-left: 3px solid var(--green);
  background: linear-gradient(90deg, rgba(52, 211, 153, 0.04), var(--bg-2));
}
.task-item.status-queued {
  border-left: 3px solid var(--bg-5);
}
.task-desc {
  font-size: 14px;
  font-weight: var(--weight-medium);
}
.task-status.running {
  animation: pulse-glow 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.3);
}
.task-cancel-btn {
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--red);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  transition: all var(--duration-fast) var(--ease-default);
  opacity: 0;
}
.task-item:hover .task-cancel-btn {
  opacity: 1;
}
.task-cancel-btn:hover {
  background: var(--red-dim);
  border-color: rgba(248, 113, 113, 0.4);
}

/* ── Brand Cards — Premium ── */
.brand-card {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  border-left: 4px solid var(--brand);
  box-shadow: var(--shadow-card);
  transition: all var(--duration-normal) var(--ease-default);
}
.brand-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
  border-color: var(--border-hover);
  border-left-color: var(--brand);
}
.brand-name {
  font-size: 16px;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.3px;
}
.progress-bar {
  height: 4px;
  margin-top: var(--sp-3);
  background: var(--bg-4);
  border-radius: var(--radius-full);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #a78bfa, var(--accent));
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px rgba(0, 114, 222, 0.3);
}

/* ── Attention Banner — More Urgency ── */
.attention-banner {
  background: linear-gradient(135deg, rgba(227, 116, 0, 0.05), rgba(251, 191, 36, 0.04));
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: 13px;
  font-weight: var(--weight-medium);
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.08);
}

/* ── Activity Feed — Timeline Feel ── */
.activity-feed {
  position: relative;
  padding-left: 4px;
}
.activity-feed::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 16px;
  bottom: 16px;
  width: 1px;
  background: linear-gradient(to bottom, var(--border-default), transparent);
}
.activity-item {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  margin-bottom: 1px;
}
.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  z-index: 1;
  border: 2px solid var(--bg-0);
  box-sizing: content-box;
}

/* ── Sidebar — Refined ── */
.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border-subtle);
  box-shadow: 1px 0 12px rgba(0, 0, 0, 0.3);
}
.nav-item {
  border-radius: var(--radius-md);
  margin-bottom: 1px;
  transition: all var(--duration-fast) var(--ease-default);
}
.nav-item.active {
  background: var(--brand-dim);
  color: var(--brand);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-glow-subtle);
}
.nav-item.active svg {
  filter: drop-shadow(0 0 3px rgba(129, 140, 248, 0.4));
}
.logo-icon {
  box-shadow: 0 2px 8px rgba(0, 114, 222, 0.35), 0 0 0 1px rgba(0, 114, 222, 0.1);
}
.logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ── Section Headers — Bolder ── */
.section-label {
  font-size: 12px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
}

/* ── Priority List — Enhanced ── */
.priority-item {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-fast) var(--ease-default);
}
.priority-item:hover {
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}
.priority-num {
  font-size: 10px;
  font-weight: var(--weight-bold);
  min-width: 28px;
  text-align: center;
  padding: 3px 0;
  border-radius: var(--radius-sm);
}

/* ── Type Badges — Pill Style ── */
.type-badge {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.3px;
}

/* ── Instance Badges — More Distinct ── */
.instance-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: var(--weight-medium);
}

/* ── Kanban Board Enhancements ── */
.kanban-col-header {
  font-size: 11px;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: var(--sp-2);
}
/* Column header color bars */
[data-status="open"] .kanban-col-header,
.kanban-header-open { border-top: 3px solid var(--text-muted); }
[data-status="building"] .kanban-col-header,
.kanban-header-building { border-top: 3px solid var(--amber); }
[data-status="review"] .kanban-col-header,
.kanban-header-review { border-top: 3px solid var(--blue); }
[data-status="qa"] .kanban-col-header,
.kanban-header-qa { border-top: 3px solid var(--accent); }
[data-status="needs-spec"] .kanban-col-header,
.kanban-header-needs-spec { border-top: 3px solid var(--purple); }
[data-status="blocked"] .kanban-col-header,
.kanban-header-blocked { border-top: 3px solid var(--red); }
[data-status="done"] .kanban-col-header,
.kanban-header-done { border-top: 3px solid var(--green); }

/* ── Tables — Refined ── */
.table th {
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
  padding: var(--sp-3) var(--sp-4);
}
.table td {
  padding: var(--sp-3) var(--sp-4);
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
}
.table tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

/* ── Modal Enhancements ── */
.modal {
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xl), 0 0 60px rgba(0, 0, 0, 0.5);
}
.modal h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ── Form Inputs — Refined ── */
.form-input, .form-select, .form-textarea,
.modal select, .modal textarea, .modal input[type="text"],
.modal input[type="password"], .modal input[type="email"] {
  background: var(--bg-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  transition: all var(--duration-fast) var(--ease-default);
}
.form-input:focus, .form-select:focus, .form-textarea:focus,
.modal select:focus, .modal textarea:focus, .modal input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 114, 222, 0.12), 0 0 12px rgba(0, 114, 222, 0.08);
}

/* ── Filter Pills — More Contrast ── */
.pill {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: var(--weight-medium);
  border: 1px solid var(--border-subtle);
}
.pill.active {
  background: var(--brand-dim);
  color: var(--brand);
  border-color: rgba(0, 114, 222, 0.3);
  box-shadow: 0 0 12px rgba(0, 114, 222, 0.1);
}

/* ── Status Badges — Glow Effect ── */
.status-badge.healthy, .status-badge.online, .status-badge.active {
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.15);
}
.status-badge.degraded, .status-badge.warning {
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.15);
}
.status-badge.error, .status-badge.offline, .status-badge.failed {
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.15);
}

/* ── Sparkline Container ── */
.sparkline-container {
  height: 32px;
  margin-top: var(--sp-2);
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.sparkline-bar {
  flex: 1;
  background: var(--brand-dim);
  border-radius: 2px 2px 0 0;
  min-height: 3px;
  transition: height 0.3s var(--ease-default);
}
.sparkline-bar:last-child {
  background: var(--brand);
}

/* ── Empty State Enhancements ── */
.empty-state {
  padding: var(--sp-8) var(--sp-4);
}
.empty-state-icon {
  font-size: 48px;
  opacity: 0.15;
  margin-bottom: var(--sp-4);
}

/* ── Smooth Page Transitions ── */
.main {
  animation: page-fade-in 0.3s var(--ease-out);
}
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar refinement ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ── Focus rings for accessibility ── */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Micro-interactions ── */
.btn {
  transition: all var(--duration-fast) var(--ease-default);
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0) scale(0.97);
}
.btn-primary {
  background: linear-gradient(135deg, #0061bd, #1a8aff);
  box-shadow: 0 2px 8px rgba(0, 114, 222, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f52d8, #7880f5);
  box-shadow: 0 4px 16px rgba(0, 114, 222, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ── Tab Bar Enhancement ── */
.tab-item {
  font-size: 14px;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-item:hover {
  background: rgba(0, 0, 0, 0.02);
}
.tab-item.active::after {
  height: 2px;
  background: linear-gradient(90deg, var(--brand), #a78bfa);
}

/* ── Toast Refinement ── */
.toast {
  background: var(--bg-3);
  border: 1px solid var(--border-default);
  backdrop-filter: blur(12px);
}

/* ── Responsive tweaks ── */
@media (max-width: 768px) {
  .page-title {
    font-size: 22px;
  }
  .card-value {
    font-size: 28px;
  }
  .server-chip {
    padding: var(--sp-3);
  }
  .server-chip .name {
    font-size: 13px;
  }
}

/* ── Kanban Board — Enterprise Polish ── */
.kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: 400px;
  scroll-snap-type: x mandatory;
}
.kanban-col {
  flex: 0 0 220px;
  min-width: 220px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
}
.kanban-col-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border-top: 3px solid var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-col-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 10px;
  background: var(--bg-4);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}
/* Column header colors by status */
.kanban-col:nth-child(1) .kanban-col-header { border-top-color: #71717a; } /* OPEN */
.kanban-col:nth-child(2) .kanban-col-header { border-top-color: #fbbf24; color: #fbbf24; } /* BUILDING */
.kanban-col:nth-child(3) .kanban-col-header { border-top-color: #60a5fa; color: #60a5fa; } /* REVIEW */
.kanban-col:nth-child(4) .kanban-col-header { border-top-color: #22d3ee; color: #22d3ee; } /* QA */
.kanban-col:nth-child(5) .kanban-col-header { border-top-color: #c084fc; color: #c084fc; } /* NEEDS SPEC */
.kanban-col:nth-child(6) .kanban-col-header { border-top-color: #f87171; color: #f87171; } /* BLOCKED */
.kanban-col:nth-child(7) .kanban-col-header { border-top-color: #34d399; color: #34d399; } /* DONE */

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.kanban-card {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  box-shadow: var(--shadow-xs);
}
.kanban-card:hover {
  background: var(--bg-3);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.kanban-card-title {
  font-size: 13px;
  font-weight: var(--weight-medium);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kanban-card-meta {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Priority badges */
.p-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}
.p-badge.p1 { background: rgba(239,68,68,0.15); color: #ef4444; }
.p-badge.p2 { background: rgba(245,158,11,0.15); color: #f59e0b; }
.p-badge.p3 { background: rgba(234,179,8,0.1); color: #eab308; }
.p-badge.p4 { background: rgba(82,82,91,0.3); color: #a1a1aa; }

/* ── Activity Log — Timeline Enhancement ── */
.activity-table {
  width: 100%;
  border-collapse: collapse;
}
.activity-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: var(--weight-semibold);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-default);
  text-align: left;
}
.activity-table td {
  padding: var(--sp-2) var(--sp-4);
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.activity-table tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}
.activity-table .action-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.action-badge[data-action="backlog started"] { background: var(--blue-dim); color: var(--blue); }
.action-badge[data-action="task started"] { background: var(--amber-dim); color: var(--amber); }
.action-badge[data-action="task completed"] { background: var(--green-dim); color: var(--green); }
.action-badge[data-action="task failed"], .action-badge[data-action="enrichment failed"] { background: var(--red-dim); color: var(--red); }
.action-badge[data-action="enriching item"], .action-badge[data-action="item enriched"] { background: var(--purple-dim); color: var(--purple); }

/* ── Braindump — Enhanced ── */
.braindump-item {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: 6px;
  background: var(--bg-2);
  transition: all var(--duration-fast) var(--ease-default);
}
.braindump-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-3);
}

/* ── Config Page — Card Sections ── */
.config-section {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.config-section h3 {
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}

/* ── Costs Page — Chart Area ── */
.cost-chart {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  min-height: 120px;
}

/* ── Recurring Tasks — Card Style ── */
.recurring-item {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: 6px;
  transition: all var(--duration-fast) var(--ease-default);
}
.recurring-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

/* ── Instance Detail — Resource Gauges ── */
.resource-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
}
.gauge-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: conic-gradient(var(--brand) var(--gauge-pct, 0%), var(--bg-4) var(--gauge-pct, 0%));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.gauge-ring::after {
  content: '';
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-2);
  position: absolute;
}
.gauge-value {
  z-index: 1;
  font-size: 14px;
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}

/* ── Login Page — Premium ── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(0, 114, 222, 0.08) 0%, transparent 60%);
}
.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--sp-8) var(--sp-6);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
}

/* ── Global hover effect for clickable rows ── */
[data-expand]:hover, [data-toggle]:hover {
  cursor: pointer;
}

/* ── Print styles ── */
@media print {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .fab, .cmd-palette-overlay, .toast-container { display: none; }
}

/* ── Override inline kanban styles with higher specificity ── */
.kanban .kanban-card {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-xs);
}
.kanban .kanban-card:hover {
  background: var(--bg-3);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.kanban .kanban-col-header {
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.kanban .kanban-card-title {
  font-size: 13px;
  font-weight: var(--weight-medium);
  line-height: 1.4;
}

/* ── Brand Page — Match actual JS class names ── */
.tab-btn {
  padding: var(--sp-3) var(--sp-5);
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-weight: 500;
  position: relative;
  border-radius: var(--radius-md);
  transition: color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.02);
}
.tab-btn.tab-active {
  background: var(--brand-dim);
  color: var(--brand);
}
.tab-btn.tab-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), #a78bfa);
  border-radius: 1px 1px 0 0;
  animation: tab-underline 0.2s ease;
}
@keyframes tab-underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: all 0.2s;
}
.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Brand page alert banner */
.alert-banner {
  background: linear-gradient(135deg, rgba(248,113,113,0.08), rgba(248,113,113,0.03));
  border: 1px solid rgba(248,113,113,0.15);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.alert-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
}

/* Brand attention items */
.attention-item {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  transition: all 0.15s;
}
.attention-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-3);
}

/* Brand quick action buttons */
.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

/* Brand tab panes */
.tab-pane {
  display: none;
}
.tab-pane.pane-active {
  display: block;
  animation: fade-in-up 0.3s ease both;
}

/* Brand info cards */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
.section {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}
.section .section-title {
  margin-top: 0;
}

/* Status colors */
.c-yellow { color: var(--amber); }
.c-green { color: var(--green); }
.c-red { color: var(--red); }
.c-blue { color: var(--blue); }

/* Brand header */
.brand-header .brand-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
}
.brand-header .brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.brand-link {
  font-size: 12px;
  padding: 4px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: all 0.15s;
  font-weight: 500;
}
.brand-link:hover {
  background: var(--bg-4);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .tab-btn { padding: var(--sp-2) var(--sp-3); font-size: 12px; }
}

/* ============================================================
   Page-Specific Missing Styles Fix
   Addresses class mismatches between JS-generated HTML and CSS
   ============================================================ */

/* ── Shared: Page Layout Components ── */
.page-sub { font-size: var(--text-md); color: var(--text-secondary); margin-top: calc(-1 * var(--sp-3)); margin-bottom: var(--sp-5); }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-5); flex-wrap: wrap; gap: var(--sp-3); }
.header-actions { display: flex; gap: var(--sp-2); align-items: center; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-4); flex-wrap: wrap; gap: var(--sp-3); }
.top-bar-left { display: flex; align-items: center; gap: var(--sp-4); }
.top-bar-right { display: flex; align-items: center; gap: var(--sp-2); }

/* ── Shared: Button Variants ── */
.add-btn, .btn-add, #btn-dump-add {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 8px 16px; border-radius: var(--radius-sm); font-size: var(--text-sm);
  font-weight: var(--weight-medium); border: none; cursor: pointer;
  background: #007aff; color: white;
  font-family: var(--font-sans); transition: all var(--duration-fast) var(--ease-default);
  box-shadow: var(--shadow-xs), 0 0 12px rgba(0,114,222,0.2); min-height: 34px;
}
.add-btn:hover, .btn-add:hover, #btn-dump-add:hover {
  box-shadow: var(--shadow-sm), 0 0 20px rgba(0,114,222,0.3); transform: translateY(-1px);
}
.btn-cancel { padding: 8px 16px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--weight-medium); border: 1px solid var(--border-default); cursor: pointer; background: var(--bg-3); color: var(--text-secondary); font-family: var(--font-sans); transition: all var(--duration-fast); }
.btn-cancel:hover { background: var(--bg-4); color: var(--text-primary); border-color: var(--border-hover); }
.btn-submit { padding: 8px 16px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--weight-medium); border: none; cursor: pointer; background: #007aff; color: white; font-family: var(--font-sans); box-shadow: var(--shadow-xs); transition: all var(--duration-fast); }
.btn-submit:hover { box-shadow: var(--shadow-sm), 0 0 16px rgba(0,114,222,0.25); }
.btn-sm { padding: 5px 12px; border-radius: var(--radius-sm); font-size: 11px; font-weight: var(--weight-medium); border: 1px solid var(--border-subtle); cursor: pointer; background: var(--bg-3); color: var(--text-secondary); font-family: var(--font-sans); transition: all var(--duration-fast); }
.btn-sm:hover { background: var(--bg-4); color: var(--text-primary); border-color: var(--border-hover); }
.btn-sm.btn-run { border-color: rgba(52,211,153,0.2); }
.btn-sm.btn-run:hover { background: var(--green-dim); color: var(--green); border-color: rgba(52,211,153,0.4); }

/* ── Shared: Form Elements ── */
.brand-filter, select.brand-filter {
  background: var(--bg-1); border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: var(--text-sm); color: var(--text-primary); font-family: var(--font-sans);
  cursor: pointer; transition: border-color var(--duration-fast);
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
.brand-filter:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dimmer); }

/* ── View Toggle ── */
.view-toggle { display: flex; background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-sm); overflow: hidden; }
.view-btn { display: flex; align-items: center; gap: 6px; padding: 6px 14px; font-size: var(--text-sm); font-weight: var(--weight-medium); border: none; cursor: pointer; background: transparent; color: var(--text-secondary); font-family: var(--font-sans); transition: all var(--duration-fast); }
.view-btn:hover { color: var(--text-primary); background: var(--bg-3); }
.view-btn.active { background: var(--brand-dim); color: var(--brand); }

/* ── Modal Row Layout ── */
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

/* ══════════════════════════════════════════
   TODOS PAGE
   ══════════════════════════════════════════ */

/* ── Morning Briefing ── */
.briefing-banner { background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-5); box-shadow: var(--shadow-card); }
.briefing-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-3); }
.briefing-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text-primary); }
.briefing-date { font-size: var(--text-sm); color: var(--text-muted); font-weight: var(--weight-normal); margin-left: var(--sp-2); }
.briefing-refresh { background: transparent; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 6px; cursor: pointer; color: var(--text-muted); transition: all var(--duration-fast); display: flex; align-items: center; }
.briefing-refresh:hover { background: var(--bg-3); color: var(--text-primary); border-color: var(--border-hover); }
.briefing-context { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.6; margin-bottom: var(--sp-2); padding: var(--sp-2) var(--sp-3); background: var(--bg-3); border-radius: var(--radius-sm); }
.briefing-priorities { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.6; margin-bottom: var(--sp-2); }
.briefing-priorities ol { padding-left: var(--sp-5); margin-top: var(--sp-1); }
.briefing-priorities li { margin-bottom: 4px; }
.briefing-summary { font-size: var(--text-sm); color: var(--text-tertiary); line-height: 1.6; }
.briefing-loading { color: var(--text-muted); font-size: var(--text-sm); padding: var(--sp-4); text-align: center; }
.briefing-error { color: var(--red); font-size: var(--text-sm); padding: var(--sp-3); background: var(--red-dim); border-radius: var(--radius-sm); display: flex; align-items: center; gap: var(--sp-2); }
.briefing-retry { background: var(--bg-4); border: 1px solid var(--border-default); border-radius: var(--radius-sm); padding: 4px 10px; cursor: pointer; color: var(--text-secondary); font-size: 11px; margin-left: auto; }

/* ── Add Todo Bar ── */
.add-bar { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); flex-wrap: wrap; align-items: center; }
.add-bar input, .add-bar select {
  background: var(--bg-1); border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 9px 14px; font-size: var(--text-base); color: var(--text-primary); font-family: var(--font-sans);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.add-bar input:focus, .add-bar select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dimmer); }
.add-bar input::placeholder { color: var(--text-muted); }
.add-bar input[type="text"] { flex: 1; min-width: 200px; }
.add-bar select { -webkit-appearance: none; appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.add-bar input[type="date"] { cursor: pointer; }
.add-bar input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }

/* ── Todo Board View ── */
.board-view { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.board-column { background: var(--bg-1); border: 1px solid var(--border-default); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 300px; }
.board-column-header { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--border-subtle); }
.col-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.col-dot.todo { background: #6b7280; }
.col-dot.in-progress { background: #3b82f6; box-shadow: 0 0 8px rgba(59,130,246,0.3); }
.col-dot.review { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,0.3); }
.col-dot.done { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.3); }
.col-name { font-size: var(--text-sm); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); }
.col-count { font-size: 10px; padding: 1px 7px; border-radius: var(--radius-full); background: var(--bg-4); color: var(--text-muted); font-weight: var(--weight-medium); margin-left: auto; }
.board-column-body { padding: var(--sp-2); flex: 1; overflow-y: auto; }
.empty-col { color: var(--text-muted); font-size: var(--text-sm); text-align: center; padding: var(--sp-6) var(--sp-3); }

/* ── Todo Ticket Cards ── */
.ticket { background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: var(--sp-2) var(--sp-3); margin-bottom: 6px; cursor: grab; transition: all var(--duration-fast); position: relative; }
.ticket:hover { border-color: var(--border-hover); background: var(--bg-3); box-shadow: var(--shadow-sm); }
.ticket.done { opacity: 0.5; }
.ticket.done .ticket-title { text-decoration: line-through; color: var(--text-muted); }
.ticket-top { display: flex; align-items: flex-start; gap: var(--sp-2); }
.ticket-check { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; margin-top: 2px; flex-shrink: 0; }
.ticket-title { font-size: var(--text-base); font-weight: var(--weight-medium); flex: 1; min-width: 0; word-break: break-word; line-height: 1.4; }
.ticket-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--duration-fast); flex-shrink: 0; }
.ticket:hover .ticket-actions { opacity: 1; }
.ticket-action-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 2px 4px; border-radius: var(--radius-xs); font-size: 14px; transition: all var(--duration-fast); display: flex; align-items: center; }
.ticket-action-btn:hover { color: var(--text-primary); background: var(--bg-4); }
.ticket-bottom { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.ticket-priority { font-size: 9px; padding: 2px 6px; border-radius: var(--radius-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.3px; }
.ticket-priority.high { background: var(--red-dim); color: var(--red); }
.ticket-priority.med { background: var(--amber-dim); color: var(--amber); }
.ticket-priority.low { background: var(--bg-4); color: var(--text-muted); }
.ticket-due { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; color: var(--text-muted); }
.ticket-due svg { width: 11px; height: 11px; }
.ticket-due.overdue { color: var(--red); }
.ticket-due.soon { color: var(--amber); }
.ticket-cat { font-size: 10px; padding: 1px 6px; border-radius: var(--radius-xs); background: var(--brand-dimmer); color: var(--brand); font-weight: var(--weight-medium); }
.ticket-id { font-size: 10px; color: var(--text-ghost); font-family: var(--font-mono); margin-left: auto; }

/* ── Todo List View ── */
.list-view { display: flex; flex-direction: column; gap: var(--sp-4); }
.list-section { margin-bottom: var(--sp-2); }
.list-section-header { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border-subtle); }
.list-section-dot { width: 8px; height: 8px; border-radius: 50%; }
.list-section-dot.todo { background: #6b7280; }
.list-section-dot.in-progress { background: #3b82f6; }
.list-section-dot.review { background: #f59e0b; }
.list-section-dot.done { background: #22c55e; }
.list-section .count { font-size: 10px; padding: 1px 7px; border-radius: var(--radius-full); background: var(--bg-4); color: var(--text-muted); }

/* ── Todos Mobile ── */
@media (max-width: 768px) {
  .board-view { grid-template-columns: 1fr; }
  .board-column { min-height: 120px; }
  .add-bar { flex-direction: column; }
  .add-bar input[type="text"] { min-width: 100%; }
  .top-bar { flex-direction: column; align-items: stretch; }
  .top-bar-left, .top-bar-right { justify-content: space-between; }
}

/* ══════════════════════════════════════════
   BRANDS OVERVIEW PAGE
   ══════════════════════════════════════════ */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.summary-card { background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--sp-4) var(--sp-4); box-shadow: var(--shadow-card); position: relative; overflow: hidden; }
.summary-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(0,0,0,0.03), transparent); }
.summary-label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: var(--weight-medium); margin-bottom: var(--sp-1); }
.summary-value { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -0.5px; }
.summary-value.num-green, .num-green { color: var(--green); }
.summary-value.num-yellow, .num-yellow { color: var(--amber); }
.summary-value.num-blue, .num-blue { color: var(--blue); }
.num-dim { color: var(--text-muted); }
.num-col { text-align: right; font-family: var(--font-mono); font-size: var(--text-sm); }

.refresh-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-3); }
.refresh-text { font-size: var(--text-xs); color: var(--text-muted); display: flex; align-items: center; gap: var(--sp-2); }
.loading-spinner { width: 14px; height: 14px; border: 2px solid var(--bg-4); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
.loading-spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.brand-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; }
.brand-table thead tr { background: var(--bg-3); }
.brand-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); font-weight: var(--weight-semibold); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-default); text-align: left; }
.brand-table td { padding: var(--sp-3) var(--sp-4); font-size: var(--text-base); border-bottom: 1px solid var(--border-subtle); transition: background var(--duration-fast); }
.brand-table tbody tr:hover td { background: rgba(0,0,0,0.02); }
.brand-table tbody tr:last-child td { border-bottom: none; }
.brand-name-cell a { font-weight: var(--weight-semibold); color: var(--brand); }
.brand-name-cell a:hover { color: var(--brand-hover); }
.tier-badge { font-size: 10px; padding: 2px 8px; border-radius: var(--radius-full); font-weight: var(--weight-medium); text-transform: uppercase; letter-spacing: 0.3px; }
.tier-badge.tier-hq { background: var(--purple-dim); color: var(--purple); }
.tier-badge.tier-brand { background: var(--brand-dim); color: var(--brand); }
.status-badge.status-active { background: var(--green-dim); color: var(--green); }
.status-badge.status-inactive { background: var(--bg-4); color: var(--text-muted); }
.instance-tag { font-size: 11px; padding: 2px 8px; border-radius: var(--radius-xs); background: var(--bg-4); color: var(--text-secondary); font-family: var(--font-mono); }

@media (max-width: 768px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .brand-table { font-size: 12px; }
  .brand-table th, .brand-table td { padding: var(--sp-2) var(--sp-3); }
}

/* ══════════════════════════════════════════
   BRAIN DUMP PAGE
   ══════════════════════════════════════════ */
.input-bar { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.input-bar input { flex: 1; background: var(--bg-1); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 12px var(--sp-4); font-size: var(--text-md); color: var(--text-primary); font-family: var(--font-sans); transition: all var(--duration-fast); }
.input-bar input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dimmer); }
.input-bar input::placeholder { color: var(--text-muted); }

/* Brain dump items — long text truncation */
.dump-content { max-height: 120px; overflow: hidden; position: relative; }
.dump-item:not(:hover) .dump-content::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 30px; background: linear-gradient(transparent, var(--bg-2)); pointer-events: none; }
.dump-item:hover .dump-content { max-height: none; }
.dump-item:hover .dump-content::after { display: none; }

/* ══════════════════════════════════════════
   RECURRING TASKS PAGE
   ══════════════════════════════════════════ */
.task-row { display: flex; align-items: center; gap: var(--sp-3); background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4); margin-bottom: 6px; transition: all var(--duration-fast); box-shadow: var(--shadow-card); }
.task-row:hover { border-color: var(--border-hover); box-shadow: var(--shadow-card-hover); }
.task-row.disabled { opacity: 0.5; }
.task-row .task-left { flex: 1; min-width: 0; }
.task-row .task-right { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.task-row .task-name { font-size: var(--text-md); font-weight: var(--weight-semibold); margin-bottom: 2px; }
.task-row .task-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.schedule-text { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.success { background: var(--green); box-shadow: var(--shadow-glow-green); }
.status-dot.failed { background: var(--red); box-shadow: var(--shadow-glow-red); }
.status-dot.never { background: var(--text-muted); }
.inst-badge { font-size: 10px; padding: 2px 7px; border-radius: var(--radius-xs); font-weight: var(--weight-medium); background: var(--bg-4); color: var(--text-secondary); }
.mode-badge { font-size: 10px; padding: 2px 7px; border-radius: var(--radius-xs); font-weight: var(--weight-medium); background: var(--blue-dim); color: var(--blue); }
.brand-badge { font-size: 10px; padding: 2px 7px; border-radius: var(--radius-full); font-weight: var(--weight-medium); background: var(--amber-dim); color: var(--amber); text-transform: uppercase; }
.history-table { width: 100%; border-collapse: collapse; margin-top: var(--sp-3); }
.history-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: var(--weight-medium); padding: var(--sp-2); text-align: left; border-bottom: 1px solid var(--border-default); }
.history-table td { padding: var(--sp-2); font-size: var(--text-sm); border-bottom: 1px solid var(--border-subtle); }
.output-preview { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ══════════════════════════════════════════
   CONFIG PAGE
   ══════════════════════════════════════════ */
.health-card { background: var(--bg-2); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--sp-4); margin-bottom: var(--sp-3); box-shadow: var(--shadow-card); }
.health-card .label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: var(--weight-medium); }
.health-card .value { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin-top: 2px; }

/* ══════════════════════════════════════════
   OVERFLOW FIXES (Backlog + Fleet)
   ══════════════════════════════════════════ */
.main { overflow-x: hidden; }
.kanban { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Backlog Kanban Scroll Fix ── */
.kanban { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--sp-2); margin-right: calc(-1 * var(--sp-8)); padding-right: var(--sp-8); }
.kanban-col { min-width: 200px; }

/* ── Override: Remove overflow-x hidden from main, fix at component level ── */
.main { overflow-x: visible; }
.task-item { overflow: hidden; }
.task-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.task-right { flex-shrink: 0; }

/* ── Final Kanban fix: allow scrolling in main ── */
.main { overflow-x: auto; }

/* ══════════════════════════════════════════
   MOBILE FIX — Comprehensive 390px audit
   2026-03-23
   ══════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Activity: stat cards 2-col ── */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── Brand: pillar tab bar horizontal scroll ── */
  .tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; scrollbar-width: none; }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; }

  /* ── All tables: horizontal scroll wrapper ── */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  thead, tbody, tr { min-width: max-content; }

  /* ── Infra/Costs: table container scroll ── */
  .table-wrap, .infra-section, [class*="table-container"] { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Recurring: task rows stack vertically ── */
  .task-row { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
  .task-row .task-right { justify-content: flex-start; flex-wrap: wrap; }
  .task-row .task-meta { flex-wrap: wrap; }

  /* ── Tools: tool items stack ── */
  .tool-item { flex-direction: column; align-items: stretch; gap: var(--sp-1); }
  .tool-item .tool-notes { word-break: break-word; overflow-wrap: break-word; }

  /* ── Global: prevent horizontal page overflow but allow inner scroll ── */
  .main { overflow-x: hidden; max-width: 100vw; box-sizing: border-box; }

  /* ── Costs: card-grid for stat cards ── */
  .card-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── Brand overview: overview-grid single col ── */
  .overview-grid { grid-template-columns: 1fr; }

  /* ── Quick actions grid ── */
  .quick-actions { grid-template-columns: repeat(2, 1fr); }

  /* ── Page title size ── */
  .page-title { font-size: 22px; }
}

/* ══════════════════════════════════════════
   APPLE iOS PREMIUM POLISH
   Make it feel native, alive, and premium
   ══════════════════════════════════════════ */

/* ── Font Rendering (Apple crisp text) ── */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}

/* ── Vibrant Translucent Sidebar (macOS Finder) ── */
.sidebar {
  background: rgba(242, 242, 247, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right-color: rgba(60, 60, 67, 0.08);
}
[data-theme="dark"] .sidebar {
  background: rgba(28, 28, 30, 0.72);
  border-right-color: rgba(255, 255, 255, 0.06);
}

/* ── Cards: No borders, shadow-only depth (iOS style) ── */
.card {
  border: none;
  box-shadow: 0 0.5px 0 rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.04);
}
.card:hover {
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
[data-theme="dark"] .card {
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[data-theme="dark"] .card:hover {
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ── Press-down scale (iOS haptic feel) ── */
button, .btn, .btn-primary, .btn-add, .btn-submit, .btn-cancel,
.nav-item, .pill, .tab-btn, .server-chip, .brand-card,
.kanban-card, .task-item, .tool-item, .ws-dropdown-item {
  transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}
button:active, .btn:active, .btn-primary:active, .btn-add:active,
.nav-item:active, .pill:active, .tab-btn:active,
.server-chip:active, .kanban-card:active, .task-item:active {
  transform: scale(0.97);
  transition-duration: 80ms;
}

/* ── iOS Segmented Control (replaces filter pills) ── */
.filter-pills {
  display: inline-flex;
  background: rgba(118, 118, 128, 0.12);
  border-radius: 8px;
  padding: 2px;
  gap: 0;
}
[data-theme="dark"] .filter-pills {
  background: rgba(118, 118, 128, 0.24);
}
.pill, [data-tool-filter] {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.pill.active, [data-tool-filter].active {
  background: var(--bg-2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 1px rgba(0,0,0,0.04);
  font-weight: 600;
}
[data-theme="dark"] .pill.active, [data-theme="dark"] [data-tool-filter].active {
  background: rgba(99, 99, 102, 0.36);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ── Pulsing Status Dots ── */
@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.dot.online, .dot.working,
span[style*="background:var(--green)"],
span[style*="background:#34c759"],
span[style*="background:#30d158"] {
  animation: pulse-live 2s ease-in-out infinite;
}

/* ── Spring entrance animations ── */
@keyframes apple-fade-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.animate-in { animation: apple-fade-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.animate-in-1 { animation-delay: 0.05s; }
.animate-in-2 { animation-delay: 0.1s; }
.animate-in-3 { animation-delay: 0.15s; }

/* Cards inherit animation from parent .animate-in class */

/* Task items use default transitions */

/* ── Spotlight Command Palette (heavy blur) ── */
.command-overlay {
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: saturate(180%) blur(40px);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
}
[data-theme="dark"] .command-overlay {
  background: rgba(0, 0, 0, 0.5);
}
.command-box {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: none;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  border-radius: 14px;
}
[data-theme="dark"] .command-box {
  background: rgba(44, 44, 46, 0.88);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
}

/* ── Smoother Skeleton Shimmer (Apple Music style) ── */
@keyframes apple-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-3) 0%,
    var(--bg-2) 40%,
    var(--bg-3) 60%,
    var(--bg-3) 100%
  );
  background-size: 200% 100%;
  animation: apple-shimmer 1.8s ease-in-out infinite;
  border-radius: 6px;
}

/* ── Floating Action Button (iOS style with spring) ── */
.fab {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3), 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 122, 255, 0.4), 0 2px 6px rgba(0, 0, 0, 0.1);
}
.fab:active {
  transform: scale(0.92);
  transition-duration: 100ms;
}

/* ── Server chips — glass feel ── */
.server-chip {
  border: none;
  background: var(--bg-2);
  box-shadow: 0 0.5px 0 rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.04);
}
.server-chip:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
[data-theme="dark"] .server-chip {
  background: var(--bg-2);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ── iOS-style attention banner ── */
.attention-banner {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.08), rgba(255, 149, 0, 0.04));
  border-left: 3px solid var(--amber);
  border-radius: 10px;
  border: none;
  border-left: 3px solid var(--amber);
}

/* ── Task items — cleaner, no border ── */
.task-item {
  border: none;
  box-shadow: 0 0.5px 0 rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  border-radius: 12px;
}
.task-item:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
[data-theme="dark"] .task-item {
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ── Kanban cards — raised paper feel ── */
.kanban-card {
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0.5px 1px rgba(0,0,0,0.03);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.kanban-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px) scale(1.01);
}

/* ── Primary button — Apple gradient ── */
.btn-primary, .btn-add, .add-btn, #btn-dump-add, .btn-submit {
  background: linear-gradient(180deg, #0a84ff 0%, #007aff 100%);
  border: none;
  box-shadow: 0 1px 3px rgba(0, 122, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.btn-primary:hover, .btn-add:hover, .add-btn:hover, .btn-submit:hover {
  background: linear-gradient(180deg, #409cff 0%, #0a84ff 100%);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ── Sidebar active item — iOS style ── */
.nav-item.active {
  background: var(--brand-dim);
  border-radius: 8px;
  color: var(--brand);
  font-weight: 600;
}

/* ── Tooltip / Badge — iOS style ── */
.badge {
  background: #ff3b30;
  color: white;
  font-weight: 700;
  font-size: 10px;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(255, 59, 48, 0.3);
}

/* ── Section labels — Apple uppercase micro ── */
.section-label, .card-label, .stat-label {
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

/* ── Scrollbar (macOS thin style) ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* ── Modal — iOS sheet style ── */
.modal-overlay {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal {
  border-radius: 14px;
  border: none;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(0, 0, 0, 0.05);
  animation: apple-sheet-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes apple-sheet-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
[data-theme="dark"] .modal {
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
}

/* ── Input focus — Apple blue ring ── */
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3.5px rgba(0, 122, 255, 0.3);
  border-color: var(--brand);
}

/* ── Page title — Apple bold ── */
.page-title {
  font-weight: 700;
  letter-spacing: -0.025em;
  font-size: 28px;
}

/* ── Smooth page content fade ── */
.main {
  animation: apple-fade-in 0.3s ease both;
}

/* ── Mobile bottom bar — vibrancy ── */
@media (max-width: 768px) {
  .sidebar {
    background: rgba(242, 242, 247, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid rgba(60, 60, 67, 0.12);
  }
  [data-theme="dark"] .sidebar {
    background: rgba(28, 28, 30, 0.72);
    border-top-color: rgba(255, 255, 255, 0.06);
  }
}

/* ══════════════════════════════════════════
   VISUAL FIX — Text visibility, button styling, Apple polish
   ══════════════════════════════════════════ */

/* ── Activity feed: ensure text is readable ── */
.activity-item { color: var(--text-primary); }
.activity-title { color: var(--text-primary); font-size: 14px; font-weight: 400; }
.activity-title a { color: var(--brand); text-decoration: none; }
.activity-title a:hover { text-decoration: underline; }
.activity-time { color: var(--text-muted); }
.activity-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--brand-dim);
  color: var(--brand);
  font-weight: 500;
}

/* ── Quick Action buttons — Apple style ── */
.quick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg-2);
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand);
  cursor: pointer;
  font-family: var(--font-sans);
  box-shadow: 0 0.5px 1px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
}
.quick-btn:hover {
  background: var(--brand-dim);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}
.quick-btn:active {
  transform: scale(0.97);
}
[data-theme=dark] .quick-btn {
  background: var(--bg-2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
[data-theme=dark] .quick-btn:hover {
  background: var(--bg-3);
}

/* ── Attention items — cleaner, Apple grouped style ── */
.attention-item {
  background: var(--bg-2);
  border: none;
  border-left: 3px solid var(--amber);
  box-shadow: 0 0.5px 1px rgba(0,0,0,0.04);
  color: var(--text-primary);
  font-size: 13px;
}
.attention-item:hover {
  background: var(--bg-3);
  border-color: var(--amber);
}

/* ── Card values — ensure proper colors ── */
.card-value { color: var(--text-primary); }
.card-sub, .card-label { color: var(--text-muted); }
.stat-value { font-weight: 700; }

/* ── Needs Attention section — fix skeleton look ── */
.needs-attention .card, .needs-attention .attention-list {
  background: var(--bg-2);
  border: none;
  box-shadow: 0 0.5px 1px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.04);
}

/* ── Brand header links — Apple capsule buttons ── */
.brand-header-links a, .brand-header-links button {
  background: var(--bg-2);
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand);
  box-shadow: 0 0.5px 1px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  text-decoration: none;
  transition: all 0.2s ease;
}
.brand-header-links a:hover, .brand-header-links button:hover {
  background: var(--brand-dim);
}

/* ── Sidebar section labels ── */
.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 16px 16px 6px;
}

/* ── Sidebar shadow: softer, no hard line ── */
.sidebar {
  box-shadow: none;
  border-right: 0.5px solid var(--border-subtle);
}

/* ── Fix text-secondary readability — use darker value in light mode ── */
:root {
  --text-secondary: #3c3c43;
}
[data-theme=dark] {
  --text-secondary: rgba(235, 235, 245, 0.6);
}

/* ── Priority items: ensure visible text ── */
.priority-item { color: var(--text-primary); }

/* ── Tab bar — Apple segment feel ── */
.tab-bar {
  background: rgba(118, 118, 128, 0.08);
  border-radius: 10px;
  padding: 2px;
  border-bottom: none;
  display: inline-flex;
  margin-bottom: var(--sp-5);
}
.tab-btn {
  border-radius: 8px;
  background: transparent;
  border: none;
  font-weight: 500;
  color: var(--text-primary);
}
.tab-btn.tab-active {
  background: var(--bg-2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0.5px 1px rgba(0,0,0,0.03);
  font-weight: 600;
  color: var(--text-primary);
}
.tab-btn.tab-active::after { display: none; }
[data-theme=dark] .tab-bar {
  background: rgba(118, 118, 128, 0.2);
}
[data-theme=dark] .tab-btn.tab-active {
  background: rgba(99, 99, 102, 0.36);
}

/* ── Form inputs — Apple rounded rect ── */
input, select, textarea {
  border-radius: 10px;
  border: 1px solid var(--border-default);
  padding: 10px 14px;
  font-size: 14px;
  background: var(--bg-2);
  font-family: var(--font-sans);
}

/* ── Status badges — softer Apple pill ── */
.status-badge {
  border: none;
  font-weight: 600;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: 0;
}

/* ── View toggle — Apple segment ── */
.view-toggle {
  display: inline-flex;
  background: rgba(118, 118, 128, 0.12);
  border-radius: 8px;
  padding: 2px;
  border: none;
}
.view-btn {
  border: none;
  border-radius: 7px;
  background: transparent;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}
.view-btn.active {
  background: var(--bg-2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-weight: 600;
}

/* ══════════════════════════════════════════
   MOBILE UI/UX AUDIT FIXES — 2026-03-23
   ══════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── FAB: lift above mobile tab bar ── */
  .fab {
    bottom: 70px;
    right: 16px;
  }

  /* ── Pillar tab bar: scroll fade indicator ── */
  .tab-bar {
    position: relative;
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
  }
  /* Remove mask when scrolled to end */
  .tab-bar.scrolled-end {
    -webkit-mask-image: none;
    mask-image: none;
  }

  /* ── Infra: sections use full width ── */
  .infra-section {
    overflow-x: visible;
    width: 100%;
  }
  .infra-section .table-scroll {
    width: 100%;
  }
  /* Collapsed infra sections (SSH Keys, Credentials, etc.) — full width */
  .infra-section .key-card,
  .infra-section > div {
    width: 100%;
    box-sizing: border-box;
  }

  /* ── Activity table: readable on mobile ── */
  .activity-table th:nth-child(4),
  .activity-table td:nth-child(4) {
    display: none;
  }
  .activity-table td {
    padding: 8px 6px;
    font-size: 12px;
  }
  .activity-table th {
    padding: 8px 6px;
    font-size: 10px;
  }

  /* ── Recurring: extra bottom padding so last item doesn't clip under tab bar ── */
  .main {
    padding-bottom: 80px;
  }

  /* ── Tools: larger text on mobile ── */
  .tool-item .tool-name {
    font-size: 14px;
  }
  .tool-item .tool-notes {
    font-size: 13px;
    line-height: 1.4;
  }

  /* ── Todos: form field alignment ── */
  .todo-form input,
  .todo-form select {
    width: 100%;
    box-sizing: border-box;
  }
}

/* ── Sidebar Logo — clean img icon ── */
img.logo-icon {
  background: none;
  box-shadow: none;
  border-radius: 10px;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* ── Filter Bar — consistent layout ── */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

/* ── Brand filter select — Apple style ── */
.filter-bar select,
#brand-filter {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 7px 32px 7px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-primary);
  cursor: pointer;
  min-height: 34px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url(data:image/svg+xml,%3Csvg xmlns=http://www.w3.org/2000/svg width=12 height=12 fill=%238e8e93 viewBox=0 0 16 16%3E%3Cpath d=M8 11L3 6h10z/%3E%3C/svg%3E);
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-bar select:focus,
#brand-filter:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}
[data-theme=dark] .filter-bar select,
[data-theme=dark] #brand-filter {
  background: var(--bg-3);
  color: var(--text-primary);
}

/* ── View toggle buttons in backlog — Apple segmented control ── */
.view-toggle button {
  border: none;
  border-radius: 7px;
  background: transparent;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}
.view-toggle button.active {
  background: var(--bg-2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 1px rgba(0,0,0,0.04);
  font-weight: 600;
}
[data-theme=dark] .view-toggle button.active {
  background: rgba(99, 99, 102, 0.36);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ── Instance bar — tighter grid ── */
.instance-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  margin-bottom: var(--sp-4);
}
.inst-chip {
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
}

/* ── Empty card state fix (fleet overview) ── */
.server-chip:empty,
.brand-card:empty,
.card:empty {
  display: none;
}

/* ── Priority badge — Apple pill ── */
.p-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0;
  min-width: 24px;
}
.p-badge.p1 { background: var(--red-dim); color: var(--red); }
.p-badge.p2 { background: var(--amber-dim); color: var(--amber); }
.p-badge.p3 { background: var(--blue-dim); color: var(--blue); }
.p-badge.p4 { background: rgba(142,142,147,0.12); color: var(--text-muted); }
.p-badge.p5 { background: rgba(142,142,147,0.08); color: var(--text-ghost); }

/* ── Type badge — softer ── */
.type-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: capitalize;
}
.type-badge.bug { background: var(--red-dim); color: var(--red); }
.type-badge.feature { background: var(--blue-dim); color: var(--brand); }
.type-badge.improvement { background: var(--green-dim); color: var(--green); }

/* ── Instance badge in backlog ── */
.inst-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(142,142,147,0.1);
  color: var(--text-muted);
}

/* ── Backlog page count dots ── */
.page-counts {
  gap: 12px;
}
.page-counts span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.count-dot {
  width: 7px;
  height: 7px;
}

/* ── Kanban columns — tighter ── */
.kanban-board {
  gap: 12px;
}
.kanban-col-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 0 0 8px 0;
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: 8px;
}

/* ── Mobile filter bar ── */
@media (max-width: 768px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-bar > div {
    width: 100%;
  }
  .filter-bar > div:last-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .instance-bar {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Light mode select fix ── */
#brand-filter {
  background-color: var(--bg-2);
}

/* ── Page title — remove gradient in light mode ── */
.page-title {
  -webkit-text-fill-color: var(--text-primary);
  background: none;
  background-clip: unset;
  -webkit-background-clip: unset;
}

/* ── Kanban column count badge — Apple style ── */
.kanban-col-count {
  background: rgba(142,142,147,0.12);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* ── Kanban column headers — neutral text, colored top border only ── */
.kanban-col:nth-child(2) .kanban-col-header,
.kanban-col:nth-child(3) .kanban-col-header,
.kanban-col:nth-child(4) .kanban-col-header,
.kanban-col:nth-child(5) .kanban-col-header,
.kanban-col:nth-child(6) .kanban-col-header,
.kanban-col:nth-child(7) .kanban-col-header {
  color: var(--text-secondary);
}

/* ── All Brands select — match segmented control height ── */
#brand-filter {
  height: 34px;
  line-height: 1;
}

/* ── Backlog page header — align title and counts ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--sp-4);
}
.page-header .page-title {
  margin-bottom: 0;
}

/* ── Progress bar polish ── */
.progress-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--bg-3);
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), #5ac8fa);
  transition: width 0.3s ease;
}

/* ── Sentinel latency dash ── */
.server-chip .latency:empty {
  display: none;
}

/* ── Mobile backlog filter bar — tighter layout ── */
@media (max-width: 768px) {
  .filter-bar {
    gap: 8px;
    margin-bottom: 12px;
  }
  .filter-bar select,
  #brand-filter {
    width: 100%;
  }
  .page-header {
    margin-bottom: 8px;
  }
  .page-counts {
    gap: 8px;
    flex-wrap: wrap;
  }
  .page-counts span {
    font-size: 11px;
  }
  /* Keep Board/List + Add Item on same row */
  .filter-bar > div:last-child {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }
}

/* ── Analytics connect cards (brand detail) ── */
.analytics-connect-card {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 16px 20px;
  transition: all 0.15s;
}
.analytics-connect-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.analytics-connect-card .icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.analytics-connect-card .title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.analytics-connect-card .desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}
.analytics-connect-card.analytics-connected {
  border-left: 3px solid var(--green);
}
[data-theme="dark"] .analytics-connect-card {
  background: var(--bg-3);
}

/* ── Integrations section — grid layout ── */
#analytics-traffic,
#analytics-search,
#analytics-funnels,
#analytics-revenue {
  margin-bottom: 12px;
}

/* ── Needs Attention list — polish ── */
.needs-attention-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.needs-attention-item:last-child {
  border-bottom: none;
}

/* ── Brand Identity Card (Brand tab) ── */
.brand-identity-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  margin-bottom: 20px;
}
.brand-logo-area {
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 64px;
}
.brand-logo-area img {
  max-height: 48px;
  width: auto;
  display: block;
}
.brand-identity-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.brand-identity-tagline {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
}
.brand-colors {
  display: flex;
  gap: 6px;
}
.brand-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  cursor: help;
}
@media (max-width: 768px) {
  .brand-identity-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .brand-identity-card > div:last-child {
    text-align: left;
  }
}

/* ── Brand list items ── */
.brand-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.brand-list li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.brand-list li:last-child {
  border-bottom: none;
}
.brand-list li .label {
  font-weight: 600;
  color: var(--text-primary);
  display: inline;
  margin-right: 4px;
}
.brand-list li .label::after {
  content: " — ";
  font-weight: 400;
  color: var(--text-muted);
}

/* ── Global section spacing — more breathing room ── */
.section-row {
  margin-top: 28px;
}
.section-row:first-of-type {
  margin-top: var(--sp-4);
}
.card-grid {
  margin-bottom: 24px;
}
.section + .section {
  margin-top: 8px;
}

/* ── Mobile: Scrollable tables with fade hint ── */
@media (max-width: 768px) {
  .mobile-table-scroll {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobile-table-scroll::-webkit-scrollbar { display: none; }
  .mobile-table-scroll::after {
    content: '';
    position: sticky;
    right: 0;
    top: 0;
    bottom: 0;
    width: 32px;
    min-height: 100%;
    background: linear-gradient(to right, transparent, var(--bg-1) 90%);
    pointer-events: none;
    flex-shrink: 0;
  }
  /* Apply to known table containers */
  .infra-section,
  .table-wrap,
  [class*="table-container"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, black 90%, transparent 100%);
    mask-image: linear-gradient(to right, black 90%, transparent 100%);
  }
  /* Remove mask when scrolled to end (JS adds this class) */
  .scroll-end {
    -webkit-mask-image: none;
    mask-image: none;
  }
  /* Fix infra section override — allow scroll */
  .infra-section {
    overflow-x: auto;
  }
}