:root {
  color-scheme: dark;
  --bg: #08090d;
  --bg-elevated: #0d0f16;
  --panel: rgba(18, 20, 29, .84);
  --panel-solid: #12141d;
  --panel-soft: #171a25;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f4f2f7;
  --muted: #9a9baa;
  --quiet: #686a79;
  --violet: #a98cff;
  --violet-bright: #cbbaff;
  --cyan: #70e8d1;
  --amber: #f0c971;
  --red: #ff7e8f;
  --radius: 22px;
  --radius-small: 14px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  --topbar: 76px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 76% -10%, rgba(121, 82, 221, .17), transparent 31rem),
    radial-gradient(circle at 4% 42%, rgba(42, 171, 156, .06), transparent 30rem),
    var(--bg);
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: .25;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 12px 16px;
  border-radius: 10px;
  background: white;
  color: black;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(20px, 3vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 9, 13, .78);
  backdrop-filter: blur(22px) saturate(145%);
}
.brand { display: inline-flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(203, 186, 255, .45);
  border-radius: 12px;
  color: var(--violet-bright);
  font-weight: 900;
  box-shadow: inset 0 0 20px rgba(169, 140, 255, .12), 0 0 28px rgba(169, 140, 255, .1);
}
.brand strong { display: block; letter-spacing: -.02em; font-size: 18px; }
.brand small { display: block; margin-top: 3px; color: var(--quiet); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.status-chip {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  cursor: pointer;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--quiet); box-shadow: 0 0 0 5px rgba(104, 106, 121, .1); }
.status-dot.good { background: var(--cyan); box-shadow: 0 0 0 5px rgba(112, 232, 209, .1), 0 0 14px rgba(112, 232, 209, .65); }
.status-dot.warn { background: var(--amber); box-shadow: 0 0 0 5px rgba(240, 201, 113, .1); }
.status-dot.bad { background: var(--red); }
.avatar-button {
  width: 45px;
  height: 45px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: linear-gradient(145deg, #262236, #14151e);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  cursor: pointer;
}

.app-shell { min-height: calc(100vh - var(--topbar)); display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  display: flex;
  flex-direction: column;
  padding: 24px 17px 20px;
  border-right: 1px solid var(--line);
  background: rgba(10, 11, 16, .56);
}
.sidebar nav { display: grid; gap: 5px; }
.nav-item {
  min-height: 48px;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 680;
  cursor: pointer;
}
.nav-item span { color: var(--quiet); font-size: 18px; text-align: center; }
.nav-item b { min-width: 24px; padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,.05); font-size: 10px; text-align: center; }
.nav-item:hover, .nav-item.active { border-color: rgba(169, 140, 255, .17); background: linear-gradient(90deg, rgba(169, 140, 255, .13), rgba(169, 140, 255, .025)); color: white; }
.nav-item.active span { color: var(--violet-bright); }
.sidebar-card { margin-top: auto; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); }
.sidebar-card strong { display: block; margin: 8px 0 6px; font-size: 14px; }
.sidebar-card p { margin: 0 0 12px; color: var(--quiet); font-size: 12px; line-height: 1.65; }
.version { padding: 18px 6px 0; color: #50525f; font-size: 9px; font-weight: 800; letter-spacing: .12em; }

main { width: min(1500px, 100%); min-width: 0; padding: clamp(28px, 4vw, 58px); outline: 0; }
.view { display: none; animation: enter .26s ease both; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(7px); } }
.hero-line, .section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 26px; margin-bottom: 32px; }
.hero-line h1, .section-title h1 { max-width: 760px; margin: 8px 0 10px; font-size: clamp(30px, 4.4vw, 56px); line-height: 1.05; letter-spacing: -.045em; }
.section-title h1 { font-size: clamp(30px, 3.5vw, 46px); }
.hero-line p, .section-title p { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.72; }
.eyebrow { color: var(--violet-bright); font-size: 10px; font-weight: 900; letter-spacing: .22em; }

