/* ========== DESIGN TOKENS ========== */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Backgrounds */
  --bg: #0b0b0c;
  --panel: #131316;
  --panel-2: #17171b;
  --panel-3: #1c1c21;

  /* Borders */
  --border: #26262c;
  --border-strong: #34343c;

  /* Text */
  --text: #ECECEC;
  --muted: #8a8a93;
  --muted-2: #5f5f68;

  /* Accent (gold) */
  --accent: #E2C088;
  --accent-soft: #d9b87a;
  --accent-dim: rgba(226,192,136,0.12);
  --accent-deep: rgba(226,192,136,0.06);

  /* Semantic */
  --green: #7ad99a;
  --green-dim: rgba(122,217,154,0.12);
  --blue: #8ab4ee;
  --blue-dim: rgba(138,180,238,0.10);
  --red: #ee8a8a;
  --red-dim: rgba(238,138,138,0.12);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace;

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

  /* Spacing */
  --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;

  /* Radii */
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-subtle: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-elevated: 0 4px 16px rgba(0,0,0,0.4);

  /* Motion */
  --ease-default: ease-out;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 120ms;
  --t-normal: 200ms;
  --t-slow: 350ms;
}

/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-soft); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
::selection { background: var(--accent-dim); color: var(--accent); }

/* ========== BASE ========== */
h1, h2, h3, h4 { color: var(--text); line-height: 1.3; }
h1 { font-size: var(--text-3xl); font-weight: 600; letter-spacing: -0.015em; }
h2 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.005em; }

/* ========== UTILITIES ========== */
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.accent { color: var(--accent); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

/* ========== SVG ICONS ========== */
.svg-ico {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.svg-ico.sm { width: 14px; height: 14px; }
.svg-ico.lg { width: 20px; height: 20px; }
.svg-ico.xl { width: 24px; height: 24px; }

/* ========== SHELL ========== */
.shell-wrapper {
  width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Top nav bar */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11,11,12,0.92);
  backdrop-filter: blur(12px);
}
.brand {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}
.nav-center {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.nav-link {
  color: var(--muted);
  font-size: var(--text-base);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: color var(--t-fast), background var(--t-fast);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-link:hover { color: var(--text); background: var(--panel-2); }
.nav-link.active { color: var(--accent); background: var(--accent-deep); }

/* User avatar in nav */
.nav-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--panel-3);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: border-color var(--t-fast);
  position: relative;
}
.nav-avatar:hover { border-color: var(--accent); }

/* User dropdown */
.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  min-width: 180px;
  box-shadow: var(--shadow-elevated);
  z-index: 100;
  display: none;
}
.user-dropdown.open { display: block; }
.user-dropdown-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.user-dropdown-header .name { color: var(--text); font-size: var(--text-base); font-weight: 500; }
.user-dropdown-header .role { color: var(--muted); font-size: var(--text-sm); }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-base);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.user-dropdown-item:hover { background: var(--panel-2); color: var(--text); }
.user-dropdown-item.danger:hover { color: var(--red); }

/* ========== PAGE CONTAINER ========== */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 40px 96px;
  animation: fadeIn var(--t-normal) var(--ease-default);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-base);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform 60ms;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #1a1408;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-soft); }
.btn-primary .svg-ico { stroke: #1a1408; }
.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--panel-2); border-color: var(--border-strong); }
.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(238,138,138,0.25);
}
.btn-danger:hover { background: rgba(238,138,138,0.18); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
}
.btn-ghost:hover { color: var(--text); background: var(--panel-2); }
.btn:disabled, .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-sm { padding: 5px 10px; font-size: var(--text-sm); }

/* ========== HEADER ROW ========== */
.header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--sp-8);
}
.header-row .lede {
  color: var(--muted);
  font-size: 15px;
  margin: 8px 0 0;
  max-width: 540px;
}

/* ========== FILTER CHIPS ========== */
.filters {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-4);
}
.fchip {
  padding: 6px 12px;
  font-size: var(--text-base);
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: color var(--t-fast), background var(--t-fast);
}
.fchip:hover { color: var(--text); background: var(--panel-2); }
.fchip.active { color: var(--text); background: var(--panel-2); font-weight: 500; }
.fchip .n {
  color: var(--muted-2);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.fchip.active .n { color: var(--muted); }
.filters .spacer { flex: 1; }
.search-input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  width: 240px;
  outline: none;
  transition: border-color var(--t-fast);
}
.search-input:focus { border-color: var(--border-strong); }
.search-input::placeholder { color: var(--muted-2); }

