/* ============ Tokens ============ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e3e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef2ff;
  --accent-text: #4338ca;
  --ok: #059669; --ok-soft: #ecfdf5;
  --warn: #d97706; --warn-soft: #fffbeb;
  --err: #dc2626; --err-soft: #fef2f2;
  --side-bg: #0f1629;
  --side-text: #cbd5e1;
  --side-muted: #64748b;
  --side-hover: rgba(255,255,255,.06);
  --side-active: rgba(99,102,241,.18);
  --ph-planning: #2563eb;
  --ph-design: #7c3aed;
  --ph-execution: #059669;
  --ph-closure: #d97706;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
  --shadow-lg: 0 10px 40px rgba(15,23,42,.12);
  --radius: 14px;
  --radius-sm: 9px;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: "Segoe UI Variable", "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --surface: #121a2e; --surface-2: #0f1628; --surface-3: #1a2440;
    --border: #233050; --border-strong: #33446b; --text: #e6ebf5; --text-2: #a9b4cc; --text-3: #7c89a6;
    --accent: #818cf8; --accent-2: #a78bfa; --accent-soft: rgba(129,140,248,.14); --accent-text: #a5b4fc;
    --ok: #34d399; --ok-soft: rgba(52,211,153,.12); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.12);
    --err: #f87171; --err-soft: rgba(248,113,113,.12); --side-bg: #080c18;
    --ph-planning: #60a5fa; --ph-design: #a78bfa; --ph-execution: #34d399; --ph-closure: #fbbf24;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --surface: #121a2e; --surface-2: #0f1628; --surface-3: #1a2440;
  --border: #233050; --border-strong: #33446b; --text: #e6ebf5; --text-2: #a9b4cc; --text-3: #7c89a6;
  --accent: #818cf8; --accent-2: #a78bfa; --accent-soft: rgba(129,140,248,.14); --accent-text: #a5b4fc;
  --ok: #34d399; --ok-soft: rgba(52,211,153,.12); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.12);
  --err: #f87171; --err-soft: rgba(248,113,113,.12); --side-bg: #080c18;
  --ph-planning: #60a5fa; --ph-design: #a78bfa; --ph-execution: #34d399; --ph-closure: #fbbf24;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
code, pre, textarea.mono { font-family: var(--mono); }

/* ============ Layout ============ */
:root {
  --banner-h: clamp(68px, 6vw, 104px);
  --side-w: clamp(236px, 16vw, 300px);
  --gap: clamp(10px, 1vw, 20px);
  --pad: clamp(16px, 1.8vw, 40px);
  --tile-min: clamp(230px, 16vw, 340px);
}
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--banner-h)); }
.sidebar { background: var(--side-bg); color: var(--side-text); position: sticky; top: var(--banner-h); height: calc(100vh - var(--banner-h)); display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,.04); z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; color: #fff; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(99,102,241,.45); }
.brand-mark svg { stroke: #fff; stroke-width: 3; width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; letter-spacing: .2px; }
.brand-text small { color: var(--side-muted); font-size: 11.5px; }
.nav { flex: 1; overflow-y: auto; padding: 14px 12px 12px; scrollbar-width: thin; scrollbar-color: #1e293b transparent; }
.nav-group { margin-top: 6px; }
.nav-label { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: clamp(11px, .65vw, 13px); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); cursor: pointer; text-align: left; transition: background .15s, color .15s; }
.nav-label:hover { background: var(--side-hover); color: var(--side-text); }
.nav-label:focus-visible { outline: 2px solid #818cf8; outline-offset: 1px; }
.nav-label .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.nav-label .nl-text { flex: 1; }
.nav-label .nl-count { font-size: 10.5px; letter-spacing: 0; padding: 0 6px; border-radius: 99px; background: rgba(255,255,255,.07); color: var(--side-muted); }
.nav-label .nl-chev svg { width: 14px; height: 14px; transform: rotate(90deg); transition: transform .2s; }
.nav-group.collapsed .nl-chev svg { transform: rotate(0deg); }
.nav-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .22s ease; }
.nav-items > div { overflow: hidden; min-height: 0; }
.nav-group.collapsed .nav-items { grid-template-rows: 0fr; }
.nav-tools { display: flex; justify-content: flex-end; gap: 4px; margin-top: 10px; }
.nav-mini { border: 0; background: transparent; color: var(--side-muted); font: inherit; font-size: 11px; padding: 3px 7px; border-radius: 6px; cursor: pointer; }
.nav-mini:hover { background: var(--side-hover); color: var(--side-text); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: clamp(7px, .55vw, 11px) 10px; border-radius: 8px; color: var(--side-text); font-size: clamp(13px, .82vw, 16px); transition: background .15s, color .15s; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.active { background: var(--side-active); color: #fff; box-shadow: inset 2px 0 0 #818cf8; }
.nav-item .ico svg { width: clamp(16px, 1vw, 20px); height: clamp(16px, 1vw, 20px); opacity: .85; }
.nav-item > span:nth-child(2) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-tag { font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: linear-gradient(135deg, rgba(99,102,241,.35), rgba(139,92,246,.35)); color: #c7d2fe; letter-spacing: .04em; }
.sidebar-foot { padding: 10px 12px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.side-legal { display: inline-block; margin: 8px 0 0 12px; font-size: 12px; color: rgba(255,255,255,.5); text-decoration: none; }
.side-legal:hover { color: rgba(255,255,255,.85); text-decoration: underline; }
.main { min-width: 0; display: flex; flex-direction: column; }
.banner { position: sticky; top: 0; z-index: 45; height: var(--banner-h); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; column-gap: 16px; padding: 0 var(--pad);
  background: radial-gradient(900px 220px at 85% -60%, rgba(167,139,250,.45), transparent 60%), linear-gradient(110deg, #0f1629 0%, #1e1b4b 40%, #3730a3 100%);
  color: #fff; box-shadow: 0 2px 18px rgba(15,23,42,.25); border-bottom: 1px solid rgba(255,255,255,.08); }
.banner-brand { grid-column: 2; justify-self: center; display: flex; align-items: center; gap: clamp(10px, 1vw, 18px); min-width: 0; max-width: calc(100vw - 2 * var(--pad) - 120px); color: #fff; }
.banner .menu-btn { grid-column: 1; justify-self: start; }
.banner .topbar-right { grid-column: 3; justify-self: end; margin-left: 0; min-width: 0; }
.banner .model-chip { max-width: clamp(140px, 16vw, 320px); font-size: clamp(12.5px, .8vw, 15px); padding: clamp(6px, .45vw, 9px) clamp(12px, .9vw, 16px); }
.banner .icon-btn { width: clamp(36px, 2.4vw, 46px); height: clamp(36px, 2.4vw, 46px); }
.banner .brand-logo { width: clamp(52px, 4.6vw, 80px); height: clamp(52px, 4.6vw, 80px); flex-shrink: 0; stroke: none; stroke-width: 1; fill: none;
  filter: drop-shadow(0 6px 14px rgba(124,58,237,.55)) drop-shadow(0 0 10px rgba(34,211,238,.25)); transition: transform .25s ease; }
.banner-brand:hover .brand-logo { transform: rotate(-8deg) scale(1.05); }
.app-title { font-size: clamp(18px, 2.2vw, 40px); font-weight: 700; letter-spacing: -.015em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.app-title .title-main { color: #fff; }
.app-title .sep { color: rgba(199,210,254,.7); font-weight: 400; }
.app-title .tagline { background: linear-gradient(90deg, #c7d2fe, #e9d5ff); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 600; }
.banner .icon-btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #e0e7ff; }
.banner .icon-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.banner .model-chip { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #e0e7ff; }
.banner .model-chip:hover { border-color: #a5b4fc; color: #fff; }
.llm-hint { display: flex; align-items: center; gap: 10px; padding: 8px var(--pad); background: var(--warn-soft); color: var(--text); border-bottom: 1px solid var(--border); font-size: clamp(12.5px, .8vw, 14.5px); line-height: 1.45; }
.llm-hint[hidden] { display: none; }
.llm-hint > span:first-child { display: flex; color: var(--warn); flex: none; }
.llm-hint svg { width: 16px; height: 16px; }
.llm-hint a { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.llm-hint .llm-hint-free { margin-left: 6px; font-weight: 500; }
.llm-hint-x { margin-left: auto; flex: none; background: none; border: 0; color: var(--text-3); font-size: 20px; line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 6px; }
.llm-hint-x:hover { color: var(--text); background: var(--surface-3); }
.free-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.free-key { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.free-key b { font-size: 14px; }
.free-key small { color: var(--text-2); line-height: 1.45; }
.free-key code { font-size: 11.5px; color: var(--text-2); word-break: break-all; }
.free-key .fk-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.subbar { display: flex; align-items: center; height: clamp(40px, 2.8vw, 52px); padding: 0 var(--pad); border-bottom: 1px solid var(--border); background: var(--surface); }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: clamp(12.5px, .8vw, 15px); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumbs svg { width: 14px; height: 14px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.model-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px; color: var(--text-2); font-size: 12.5px; background: var(--surface); max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-chip:hover { border-color: var(--accent); color: var(--text); }
.model-chip .chip-text { overflow: hidden; text-overflow: ellipsis; }
.model-chip .status { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); flex-shrink: 0; }
.model-chip.off .status { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.menu-btn { display: none; }
.content { padding: var(--pad); max-width: 2400px; width: 100%; margin: 0 auto; }
.scrim { display: none; }

/* ============ Home ============ */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: clamp(22px, 2.4vw, 48px) clamp(20px, 2.6vw, 52px); color: #fff; background: radial-gradient(1200px 400px at 90% -20%, rgba(167,139,250,.55), transparent 60%), linear-gradient(120deg, #1e1b4b 0%, #312e81 45%, #4f46e5 100%); box-shadow: var(--shadow-lg); }
.hero h1 { font-size: clamp(20px, 1.9vw, 36px); font-weight: 700; letter-spacing: -.01em; }
.hero p { margin: 8px 0 0; max-width: 60ch; color: #c7d2fe; font-size: clamp(13.5px, 1vw, 18px); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.hero-stat { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: clamp(8px, .8vw, 14px) clamp(12px, 1.2vw, 22px); min-width: clamp(110px, 9vw, 170px); }
.hero-stat b { display: block; font-size: clamp(18px, 1.5vw, 28px); }
.hero-stat span { font-size: clamp(11.5px, .8vw, 14px); color: #c7d2fe; }
.phase-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: var(--gap); margin: 22px 0 6px; }
.phase-step { display: flex; align-items: center; gap: 10px; padding: clamp(10px, 1vw, 18px) clamp(12px, 1.1vw, 20px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; border-top: 3px solid var(--c); cursor: pointer; }
.phase-step:hover { box-shadow: var(--shadow); }
.phase-step .num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.phase-step b { font-size: clamp(13px, .95vw, 17px); }
.phase-step small { display: block; color: var(--text-3); font-size: clamp(11.5px, .8vw, 14px); }
.phase-section { margin-top: 28px; scroll-margin-top: calc(var(--banner-h) + 16px); }
.phase-head { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 14px; padding: 8px 12px 8px 0; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .15s; }
.phase-head:hover { background: color-mix(in srgb, var(--c) 7%, transparent); }
.phase-head:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.phase-head h2 { font-size: clamp(16px, 1.15vw, 21px); }
.ph-toggle { margin-left: auto; width: clamp(30px, 2vw, 38px); height: clamp(30px, 2vw, 38px); border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); transition: background .15s, transform .15s; }
.phase-head:hover .ph-toggle { background: color-mix(in srgb, var(--c) 22%, transparent); transform: scale(1.06); }
.ph-toggle svg { width: 55%; height: 55%; stroke-width: 2.4; transform: rotate(90deg); transition: transform .25s ease; }
.phase-section.collapsed .ph-toggle svg { transform: rotate(0deg); }
.ps-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s ease; }
.ps-body > div { overflow: hidden; min-height: 0; padding: 6px 10px 16px; margin: -6px -10px -16px; /* room for card hover lift + shadow */
  transition: padding .3s ease, margin .3s ease, visibility 0s linear 0s; }
.phase-section.collapsed .ps-body > div { padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; visibility: hidden;
  transition: padding .3s ease, margin .3s ease, visibility 0s linear .3s; }
.phase-section.collapsed .ps-body { grid-template-rows: 0fr; }
.phase-section.collapsed .phase-head { margin-bottom: 0; }
.phase-section.collapsed { margin-top: 12px; }
.home-tools { display: flex; justify-content: flex-end; gap: 6px; margin: 18px 0 -10px; }
.phase-head .bar { width: 4px; height: 20px; border-radius: 4px; background: var(--c); }
.phase-head .count { color: var(--text-3); font-size: 12.5px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--tile-min)), 1fr)); gap: var(--gap); }
.tool-card { position: relative; display: flex; flex-direction: column; gap: clamp(8px, .8vw, 14px); padding: clamp(14px, 1.3vw, 26px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); min-width: 0; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--c) 40%, var(--border)); }
.tool-card .top { display: flex; align-items: center; justify-content: space-between; }
.tool-ico { width: clamp(36px, 2.8vw, 52px); height: clamp(36px, 2.8vw, 52px); border-radius: 11px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.tool-ico svg { width: 50%; height: 50%; }
.tool-card h3 { font-size: clamp(14px, 1.05vw, 19px); font-weight: 600; }
.tool-card p { margin: 0; color: var(--text-2); font-size: clamp(12.5px, .9vw, 16px); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge.ai { color: var(--accent-text); background: var(--accent-soft); }
.badge.util { color: var(--text-2); background: var(--surface-3); }
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.err { color: var(--err); background: var(--err-soft); }

/* ============ Tool page ============ */
.tool-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.tool-header .tool-ico { width: 48px; height: 48px; border-radius: 13px; }
.tool-header .tool-ico svg { width: 24px; height: 24px; }
.tool-header h1 { font-size: 21px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tool-header p { margin: 4px 0 0; color: var(--text-2); }
.workspace { display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; gap: 20px; align-items: start; }
.workspace.single { grid-template-columns: 1fr; }
.workspace > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 54px; flex-wrap: wrap; }
.card-head h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.sticky { position: sticky; top: calc(var(--banner-h) + 20px); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; }
.field { display: flex; flex-direction: column; gap: 6px; grid-column: span 2; min-width: 0; }
.field.half { grid-column: span 1; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--err); }
.hint { font-size: 12px; color: var(--text-3); }
input[type=text], input[type=number], input[type=password], input[type=url], input[type=date], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
textarea.mono { font-size: 12.5px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 99px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; background: var(--surface-2); transition: all .12s; }
.chip input { display: none; }
.chip:hover { border-color: var(--border-strong); }
.chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent-text); font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all .15s; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
details.extra { grid-column: span 2; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
details.extra summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
details.extra textarea { margin-top: 8px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: var(--border); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Output */
.output { min-height: 420px; }
.output-body { padding: 20px 22px; overflow-x: auto; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 70px 24px; color: var(--text-3); }
.empty .tool-ico { width: 56px; height: 56px; border-radius: 16px; }
.empty .tool-ico svg { width: 26px; height: 26px; }
.empty b { color: var(--text); font-size: 15px; }
.thinking { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 80px 20px; color: var(--text-2); }
.pulse-dots { display: flex; gap: 6px; }
.pulse-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite ease-in-out; }
.pulse-dots i:nth-child(2) { animation-delay: .15s; background: var(--accent-2); }
.pulse-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.error-box { margin: 18px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--err-soft); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 30%, transparent); white-space: pre-wrap; word-break: break-word; }
.next-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); font-size: 12.5px; color: var(--text-3); }

/* Markdown */
.md { color: var(--text); font-size: 14px; line-height: 1.65; }
.md > *:first-child { margin-top: 0; }
.md h1 { font-size: 20px; margin: 22px 0 10px; }
.md h2 { font-size: 17px; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 15px; margin: 18px 0 8px; }
.md h4, .md h5, .md h6 { font-size: 14px; margin: 14px 0 6px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 24px; }
.md li { margin: 3px 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.md blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text-2); }
.md code { font-size: 12.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); }
.md .table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--border); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: 12.8px; }
.md th { background: var(--surface-3); text-align: left; font-weight: 600; padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--border); }
.md td { padding: 8px 12px; border-top: 1px solid var(--border); vertical-align: top; min-width: 90px; }
.md tr:nth-child(even) td { background: var(--surface-2); }
.code-block { position: relative; margin: 12px 0; border-radius: 10px; overflow: hidden; border: 1px solid #1e293b; background: #0b1220; }
.code-block .code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 6px 14px; background: #111a2e; color: #94a3b8; font-size: 11.5px; font-family: var(--mono); }
.code-block .code-head button { background: transparent; border: 1px solid #263452; color: #cbd5e1; border-radius: 6px; font-size: 11.5px; padding: 3px 8px; cursor: pointer; }
.code-block .code-head button:hover { background: #1e293b; }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; color: #e2e8f0; font-size: 12.5px; line-height: 1.6; }
.code-block pre code { background: none; padding: 0; color: inherit; }

/* Data tables & util */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 11px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; border: 0; background: transparent; white-space: nowrap; font-family: inherit; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dtable-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 10px; max-height: 560px; }
.dtable { border-collapse: collapse; width: 100%; font-size: 12.8px; }
.dtable th { position: sticky; top: 0; background: var(--surface-3); text-align: left; padding: 8px 10px; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--border); z-index: 1; }
.dtable td { padding: 6px 10px; border-top: 1px solid var(--border); vertical-align: middle; }
.dtable td input, .dtable td select { padding: 6px 8px; font-size: 12.8px; }
.dtable tr:hover td { background: var(--surface-2); }
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, clamp(150px, 11vw, 230px)), 1fr)); gap: var(--gap); }
.kpi { padding: clamp(12px, 1vw, 20px) clamp(14px, 1.1vw, 22px); border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.kpi span { font-size: clamp(11.5px, .8vw, 14px); color: var(--text-3); font-weight: 600; }
.kpi b { display: block; font-size: clamp(20px, 1.7vw, 32px); font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 11.5px; color: var(--text-3); }
.kpi.good b { color: var(--ok); } .kpi.mid b { color: var(--warn); } .kpi.bad b { color: var(--err); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { grid-column: auto; flex: 1; min-width: 140px; }
pre.out { margin: 0; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow: auto; max-height: 520px; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.diff-add { color: var(--ok); } .diff-del { color: var(--err); } .diff-chg { color: var(--warn); }
mark.hl { background: color-mix(in srgb, var(--warn) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.status-pill { font-weight: 700; padding: 4px 10px; border-radius: 8px; font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bar-line { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 10px; margin: 10px 0; font-size: 12.5px; }
.bar-track { height: 12px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; transition: width .4s; }

/* Settings */
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, clamp(190px, 14vw, 280px)), 1fr)); gap: var(--gap); }
.provider { position: relative; text-align: left; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--text); font: inherit; transition: all .15s; }
.provider:hover { border-color: var(--border-strong); }
.provider.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.provider b { display: block; font-size: 14px; }
.provider small { color: var(--text-3); font-size: 12px; }
.provider .pbadges { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.key-wrap { position: relative; }
.key-wrap input { padding-right: 70px; }
.key-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { padding: 11px 16px; border-radius: 10px; background: #0f172a; color: #fff; font-size: 13px; box-shadow: var(--shadow-lg); animation: toastIn .2s ease-out; max-width: 380px; border-left: 3px solid #818cf8; }
.toast.ok { border-left-color: #34d399; } .toast.err { border-left-color: #f87171; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .banner .model-chip { padding: 0; width: 36px; height: 36px; justify-content: center; }
  .banner .model-chip .chip-text { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .banner { column-gap: 10px; }
  .subbar { padding: 0 16px; }
  .sidebar { position: fixed; left: 0; top: var(--banner-h); bottom: 0; height: auto; width: min(85vw, 300px); transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 35; }
  .menu-btn { display: grid; }
  .chart-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .app-title .sep, .app-title .tagline { display: none; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .field, .field.half, details.extra { grid-column: span 1; }
  .crumbs span.hide-sm { display: none; }
}

/* API runner request line */
.req-line { flex-wrap: nowrap; }
.req-method { width: 120px; flex: none; font-weight: 700; }
@media (max-width: 560px) {
  .req-line { flex-wrap: wrap; }
  .req-line input[type=text] { flex: 1 1 100% !important; order: 3; }
}

/* QA Toolkit groups & comparators */
.tk-groups { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
.tk-group { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.tk-glabel { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--gap); }
.xml-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.drop { display: flex; align-items: center; gap: 14px; padding: clamp(16px, 1.6vw, 26px); border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: all .15s; min-width: 0; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.has-file { border-style: solid; border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: var(--ok-soft); }
.drop-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--accent-text); flex-shrink: 0; }
.drop-ico svg { width: 22px; height: 22px; }
.drop-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drop-text b { font-size: 14px; }
.drop-text .fname { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop.has-file .fname { color: var(--ok); font-weight: 600; }
.drop-text small { font-size: 12px; color: var(--text-3); }
.cmp-opts { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface); }
.cmp-opts summary { cursor: pointer; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.cmp-opts summary svg { width: 15px; height: 15px; }
.opts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 10px 20px; margin-top: 12px; align-items: end; }
.opts-grid .field { grid-column: auto; }
.opt { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; padding: 6px 0; }
.opt:has(input:disabled) { opacity: .5; }
.diffview { max-height: 640px; }
.diffview td { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; vertical-align: top; }
.diffview th.ln, .diffview td.ln { width: 1%; white-space: nowrap; color: var(--text-3); text-align: right; font-size: 11.5px; user-select: none; }
.diffview td.dc { width: 49%; }
.d-del td.dc:nth-child(2) { background: var(--err-soft); }
.d-ins td.dc:nth-child(4) { background: var(--ok-soft); }
.d-chg td.dc { background: var(--warn-soft); }
.d-eq td { color: var(--text-2); }
.dgap td { text-align: center; color: var(--text-3); font-size: 12px; background: var(--surface-2); font-family: var(--sans); }
td.dc del { background: color-mix(in srgb, var(--err) 28%, transparent); color: inherit; text-decoration: line-through; border-radius: 3px; }
td.dc ins { background: color-mix(in srgb, var(--ok) 30%, transparent); color: inherit; text-decoration: none; border-radius: 3px; }
.dtable td.dc { white-space: pre-wrap; word-break: break-word; }

/* Jira Issue Fetcher: collapsible connection card */
details.card > summary::-webkit-details-marker { display: none; }
details.card:not([open]) > summary.card-head { border-bottom: 0; }