.button, .icon-button, .text-button { border: 0; cursor: pointer; }
.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 780;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { background: linear-gradient(135deg, #bca6ff, #8d6ceb); color: #0b0712; box-shadow: 0 12px 32px rgba(141, 108, 235, .19); }
.button.secondary { border-color: rgba(169, 140, 255, .22); background: rgba(169, 140, 255, .09); color: var(--violet-bright); }
.button.ghost { border-color: var(--line); background: rgba(255,255,255,.025); color: var(--muted); }
.button.danger { border-color: rgba(255,126,143,.25); background: rgba(255,126,143,.08); color: #ffadb7; }
.button.compact { min-height: 40px; padding: 0 13px; border-radius: 11px; font-size: 12px; }
.button.full { width: 100%; }
.icon-button { min-width: 44px; min-height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 20px; }
.text-button { min-height: 34px; padding: 0; background: transparent; color: var(--violet-bright); font-weight: 750; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { position: relative; overflow: hidden; min-height: 150px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(23,25,35,.86), rgba(13,15,22,.88)); box-shadow: 0 12px 35px rgba(0,0,0,.12); }
.metric-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { display: block; margin: 15px 0 5px; font-size: clamp(27px, 3vw, 39px); letter-spacing: -.045em; }
.metric-card small { color: var(--quiet); }
.metric-card::after { position: absolute; right: -50px; bottom: -75px; width: 150px; height: 150px; border: 1px solid rgba(255,255,255,.035); border-radius: 50%; content: ""; }
.glow-card { border-color: rgba(169,140,255,.22); background: radial-gradient(circle at 85% 10%, rgba(169,140,255,.14), transparent 55%), var(--panel); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .8fr); gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(15px); }
.priority-panel, .health-panel, .action-panel, .signal-panel, .performance-panel, .source-search-panel { padding: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 21px; }
.panel h2 { margin: 7px 0 0; font-size: 20px; letter-spacing: -.02em; }
.priority-panel { min-height: 360px; }
.health-panel { min-height: 360px; }
.action-panel { grid-column: 1 / -1; }
.signal-panel { grid-column: 1 / -1; }

.opportunity-list, .radar-list { display: grid; gap: 10px; }
.opportunity-card { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 17px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.021); }
.opportunity-card:hover { border-color: rgba(169,140,255,.21); background: rgba(169,140,255,.035); }
.score-ring { width: 64px; height: 64px; display: grid; place-content: center; border: 2px solid rgba(169,140,255,.46); border-radius: 50%; background: radial-gradient(circle, rgba(169,140,255,.13), transparent 68%); text-align: center; box-shadow: inset 0 0 20px rgba(169,140,255,.09); }
.score-ring strong { font-size: 22px; line-height: 1; }
.score-ring small { margin-top: 4px; color: var(--quiet); font-size: 7px; font-weight: 900; letter-spacing: .1em; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; color: var(--quiet); font-size: 10px; }
.tag { padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.05); font-weight: 900; letter-spacing: .06em; }
.tag.good { background: rgba(112,232,209,.1); color: var(--cyan); }
.tag.warn { background: rgba(240,201,113,.1); color: var(--amber); }
.tag.muted { color: #a6a8b5; }
.opportunity-copy h3 { margin: 7px 0 5px; font-size: 16px; }
.opportunity-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.micro-metrics { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 11px; color: var(--quiet); font-size: 10px; }
.micro-metrics b { color: #cbcbd3; }
.card-actions { display: flex; align-items: center; gap: 8px; }
.delete-opportunity { color: var(--red); }

.health-list { display: grid; }
.health-list > div { min-height: 69px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.health-list > div:last-child { border-bottom: 0; }
.health-list p { margin: 0; }
.health-list strong, .health-list small { display: block; }
.health-list strong { font-size: 13px; }
.health-list small { margin-top: 4px; color: var(--quiet); font-size: 10px; }
.health-list b { color: var(--quiet); font-size: 8px; letter-spacing: .1em; }
.health-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.05); color: var(--quiet); font-weight: 900; }
.health-icon.good { background: rgba(112,232,209,.1); color: var(--cyan); }
.health-icon.warn { background: rgba(240,201,113,.1); color: var(--amber); }
.health-icon.bad { background: rgba(255,126,143,.1); color: var(--red); }
.health-panel > .button { margin-top: 16px; }

.action-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.action-trio button { min-height: 118px; display: grid; grid-template-columns: 45px 1fr; grid-template-rows: auto auto; align-content: center; column-gap: 15px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.02); text-align: left; cursor: pointer; }
.action-trio button:hover { border-color: rgba(169,140,255,.28); background: rgba(169,140,255,.05); }
.action-trio span { grid-row: 1 / 3; color: var(--violet-bright); font-size: 11px; font-weight: 900; letter-spacing: .1em; }
.action-trio strong { font-size: 16px; }
.action-trio small { color: var(--quiet); }
.signal-summary { min-height: 100px; display: flex; align-items: center; }
.signal-empty p, .signal-note { color: var(--muted); line-height: 1.6; }
.signal-stat { display: grid; min-width: 220px; }
.signal-stat span, .signal-stat small { color: var(--quiet); }
.signal-stat strong { margin: 4px 0; font-size: 38px; color: var(--cyan); }

