:root {
  --bg: #1b1740;
  --panel: #1e2b45;
  --panel-2: #243555;
  --line: #34476b;
  --text: #f3f5fb;
  --muted: #aab6d3;
  --accent: #1fb0f0;
  --accent-ink: #0b2233;
  --pink: #c7247d;
  --section: #ff5fa8;
  --good: #3ecf8e;
  --warn: #f5b041;
  --bad: #ef5a6f;
  --radius: 4px;
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { background: #1b1740; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(199, 36, 125, .55), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(38, 96, 190, .55), transparent 60%),
    linear-gradient(135deg, #2a2466 0%, #3b2468 50%, #1b1740 100%);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- layout */
.app { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(20, 22, 50, .72);
  backdrop-filter: blur(8px);
  border-right: 1px solid rgba(255,255,255,.06);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
/* ---------- sidebar: brand */
.sidebar-head { position: relative; padding: 4px 4px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: block; text-decoration: none; }
.brand-logo { display: block; width: 165px; height: auto; }
.brand-markimg { display: none; width: 44px; height: 44px; margin: 0 auto; }
.brand-sub { margin-top: 8px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.collapse-btn {
  position: absolute; top: 2px; right: -2px; width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
  transition: transform .2s, border-color .15s;
}
.collapse-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- sidebar: navigation buttons */
.nav-group { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--section); margin: 4px 4px 2px; white-space: nowrap; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px;
  background: rgba(36, 53, 85, .75); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 500; line-height: 1.2;
  box-shadow: 0 1px 0 rgba(0,0,0,.25);
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.nav-btn .ico { flex: none; color: var(--accent); }
.nav-btn .num { flex: none; font-size: 12px; font-weight: 800; color: var(--accent); width: 18px; }
.nav-btn .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-btn:hover { background: #2c4168; border-color: var(--accent); transform: translateX(2px); }
.nav-btn.off { background: rgba(36, 53, 85, .35); border-style: dashed; color: #8f9bb9; }
.nav-btn.off .ico, .nav-btn.off .num { color: #65739a; }
.nav-btn.off:hover { border-color: #65739a; transform: none; }
.nav-btn .tag { flex: none; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #8f9bb9; border: 1px solid #45557a; border-radius: 99px; padding: 1px 7px; }
.nav-btn.active {
  background: linear-gradient(135deg, #1fb0f0 0%, #3d8bff 100%); border-color: #8fdcff; color: #06182a; font-weight: 700;
  box-shadow: 0 0 0 3px rgba(31,176,240,.25), 0 8px 22px rgba(31,176,240,.35);
}
.nav-btn.active .ico, .nav-btn.active .num { color: #06182a; }
.nav-btn.active:hover { transform: none; }

/* ---------- sidebar: status */
.sidebar-foot .chip { display: inline-flex; align-items: center; gap: 6px; margin: 0 4px 4px 0; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.chip b { font-weight: 600; }
.model-line { margin-top: 4px; }

/* ---------- collapsed sidebar */
.app { transition: grid-template-columns .2s; }
.app.collapsed { grid-template-columns: 84px 1fr; }
.app.collapsed .sidebar { padding: 18px 12px; }
.app.collapsed .brand-logo, .app.collapsed .brand-sub { display: none; }
.app.collapsed .brand-markimg { display: block; }
.app.collapsed .sidebar-head { padding: 4px 0 14px; }
.app.collapsed .collapse-btn { position: static; margin: 10px auto 0; transform: rotate(180deg); }
.app.collapsed .nav-btn { justify-content: center; padding: 9px 0; }
.app.collapsed .nav-btn .lbl, .app.collapsed .nav-btn .num, .app.collapsed .nav-btn .tag { display: none; }
.app.collapsed .nav-btn:hover { transform: none; }
.app.collapsed .nav-label { height: 2px; margin: 4px 10px 4px; background: var(--section); border-radius: 2px; opacity: .8; }
.app.collapsed .nav-label span { display: none; }
.app.collapsed .sidebar-foot { text-align: center; }
.app.collapsed .sidebar-foot .chip { padding: 5px; }
.app.collapsed .sidebar-foot .chip b, .app.collapsed .model-line { display: none; }

.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--muted); }
.main { padding: 32px 40px 80px; min-width: 0; }
.menu-btn { display: none; }

/* ---------- panels */
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.page-head { margin-bottom: 24px; }
.page-head h1 .accent { color: var(--accent); }
.panel {
  background: var(--panel);
  border-top: 5px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.panel.plain { border-top-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.step-num { color: var(--accent); font-weight: 800; font-size: 22px; margin-right: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- form */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: #15203a; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 11px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { text-decoration: none; display: inline-block;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 9px 16px; border-radius: var(--radius);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: rgba(31,176,240,.06); }
.dropzone strong { color: var(--accent); }

/* ---------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--panel-2); border-radius: var(--radius); padding: 12px 14px; border-top: 3px solid var(--accent); }
.stat .v { font-size: 28px; font-weight: 800; color: var(--accent); line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); }
.stat.warn { border-top-color: var(--warn); } .stat.warn .v { color: var(--warn); }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.chip.good { color: var(--good); border-color: var(--good); }
.chip.warn { color: var(--warn); border-color: var(--warn); }
.chip.bad { color: var(--bad); border-color: var(--bad); }
.chip.info { color: var(--accent); border-color: var(--accent); }

/* ---------- swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 92px; font-size: 12px; }
.swatch .chipc { height: 44px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.15); }
.swatch .hex { font-weight: 600; margin-top: 3px; }
.swatch .lbl { color: var(--muted); }

/* ---------- tabs + tables */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { background: none; border: none; color: var(--muted); font: inherit; font-weight: 600; padding: 9px 14px; cursor: pointer; border-bottom: 3px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { color: var(--accent); margin-left: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
td select { padding: 5px 7px; font-size: 13px; min-width: 130px; }
td input[type=text] { padding: 5px 7px; font-size: 13px; }
tr.done td { opacity: .5; }
tr.hidden-slide td:first-child::after { content: ' hidden'; color: var(--warn); font-size: 11px; }
.slide-title { font-weight: 600; }
.reason { color: var(--muted); font-size: 13px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.list li:last-child { border-bottom: none; }

.progress { height: 8px; background: #15203a; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }

.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--panel); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 16px; cursor: pointer; }
.card:hover { background: var(--panel-2); }
.card .mini-swatches { display: flex; gap: 4px; margin: 8px 0; }
.card .mini-swatches span { width: 22px; height: 22px; border-radius: 3px; border: 1px solid rgba(255,255,255,.15); }

.stage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.stage-col h3 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--section); }
.stage-tile {
  display: flex; align-items: center; gap: 14px; background: var(--panel); border-top: 5px solid var(--accent);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; text-decoration: none; color: var(--text);
}
.stage-tile .n { font-size: 30px; font-weight: 800; color: var(--accent); width: 46px; }
.stage-tile .tile-ico { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 10px; background: rgba(31,176,240,.12); color: var(--accent); }
.stage-tile.off .tile-ico { background: rgba(255,255,255,.04); color: #7e89a8; }
.stage-tile .t { font-weight: 700; }
.stage-tile .s { font-size: 12px; color: var(--muted); }
.stage-tile.off { opacity: .55; border-top-color: #56627f; }
.stage-tile.off .n { color: #7e89a8; }
.stage-tile:not(.off):hover { background: var(--panel-2); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0f1830; border: 1px solid var(--accent); color: var(--text); padding: 10px 18px; border-radius: var(--radius);
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--bad); }

.modal-back { position: fixed; inset: 0; background: rgba(8, 10, 25, .7); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--panel); border-top: 5px solid var(--accent); border-radius: var(--radius); padding: 22px; width: min(460px, 100%); }

.empty { text-align: center; padding: 30px; color: var(--muted); }
.notice { background: rgba(245,176,65,.1); border-left: 4px solid var(--warn); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 14px; }

@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .collapse-btn { display: none; }
  .sidebar { position: fixed; z-index: 30; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-block; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); font-size: 18px; padding: 4px 10px; margin-bottom: 14px; }
  .main { padding: 18px 16px 60px; }
  .grid-2, .grid-3, .stage-grid { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; color: #111; }
  .sidebar, .menu-btn, .no-print, .toast { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .panel, .stat { background: #fff; color: #111; border-color: #1fb0f0; break-inside: avoid; }
  .muted, .reason, th, .stat .l { color: #555; }
  .tab-panel { display: block !important; margin-bottom: 20px; }
  .tabs { display: none; }
  select, input { border: none; background: none; color: #111; }
}


/* =====================================================================
   Modern layer (spacing, rounded surfaces, aligned forms)
   ===================================================================== */
:root { --radius: 12px; --radius-lg: 18px; --surface: rgba(30, 43, 69, .78); --surface-2: rgba(40, 57, 90, .7); --hair: rgba(255,255,255,.08); }
p, h1, h2, h3, .lede { text-wrap: balance; }

/* sidebar */
.sidebar { padding: 26px 18px 18px; gap: 20px; }
.sidebar-head { padding: 0 0 18px; }
.brand-logo { width: 100%; max-width: none; }
.brand-sub { margin-top: 10px; text-align: left; }
.collapse-btn {
  position: static; width: 100%; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; border: 1px solid var(--hair); color: var(--muted); font: inherit; font-size: 13px; font-weight: 500;
}
.collapse-btn:hover { color: var(--text); border-color: var(--accent); background: rgba(31,176,240,.08); }
.app.collapsed .collapse-btn { margin: 0; transform: none; }
.app.collapsed .collapse-btn svg { transform: rotate(180deg); }
.app.collapsed .collapse-btn .lbl { display: none; }
.nav-btn { border-radius: 10px; }

/* main column */
.main { padding: 64px 56px 96px; }
#view { max-width: 1180px; margin: 0 auto; }
.page-head { margin-bottom: 40px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.eyebrow-pill { background: rgba(31,176,240,.15); color: var(--accent); border: 1px solid rgba(31,176,240,.35); border-radius: 99px; padding: 3px 10px; font-weight: 700; letter-spacing: .08em; }
h1 { font-size: 40px; letter-spacing: -.02em; margin-bottom: 14px; }
h1 .accent { color: var(--accent); }
h2 { font-size: 20px; letter-spacing: -.01em; margin: 0; }
.lede { font-size: 17px; line-height: 1.6; color: #c9d2ea; max-width: 82ch; margin: 0; }

/* surfaces */
.panel {
  background: var(--surface); border: 1px solid var(--hair); border-top: 1px solid var(--hair);
  border-radius: var(--radius-lg); padding: 28px 30px; margin-bottom: 24px;
  box-shadow: 0 20px 40px -24px rgba(0,0,0,.55); backdrop-filter: blur(6px);
}
.panel.plain { border-top: 1px solid var(--hair); }
.panel-head { margin-bottom: 18px; }
.stat, .card, .stage-tile { border-radius: 14px; }
.stat { background: var(--surface-2); border-top-width: 0; border-left: 3px solid var(--accent); padding: 14px 16px; }
.stat.warn { border-left-color: var(--warn); }
.stage-tile { border-top-width: 0; border: 1px solid var(--hair); border-left: 4px solid var(--accent); background: var(--surface); padding: 18px 20px; }
.stage-tile.off { border-left-color: #56627f; }
.card { border-top-width: 0; border: 1px solid var(--hair); background: var(--surface); }
.modal { border-radius: var(--radius-lg); border-top: 1px solid var(--hair); }
.stage-grid { gap: 28px; }

/* step headings */
.step-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.step-head.flat { align-items: center; margin-bottom: 0; }
.step-head p { margin: 4px 0 0; }
.step-badge { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #1fb0f0, #3d8bff); color: #06182a; font-weight: 800; font-size: 16px; }

/* forms */
label.field { margin-bottom: 0; }
label.field > span, .field-label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
label.field em { font-style: normal; opacity: .7; }
input[type=text], input[type=password], input[type=search], select, textarea {
  height: 46px; padding: 0 14px; border-radius: 10px; background: rgba(10, 18, 38, .6); border-color: rgba(255,255,255,.1);
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 110px; padding: 12px 14px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,176,240,.22); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aab6d3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select option { background: #15203a; }
td select { height: 36px; padding: 0 34px 0 10px; background-position: right 10px center; }
td input[type=text] { height: 36px; }
.btn { height: 46px; padding: 0 20px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.small { height: 34px; padding: 0 12px; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.14); }
.btn.ghost:hover { border-color: var(--accent); background: rgba(31,176,240,.08); }
.btn.primary { box-shadow: 0 8px 20px -8px rgba(31,176,240,.6); }

/* session bar */
.session-bar { display: grid; grid-template-columns: 1fr auto; column-gap: 14px; row-gap: 10px; align-items: end; padding: 22px 26px; }
.session-actions { display: flex; gap: 10px; }
.save-state { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }

/* client + deck */
.grid-2 { gap: 28px; }
.grid-2.align-stretch { align-items: stretch; }
.stack { display: flex; flex-direction: column; gap: 20px; min-height: 100%; }
.stack > .field-label { margin-bottom: -12px; }
.field.fill { flex: 1; display: flex; flex-direction: column; }
.field.fill textarea { flex: 1; }
.dropzone {
  border: 2px dashed rgba(255,255,255,.16); border-radius: 14px; padding: 28px; background: rgba(10,18,38,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
}
.dropzone.fill { flex: 1; min-height: 210px; }
.dropzone[hidden] { display: none; }
.dropzone strong { font-size: 16px; }
.drop-ico { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: rgba(31,176,240,.14); color: var(--accent); margin-bottom: 8px; }
.drop-note { margin-top: 10px; font-size: 12px; color: #8f9bb9; max-width: 34ch; }
.file-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: rgba(10,18,38,.45); border: 1px solid rgba(255,255,255,.1); }
.file-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(31,176,240,.14); color: var(--accent); flex: none; }
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .main { padding: 20px 16px 60px; }
  h1 { font-size: 30px; }
  .session-bar { grid-template-columns: 1fr; }
  .collapse-btn { display: none; }
}
