/* Painel do gateway SmartBid. Um arquivo, sem framework, sem build (docs/fase-7-painel.md, 2.8).
   Desenho: docs/ui/ (001 a 010). Nenhum template usa style= inline (CSP), então tudo o que os wireframes
   faziam inline virou classe aqui. */
:root {
  --bg: #f3f4f8; --surface: #ffffff; --surface-2: #f7f8fb; --text: #101828; --muted: #5d6679; --border: #dfe3ec;
  --primary: #3b4eff; --primary-hover: #2f3fd6; --primary-soft: #e8eaff; --primary-text: #ffffff;
  --nav-bg: #0d1424; --nav-text: #aab3c7; --nav-active: #ffffff; --nav-active-bg: #1b2540; --nav-border: #1f2a46;
  --success: #12805c; --success-soft: #dff5ec; --warn: #8a5a00; --warn-soft: #fff1cf;
  --danger: #c0271d; --danger-soft: #fde7e4; --code-bg: #eceff6;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.08), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.22);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1c; --surface: #131a2b; --surface-2: #18213a; --text: #eef1f8; --muted: #9aa5bd; --border: #26304c;
    --primary: #7b88ff; --primary-hover: #94a0ff; --primary-soft: #232b5c; --primary-text: #0a0f1c;
    --nav-bg: #070b15; --nav-active-bg: #172038;
    --success: #4fd1a3; --success-soft: #11332a; --warn: #f3c969; --warn-soft: #3a3016;
    --danger: #ff8d82; --danger-soft: #3d1b18; --code-bg: #1c2540;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1c; --surface: #131a2b; --surface-2: #18213a; --text: #eef1f8; --muted: #9aa5bd; --border: #26304c;
  --primary: #7b88ff; --primary-hover: #94a0ff; --primary-soft: #232b5c; --primary-text: #0a0f1c;
  --nav-bg: #070b15; --nav-active-bg: #172038;
  --success: #4fd1a3; --success-soft: #11332a; --warn: #f3c969; --warn-soft: #3a3016;
  --danger: #ff8d82; --danger-soft: #3d1b18; --code-bg: #1c2540;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, "Segoe UI", sans-serif; }
a { color: var(--primary); }
h1 { font-size: 1.4rem; margin: 0 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0 0 .25rem; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- Casca: trilho de 60px e barra superior */
.app { display: flex; min-height: 100vh; }
.rail { width: 60px; flex: none; position: relative; z-index: 30; }
.side { position: fixed; top: 0; bottom: 0; left: 0; width: 60px; background: var(--nav-bg); color: var(--nav-text);
        display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; overflow: hidden; transition: width .15s ease; }
.rail:hover .side, .rail:focus-within .side { width: 232px; box-shadow: var(--shadow-lg); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; padding: 2px 6px 12px;
         text-decoration: none; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; flex: none;
              background: linear-gradient(135deg, #5a6bff, #22d3a6); }
.brand small { display: block; font-weight: 500; color: var(--nav-text); font-size: 11px; }
.navgroup { height: 1px; background: var(--nav-border); margin: 8px 6px; font-size: 0; }
.navgroup .lbl { display: none; }
.rail:hover .navgroup, .rail:focus-within .navgroup { height: auto; background: none; margin: 10px 8px 2px; font-size: 11px;
        letter-spacing: .08em; text-transform: uppercase; color: #6b7794; }
.rail:hover .navgroup .lbl, .rail:focus-within .navgroup .lbl { display: inline; }
.navitem { position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 11px;
           border-radius: 10px; color: var(--nav-text); text-decoration: none; font-weight: 500; white-space: nowrap; }
.navitem:hover, .navitem:focus-visible { background: var(--nav-active-bg); color: var(--nav-active); outline: none; }
.navitem svg { width: 18px; height: 18px; flex: none; }
.navitem .lbl { opacity: 0; transition: opacity .1s ease; }
.brand .lbl { opacity: 0; transition: opacity .1s ease; }
.rail:hover .navitem .lbl, .rail:focus-within .navitem .lbl,
.rail:hover .brand .lbl, .rail:focus-within .brand .lbl { opacity: 1; }
.navitem[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active); box-shadow: inset 3px 0 0 var(--primary); }
.navitem .count { position: absolute; top: 4px; left: 28px; min-width: 16px; height: 16px; background: #f59e0b; color: #1c1300;
                  font-size: 10px; font-weight: 700; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; }
.rail:hover .navitem .count, .rail:focus-within .navitem .count { left: auto; right: 10px; top: 12px; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 24px;
          border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.crumb { color: var(--muted); font-size: 13px; font-weight: 600; margin-right: auto; }
.search-trigger { display: flex; align-items: center; gap: 8px; width: 240px; padding: 6px 10px; border: 1px solid var(--border);
                  border-radius: 10px; color: var(--muted); background: var(--surface-2); font: inherit; cursor: pointer; white-space: nowrap; }
.search-trigger svg { width: 15px; height: 15px; flex: none; }
.search-trigger kbd, .kbd { margin-left: auto; font: 11px ui-monospace, monospace; border: 1px solid var(--border); border-radius: 5px;
                            padding: 0 5px; background: var(--surface); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
        background: var(--success-soft); color: var(--success); white-space: nowrap; text-decoration: none; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--danger-soft); color: var(--danger); }
.iconbtn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--border);
           background: var(--surface); color: var(--muted); position: relative; flex: none; padding: 0; cursor: pointer; }
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: grid; place-items: center; font-weight: 700;
          font-size: 12px; color: var(--primary-text); flex: none; }
.usermenu { position: relative; }
.usermenu > summary { list-style: none; cursor: pointer; border-radius: 50%; }
.usermenu > summary::-webkit-details-marker { display: none; }
.menu { position: absolute; right: 0; top: 40px; width: 270px; background: var(--surface); border: 1px solid var(--border);
        border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 40; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; color: var(--text);
                        text-decoration: none; border: 0; background: none; font: inherit; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--code-bg); }