.toolbar { display: flex; gap: 12px; margin-bottom: 18px; }
.search-field { flex: 1; position: relative; }
.search-field span { position: absolute; top: 50%; left: 17px; z-index: 1; color: var(--quiet); transform: translateY(-50%); }
.search-field input { padding-left: 43px; }
.toolbar select { width: 180px; }
.radar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.formula-card { position: sticky; top: calc(var(--topbar) + 22px); padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(15,17,24,.9); }
.formula-card h3 { margin: 8px 0 18px; }
.formula-card ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.formula-card li { display: flex; gap: 10px; color: var(--muted); font-size: 12px; }
.formula-card li span { width: 35px; color: var(--violet-bright); font-weight: 900; }
.formula-card p { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--quiet); font-size: 11px; line-height: 1.6; }

input, select, textarea {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: rgba(7,8,12,.68);
  color: var(--text);
  font-size: 16px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
textarea { min-height: 98px; resize: vertical; line-height: 1.58; }
input:focus, select:focus, textarea:focus { border-color: rgba(169,140,255,.65); box-shadow: 0 0 0 4px rgba(169,140,255,.1); }
label { display: block; color: #b8b8c4; font-size: 12px; font-weight: 680; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.forge-grid, .insight-grid, .settings-grid { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr); gap: 18px; align-items: start; }
.form-panel, .output-panel, .import-panel, .setting-card { padding: 24px; }
.form-panel { display: grid; gap: 17px; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-note, .fine-print { margin: 0; color: var(--quiet); font-size: 11px; line-height: 1.6; }
.output-panel { min-height: 540px; }
.output-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,0,0,.18); }
.output-tabs button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--quiet); font-weight: 750; cursor: pointer; }
.output-tabs button.active { background: rgba(169,140,255,.13); color: var(--violet-bright); }
.empty-state { min-height: 350px; display: grid; place-content: center; justify-items: center; padding: 28px; color: var(--quiet); text-align: center; }
.empty-state > span { color: var(--violet); font-size: 32px; }
.empty-state h3 { margin: 12px 0 4px; color: var(--text); }
.empty-state p { max-width: 430px; margin: 0; line-height: 1.6; }
.compact-empty { min-height: 230px; }
.compact-empty .button { margin-top: 16px; }
.draft-block { margin-top: 18px; }
.draft-block > div { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; color: var(--violet-bright); font-size: 9px; font-weight: 900; letter-spacing: .13em; }
.draft-block button { min-height: 36px; border: 0; background: transparent; color: var(--cyan); cursor: pointer; }
.draft-block textarea { margin: 0; }
.review-box { margin-top: 17px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; font-size: 12px; line-height: 1.6; }
.review-box.warn { border-color: rgba(240,201,113,.19); background: rgba(240,201,113,.055); color: #dbc58f; }
.review-box.good { border-color: rgba(112,232,209,.18); background: rgba(112,232,209,.05); color: var(--cyan); }
.review-box ul { margin: 8px 0 0; padding-left: 18px; }
.output-panel details { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); }
.output-panel details ol { padding-left: 20px; line-height: 1.8; }