/* ========== CARDS GRID ========== */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* ========== PROJECT CARD ========== */
.proj {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  position: relative;
  display: block;
  color: inherit;
  transition: border-color var(--t-normal) var(--ease-default), background var(--t-normal) var(--ease-default);
  cursor: pointer;
}
.proj:hover {
  border-color: var(--border-strong);
  background: var(--panel-2);
}
.proj.archived-card { opacity: 0.7; }
.proj-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.proj-name {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 3px;
}
.proj-sub {
  color: var(--muted);
  font-size: var(--text-base);
  margin: 0;
  line-height: 1.4;
}
.proj-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

/* Version tag */
.version-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #1a1408;
  margin-left: 8px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.version-tag.building { background: var(--blue); color: #0c1626; }
.version-tag.archived { background: var(--panel-3); color: var(--muted); border: 1px solid var(--border); }

/* ========== STATUS PILL ========== */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.status .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status.ready {
  background: var(--accent-deep);
  color: var(--accent);
  border: 1px solid rgba(226,192,136,0.25);
}
.status.ready .dot { background: var(--accent); }
.status.building {
  background: rgba(138,180,238,0.08);
  color: var(--blue);
  border: 1px solid rgba(138,180,238,0.25);
}
.status.building .dot { background: var(--blue); animation: pulse 1.6s ease-in-out infinite; }
.status.discovery {
  background: var(--panel-3);
  color: var(--muted);
  border: 1px solid var(--border);
}
.status.discovery .dot { background: var(--muted); }
.status.archived {
  background: transparent;
  color: var(--muted-2);
  border: 1px solid var(--border);
}
.status.archived .dot { background: var(--muted-2); }

/* ========== PIPELINE STRIP ========== */
.pipeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 14px 0 4px;
}
.pseg {
  height: 4px;
  border-radius: 2px;
  background: var(--panel-3);
  position: relative;
  overflow: hidden;
}
.pseg.done { background: var(--accent); }
.pseg.active { background: var(--panel-3); }
.pseg.active::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 42%;
  background: var(--blue);
  animation: slide 2.4s ease-in-out infinite;
}
.pipeline-labels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 11px;
  color: var(--muted-2);
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}
.pipeline-labels .l.done { color: var(--muted); }
.pipeline-labels .l.active { color: var(--blue); }
.pipeline-labels .l.current { color: var(--accent); }

/* ========== CARD STATS ROW ========== */
.card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}
.card-stats .left { display: flex; align-items: center; gap: 14px; }
.card-stats .pair { display: inline-flex; align-items: baseline; gap: 5px; }
.card-stats .pair .v { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.card-stats .right { color: var(--muted-2); font-size: var(--text-sm); }

/* New project card */
.proj.new {
  border-style: dashed;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 220px;
  color: var(--muted);
}
.proj.new:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-deep);
}
.proj.new .plus {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 10px;
}
.proj.new .label { font-size: var(--text-md); font-weight: 500; }
.proj.new .hint { font-size: var(--text-sm); color: var(--muted-2); margin-top: 4px; }

/* Card more-menu trigger */
.card-menu-trigger {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  z-index: 2;
}
.card-menu-trigger:hover { background: var(--panel-3); color: var(--text); }
.card-menu {
  position: absolute;
  top: 44px;
  right: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  min-width: 140px;
  box-shadow: var(--shadow-elevated);
  z-index: 10;
  display: none;
}
.card-menu.open { display: block; }
.card-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.card-menu-item:hover { background: var(--panel-2); color: var(--text); }
.card-menu-item.danger:hover { color: var(--red); }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn var(--t-normal) var(--ease-default);
}
.modal-overlay.closing { animation: fadeOut var(--t-normal) var(--ease-default) forwards; }
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
  animation: scaleIn var(--t-normal) var(--ease-spring);
}
.modal-overlay.closing .modal-box { animation: scaleOut var(--t-normal) var(--ease-default) forwards; }
.modal-title { font-size: var(--text-xl); font-weight: 600; margin-bottom: var(--sp-5); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

/* ========== FORM ELEMENTS ========== */
.form-group { margin-bottom: var(--sp-5); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: var(--sp-2);
  font-weight: 500;
}
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text);
  font-size: var(--text-md);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast);
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted-2); }
textarea.form-input { min-height: 80px; resize: vertical; line-height: 1.5; }

