/* =========================================================
   ALEXANDRIA · COMMAND CENTER
   Tokens e componentes. Desktop-first, responsivo real no celular.
   ========================================================= */
:root, [data-theme="escuro"] {
  --bg: #0E0D0C;
  --surface: #161412;
  --surface-2: #1E1B17;
  --surface-3: #28241E;
  --border: #2A251C;
  --border-2: #3A3327;
  --text: #F2EDE3;
  --text-2: #A79E8D;
  --text-3: #857C6C;
  --gold: #C9A45C;
  --gold-text: #C9A45C;
  --gold-soft: rgba(201, 164, 92, .12);
  --gold-line: rgba(201, 164, 92, .42);
  --on-gold: #17120A;
  --ok: #8DB07A;     --ok-soft: rgba(141, 176, 122, .13);
  --warn: #DDA94B;   --warn-soft: rgba(221, 169, 75, .13);
  --err: #DC7A66;    --err-soft: rgba(220, 122, 102, .13);
  --info: #8CA6C6;   --info-soft: rgba(140, 166, 198, .13);
  --demo: #B98BD0;   --demo-soft: rgba(185, 139, 208, .13);
  --scrim: rgba(5, 4, 3, .72);
  --shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
[data-theme="claro"] {
  --bg: #F3ECDF;
  --surface: #FBF7EF;
  --surface-2: #EFE6D6;
  --surface-3: #E6DAC5;
  --border: #DFD2BC;
  --border-2: #CFBFA4;
  --text: #2A2016;
  --text-2: #5C4F3F;
  --text-3: #74664F;
  --gold: #C9A45C;
  --gold-text: #86672C;
  --gold-soft: rgba(201, 164, 92, .18);
  --gold-line: rgba(134, 103, 44, .45);
  --ok: #4E7A3C;   --ok-soft: rgba(78, 122, 60, .12);
  --warn: #9A6A12; --warn-soft: rgba(154, 106, 18, .12);
  --err: #A8432E;  --err-soft: rgba(168, 67, 46, .12);
  --info: #3F6491; --info-soft: rgba(63, 100, 145, .12);
  --demo: #7B4A94; --demo-soft: rgba(123, 74, 148, .12);
  --scrim: rgba(42, 32, 22, .45);
  --shadow: 0 24px 60px rgba(60, 42, 20, .22), 0 2px 8px rgba(60, 42, 20, .12);
  color-scheme: light;
}
:root {
  --f-display: 'Cormorant Garamond', Georgia, serif;
  --f-ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --side-w: 264px;
  --top-h: 60px;
  --r-sm: 7px; --r-md: 10px; --r-lg: 14px;
  /* categorias da casa */
  --c-vendas: #A4553A; --c-crescimento: #6F7F6A; --c-fe: #3B5584; --c-ia: #E6DDC8; --c-masculinidade: #8A3343;
  --c-ideias: #C98A2E; --c-pickup: #B06B6B; --c-habilidades: #7A62A6; --c-negocios: #5B6B80; --c-producao: #8A8848;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--f-ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; flex: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.gold { color: var(--gold-text); }
.display { font-family: var(--f-display); font-weight: 600; font-variant-numeric: lining-nums; }
.eyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------- casca ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; border-right: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.brand b { display: block; font-family: var(--f-display); font-size: 21px; font-weight: 700; line-height: 1; }
.brand span { display: block; font-size: 10.5px; letter-spacing: .14em; font-weight: 800; color: var(--gold-text); margin-top: 3px; }
.side-quick { padding: 4px 10px 8px; }
.side-quick summary { list-style: none; }
.side-sec { padding: 2px 10px; }
.grp-h { width: 100%; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px; border-radius: 8px; color: var(--text-2); font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
.grp-h:hover { background: var(--surface-2); color: var(--text); }
.grp-h .n { font-size: 10.5px; color: var(--text-3); font-weight: 800; width: 16px; text-align: right; }
.grp-h .chev { margin-left: auto; transition: transform .15s; color: var(--text-3); }
.grp.closed .chev { transform: rotate(-90deg); }
.grp.closed .grp-items { display: none; }
.grp-items { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 6px 26px; }
.nav-a { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: 7px; font-size: 13px; color: var(--text-2); }
.nav-a:hover { background: var(--surface-2); color: var(--text); }
.nav-a.on { background: var(--surface-3); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--gold); }
.nav-a .b { margin-left: auto; }
.grp.active > .grp-h { color: var(--text); }
.grp.active > .grp-h svg:first-of-type { color: var(--gold); }
.side-foot { margin-top: auto; padding: 12px 16px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 24px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); }
.ib.menu-btn { display: none; }
.acts-col .btn { justify-content: flex-start; }
.demo-seal.sm { height: 18px; padding: 0 5px; font-size: 9px; letter-spacing: .08em; }
.gsearch { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-3); font-size: 13.5px; text-align: left; }
.gsearch:hover { border-color: var(--border-2); }
.gsearch span:nth-child(2) { flex: 1; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); border: 1px solid var(--gold-line); color: var(--gold-text); font-family: var(--f-display); font-weight: 700; font-size: 15px; flex: none; }
.content { padding: 24px 28px 64px; }
.page-h { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-h h1 { font-family: var(--f-display); font-size: 34px; line-height: 1.02; font-weight: 600; }
.page-h p { margin: 6px 0 0; color: var(--text-2); max-width: 760px; }
.page-h .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { font-size: 12px; color: var(--text-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }

/* ---------- controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn.gold:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--border)); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.ib { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); position: relative; }
.ib:hover { background: var(--surface-2); color: var(--text); }
.ib .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); box-shadow: 0 0 0 2px var(--bg); }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--surface); }
.input, .select, .textarea { height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-size: 13px; min-width: 0; }
.textarea { height: auto; min-height: 88px; padding: 10px; resize: vertical; width: 100%; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lab { font-size: 12px; font-weight: 700; color: var(--text-2); }
.field .help { font-size: 11.5px; color: var(--text-3); }
.chk { width: 17px; height: 17px; accent-color: var(--gold); cursor: pointer; }
.switch { position: relative; width: 36px; height: 20px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-2); flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-3); transition: left .15s; }
.switch.on { background: var(--gold); border-color: var(--gold); }
.switch.on::after { left: 18px; background: var(--on-gold); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .sp { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .x { opacity: .6; }

/* selo de status: marca o fato */
.st { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.st::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.ok { background: var(--ok-soft); color: var(--ok); }
.st.warn { background: var(--warn-soft); color: var(--warn); }
.st.err { background: var(--err-soft); color: var(--err); }
.st.info { background: var(--info-soft); color: var(--info); }
.st.gold { background: var(--gold-soft); color: var(--gold-text); }
.st.neutral::before { background: var(--text-3); }
.st.pulse::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--gold); color: var(--on-gold); font-size: 10.5px; font-weight: 800; }
.badge.err { background: var(--err); color: #fff; }
.badge.mute { background: var(--surface-3); color: var(--text-2); }
.demo-seal { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 5px; border: 1px dashed var(--demo); color: var(--demo); background: var(--demo-soft); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }

/* ---------- painéis e KPI ---------- */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; } .s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s12 { grid-column: span 12; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; flex-wrap: wrap; }
.panel-h h2 { font-size: 15px; font-weight: 700; }
.panel-h .r { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.panel-b { padding: 14px 16px 16px; }
.kpi { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: 6px; }
.kpi-top .lab { font-size: 12px; font-weight: 600; color: var(--text-2); flex: 1; min-width: 0; }
.kpi .val { font-family: var(--f-display); font-size: 32px; font-weight: 600; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.kpi .val.na { font-family: var(--f-ui); font-size: 14px; font-weight: 700; color: var(--text-3); line-height: 32px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); flex-wrap: wrap; }
.delta { font-weight: 800; font-size: 11.5px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--err); } .delta.flat { color: var(--text-3); }
.delta.up.bad { color: var(--err); } .delta.down.good { color: var(--ok); }
.kpi.click { cursor: pointer; } .kpi.click:hover { border-color: var(--gold-line); }

/* precisa de você */
.need { display: flex; flex-direction: column; }
.need a { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--border); }
.need a:first-child { border-top: 0; }
.need a:hover { background: var(--surface-2); }
.need .ic { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.need .t { font-weight: 700; font-size: 13.5px; }
.need .d { font-size: 12px; color: var(--text-2); }

/* abas */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tab { height: 38px; padding: 0 12px; font-weight: 600; font-size: 13px; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-color: var(--gold); }

/* ---------- tabela ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td.wrap-sm { max-width: 260px; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.sel td { background: var(--gold-soft); }
.tbl td.strong, .tbl .strong { color: var(--text); font-weight: 600; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl .row-acts { display: flex; gap: 4px; justify-content: flex-end; }
.tbl tr.click { cursor: pointer; }
.bulk { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; background: var(--text); color: var(--bg); border-radius: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.bulk .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 25%, transparent); }
.bulk b { margin-right: 4px; }
.colpick { position: relative; }
.pop { position: absolute; z-index: 40; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; }
.pop label { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.pop label:hover { background: var(--surface-2); }
.pop .pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 8px; text-align: left; font-size: 13px; }
.pop .pop-item:hover { background: var(--surface-2); }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.bar-cell .tr { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar-cell .tr i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.bar-cell .tr i.warn { background: var(--warn); } .bar-cell .tr i.err { background: var(--err); } .bar-cell .tr i.ok { background: var(--ok); }
.cat-dot { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.cat-dot i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); box-shadow: 0 0 0 1px rgba(242, 237, 227, .15); }
.tag { display: inline-flex; height: 20px; align-items: center; padding: 0 7px; border-radius: 5px; background: var(--surface-3); font-size: 11px; font-weight: 700; color: var(--text-2); margin-right: 4px; }

/* ---------- pipeline ---------- */
.pipe { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.stage { position: relative; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; text-align: left; min-width: 0; }
.stage:hover { border-color: var(--border-2); }
.stage.on { border-color: var(--gold); background: var(--gold-soft); }
.stage .nm { font-size: 11.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage .ct { font-family: var(--f-display); font-size: 28px; font-weight: 600; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.stage .sub { font-size: 11px; color: var(--text-3); }
.stage.bad .ct { color: var(--err); }
.stage.wait .ct { color: var(--warn); }
.stage::after { content: ''; position: absolute; right: -7px; top: 50%; width: 6px; height: 1px; background: var(--border-2); }
.stage:last-child::after { display: none; }
.flowline { height: 34px; position: relative; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.flowline .lane { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border-2); }
.flowline .tok { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px rgba(201, 164, 92, .6); transition: left .9s linear; }
.flowline .tok.f { background: var(--err); box-shadow: none; }
.feed { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; }
.feed-row { display: grid; grid-template-columns: 64px 26px minmax(0, 1fr) 150px; gap: 10px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12.5px; animation: fin .4s ease; }
@keyframes fin { from { background: var(--gold-soft); } }
.src-ic { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; background: var(--surface-3); color: var(--text-2); }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; padding: 6px 0; font-size: 12.5px; }
.tl i { width: 10px; height: 10px; border-radius: 50%; margin: 4px; background: var(--ok); }
.tl.cur i { background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.tl.bad i { background: var(--err); }
.tl.todo i { background: var(--surface-3); }

/* ---------- gráficos ---------- */
.chart { width: 100%; height: auto; }
.chart text { font: 600 10.5px var(--f-ui); fill: var(--text-3); }
.chart .grid-l { stroke: var(--border); }
.chart .line { fill: none; stroke: var(--gold); stroke-width: 2; }
.chart .area { fill: var(--gold-soft); }
.chart .bar { fill: var(--text-3); opacity: .55; }
.chart .bar.hi { fill: var(--gold); opacity: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.heat td { text-align: center; font-size: 12px; font-weight: 700; color: var(--text); padding: 8px 6px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gold); }
.meter i.warn { background: var(--warn); } .meter i.err { background: var(--err); } .meter i.ok { background: var(--ok); }
.stack { display: flex; height: 12px; border-radius: 4px; overflow: hidden; gap: 2px; }
.stack i { display: block; height: 100%; }

/* ---------- gaveta e modal ---------- */
.scrim { position: fixed; inset: 0; z-index: 80; background: var(--scrim); backdrop-filter: blur(2px); }
.drawer { position: fixed; z-index: 81; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: din .18s ease; }
@keyframes din { from { transform: translateX(30px); opacity: 0; } }
.drawer-h { display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.drawer-h h2 { font-family: var(--f-display); font-size: 24px; line-height: 1.1; }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.drawer-f { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; }
.modal-wrap { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; background: var(--scrim); backdrop-filter: blur(3px); overflow-y: auto; }
.modal { width: min(600px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); animation: min .16s ease; }
@keyframes min { from { transform: translateY(10px); opacity: 0; } }
.modal-h { padding: 20px 22px 12px; display: flex; gap: 12px; align-items: flex-start; }
.modal-h .lvl { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none; }
.modal-h h2 { font-family: var(--f-display); font-size: 26px; line-height: 1.05; }
.modal-b { padding: 4px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.modal-f .note { margin-right: auto; font-size: 11.5px; color: var(--text-3); }
.facts { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: 12.5px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; }
.facts dt { color: var(--text-3); } .facts dd { margin: 0; color: var(--text); font-weight: 600; }
.pin { display: flex; gap: 8px; }
.pin input { width: 44px; height: 48px; text-align: center; font-size: 20px; font-weight: 800; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.pin input:focus { outline: none; border-color: var(--gold); }

/* paleta */
.pal { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.pal-in { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.pal-in input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; }
.pal-b { max-height: 440px; overflow-y: auto; padding: 6px; }
.pal-g { padding: 10px 10px 4px; }
.pal-r { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px; border-radius: 9px; font-size: 13.5px; color: var(--text-2); text-align: left; }
.pal-r .k { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.pal-r.hi, .pal-r:hover { background: var(--surface-3); color: var(--text); }

/* toast, alertas */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border-2); box-shadow: var(--shadow); font-size: 13px; font-weight: 600; max-width: 92vw; }

/* estados */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 24px; }
.state h3 { font-family: var(--f-display); font-size: 24px; font-weight: 600; }
.state p { margin: 0; max-width: 460px; color: var(--text-2); }
.sk { background: var(--surface-2); border-radius: 8px; position: relative; overflow: hidden; }
.sk::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent); animation: sk 1.3s infinite; }
@keyframes sk { to { transform: translateX(100%); } }
.honest { border: 1px dashed var(--border-2); border-radius: var(--r-lg); padding: 18px; background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--text) 2%, transparent) 10px 20px); }
.stbar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.stbar select { height: 28px; font-size: 12px; }

/* flow builder */
.flow { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 20px; }
.node { width: min(420px, 100%); padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); display: flex; gap: 12px; align-items: flex-start; }
.node.trig { border-color: var(--gold); background: var(--gold-soft); }
.node .ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); flex: none; }
.node .t { font-weight: 700; font-size: 13.5px; }
.node .d { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.conn { width: 1px; height: 22px; background: var(--border-2); position: relative; }
.conn .plus { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border-2); display: flex; align-items: center; justify-content: center; }
.split { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }

