/* Shared admin visual system. Legacy page styles load before this file. */
:root {
  --r-card: 10px;
  --r-ctl: 7px;
  --r-chip: 6px;
  --ink: #18181b;
  --muted: #61616b;
  --muted-2: #71717a;
  --brand: #6846f5;
  --brand-hover: #5838dc;
  --brand-soft: #f2efff;
  --line: #e5e5e9;
  --line-strong: #cfcfd5;
  --bg: #fafafa;
  --surface: #fff;
  --surface-raised: #fff;
  --subtle: #f7f7f8;
  --sidebar: #fff;
  --sidebar-hover: #f5f5f6;
  --positive: #087f5b;
  --positive-bg: #ebf8f1;
  --danger: #b42337;
  --danger-bg: #fff0f1;
  --warning: #925d00;
  --warning-bg: #fff7e5;
  --shadow-sm: 0 1px 2px #18181b08;
  --shadow-lg: 0 20px 60px #18181b1a;
}
:root[data-theme="dark"] {
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --muted-2: #85858f;
  --brand: #a18bff;
  --brand-hover: #b4a3ff;
  --brand-soft: #252035;
  --line: #303034;
  --line-strong: #48484f;
  --bg: #0c0c0e;
  --surface: #151517;
  --surface-raised: #1b1b1e;
  --subtle: #1b1b1e;
  --sidebar: #111113;
  --sidebar-hover: #202023;
  --positive: #6ee7b7;
  --positive-bg: #123b2b;
  --danger: #fda4af;
  --danger-bg: #421c25;
  --warning: #fcd38d;
  --warning-bg: #402e15;
}