main.page { flex: 1; width: 100%; max-width: 72rem; margin: 0 auto; padding: 24px 32px 48px; }
.pagehead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.pagehead h1 { font-size: 22px; margin: 0; }
.pagehead p { margin: 2px 0 0; color: var(--muted); max-width: 42rem; }
.pagehead .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
body.bare main.page { max-width: 44rem; }

/* ---------------------------------------------------------------- Blocos */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
        padding: 24px; margin-bottom: 16px; }
.card > h2, .card > h3 { margin: 0 0 4px; }
.card > .sub, .sub { color: var(--muted); margin: 0 0 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.highlight { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.card.center, .center { text-align: center; }
.card.center { padding: 36px 24px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 16px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 16px 24px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.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)); }
.grid > .card { margin-bottom: 0; }
.split { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 1fr) 340px; margin-bottom: 16px; }
.split.wide-side { grid-template-columns: minmax(0, 1fr) 380px; }
.split.left-nav { grid-template-columns: 300px minmax(0, 1fr); }
.split > .card, .split > div > .card:last-child { margin-bottom: 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 24px; box-shadow: var(--shadow); }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat .v.text { font-size: 20px; padding-top: 4px; }
.stat .d { font-size: 12px; color: var(--muted); }
.stat .d.bad { color: var(--danger); } .stat .d.good { color: var(--success); }

.btn, button { font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; border: 1px solid var(--border);
               background: var(--surface); color: var(--text); padding: 8px 14px; display: inline-flex; align-items: center; gap: 8px;
               text-decoration: none; }
.btn:hover, button:hover { border-color: var(--primary); }
.btn.primary, button.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.primary:hover, button.primary:hover { background: var(--primary-hover); }
.btn.danger, button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.btn.danger.solid, button.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost, button.linklike { border-color: transparent; background: transparent; color: var(--primary); }
.btn.sm, button.sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; justify-content: center; }
button:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
button.loading::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor;
                         border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.loading::before, .skeleton { animation: none; } }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
         background: var(--code-bg); color: var(--muted); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.on, .badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; align-items: center; }
.chip, .chips li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 8px; background: var(--code-bg);
                   font-size: 13px; font-weight: 500; }
.chip.on { background: var(--primary-soft); color: var(--primary); }
code { background: var(--code-bg); border-radius: 6px; padding: 1px 6px; font: 12.5px ui-monospace, Consolas, monospace; }
.secret { display: flex; align-items: center; gap: 8px; background: var(--nav-bg); color: #d7defa; border-radius: 10px; padding: 10px 12px;
          font: 13px ui-monospace, Consolas, monospace; word-break: break-all; margin: 8px 0; background-clip: padding-box; }
.secret > :first-child { flex: 1; min-width: 0; user-select: all; }
.secret .btn, .secret button { flex: none; }
.secret code { background: none; color: inherit; padding: 0; }