/* ========== TOAST ========== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  color: var(--text);
  font-size: var(--text-base);
  box-shadow: var(--shadow-elevated);
  animation: slideInRight var(--t-slow) var(--ease-spring);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 360px;
}
.toast.toast-success { border-color: rgba(122,217,154,0.3); }
.toast.toast-success .toast-icon { color: var(--green); }
.toast.toast-error { border-color: rgba(238,138,138,0.3); }
.toast.toast-error .toast-icon { color: var(--red); }
.toast.toast-info { border-color: rgba(138,180,238,0.3); }
.toast.toast-info .toast-icon { color: var(--blue); }
.toast.removing { animation: slideOutRight var(--t-normal) var(--ease-default) forwards; }

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}
.tab {
  padding: 10px 18px;
  font-size: var(--text-base);
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ========== BREADCRUMBS ========== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-base);
  color: var(--muted);
  margin-bottom: var(--sp-6);
}
.breadcrumbs .sep { color: var(--muted-2); }
.breadcrumbs .crumb { cursor: pointer; transition: color var(--t-fast); }
.breadcrumbs .crumb:hover { color: var(--text); }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

/* ========== TABLE ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.data-table tbody td {
  padding: 12px 14px;
  font-size: var(--text-base);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tbody tr:hover { background: var(--panel-2); }
.data-table .mono-cell { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--muted-2); }

/* ========== BADGES / CHIPS ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-muted { background: var(--panel-3); color: var(--muted); }

/* Selectable chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t-fast);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.selected {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(226,192,136,0.3);
}

/* ========== DROPDOWN ========== */
.dropdown-wrapper { position: relative; display: inline-block; }
.dropdown-panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  min-width: 160px;
  box-shadow: var(--shadow-elevated);
  z-index: 100;
  display: none;
  animation: dropIn var(--t-fast) var(--ease-default);
}
.dropdown-panel.open { display: block; }
.dropdown-panel.align-right { left: auto; right: 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.dropdown-item:hover { background: var(--panel-2); color: var(--text); }
.dropdown-item.active { color: var(--accent); }
.dropdown-item.danger:hover { color: var(--red); }

/* ========== EMPTY STATE ========== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state .empty-icon { color: var(--muted-2); margin-bottom: var(--sp-4); }
.empty-state .empty-icon .svg-ico { width: 40px; height: 40px; }
.empty-state .empty-title { font-size: var(--text-lg); font-weight: 500; color: var(--text); margin-bottom: var(--sp-2); }
.empty-state .empty-sub { font-size: var(--text-base); color: var(--muted); }

/* ========== LOGIN ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-brand { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.login-subtitle { color: var(--muted); font-size: 15px; margin-bottom: 48px; }
.login-cards {
  display: flex;
  gap: 16px;
  margin-bottom: 40px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  width: 200px;
  cursor: pointer;
  text-align: center;
  transition: border-color var(--t-normal), background var(--t-normal);
}
.login-card:hover { border-color: var(--border-strong); background: var(--panel-2); }
.login-card.selected { border-color: var(--accent); background: var(--accent-deep); }
.login-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  margin: 0 auto 12px;
}
.login-card .name { color: var(--text); font-weight: 500; font-size: var(--text-md); }
.login-card .role-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
}
.login-card .email { color: var(--muted-2); font-size: var(--text-sm); margin-top: 6px; }
.login-form {
  width: 360px;
}
.login-form .form-group { margin-bottom: 16px; }
.login-error {
  color: var(--red);
  font-size: var(--text-sm);
  margin-top: 4px;
  display: none;
}
.login-error.visible { display: block; }

/* ========== DISCOVERY WORKSPACE ========== */
.workspace-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  min-height: calc(100vh - 200px);
}
.conversation-panel {
  display: flex;
  flex-direction: column;
}
.conversation-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 24px;
}
.conv-turn {
  display: flex;
  gap: 12px;
  animation: fadeInUp var(--t-normal) var(--ease-default);
}
.conv-turn .turn-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.conv-turn.system .turn-avatar { background: var(--accent-dim); color: var(--accent); }
.conv-turn.user .turn-avatar { background: var(--panel-3); color: var(--text); }
.conv-turn .turn-body {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
}
.conv-turn.system .turn-body { background: var(--panel); }
.conv-turn.user .turn-body { background: var(--panel-2); border-color: var(--border-strong); }
.turn-body p { font-size: var(--text-md); line-height: 1.6; margin-bottom: 8px; }
.turn-body p:last-child { margin-bottom: 0; }