.insight-grid { grid-template-columns: 1.3fr .7fr; }
.import-panel p { color: var(--muted); line-height: 1.7; }
.file-drop { min-height: 180px; display: grid; place-content: center; justify-items: center; margin-top: 20px; border: 1px dashed rgba(169,140,255,.35); border-radius: 18px; background: rgba(169,140,255,.035); cursor: pointer; }
.file-drop span { color: var(--violet-bright); font-size: 28px; }
.file-drop strong { margin: 6px 0; color: white; }
.file-drop small { color: var(--quiet); }
.csv-result { margin-top: 16px; color: var(--cyan); }
.csv-result p { margin: 6px 0 0; color: var(--muted); }
.performance-panel { margin-top: 18px; }
.performance-list { overflow-x: auto; }
.performance-row { min-width: 760px; min-height: 68px; display: grid; grid-template-columns: minmax(190px, 1.6fr) repeat(4, minmax(80px, .65fr)) 44px; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.performance-row:first-child { border-top: 0; }
.performance-row div span, .performance-row div strong { display: block; }
.performance-row div span { color: var(--quiet); font-size: 9px; }
.performance-row div strong, .performance-row div b { margin-top: 4px; font-size: 12px; }

.source-search-panel { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(250px, .6fr); gap: 22px; align-items: end; }
.source-search { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: end; }
.check-row { min-height: 48px; display: flex; align-items: center; gap: 10px; }
.check-row input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--violet); }
.notice { padding: 16px; border-left: 2px solid var(--amber); background: rgba(240,201,113,.045); }
.notice p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.source-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.source-card { overflow: hidden; display: grid; grid-template-columns: 200px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.source-card img { width: 100%; height: 100%; min-height: 180px; object-fit: cover; background: var(--panel-soft); }
.source-card > div { min-width: 0; padding: 18px; }
.source-card span { color: var(--quiet); font-size: 10px; }
.source-card h3 { margin: 8px 0; font-size: 15px; }
.source-card p { overflow: hidden; display: -webkit-box; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.source-actions { display: flex; gap: 8px; margin-top: 14px; }
.loading-card { grid-column: 1 / -1; min-height: 180px; display: grid; place-items: center; color: var(--muted); }

.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.setting-card { position: relative; min-height: 310px; }
.setting-number { color: var(--violet-bright); font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.setting-card h2 { margin: 12px 0 8px; }
.setting-card > p { color: var(--muted); line-height: 1.7; }
.setting-card form { display: grid; gap: 14px; margin-top: 22px; }
.connection-row { min-height: 54px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.connection-row b { color: #d3d1d8; font-size: 10px; }
.inline-status { margin-top: 13px; color: var(--quiet); font-size: 11px; }
.inline-status.good { color: var(--cyan); }
.inline-status.bad { color: var(--red); }
.button-stack { display: grid; gap: 9px; margin-top: 22px; }
.file-button { cursor: pointer; }
.danger-card { border-color: rgba(255,126,143,.13); }

dialog { width: min(760px, calc(100% - 28px)); max-height: min(900px, calc(100dvh - 28px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 24px; background: #10121a; color: var(--text); box-shadow: 0 40px 100px rgba(0,0,0,.65); }
dialog::backdrop { background: rgba(2,3,6,.76); backdrop-filter: blur(9px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 7px 0 0; }
.dialog-scroll { max-height: calc(100dvh - 190px); overflow: auto; display: grid; gap: 16px; padding: 23px 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px; border-top: 1px solid var(--line); background: rgba(0,0,0,.14); }
.slider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 22px; }
.slider-grid label { position: relative; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; }
.slider-grid output { float: right; color: var(--violet-bright); }
.slider-grid input { height: 25px; min-height: 25px; padding: 0; border: 0; background: transparent; box-shadow: none; accent-color: var(--violet); }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(420px, calc(100% - 32px)); padding: 14px 18px; border: 1px solid rgba(112,232,209,.2); border-radius: 13px; background: #151922; color: var(--cyan); box-shadow: 0 18px 50px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast[data-tone="warn"] { border-color: rgba(240,201,113,.25); color: var(--amber); }
.toast[data-tone="bad"] { border-color: rgba(255,126,143,.25); color: var(--red); }
.mobile-only, .bottom-nav { display: none; }

.ghost-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 340px);
  align-items: end;
  gap: 26px;
  margin-bottom: 24px;
}
.ghost-hero h1 { margin: 8px 0 11px; font-size: clamp(38px, 6vw, 76px); line-height: .98; letter-spacing: -.06em; }
.ghost-hero p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.7; }
.ghost-privacy { display: grid; gap: 5px; padding: 18px; border: 1px solid rgba(112,232,209,.17); border-radius: 17px; background: rgba(112,232,209,.04); }
.ghost-privacy span { color: var(--cyan); font-size: 9px; font-weight: 900; letter-spacing: .18em; }
.ghost-privacy strong { font-size: 14px; }
.ghost-privacy small { color: var(--quiet); line-height: 1.5; }
.ghost-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); gap: 18px; align-items: start; }
.ghost-console, .ghost-pipeline, .ghost-result { padding: clamp(20px, 3vw, 30px); }
.ghost-console { display: grid; gap: 17px; }
.ghost-drop {
  min-height: 270px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 28px;
  border: 1px dashed rgba(169,140,255,.48);
  border-radius: 22px;
  background: radial-gradient(circle at 50% 44%, rgba(169,140,255,.12), transparent 48%), rgba(169,140,255,.025);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.ghost-drop:hover, .ghost-drop.dragging { border-color: var(--violet-bright); background-color: rgba(169,140,255,.07); transform: translateY(-1px); }
.ghost-orb { width: 67px; height: 67px; display: grid; place-items: center; margin-bottom: 13px; border: 1px solid rgba(203,186,255,.45); border-radius: 22px; background: linear-gradient(145deg, rgba(188,166,255,.18), rgba(112,232,209,.07)); color: var(--violet-bright); font-size: 27px; box-shadow: 0 0 45px rgba(169,140,255,.13); }
.ghost-drop strong { color: white; font-size: 20px; }
.ghost-drop small { margin-top: 7px; color: var(--muted); line-height: 1.55; }
.ghost-drop em { margin-top: 14px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.05); color: var(--quiet); font-size: 10px; font-style: normal; }
.ghost-media-preview { overflow: hidden; min-height: 110px; padding: 13px; border: 1px solid var(--line); border-radius: 15px; color: var(--muted); font-size: 12px; }
.ghost-media-preview img, .ghost-media-preview video { width: 100%; max-height: 230px; display: block; border-radius: 11px; background: #050609; object-fit: contain; }
.ghost-media-preview p { margin: 9px 0 0; }
.ghost-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.ghost-pair-status { margin-top: -7px; color: var(--quiet); font-size: 10px; line-height: 1.5; }
.ghost-pair-status.good { color: var(--cyan); }
.ghost-corrections { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; }
.ghost-corrections summary { min-height: 30px; color: var(--muted); cursor: pointer; }
.ghost-corrections[open] summary { margin-bottom: 15px; }
.ghost-corrections > label, .ghost-corrections > .field-grid { margin-top: 13px; }
.ghost-run { min-height: 62px; font-size: 17px; }
.ghost-run span { font-size: 21px; }
.ghost-pipeline { position: sticky; top: calc(var(--topbar) + 20px); }
.ghost-pipeline h2 { margin-bottom: 18px; font-size: 26px; }
.pipeline-list { display: grid; }
.pipeline-list > div { min-height: 76px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; border-top: 1px solid var(--line); }
.pipeline-list > div > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.045); color: var(--quiet); font-size: 9px; font-weight: 900; }
.pipeline-list p { margin: 0; }
.pipeline-list strong, .pipeline-list small { display: block; }
.pipeline-list strong { font-size: 12px; }
.pipeline-list small { margin-top: 4px; color: var(--quiet); font-size: 9px; line-height: 1.45; }
.pipeline-list b { color: var(--quiet); font-size: 8px; letter-spacing: .09em; }
.pipeline-list > div.running > span { background: rgba(169,140,255,.13); color: var(--violet-bright); animation: ghostPulse 1s ease-in-out infinite alternate; }
.pipeline-list > div.running b { color: var(--violet-bright); }
.pipeline-list > div.done > span { background: rgba(112,232,209,.11); color: var(--cyan); }
.pipeline-list > div.done b { color: var(--cyan); }
.pipeline-list > div.warn > span { background: rgba(240,201,113,.1); color: var(--amber); }
.pipeline-list > div.warn b { color: var(--amber); }
@keyframes ghostPulse { to { box-shadow: 0 0 20px rgba(169,140,255,.35); } }
.dna-mini { display: grid; gap: 4px; margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.02); }
.dna-mini span { color: var(--muted); font-size: 10px; }
.dna-mini strong { color: var(--violet-bright); font-size: 23px; }
.dna-mini small { color: var(--quiet); font-size: 9px; line-height: 1.55; }
.ghost-result { margin-top: 18px; }
.ghost-result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.ghost-result-head h2 { font-size: 24px; }
.ghost-result-head h2 span { color: var(--cyan); }
.ghost-result-head p { max-width: 700px; margin: 7px 0 0; color: var(--muted); line-height: 1.6; }
.ghost-output-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.performance-scan { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 18px; margin-bottom: 18px; padding: 22px; }
.performance-scan h2 { margin: 7px 0 5px; }
.performance-scan p { margin: 0; color: var(--muted); line-height: 1.6; }
.performance-scan .inline-status { grid-column: 1 / -1; margin: 0; }
.setting-card #forgetOwnerKey { margin-top: 9px; color: var(--quiet); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .action-panel, .signal-panel { grid-column: auto; }
  .radar-layout { grid-template-columns: 1fr; }
  .formula-card { position: static; }
  .source-results { grid-template-columns: 1fr; }
  .source-search-panel { grid-template-columns: 1fr; }
  .ghost-grid { grid-template-columns: 1fr; }
  .ghost-pipeline { position: static; }
}