.notice { display: flex; gap: 10px; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid transparent; flex-wrap: wrap; }
.notice.ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.notice.info { background: var(--primary-soft); color: var(--primary); }
.notice .act { margin-left: auto; font-weight: 600; }
.notice p { margin: 0; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #0d1424; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; gap: 10px;
         align-items: center; min-width: 260px; box-shadow: inset 4px 0 0 #22d3a6, var(--shadow-lg); }
.toast.err { box-shadow: inset 4px 0 0 #ff6b5e, var(--shadow-lg); }
.toast button { margin-left: auto; background: none; border: 0; color: #fff; opacity: .7; padding: 0 4px; }

/* ---------------------------------------------------------------- Formulários */
label { font-weight: 600; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.field .err { font-size: 12px; color: var(--danger); font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea, .input {
  font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 100%; font-weight: 400; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); outline: none; }
.input.invalid, input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
input:disabled, select:disabled { background: var(--surface-2); opacity: .6; }
.check { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
         background: var(--surface); font-weight: 500; cursor: pointer; }
.check input { accent-color: var(--primary); width: auto; }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
form.inline, .inline { display: inline; }
.form-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.searchbox { position: relative; flex: 1 1 14rem; }
.searchbox svg { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.searchbox input { padding-left: 34px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; text-decoration: none; margin-bottom: -1px; }
.tab[aria-current="page"], .tab.active { color: var(--primary); border-color: var(--primary); }
.seg { display: inline-flex; background: var(--code-bg); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg span { padding: 5px 12px; border-radius: 8px; font-weight: 600; color: var(--muted); font-size: 13px; text-decoration: none; }
.seg [aria-current="true"], .seg .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- Listas e tabelas */
.rows > .row, .account { display: flex; align-items: center; gap: 16px; padding: 12px 24px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.rows > .row:first-child { border-top: 0; }
.card:not(.flush) > .account:first-of-type { border-top: 0; padding-left: 0; padding-right: 0; }
.card:not(.flush) > .account { padding-left: 0; padding-right: 0; }
.row .grow, .account .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row .title { font-weight: 600; } .row .meta { color: var(--muted); font-size: 13px; }
.row .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.row .ico.off { background: var(--code-bg); color: var(--muted); }
.row .ico svg { width: 18px; height: 18px; }
.row.selected { background: var(--primary-soft); }
.account .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tablewrap { overflow-x: auto; }
table, .tbl { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 16px; background: var(--surface-2);
     border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
tr.selected td { background: var(--primary-soft); }
tr.sub td { background: var(--surface-2); font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.trunc { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.bar { height: 8px; border-radius: 99px; background: var(--code-bg); overflow: hidden; min-width: 80px; }
.bar > meter { width: 100%; height: 8px; display: block; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--muted); flex-wrap: wrap; }
.pager .right { margin-left: auto; display: flex; gap: 8px; }
meter { width: 100%; min-width: 80px; height: 10px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
dt { color: var(--muted); } dd { margin: 0; }
details.more { margin-top: 12px; }
details.more > summary { cursor: pointer; color: var(--muted); }
details.more[open] > summary { margin-bottom: 8px; }
pre.preview-body { background: var(--code-bg); padding: 12px; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; }
.tag { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 0 6px; font-size: 12px; }
.warnings { list-style: none; margin: 0 0 12px; padding: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding: 4px 0; }
.bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; font-size: 11px; color: var(--muted); }
.bars i { display: block; width: 100%; border-radius: 6px 6px 0 0; background: var(--primary); min-height: 2px; }
.bars i.err { background: var(--danger); border-radius: 0; height: 3px; min-height: 3px; margin-bottom: -6px; }

/* ---------------------------------------------------------------- Trilha de passos e estados */
.steps { display: flex; margin: 0; padding: 0; list-style: none; }
.step { flex: 1; position: relative; padding-top: 34px; font-size: 13px; text-align: center; color: var(--muted); }
.step::before { content: attr(data-n); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%;
                background: var(--code-bg); display: grid; place-items: center; font-weight: 700; z-index: 1; }
.step::after { content: ""; position: absolute; top: 12px; left: 50%; width: 100%; height: 2px; background: var(--border); }
.step:last-child::after { display: none; }
.step.done::before { content: "\2713"; background: var(--success); color: #fff; }
.step.done::after { background: var(--success); }
.step.current::before { background: var(--primary); color: var(--primary-text); box-shadow: 0 0 0 4px var(--primary-soft); }
.step.current { color: var(--text); font-weight: 600; }
.step.fail::before { content: "!"; background: var(--danger); color: #fff; }
.step b { display: block; color: var(--text); }
.steps.v { flex-direction: column; }
.steps.v .step { text-align: left; padding: 0 0 18px 40px; }
.steps.v .step::before { left: 0; transform: none; }
.steps.v .step::after { top: 26px; left: 12px; width: 2px; height: calc(100% - 26px); }
.empty { text-align: center; padding: 32px 24px; color: var(--muted); }
.empty .art { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); margin: 0 auto 8px; display: grid; place-items: center; }
.empty .art svg { width: 26px; height: 26px; }
.empty h2, .empty h3 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.empty p { margin: 0 auto 16px; max-width: 380px; }
.skeleton { height: 14px; border-radius: 6px; margin-bottom: 10px; animation: sh 1.4s linear infinite;
            background: linear-gradient(90deg, var(--code-bg), var(--surface-2), var(--code-bg)); background-size: 200% 100%; }
@keyframes sh { to { background-position: -200% 0; } }
.dim { opacity: .55; }

/* ---------------------------------------------------------------- Modal de confirmação e paleta (panel.js) */
dialog.confirm, dialog.palette { border: 0; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.confirm { border-radius: 16px; width: 440px; max-width: calc(100vw - 32px); }
dialog.confirm::backdrop, dialog.palette::backdrop { background: rgba(8,12,24,.55); }
dialog.confirm .body { padding: 24px; }
dialog.confirm h2 { font-size: 17px; margin: 0 0 6px; }
dialog.confirm .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 24px; }
dialog.palette { border-radius: 14px; width: 520px; max-width: calc(100vw - 32px); margin-top: 80px; overflow: hidden; }
dialog.palette input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 14px 16px; font-size: 15px; box-shadow: none; }
dialog.palette ul { list-style: none; margin: 0; padding: 6px 0; max-height: 50vh; overflow: auto; }
dialog.palette a { display: flex; gap: 10px; align-items: center; padding: 8px 16px; color: var(--text); text-decoration: none; }
dialog.palette a[aria-selected="true"], dialog.palette a:hover { background: var(--primary-soft); color: var(--primary); }
dialog.palette .none { padding: 16px; color: var(--muted); }

/* ---------------------------------------------------------------- Telas estreitas: o trilho vira barra de ícones embaixo */
@media (max-width: 48rem) {
  .app { flex-direction: column; }
  .rail { width: 100%; height: 56px; order: 2; }
  .side, .rail:hover .side, .rail:focus-within .side { top: auto; bottom: 0; width: 100%; height: 56px; flex-direction: row; align-items: center;
         padding: 0 8px; overflow-x: auto; overflow-y: hidden; box-shadow: none; transition: none; }
  .brand { display: none; }
  .navgroup, .rail:hover .navgroup, .rail:focus-within .navgroup { width: 1px; height: 24px; margin: 0 4px; flex: none; font-size: 0; }
  .navitem { flex: none; }
  .navitem .lbl, .rail:hover .navitem .lbl { display: none; }
  .navitem .count, .rail:hover .navitem .count { left: 24px; right: auto; top: 4px; }
  .topbar { padding: 0 12px; }
  .search-trigger { width: auto; }
  .search-trigger .kbd, .search-trigger span.txt { display: none; }
  main.page { padding: 16px 16px 72px; }
  .g2, .g3, .g4, .split, .split.wide-side, .split.left-nav { grid-template-columns: 1fr; }
  .pagehead .actions { margin-left: 0; }
  .steps:not(.v) { flex-direction: column; }
  .steps:not(.v) .step { text-align: left; padding: 0 0 18px 40px; }
  .steps:not(.v) .step::before { left: 0; transform: none; }
  .steps:not(.v) .step::after { top: 26px; left: 12px; width: 2px; height: calc(100% - 26px); }
  .card { padding: 16px; }
  .rows > .row, .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
}

/* === Slack, Gmail, HubSpot e Escrita === */
.row .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .actions form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field .err { margin-top: 2px; }
.card.decide form, .card.decide > button { display: block; margin: 0 0 8px; }
.card.decide > .sub { margin-bottom: 12px; }
.card.flush > .card-head .seg a { white-space: nowrap; }
.seg a b { margin-left: 4px; font-variant-numeric: tabular-nums; }
.notice.info p, .notice.warn p { margin: 0; }

/* === Minha conta, Conectar e Entrar === */
body.bare { background: var(--nav-bg); }
body.bare main.page { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.auth-card { max-width: 400px; width: 100%; margin: 0 auto 16px; padding: 36px; }
.auth-card.wide { max-width: 560px; padding: 32px; }
.auth-card h1 { font-size: 20px; margin: 8px 0 6px; }
.auth-card .notice { text-align: left; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; }
.auth-note { margin: 14px 0 0; }
.auth-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.row-box { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; margin-bottom: 16px; background: var(--surface-2);
          border: 1px solid var(--border); border-radius: 10px; word-break: break-all; }
.btn svg, button svg { width: 16px; height: 16px; flex: none; }
.seg button { border-color: transparent; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 8px; font-size: 13px; }
.seg button:hover { border-color: transparent; background: var(--surface); color: var(--text); }

/* === Uso e Pessoas === */
/* Altura do gráfico por dia em 21 níveis (0 a 80% da coluna), no lugar de style= inline. */
.bars i.h0 { height: 0%; }
.bars i.h1 { height: 4%; }
.bars i.h2 { height: 8%; }
.bars i.h3 { height: 12%; }
.bars i.h4 { height: 16%; }
.bars i.h5 { height: 20%; }
.bars i.h6 { height: 24%; }
.bars i.h7 { height: 28%; }
.bars i.h8 { height: 32%; }
.bars i.h9 { height: 36%; }
.bars i.h10 { height: 40%; }
.bars i.h11 { height: 44%; }
.bars i.h12 { height: 48%; }
.bars i.h13 { height: 52%; }
.bars i.h14 { height: 56%; }
.bars i.h15 { height: 60%; }
.bars i.h16 { height: 64%; }
.bars i.h17 { height: 68%; }
.bars i.h18 { height: 72%; }
.bars i.h19 { height: 76%; }
.bars i.h20 { height: 80%; }
.usage-table th, .usage-table td { padding: 8px 10px; overflow-wrap: anywhere; }
.usage-table .trunc { max-width: 11rem; }
.usage-table code.wrap { white-space: normal; word-break: break-all; }
.usage-table .num { white-space: nowrap; }
details.row-toggle > summary { cursor: pointer; }
@supports selector(:has(a)) {
  tr.usage-sub { display: none; }
  tr:has(details.row-toggle[open]) + tr.usage-sub { display: table-row; }
}
.people-search { flex: 1 1 14rem; flex-wrap: nowrap; }
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.detail-head .detail-state { margin-left: auto; }
.field-title { font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
.actions-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* === Início, Ferramentas e casca (sino) === */
.tile { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile b { overflow-wrap: anywhere; }
.tile:target { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-soft); }
#saude, #falhando { scroll-margin-top: 72px; }
a.row.pick { color: inherit; text-decoration: none; padding-top: 10px; padding-bottom: 10px; }
a.row.pick:hover { background: var(--surface-2); }
a.row.pick.selected { background: var(--primary-soft); }
.usermenu > summary.iconbtn { border-radius: 10px; }
.usermenu > summary.iconbtn:hover { border-color: var(--primary); }
.menu .notifs-empty { margin: 8px 10px; }
.card-head .searchbox { margin: 0; }
.card-head > h2 + .badge { margin-left: 4px; }

/* === Grupos, Seats e Planilhas === */
.rows > a.row { color: inherit; text-decoration: none; }
.rows > a.row:hover { background: var(--surface-2); }
.rows > a.row.selected:hover { background: var(--primary-soft); }
form.pager { align-items: center; }
form.pager input[type="text"] { flex: 1 1 12rem; width: auto; }
form.pager select { width: auto; }
form.card-head select { width: auto; }
details.more > summary.btn { display: inline-flex; list-style: none; }
details.more > summary.btn::-webkit-details-marker { display: none; }
.btn svg { width: 16px; height: 16px; }
.notice > svg { width: 18px; height: 18px; flex: none; }
details.revoked { border-top: 1px solid var(--border); }
details.revoked > summary { cursor: pointer; color: var(--muted); padding: 12px 24px; }
details.revoked[open] > summary { border-bottom: 1px solid var(--border); }

/* ---------------------------------------------------------------- Prints (Fase 20, onda 1b) */
[hidden] { display: none !important; }
.shots-drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; text-align: center; background: var(--surface-2); }
.shots-drop:focus, .shots-drop.over { border-color: var(--primary); background: var(--primary-soft); outline: none; }
.shots-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.shots-canvas-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.shots-canvas { display: block; max-width: 100%; height: auto; cursor: crosshair; touch-action: none; }
.shots-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.shots-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.shots-fields label, .stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.shots-fields textarea { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.shots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding: 16px 24px; }
.shot { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.shot-thumb { display: block; width: 100%; height: 160px; object-fit: contain; background: var(--code-bg); }
.shot-body { padding: 12px; }
.shot-body p { margin: 0 0 6px; }
.shot-caption { font-weight: 600; white-space: pre-wrap; word-break: break-word; }
.shot-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.shots-retention { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.shots-retention .inline-form { margin-bottom: 0; }
.shots-total { padding: 8px 24px 0; margin: 0; }
.shots-more { text-align: center; padding: 8px 24px 24px; margin: 0; }

/* Aba Rituais: fluxo vertical de passos com seta entre eles, sem script */
.ritual { padding: 14px 16px; border-top: 1px solid var(--border); }
.ritual-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ritual-head h3 { margin: 0 8px 0 0; font-size: 16px; }
.flow { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.flow-step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border);
             border-radius: 10px; background: var(--surface-2); position: relative; margin-bottom: 18px; }
.flow-step:not(:last-child)::after { content: "↓"; position: absolute; left: 21px; bottom: -19px; color: var(--muted); font-weight: 700; }
.flow-step:last-child { margin-bottom: 0; }
.flow-step p { margin: 2px 0 0; }
.flow-n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
          display: inline-flex; align-items: center; justify-content: center; }
.flow-secret { border-color: var(--warn); }
.flow-read { border-style: dashed; }
.flow-title code { font-size: 12px; color: var(--muted); }
.flow-h { flex-direction: row; flex-wrap: wrap; gap: 12px; padding: 0 16px 16px; }
.flow-h .flow-step { flex: 1 1 220px; margin-bottom: 0; }
.flow-h .flow-step::after { content: none !important; }

/* Aba Rituais: seções recolhidas, trilhas por ator e resumo em fichas. Só HTML e CSS. */
.fold { border-top: 1px solid var(--border); }
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "▸"; color: var(--muted); transition: transform .12s ease; width: 12px; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold > summary:hover { background: var(--surface-2); }
.fold > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.fold-title { font-weight: 650; margin-right: 6px; }
.fold > :not(summary) { margin-left: 16px; margin-right: 16px; }
.fold.inner { border-top: 0; margin: 4px 0 12px; }
.fold.inner > summary { padding: 6px 4px; }
.fold.ritual > summary { padding-left: 16px; }
.lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; padding: 4px 0 16px; margin-left: 16px; margin-right: 16px; }
.lane { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.lane-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lane-head h3 { margin: 0; font-size: 16px; }
.lane-browser { border-color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }
.lane-api { box-shadow: inset 0 3px 0 var(--success); }
.lane-explore { box-shadow: inset 0 3px 0 var(--warn); }
.lane-tool, .lane-types { margin: 0; }
.lane-types code { margin-right: 6px; font-size: 12px; }
.lane-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 4px 0; font-size: 13px; }
.lane-facts dt { color: var(--muted); }
.lane-facts dd { margin: 0; }
.pipe-v { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.pipe-node { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0 14px; position: relative; }
.pipe-node:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.pipe-node p { margin: 2px 0 0; }
.actor { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 1px 7px; border-radius: 99px; margin-right: 4px;
         background: var(--primary-soft); color: var(--text); }
.actor-worker .actor { background: var(--warn-soft); }
.actor-partner .actor, .actor-api .actor { background: var(--success-soft); }
.actor-human .actor { background: var(--warn-soft); }
.pipe-h { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; }
.pipe-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px; border: 1px solid var(--border); border-radius: 99px;
             background: var(--surface-2); font-size: 13px; }
.pipe-chip:not(:last-child)::after { content: "→"; color: var(--muted); margin-left: 6px; }
.chip-secret { border-color: var(--warn); }
.chip-read { border-style: dashed; }
.guide { list-style: none; margin: 0 16px 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.guide-step { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.guide-gate { border-color: var(--warn); }
.guide-step p { margin: 2px 0 0; }
.guide-list { margin: 0 16px 12px; padding-left: 20px; }
@media (max-width: 720px) { .fold > :not(summary), .lanes, .guide, .guide-list { margin-left: 12px; margin-right: 12px; } }