/* UI blocks in conversation */
.ui-block {
  margin: 12px 0;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.ui-block-title {
  font-size: var(--text-sm);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  font-weight: 500;
}
.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Phase indicator */
.phase-bar {
  display: flex;
  gap: 4px;
  margin-bottom: var(--sp-6);
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.phase-step {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--muted-2);
  cursor: pointer;
  transition: all var(--t-fast);
}
.phase-step.completed { color: var(--accent); background: var(--accent-deep); }
.phase-step.current { color: var(--text); background: var(--panel-3); border: 1px solid var(--border); }
.phase-step.current .phase-dot { animation: pulse 1.6s ease-in-out infinite; }
.phase-step .phase-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  margin-bottom: 2px;
}

/* Sidebar panel (discovery & triage) */
.sidebar-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 20px;
}
.sidebar-section {
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.sidebar-section-title {
  font-size: var(--text-sm);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  margin-bottom: var(--sp-3);
}

/* Phase list in sidebar */
.phase-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: var(--text-base);
}
.phase-list-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}
.phase-list-icon.done { background: var(--accent-dim); color: var(--accent); }
.phase-list-icon.current { background: var(--panel-3); color: var(--text); border: 1px solid var(--border); }
.phase-list-icon.future { background: var(--panel-3); color: var(--muted-2); }

/* Editable card UI block */
.editable-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.editable-field {
  display: flex;
  align-items: center;
  gap: 10px;
}
.editable-field .field-label {
  font-size: var(--text-sm);
  color: var(--muted);
  min-width: 100px;
}
.editable-field .field-value {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: var(--text-base);
  color: var(--text);
}

/* Reorder list */
.reorder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}
.reorder-handle { color: var(--muted-2); cursor: grab; }
.reorder-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: auto;
}
.reorder-arrows button {
  padding: 2px;
  color: var(--muted);
  cursor: pointer;
}
.reorder-arrows button:hover { color: var(--text); }

/* Hierarchy tree */
.tree-node {
  padding-left: 20px;
}
.tree-node-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-base);
  transition: background var(--t-fast);
}
.tree-node-label:hover { background: var(--panel-2); }
.tree-node-label .tree-toggle { color: var(--muted-2); }
.tree-children { margin-left: 12px; }

/* ========== TRIAGE ========== */
.feedback-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: border-color var(--t-fast);
}
.feedback-item:hover { border-color: var(--border-strong); }
.feedback-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.feedback-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--panel-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--blue);
  flex-shrink: 0;
}
.feedback-content { font-size: var(--text-md); line-height: 1.5; margin-bottom: 12px; }
.triage-buttons {
  display: flex;
  gap: 8px;
}
.triage-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--t-fast);
}
.triage-btn:hover { border-color: var(--border-strong); color: var(--text); }
.triage-btn.accept.active { background: var(--green-dim); color: var(--green); border-color: rgba(122,217,154,0.3); }
.triage-btn.defer.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(226,192,136,0.3); }
.triage-btn.reject.active { background: var(--red-dim); color: var(--red); border-color: rgba(238,138,138,0.3); }
.triage-notes {
  margin-top: 8px;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text);
  font-size: var(--text-sm);
  font-family: inherit;
  outline: none;
  resize: none;
  height: 32px;
}
.triage-notes:focus { border-color: var(--accent); }
.triage-notes::placeholder { color: var(--muted-2); }

