:root {
  --bg: #0a0f18;
  --bg-soft: #0d1420;
  --panel: #111a28;
  --panel-2: #16212f;
  --line: #1f2c3e;
  --line-soft: #192436;
  --text: #e9eef7;
  --muted: #93a3ba;
  --muted-2: #6b7c93;
  --accent: #34d399;
  --accent-ink: #04231d;
  --cyan: #4cc4f7;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
  --sidebar: 236px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 20px; line-height: 1.3; }
h2 { font-size: 18px; line-height: 1.35; }
h3 { font-size: 16px; line-height: 1.4; }
h4 { font-size: 13.5px; line-height: 1.4; }
p { margin: 0; }
code { background: #0b1420; padding: 2px 6px; border-radius: 5px; font-size: 12.5px; color: #cbd5e1; }
.muted { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.hint { color: var(--muted-2); font-size: 12.5px; line-height: 1.65; margin-top: 12px; max-width: 92ch; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; }
.mt { margin-top: 22px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}
.btn:hover { background: #1d2939; border-color: #2d3d54; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: #4ade9f; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #162130; }
.btn.danger { color: #fca5a5; border-color: #3b2027; background: #1c1219; }
.btn.small { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: saturate(.35); }
.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--cyan);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.link:hover { text-decoration: underline; }

/* -------------------------------------------------------------------- login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 56px;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  max-width: 1060px;
  margin: 0 auto;
}
.login-side { display: grid; gap: 18px; max-width: 460px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand strong { display: block; font-size: 15px; }
.login-side h2 { font-size: clamp(24px, 3vw, 32px); line-height: 1.25; letter-spacing: -0.02em; }
.login-points { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 11px; color: var(--muted); font-size: 13.5px; }
.login-points li { position: relative; padding-left: 20px; line-height: 1.5; }
.login-points li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.login-card {
  width: 100%;
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  display: grid;
  gap: 15px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, .5);
}
.login-card h1 { font-size: 20px; }

/* --------------------------------------------------------------------- form */
label { display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; line-height: 1.45; }
input, select, textarea {
  width: 100%;
  background: #0c1522;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.4;
}
input[readonly] { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(76, 196, 247, .4); outline-offset: 1px; border-color: #2b4c7e; }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row input { flex: 1; min-width: 0; }
.secret-row .btn { flex: none; }

/* ------------------------------------------------------------------ layout */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  z-index: 30;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; }
.side-brand strong { display: block; font-size: 14px; letter-spacing: -0.01em; line-height: 1.35; }
.side-note { font-size: 10.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .09em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #22d3ee);
  color: #04241f;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .02em;
  flex: none;
}
.side-nav { display: grid; gap: 3px; align-content: start; overflow-y: auto; flex: 1; padding-bottom: 8px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #c6d2e2;
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: #162130; color: var(--text); }
.nav-item.active { background: #182637; color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav-ico { width: 16px; text-align: center; color: var(--muted-2); font-size: 13px; flex: none; }
.nav-item.active .nav-ico { color: var(--accent); }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #0b1220;
  background: var(--warn);
  border-radius: 999px;
  padding: 1px 6px;
}
.nav-badge:empty { display: none; }
.side-foot { border-top: 1px solid var(--line); padding: 13px 8px 0; display: grid; gap: 9px; }
.side-user { font-size: 11.5px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .btn { justify-self: start; }

.shell { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 30px;
  background: rgba(10, 15, 24, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.page-head { display: grid; gap: 3px; min-width: 0; }
.page-head .muted { font-size: 13px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn {
  display: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 9px;
  font-size: 15px;
  cursor: pointer;
  flex: none;
}

main { padding: 26px 30px 72px; width: 100%; max-width: 1260px; }
.view { display: none; }
.view.active { display: block; }

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-head > div { flex: 1 1 340px; min-width: 0; }
.card-head .muted { margin-top: 5px; max-width: 78ch; }
.card-head .row-actions { flex: none; padding-top: 2px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin-bottom: 0; }
.grid-2 > .card { height: fit-content; }

/* --------------------------------------------------------------------- KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi {
  background: linear-gradient(180deg, var(--panel), #0e1726);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}
.kpi span { font-size: 12px; color: var(--muted); font-weight: 600; line-height: 1.4; }
.kpi strong { font-size: 26px; letter-spacing: -0.03em; font-weight: 700; line-height: 1.15; }
.kpi small { font-size: 12px; color: var(--muted-2); line-height: 1.45; }
.kpi small b { color: var(--muted); }
.kpi.accent { border-color: rgba(52, 211, 153, .32); background: linear-gradient(180deg, #0f241f, #0e1726); }
.kpi.accent strong { color: var(--accent); }

/* ---------------------------------------------------------------- progress */
.progress { height: 7px; border-radius: 999px; background: #0b1420; overflow: hidden; margin: 2px 0 16px; }
.progress span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #10b981, #22d3ee); transition: width .3s ease; }

/* ------------------------------------------------------------- task / list */
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.task-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #0e1725;
}
.task-list .task-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: rgba(251, 191, 36, .14);
  color: #fcd34d;
  margin-top: 1px;
}
.task-list .task-title { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.5; color: #e2e9f4; }
.task-list .task-detail { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.55; margin-top: 3px; }
.task-list .task-action { display: block; color: var(--cyan); font-size: 12.5px; line-height: 1.5; margin-top: 4px; }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.checklist li { display: flex; gap: 11px; align-items: flex-start; padding: 11px 14px; font-size: 13px; line-height: 1.55; border-bottom: 1px solid var(--line-soft); }
.checklist li:last-child { border-bottom: 0; }
.checklist .mark { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; margin-top: 1px; }
.checklist .mark.ok { background: rgba(52, 211, 153, .16); color: #6ee7b7; }
.checklist .mark.todo { background: rgba(251, 191, 36, .14); color: #fcd34d; }
.checklist .owner { display: block; color: var(--muted-2); font-size: 12px; margin-top: 2px; }

.fact-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.fact { border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px 14px; display: grid; gap: 4px; background: #0e1725; }
.fact span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fact strong { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }

/* ----------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.55;
}
.timeline li:last-child { border-bottom: 0; }
.timeline .ts { color: var(--muted-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.timeline .act { color: #dbe4f0; min-width: 0; }
.timeline .act .det { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.timeline .lvl { display: none; }
.timeline li.warn .act { color: #fcd34d; }
.timeline li.error .act { color: #fca5a5; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge.green { background: rgba(52, 211, 153, .14); color: #6ee7b7; }
.badge.cyan { background: rgba(76, 196, 247, .14); color: #7dd3fc; }
.badge.amber { background: rgba(251, 191, 36, .14); color: #fcd34d; }
.badge.red { background: rgba(248, 113, 113, .14); color: #fca5a5; }
.badge.grey { background: rgba(148, 163, 184, .12); color: #cbd5e1; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; background: #0e1725; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.wide { min-width: 820px; }
th {
  text-align: left;
  padding: 11px 14px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted-2);
  background: #0c1521;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-weight: 700;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: #d7e1ee; line-height: 1.55; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #131d2c; }
td a { color: var(--cyan); text-decoration: none; }
td a:hover { text-decoration: underline; }
td .muted { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.chips-line { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid button { justify-self: start; align-self: end; }
.form-section {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 6px 18px 18px;
  margin: 0;
  min-width: 0;
}
.form-section legend {
  padding: 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  font-weight: 700;
}
.form-section > .form-grid { margin-top: 8px; }
.form-actions { display: flex; justify-content: flex-start; padding-top: 2px; }
.fold { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.fold summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 2px 0; }
.fold summary:hover { color: var(--text); }
.fold .form-grid { margin-top: 16px; }
.fold .table-wrap { margin-top: 14px; }
.fold-card > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  list-style-position: inside;
}
.fold-card > summary::marker { color: var(--accent); }
.fold-body { margin-top: 16px; display: grid; gap: 14px; }
.fold-body .table-wrap { margin-top: 0; }

/* ----------------------------------------------------------------- filters */
.filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: #2c3c55; }
.chip.active { background: #16263a; border-color: #2f4a68; color: #fff; }

/* --------------------------------------------------------------- notes etc */
.banner { display: none; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.banner.show { display: flex; }
.note {
  display: block;
  background: rgba(76, 196, 247, .07);
  border: 1px solid rgba(76, 196, 247, .2);
  color: #a5e5f7;
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.note.warn { background: rgba(251, 191, 36, .07); border-color: rgba(251, 191, 36, .24); color: #fde68a; }
.note a { color: #67e8f9; }
#revenue-status { margin-bottom: 18px; }

.stack { display: grid; gap: 14px; }
.proposal-card { display: grid; gap: 12px; }
.proposal-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.proposal-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.65;
  color: #cbd5e1;
  background: #0c1521;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0;
  max-height: 280px;
  overflow: auto;
}

/* ------------------------------------------------------------------ dialog */
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  width: min(560px, calc(100vw - 32px));
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6);
}
dialog::backdrop { background: rgba(3, 8, 18, .72); backdrop-filter: blur(3px); }
dialog form { display: grid; gap: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #102033;
  border: 1px solid #2b4c7e;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
  z-index: 60;
}
.toast.error { border-color: #7f1d1d; color: #fecaca; }

.scrim { display: none; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .kpi-grid, .kpi-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 60px rgba(0,0,0,.6); }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(4, 8, 16, .6); z-index: 25; }
  .shell { margin-left: 0; }
  .icon-btn { display: grid; place-items: center; }
  .login-wrap { grid-template-columns: 1fr; max-width: 460px; gap: 28px; padding: 32px 20px; }
  .login-side { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  main { padding: 18px 16px 56px; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar-actions .btn.ghost { display: none; }
  .page-head h1 { font-size: 17px; }
  .page-head .muted { display: none; }
  .card { padding: 17px 16px; }
  .card-head { gap: 12px; margin-bottom: 14px; }
  .card-head > div { flex-basis: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .timeline .ts { font-size: 11.5px; }
  .kpi-grid, .kpi-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px; gap: 5px; }
  .kpi strong { font-size: 20px; }
  .kpi span { font-size: 11.5px; }
  .kpi small { font-size: 11px; }
  .fact-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .task-list li { padding: 11px 12px; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; }
  .form-section { padding: 4px 13px 15px; }
}

@media (max-width: 380px) {
  .kpi-grid, .kpi-grid.three { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ AI worker */
.subtabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 16px; padding-bottom: 4px; }
.subtab {
  border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.03); color: #a8b6cc;
  border-radius: 999px; padding: 7px 14px; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.subtab:hover { color: #e6edf7; border-color: rgba(255,255,255,.2); }
.subtab.active { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.aipanel { display: none; }
.aipanel.active { display: block; }
.provider-row {
  display: flex; justify-content: space-between; gap: 14px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.07);
}
.provider-row:last-child { border-bottom: 0; }
.provider-row > div { min-width: 0; }
.idea-card {
  border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.02);
  border-radius: 12px; padding: 14px 15px; margin-bottom: 12px;
}
.idea-card h4 { margin: 0 0 3px; font-size: 14.5px; }
.idea-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.idea-card p { margin: 8px 0 0; font-size: 13px; line-height: 1.55; }
.qa-list { list-style: none; padding: 0; margin: 6px 0 0; }
.qa-list li { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid rgba(255,255,255,.05); }
.kpi-text { font-size: 15px !important; line-height: 1.35; word-break: break-word; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.inline { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #a8b6cc; }
.inline input { width: 72px; padding: 5px 7px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-body { max-height: 62vh; overflow: auto; font-size: 13px; line-height: 1.6; }
.dialog-body h4 { margin: 16px 0 6px; font-size: 13px; }
dialog#ai-detail { width: min(780px, 94vw); }
details.mini summary { cursor: pointer; color: #8ea4c4; font-size: 12px; margin-top: 8px; }

/* --------------------------------------------------- background job dock */
.job-dock { display: grid; gap: 12px; margin: 0 0 16px; }
.job-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.job-card.cyan { border-color: #1e4a5e; }
.job-card.green { border-color: #1c4a3a; }
.job-card.red { border-color: #4a2229; }
.job-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.job-head strong { font-size: 14px; }
.job-progress { margin: 10px 0; }
.job-stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted-2);
}
.job-stages li { display: inline-flex; align-items: center; gap: 6px; }
.job-stages .dot { width: 7px; height: 7px; border-radius: 50%; background: #24344a; flex: none; }
.job-stages li.done { color: var(--muted); }
.job-stages li.done .dot { background: #10b981; }
.job-stages li.now { color: var(--text); font-weight: 600; }
.job-stages li.now .dot { background: var(--cyan); box-shadow: 0 0 0 3px rgba(76, 196, 247, .18); }

/* -------------------------------------------------------- real preview */
dialog#preview-dialog { width: min(1180px, 95vw); max-width: 1180px; }
.preview-body { max-height: 74vh; }
.preview-assets { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.preview-assets figure { margin: 0; }
.preview-assets img { width: 260px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.preview-assets figcaption { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }
.sheet-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.preview-stage {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: auto;
  max-height: 56vh;
}
.preview-stage img { display: block; width: 100%; height: auto; }
.preview-grid { background: #fff; color: #111; padding: 4px; }
.sheet-grid { border-collapse: collapse; font-size: 11.5px; }
.sheet-grid td {
  border: 1px solid #e2e8f0;
  padding: 4px 7px;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-preview {
  background: #fff;
  color: #111;
  border-radius: 10px;
  padding: 26px 30px;
  max-height: 56vh;
  overflow: auto;
}
.doc-preview h1 { font-size: 22px; margin: 0 0 14px; }
.doc-preview h2 { font-size: 17px; margin: 20px 0 8px; }
.doc-preview h3 { font-size: 14px; margin: 14px 0 6px; }
.doc-preview p { margin: 0 0 10px; line-height: 1.6; }
.doc-table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 12.5px; }
.doc-table td { border: 1px solid #dbe3ee; padding: 6px 8px; }
.preview-body .note { margin-top: 14px; }
.preview-body .note ul { margin: 8px 0 0; padding-left: 18px; }
.job-stages li.failed { color: #fca5a5; font-weight: 600; }
.job-stages li.failed .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, .18); }
/* ------------------------------------------------ unified product catalog */
.kpi-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1240px) { .kpi-grid.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .kpi-grid.six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.product-list { display: grid; gap: 14px; margin: 14px 0 10px; }
.product-card {
  display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px;
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2);
}
.pc-thumb {
  display: block; width: 168px; height: 168px; border-radius: 10px; overflow: hidden;
  background: #0b1420; border: 1px solid var(--line);
}
.pc-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pc-empty { display: grid; place-items: center; height: 100%; padding: 8px; text-align: center; color: var(--muted-2); font-size: 12px; }
.pc-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pc-title h4 { margin: 0 0 3px; font-size: 15px; }
.pc-title code { font-size: 11.5px; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: rgba(148, 163, 184, .10); color: var(--muted); }
.flag.ok { background: rgba(52, 211, 153, .13); color: #6ee7b7; }
.flag.off { background: rgba(148, 163, 184, .07); color: #94a3b8; }
.pc-actions { padding-top: 8px; border-top: 1px solid var(--line-soft); }
code.tiny { font-size: 11px; padding: 1px 5px; }
ul.clean { margin: 6px 0 0; padding-left: 18px; }
ul.clean li { margin-bottom: 3px; }

.choice {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer;
}
.choice input { margin-top: 4px; }
.choice strong { display: block; font-size: 13.5px; }
.choice small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.choice.second { border-color: rgba(248, 113, 113, .45); background: rgba(248, 113, 113, .06); }

.delivery-list { display: grid; gap: 10px; margin-top: 10px; }
.delivery-row { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: #0e1725; }
.dr-main { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dr-main span { font-size: 12.5px; }

.visual-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; margin-bottom: 12px; }
.visual-grid figure { margin: 0; display: grid; gap: 6px; }
.visual-grid img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: #0b1420; }
.visual-grid figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
dialog.wide { width: min(980px, 94vw); max-width: 980px; }

@media (max-width: 860px) {
  .product-card { grid-template-columns: 1fr; }
  .pc-thumb { width: 100%; height: auto; aspect-ratio: 1 / 1; }
  .visual-grid { grid-template-columns: 1fr; }
}
/* delete dialog: readable left-aligned choices, clear footer */
#delete-dialog { max-width: 560px; }
#delete-dialog .dialog-body { text-align: left; }
#delete-dialog .choice { align-items: flex-start; }
#delete-dialog .choice span { text-align: left; }
#delete-dialog .choice input { margin-top: 3px; }
#delete-dialog .dialog-body > .row-actions {
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
#delete-dialog .dialog-body > .row-actions .btn { min-width: 120px; }
#visual-dialog .dialog-body { text-align: left; }
#visual-dialog .visual-grid figcaption { justify-content: flex-start; }
#delete-dialog .choice { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; text-align: left; }
#delete-dialog .choice input { margin: 2px 0 0; justify-self: start; }
#delete-dialog .choice span { display: block; width: auto; max-width: none; }
details.fold { margin: 14px 0 4px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }
details.fold > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
details.fold[open] > summary { margin-bottom: 10px; }
details.fold .stack { display: grid; gap: 10px; }
@media (max-width: 760px) {
  .row-actions { flex-wrap: wrap; }
  .pc-actions { justify-content: flex-start; }
  .product-card .pc-head .row-actions { justify-content: flex-start; }
  .chip, .flag { font-size: 11px; }
}
@media (max-width: 760px) {
  .card-head { flex-wrap: wrap; }
  .card-head .row-actions { width: 100%; min-width: 0; overflow-x: auto; padding-bottom: 2px; }
}

/* ------------------------------------------------ bulud paneli əlavələri */
.fact strong.accent { color: var(--accent); }
.login-card .btn.primary { color: var(--accent-ink); text-decoration: none; }
.pc-body .hint { max-width: none; margin: 0; }
.chips-line { align-items: center; }
#ai-weak-wrap { margin-top: 0; }
#ai-weak-wrap > summary { list-style: none; }
.journal { width: 100%; }

.busy {
  position: fixed; inset: 0; z-index: 80; display: grid; place-content: center; justify-items: center;
  gap: 12px; background: rgba(4, 8, 16, .68); backdrop-filter: blur(2px);
  font-size: 13px; color: #dbe7f6;
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(52, 211, 153, .22); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .toast { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

/* ------------------------------------------------------- real önizləmə */
.preview-sheet {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  max-height: 46vh;
  background: #0b1420;
}
.preview-table { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.preview-table th,
.preview-table td {
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  border-right: 1px solid rgba(255, 255, 255, .04);
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}
.preview-table th {
  position: sticky;
  top: 0;
  background: #101c2c;
  font-weight: 600;
  color: #cfe1f5;
}
.preview-table tr:nth-child(even) td { background: rgba(255, 255, 255, .02); }
.qa-list .mark {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 800;
}
.qa-list .mark.ok { background: rgba(52, 211, 153, .16); color: #6ee7b7; }
.qa-list .mark.todo { background: rgba(251, 191, 36, .14); color: #fcd34d; }
dialog#delete-dialog .choice,
dialog#visual-dialog .choice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 8px;
}
#delete-result ul { margin: 8px 0 0; padding-left: 18px; }
#delete-result li { margin-bottom: 3px; }

/* --------------------------------------------------- vahid panel (v2) */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  justify-content: space-between; margin: 4px 0 14px;
}
.toolbar input[type="search"] {
  flex: 1 1 220px; min-width: 0; padding: 8px 12px;
  background: #0b1420; border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font-size: 13px;
}
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-title .muted { font-size: 12px; margin: 2px 0 4px; }
.price-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line-soft);
  border-radius: 10px; background: #0d1726;
}
.price-row label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.price-row input {
  width: 90px; padding: 6px 9px; background: #0b1420; border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font-size: 13px;
}
.price-row .hint { margin: 0; font-size: 11.5px; }
.pc-actions { margin-top: 6px; }
.pc-more { margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.pc-more summary { cursor: pointer; font-size: 12.5px; color: var(--muted); list-style: none; }
.pc-more summary::-webkit-details-marker { display: none; }
.pc-more summary::before { content: "▸ "; }
.pc-more[open] summary::before { content: "▾ "; }
.pc-more .row-actions { margin-top: 10px; }
.totals-line p { margin: 0 0 6px; font-size: 13.5px; line-height: 1.6; }
.totals-line p:last-child { margin-bottom: 0; }
.funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.funnel-step {
  position: relative; padding: 14px; border: 1px solid var(--line-soft);
  border-radius: 12px; background: #0d1726; display: flex; flex-direction: column; gap: 2px;
}
.funnel-index { font-size: 11px; color: var(--muted); }
.funnel-step strong { font-size: 22px; }
.funnel-step span { font-size: 12.5px; color: #cfe1f5; }
.funnel-step small { font-size: 11px; color: var(--muted); margin-top: 2px; }
.content-preview { line-height: 1.7; font-size: 14px; }
.content-preview h3 { margin: 0 0 6px; }
.content-preview div { margin-top: 10px; white-space: pre-wrap; }
#content-form textarea {
  width: 100%; padding: 9px 11px; background: #0b1420; border: 1px solid var(--line);
  border-radius: 9px; color: var(--text); font: inherit; resize: vertical;
}
#content-form .form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bottom-nav { display: none; }

@media (max-width: 760px) {
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: #0b1420; border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; gap: 2px;
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: 0; color: var(--muted); font-size: 10.5px;
    padding: 4px 2px; border-radius: 8px;
  }
  .bn-item span { font-size: 16px; }
  .bn-item.active { color: #fff; background: rgba(255, 255, 255, .06); }
  main { padding-bottom: 96px; }
  .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card { grid-template-columns: 1fr; }
  .product-card .pc-thumb { min-height: 150px; }
  .toolbar { align-items: stretch; }
  .card-head .row-actions { width: 100%; }
}

@media (max-width: 1024px) {
  .sidebar { padding-bottom: 80px; }
}

/* AI işçi — yuxarıdakı canlı proses paneli */
.live-card { margin-bottom: 14px; }
.live-card #ai-jobs { gap: 10px; }
.live-card .job-card { margin: 0; }
.live-card .job-stages { margin-bottom: 2px; }
.card-head #ai-live-count { white-space: nowrap; }
/* ------------------------------------------------------------ AI Marketinq */
.mkt-grid { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; margin-top: 12px; align-items: start; }
.mkt-thumb { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0b1420; padding: 0; }
.mkt-thumb img { display: block; width: 100%; height: auto; }
.mkt-empty { display: grid; place-items: center; min-height: 150px; color: var(--muted-2); font-size: 12px; }
.mkt-body { font-size: 13px; line-height: 1.65; color: #cbd5e1; margin: 0; }
.mkt-preview-figure { margin: 0 0 14px; }
.mkt-preview-figure img { width: 100%; max-width: 520px; border-radius: 12px; border: 1px solid var(--line); display: block; }
#mkt-product { width: auto; min-width: 210px; max-width: 100%; }
@media (max-width: 760px) {
  .mkt-grid { grid-template-columns: 1fr; }
  .mkt-thumb { max-width: 260px; }
}

.idea-card.flash {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .16);
  transition: box-shadow .2s ease;
}