body { font-size: 14px; line-height: 1.5; }
h1, h2, h3, h4 { letter-spacing: -.025em; }
h1 { font-size: 29px; font-weight: 680; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { font-size: 13.5px; }
.layout { grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { width: 238px; padding: 18px 12px 14px; background: var(--sidebar); }
.sidebar::after { display: none; }
.sidebar-head { min-height: 48px; padding: 0 4px 12px; }
.sidebar-head .brand { font-size: 16px; }
.sidebar-head .brand img { box-shadow: none; }
.sidebar nav { gap: 2px; padding-top: 12px; }
.nav-group { margin: 20px 10px 8px; font-size: 10px; font-weight: 700; letter-spacing: .055em; color: var(--muted-2); }
.nav-link { min-height: 38px; padding: 9px 11px; border-radius: 7px; font-size: 13px; font-weight: 530; }
.nav-link:hover { background: var(--sidebar-hover); }
.nav-link[aria-current] { background: var(--brand-soft); color: var(--ink); font-weight: 650; }
.nav-link[aria-current]::after { display: none; }
.nav-link[aria-current]::before { top: 7px; bottom: 7px; width: 3px; box-shadow: none; }
.sidebar .session { padding: 14px 8px 2px; font-size: 12px; }
.sidebar .session p, .sidebar .session a { font-size: 12px; }
.sidebar .session .button { min-height: 36px; font-size: 12px; }
.main { max-width: 1580px; padding: 0 clamp(24px, 3.4vw, 56px) 64px; }
.topbar { min-height: 62px; margin-bottom: 31px; background: color-mix(in srgb, var(--bg) 92%, transparent); }
.topbar-copy strong { font-size: 13px; }
.topbar-secure { font-size: 11px!important; }
.heading { margin-bottom: 24px; }
.heading h1 { margin: 0; }
.heading p { display: none; }
.page-body { min-height: 0; gap: 18px; }

.card, .stat, .page-stage, .panel-section, .plan-card { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-sm); }
.card { padding: 22px; }
.card-heading { margin-bottom: 16px; }
.card-heading h2 { font-size: 16px; }
.page-stage { min-height: 0; }
.page-stage-bar { min-height: 58px; gap: 10px; padding: 10px 16px; background: var(--surface); }
.page-stage-bar > span { font-size: 12.5px; }
.page-stage-bar :is(input, select) { min-height: 38px; font-size: 13px; }
.page-stage-body { min-width: 0; }
.stats { gap: 0; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.stat { min-height: 96px; padding: 18px 20px; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.stat:last-child { border-right: 0; }
.stat span { font-size: 12.5px; }
.stat strong { margin-top: 5px; font-size: 27px; font-weight: 650; }
.button { min-height: 38px; padding: 8px 13px; border-radius: var(--r-ctl); background: #18181b; color: #fff; font-size: 13px; font-weight: 600; box-shadow: none; }
.button:hover { background: #303034; opacity: 1; }
.button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.button.secondary:hover { background: var(--subtle); }
:root[data-theme="dark"] .button:not(.secondary):not(.subtle) { background: #f4f4f5; color: #141416; }
:root[data-theme="dark"] .button:not(.secondary):not(.subtle):hover { background: #d4d4d8; }
.theme-button { min-height: 34px; padding: 6px 11px; font-size: 12px; box-shadow: none; }
label { font-size: 13px; font-weight: 570; }
input, select, textarea { min-height: 40px; padding: 8px 11px; border-color: var(--line-strong); border-radius: var(--r-ctl); font-size: 13.5px; background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
.badge { padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-chip); background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 550; }
.badge.positive { border-color: color-mix(in srgb, var(--positive) 20%, var(--line)); }
.panel-status { display: inline-flex; align-items: center; width: max-content; max-width: 100%; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--subtle); font-size: 12px; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.panel-status::before { content: ""; width: 6px; height: 6px; flex: none; margin-right: 6px; border-radius: 50%; background: currentColor; }
.panel-status-positive { color: var(--positive); background: var(--positive-bg); border-color: color-mix(in srgb, var(--positive) 22%, var(--line)); }
.panel-status-warning { color: var(--warning); background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 22%, var(--line)); }
.panel-status-danger { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 22%, var(--line)); }
.notice { margin: 0; padding: 12px 14px; border-radius: var(--r-ctl); font-size: 13px; }
.empty, .panel-empty { margin: 0; padding: 32px 20px; color: var(--muted); font-size: 13px; text-align: center; }
.empty h3, .empty strong { color: var(--ink); }
.table-scroll { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.table-scroll th { height: 39px; background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 600; }
.table-scroll td { height: 46px; font-size: 13px; }

.offer { gap: 14px; min-height: 70px; padding: 14px 18px; background: var(--surface); }
.offer:hover { background: var(--subtle); }
.offer-main :is(a, strong, .text-link) { color: var(--ink); font-size: 14px; font-weight: 620; }
.offer-main small, .offer-metric small { font-size: 12px; line-height: 1.4; }
.offer-mark { width: 36px; height: 36px; border-radius: 7px; background: var(--subtle); border-color: var(--line); color: var(--ink); }
.offer-metric strong { font-size: 14px; font-weight: 640; }
.account-offer { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(190px, 1fr) auto 72px 76px; align-items: center; gap: 18px; }
.accounts-stage .offer-main .text-link { font-size: 14px; }
.accounts-stage .offer-main small { font-size: 12px; }
.accounts-stage .offer-products { display: block; min-width: 0; }
.account-product-summary strong { display: block; font-size: 13px; font-weight: 600; }
.account-product-summary small { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-people { align-items: flex-start; }
.account-people strong { font-size: 14px; }
.account-people small { font-size: 11px; }
.accounts-stage .offer > .button { min-height: 34px; font-size: 12px; }
#pessoas-root .offer { display: grid; grid-template-columns: minmax(240px, 2fr) auto minmax(140px, 1fr) 76px; align-items: center; gap: 18px; }
#pessoas-root .offer > small { font-size: 12px; }
#pessoas-root .offer > .button { min-height: 34px; font-size: 12px; }
.plans .offer { display: grid; grid-template-columns: 36px minmax(190px, 1.5fr) 128px 96px 52px 82px auto; align-items: center; gap: 13px; }
.plans .offer-products { display: flex; flex-wrap: wrap; min-width: 0; gap: 4px; }
.plans .offer-products .badge { padding: 3px 5px; font-size: 10px; }
.plans .offer .row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; margin: 0; }
.plans .offer .row-actions .button { min-height: 32px; padding: 6px 9px; font-size: 11.5px; }
.plans .offer .panel-status { font-size: 11.5px; }

.control-plane { display: flex; flex-direction: column; gap: 16px; }
.cp-tabs { display: flex; gap: 22px; min-height: 44px; padding: 0 2px; overflow-x: auto; overflow-y: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.cp-tabs button { position: relative; flex: none; min-height: 43px; padding: 0 2px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 520; }
.cp-tabs button:hover { color: var(--ink); }
.cp-tabs button[aria-current="page"] { border: 0; border-radius: 0; background: transparent; color: var(--ink); box-shadow: none; font-weight: 650; }
.cp-tabs button[aria-current="page"]::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--ink); }
.panel-section { min-width: 0; overflow: hidden; }
.panel-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.panel-section-head h2 { margin: 0; font-size: 14px; }
.panel-section-head span { color: var(--muted); font-size: 12px; }
.panel-section .table-scroll { border: 0; border-radius: 0; }
.panel-section .table-scroll th { background: var(--subtle); }
.panel-list-head, .panel-list-row { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(140px, 1fr) minmax(160px, 1fr); align-items: center; gap: 18px; padding: 12px 20px; }
.panel-list-head { min-height: 40px; border-bottom: 1px solid var(--line); background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 600; }
.panel-list-row { min-height: 65px; border-bottom: 1px solid var(--line); }
.panel-list-row:last-child { border-bottom: 0; }
.panel-list-row strong { font-size: 13.5px; font-weight: 620; }
.panel-list-row time { color: var(--muted); font-size: 12.5px; }
.panel-modules-head, .panel-module-row { grid-template-columns: minmax(220px, 2fr) minmax(200px, 1fr); }
.panel-module-row select { width: min(100%, 260px); min-height: 37px; margin: 0; font-size: 13px; }
.panel-audit .timeline { margin: 0; padding: 0; }
.panel-audit-head { grid-template-columns: minmax(0, 1fr) auto; }
.panel-audit .timeline-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; min-height: 53px; padding: 12px 20px; }
.panel-audit .timeline-row strong { font-size: 13px; font-weight: 550; }
.panel-audit .timeline-row time { color: var(--muted); font-size: 12px; }
.track-card { padding: 12px; }
.track-card .track-embed { display: block; min-width: 0; }
.track-card .core-operations-context { display: none; }

@media (max-width: 1280px) {
  .account-offer { grid-template-columns: minmax(210px, 1.5fr) minmax(150px, 1fr) auto 60px; }
  .account-offer > .button { grid-column: 1 / -1; justify-self: end; }
  .plans .offer { display: flex; flex-wrap: wrap; }
  .plans .offer-main { flex: 1 1 260px; }
  .plans .offer .row-actions { margin-left: auto; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { width: 210px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .account-offer { display: flex; flex-wrap: wrap; }
  .account-offer .offer-main { flex: 1 1 220px; }
  .account-offer .account-product-summary { flex: 1 1 200px; }
  .account-offer > .button { margin-left: auto; }
  #pessoas-root .offer { grid-template-columns: minmax(180px, 2fr) auto 76px; }
  #pessoas-root .offer > small { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { width: 100%; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; flex-direction: row; gap: 2px; margin: 7px 0 0; padding: 2px 0 4px; overflow-x: auto; }
  .sidebar .session { display: none; }
  .nav-group { display: none; }
  .nav-link { flex: 0 0 auto; width: auto; min-height: 36px; gap: 5px; padding: 7px 6px; font-size: 12px; white-space: nowrap; }
  .nav-link svg { width: 13px; height: 13px; flex-basis: 13px; }
  .main { padding: 0 16px 40px; }
  .topbar { min-height: 50px; margin-bottom: 24px; }
  .heading { margin-bottom: 20px; }
  .heading h1 { font-size: 25px; }
  .page-body { gap: 14px; }
  .page-stage-bar { align-items: stretch; }
  .page-stage-bar :is(input, select) { max-width: none; }
  .cp-tabs { gap: 9px; }
  .cp-tabs button { font-size: 12px; }
  .panel-list-head { display: none; }
  .panel-list-row, .panel-modules-head, .panel-module-row { grid-template-columns: 1fr auto; gap: 7px 14px; padding: 13px 15px; }
  .panel-health-row time { grid-column: 1 / -1; }
  .panel-module-row select { width: min(100%, 190px); }
  .panel-audit .timeline-row { padding: 12px 15px; }
  .account-offer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .account-offer .offer-main { grid-column: 1 / -1; }
  .account-offer .account-product-summary { grid-column: 1 / -1; grid-row: 2; order: 0; }
  .account-offer .offer-main { grid-row: 1; order: -1; }
  .account-offer .panel-status { grid-column: 1; grid-row: 3; order: 1; }
  .account-offer .account-people { grid-column: 2; grid-row: 3; order: 2; }
  .account-offer > .button { grid-column: 1 / -1; grid-row: 4; width: 100%; margin: 0; order: 3; }
  #pessoas-root .offer { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  #pessoas-root .offer > small { grid-column: 1 / -1; grid-row: auto; }
  #pessoas-root .offer > .button { grid-column: 1 / -1; width: 100%; margin: 0; }
  .plans .offer { gap: 9px 12px; }
  .plans .offer-main { flex: 1 1 calc(100% - 50px); }
  .plans .offer .row-actions { width: 100%; justify-content: flex-start; margin: 4px 0 0; }
  .plans .offer .row-actions .button { flex: 1 1 auto; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { min-height: 84px; padding: 14px; }
  .stat strong { font-size: 24px; }
  .page-stage-bar :is(input, select) { width: 100%; }
  .panel-module-row { grid-template-columns: 1fr; }
  .panel-module-row select { width: 100%; }
  .panel-audit .timeline-row { grid-template-columns: 1fr; gap: 3px; }
}