/* Sprint summary card */
.sprint-summary {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 20px;
  margin-bottom: 16px;
}
.sprint-stat {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: var(--text-base);
}
.sprint-stat .stat-label { color: var(--muted); }
.sprint-stat .stat-value { color: var(--text); font-weight: 500; font-family: var(--font-mono); }

/* ========== PROTOTYPE VIEWER ========== */
.prototype-frame {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.prototype-frame iframe {
  width: 100%;
  height: 500px;
  border: none;
}
.prototype-placeholder {
  text-align: center;
  color: var(--muted);
}
.compare-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.version-label {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}

/* Document drawer */
.doc-drawer {
  margin-top: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.doc-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.doc-drawer-header:hover { background: var(--panel-2); }
.doc-drawer-body {
  padding: 20px;
  border-top: 1px solid var(--border);
  display: none;
}
.doc-drawer-body.open { display: block; }
.doc-content {
  font-size: var(--text-md);
  line-height: 1.7;
  color: var(--muted);
}
.doc-content li { margin-bottom: 6px; }
.doc-content strong { color: var(--text); }

/* ========== REVIEW SCREEN ========== */
.review-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}
.feedback-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 20px;
}
.feedback-form-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--sp-5);
}
.submitted-list { margin-top: 24px; }
.submitted-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.submitted-item:last-child { border-bottom: none; }
.submitted-meta {
  font-size: var(--text-sm);
  color: var(--muted-2);
  margin-top: 4px;
}

/* ========== SETTINGS ========== */
.settings-section {
  margin-bottom: var(--sp-8);
}
.settings-section-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--sp-5);
}
.provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.provider-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  transition: border-color var(--t-fast);
}
.provider-card.active-provider { border-color: rgba(226,192,136,0.3); }
.provider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.provider-name { font-size: var(--text-lg); font-weight: 600; }
.provider-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.status-dot.connected { background: var(--green); }
.status-dot.disconnected { background: var(--red); }
.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
  font-size: var(--text-base);
  color: var(--muted);
}
.radio-option.selected { color: var(--accent); }
.radio-circle {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.radio-option.selected .radio-circle { border-color: var(--accent); }
.radio-circle .radio-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: transparent;
}
.radio-option.selected .radio-circle .radio-dot { background: var(--accent); }

/* Settings single card */
.settings-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  margin-bottom: 18px;
}

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* Build progress bar */
.build-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.build-track {
  flex: 1; height: 6px;
  border-radius: 3px;
  background: var(--panel-3);
  overflow: hidden;
}
.build-track .build-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--accent));
  border-radius: 3px;
  transition: width 0.3s var(--ease-default);
}
.build-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--blue);
  min-width: 36px;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes scaleOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(138,180,238,0.1); }
  50% { box-shadow: 0 0 0 5px rgba(138,180,238,0.18); }
}
@keyframes slide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(50%); }
  100% { transform: translateX(250%); }
}
@keyframes shimmer {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
  background: var(--panel-2);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: skeletonSweep 1.5s ease-in-out infinite;
}
@keyframes skeletonSweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-block { height: 80px; }

/* Masked field */
.masked-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.masked-field .mask-toggle {
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}
.masked-field .mask-toggle:hover { color: var(--text); }

/* Section divider */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-8) 0;
}

/* Conversation input area */
.conv-input-area {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 16px;
}
.conv-input-area input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: var(--text-md);
  outline: none;
}
.conv-input-area input::placeholder { color: var(--muted-2); }

/* Warning card (gap report) */
.warning-card {
  background: rgba(238,138,138,0.06);
  border: 1px solid rgba(238,138,138,0.2);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.warning-card .warning-icon { color: var(--red); flex-shrink: 0; margin-top: 2px; }

/* Screen card (discovery) */
.screen-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.screen-thumb {
  width: 80px; height: 52px;
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.screen-card-info { flex: 1; }
.screen-card-name { font-weight: 500; font-size: var(--text-md); }
.screen-card-desc { font-size: var(--text-sm); color: var(--muted); margin-top: 2px; }

/* Frozen indicator */
.frozen-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-dim);
  color: var(--accent);
}

/* Scope chips */
.scope-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

/* Sprint history */
.sprint-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: var(--text-base);
  border-bottom: 1px solid var(--border);
}
.sprint-history-item:last-child { border-bottom: none; }