/* lista de definição e misc */
.kv { display: grid; grid-template-columns: minmax(120px, 40%) minmax(0, 1fr); gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; color: var(--text); font-weight: 600; }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
.li:first-child { border-top: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 700; color: var(--text); }
.li .d { font-size: 12px; color: var(--text-2); }
.swatch { height: 64px; border-radius: 10px; border: 1px solid var(--border); display: flex; align-items: flex-end; padding: 8px; font-size: 11px; font-weight: 700; }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; }
.kcol { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.kcard { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; align-items: flex-start; }
.callout.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: var(--warn-soft); }
.callout.err { border-color: color-mix(in srgb, var(--err) 40%, var(--border)); background: var(--err-soft); }
.callout.info { border-color: color-mix(in srgb, var(--info) 40%, var(--border)); background: var(--info-soft); }
.callout.demo { border: 1px dashed var(--demo); background: var(--demo-soft); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; }

/* ---------- celular ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipe { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .s3, .s4, .s5 { grid-column: span 6; } .s7, .s8 { grid-column: span 12; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 85; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; z-index: 84; background: var(--scrim); }
  .ib.menu-btn { display: inline-flex; }
  .top { padding: 0 12px; gap: 6px; }
  .gsearch .kbd, .gsearch span:nth-child(2) { display: none; }
  .gsearch { flex: 0 0 auto; width: 38px; padding: 0; justify-content: center; }
  .top-r .hide-m { display: none; }
  .content { padding: 18px 14px 80px; }
  .page-h h1 { font-size: 28px; }
  .page-h .acts { margin-left: 0; width: 100%; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .g12 > * { grid-column: span 12 !important; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; } .kpi .val { font-size: 26px; }
  .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage::after { display: none; }
  /* tabela vira cartões */
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tr { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; padding: 8px 12px; background: var(--surface); }
  .tbl.cards td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.cards td::before { content: attr(data-l); font-size: 11px; font-weight: 700; color: var(--text-3); text-align: left; flex: none; }
  .tbl.cards td.cb::before, .tbl.cards td.cb { justify-content: flex-start; }
  .tbl.cards tbody tr:hover td { background: transparent; }
  .feed-row { grid-template-columns: 52px 24px minmax(0, 1fr); }
  .feed-row > :last-child { grid-column: 3; }
  .kanban { grid-template-columns: repeat(4, 80vw); }
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; }
  .facts { grid-template-columns: 1fr; }
}