@media (max-width: 780px) {
  :root { --topbar: 65px; }
  .mobile-only { display: grid; }
  .topbar { padding: 0 14px; gap: 10px; }
  .brand { margin-right: auto; }
  .brand small, .avatar-button, .status-chip span:not(.status-dot) { display: none; }
  .status-chip { min-width: 42px; justify-content: center; padding: 0; }
  .app-shell { display: block; }
  .sidebar { position: fixed; top: var(--topbar); left: 0; z-index: 45; width: min(290px, 86vw); height: calc(100dvh - var(--topbar)); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 25px 0 70px rgba(0,0,0,.55); }
  .sidebar.open { transform: translateX(0); }
  main { padding: 28px 18px calc(95px + env(safe-area-inset-bottom)); }
  .bottom-nav { position: fixed; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); left: 12px; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px; border: 1px solid var(--line-strong); border-radius: 18px; background: rgba(18,20,29,.91); box-shadow: 0 18px 55px rgba(0,0,0,.56); backdrop-filter: blur(22px); }
  .bottom-nav button { min-height: 52px; display: grid; place-content: center; gap: 3px; border: 0; border-radius: 12px; background: transparent; color: var(--quiet); font-size: 9px; cursor: pointer; }
  .bottom-nav button span { font-size: 18px; line-height: 1; }
  .bottom-nav button.active { background: rgba(169,140,255,.1); color: var(--violet-bright); }
  .bottom-nav .capture-nav span { width: 37px; height: 37px; display: grid; place-items: center; margin: -19px auto 1px; border-radius: 13px; background: linear-gradient(135deg, #bca6ff, #8d6ceb); color: #0b0712; box-shadow: 0 8px 25px rgba(141,108,235,.38); }
  .forge-grid, .insight-grid, .settings-grid { grid-template-columns: 1fr; }
  .source-search { grid-template-columns: 1fr; }
  .ghost-hero { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero-line, .section-title { display: grid; align-items: start; margin-bottom: 25px; }
  .hero-line h1, .section-title h1 { font-size: 34px; }
  .hero-line .button, .section-title .button { width: 100%; }
  .metric-grid { gap: 9px; }
  .metric-card { min-height: 126px; padding: 17px; border-radius: 17px; }
  .metric-card strong { margin-top: 12px; font-size: 27px; }
  .priority-panel, .health-panel, .action-panel, .signal-panel, .performance-panel, .source-search-panel, .form-panel, .output-panel, .import-panel, .setting-card { padding: 18px; border-radius: 18px; }
  .opportunity-card { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .score-ring { width: 52px; height: 52px; }
  .score-ring strong { font-size: 18px; }
  .card-actions { grid-column: 1 / -1; }
  .card-actions .button { flex: 1; }
  .micro-metrics { gap: 9px; }
  .action-trio { grid-template-columns: 1fr; }
  .action-trio button { min-height: 84px; }
  .toolbar { display: grid; }
  .toolbar select { width: 100%; }
  .field-grid, .field-grid.three, .slider-grid { grid-template-columns: 1fr; }
  .choice-row { grid-template-columns: 1fr; }
  .output-tabs { overflow-x: auto; grid-template-columns: repeat(4, minmax(76px, 1fr)); }
  .source-card { grid-template-columns: 1fr; }
  .source-card img { height: 190px; }
  .dialog-head, .dialog-scroll, .dialog-actions { padding-right: 17px; padding-left: 17px; }
  .dialog-actions .button { flex: 1; }
  .toast { right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); left: 16px; }
  .button, .icon-button, input, select { min-height: 48px; }
  input, select, textarea { font-size: 16px; }
  .ghost-hero h1 { font-size: 43px; }
  .ghost-drop { min-height: 230px; padding: 22px 16px; }
  .ghost-link-row, .ghost-output-grid, .performance-scan { grid-template-columns: 1fr; }
  .ghost-link-row .button, .performance-scan .button { width: 100%; }
  .ghost-result-head { display: grid; }
  .ghost-result-head .button { width: 100%; }
  .ghost-console, .ghost-pipeline, .ghost-result { padding: 18px; border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
