@font-face { font-family: 'Sora'; src: url('/fonts/Sora-Variable.ttf') format('truetype'); font-weight: 100 800; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Variable.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

:root {
  --indigo: #1d1934;
  --gold: #fec53e;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e6e6e6;
  --text: #1d1934;
  --muted: #6a6785;
  --primary: #1d1934;
  --primary-text: #ffffff;
  --primary-hover: #2e2850;
  --accent: #fec53e;
  --focus: #6c5ce7;
  --row-hover: #f4f3fb;
  --row-sel: #eceaf9;
  --shadow: 0 6px 20px rgba(29, 25, 52, .09);
  --ok-bg: #dcf5e6; --ok: #146c3a;
  --warn-bg: #fff1cc; --warn: #8a5a00;
  --err-bg: #fde0e0; --err: #a31f1f;
  --info-bg: #e0eafe; --info: #1e4fb3;
  --neutral-bg: #eceaf4; --neutral: #4b4767;
  --side-bg: #1d1934; --side-text: #c9c6dc; --side-active: rgba(254, 197, 62, .14);
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --font-head: 'Sora', system-ui, sans-serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121022;
  --surface: #1b1832;
  --surface-2: #211e3c;
  --border: #302c4f;
  --text: #eeedf7;
  --muted: #a09db8;
  --primary: #fec53e;
  --primary-text: #1d1934;
  --primary-hover: #ffd266;
  --focus: #fec53e;
  --row-hover: #231f40;
  --row-sel: #2b2650;
  --shadow: 0 6px 24px rgba(0, 0, 0, .4);
  --ok-bg: #12351f; --ok: #6fdd9b;
  --warn-bg: #3a2c0a; --warn: #fec53e;
  --err-bg: #3d1717; --err: #ff9a9a;
  --info-bg: #172a52; --info: #8fb4ff;
  --neutral-bg: #2a2748; --neutral: #bdbad6;
  --side-bg: #0d0b1c; --side-active: rgba(254, 197, 62, .16);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; line-height: 1.2; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ── Layout ── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--gold); color: var(--indigo); display: grid; place-items: center; font: 800 18px var(--font-head); }
.brand b { font: 700 16px var(--font-head); display: block; letter-spacing: .01em; }
.brand small { font-size: 11px; color: #9b98b5; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav-label { font: 600 10.5px var(--font); letter-spacing: .08em; text-transform: uppercase; color: #7f7c9c; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); text-decoration: none; color: var(--side-text); font-weight: 500; position: relative; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.nav .count { margin-left: auto; background: var(--gold); color: var(--indigo); font: 700 11px var(--font); padding: 1px 7px; border-radius: 99px; }
.side-foot { padding: 12px 10px 0; font-size: 11.5px; color: #7f7c9c; border-top: 1px solid rgba(255, 255, 255, .08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 32px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.search { flex: 1; max-width: 560px; position: relative; }
.search input { width: 100%; height: 40px; border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--r); padding: 0 14px 0 40px; }
.search .icon { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.search kbd { position: absolute; right: 10px; top: 9px; font: 500 11px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: var(--surface); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r); border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); position: relative; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; border: 2px solid var(--surface); }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--indigo); color: var(--gold); display: grid; place-items: center; font: 700 12px var(--font-head); }
:root[data-theme="dark"] .avatar { background: var(--gold); color: var(--indigo); }
.user b { display: block; font-size: 12.5px; line-height: 1.2; }
.user small { color: var(--muted); font-size: 11px; }
.menu { position: absolute; right: 32px; top: 62px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 220px; padding: 6px; z-index: 40; }
.menu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: var(--r); cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }

.page { padding: 28px 32px 48px; max-width: 1560px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font: 700 11px var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.eyebrow::before { content: ''; width: 18px; height: 3px; border-radius: 2px; background: var(--gold); }
.page-head h1 { font-size: 30px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Controles ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.gold { background: var(--gold); color: var(--indigo); border-color: var(--gold); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--err); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { height: 40px; width: 100%; padding: 0 12px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r); }
textarea.input { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
.input:hover { border-color: var(--muted); }
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.input[readonly] { background: var(--surface-2); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card.pad { padding: 20px; }
.card-title { font: 600 15px var(--font-head); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card-title small { font: 400 12px var(--font); color: var(--muted); margin-left: auto; }

/* ── KPIs ── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { display: flex; gap: 14px; padding: 18px; align-items: flex-start; text-decoration: none; transition: box-shadow .15s, transform .15s; }
a.kpi:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.kpi-icon.blue { background: var(--info-bg); color: var(--info); }
.kpi-icon.red { background: var(--err-bg); color: var(--err); }
.kpi-icon.amber { background: var(--warn-bg); color: var(--warn); }
.kpi-icon.green { background: var(--ok-bg); color: var(--ok); }
.kpi-label { color: var(--muted); font-weight: 500; font-size: 13px; }
.kpi-value { font: 700 26px var(--font-head); letter-spacing: -.01em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: 12px; display: flex; align-items: center; gap: 4px; color: var(--muted); }
.kpi-delta.up { color: var(--ok); } .kpi-delta.down { color: var(--err); }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }

/* ── Chips ── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.err { background: var(--err-bg); color: var(--err); } .chip.info { background: var(--info-bg); color: var(--info); }

/* ── Filtros + tabela ── */
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 14px; align-items: end; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.filters .search-field { position: relative; }
.filters .search-field .icon { position: absolute; left: 12px; bottom: 11px; color: var(--muted); }
.filters .search-field input { padding-left: 38px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.split.open { grid-template-columns: minmax(0, 1fr) 380px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; user-select: none; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--text); }
th .arrow { opacity: .8; margin-left: 4px; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--row-hover); }
tbody tr.sel { background: var(--row-sel); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { display: block; color: var(--muted); font-size: 12px; }
td.trunc { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-foot { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); flex-wrap: wrap; }
.pager { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.pager button { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; font-weight: 600; }
.pager button:hover { background: var(--surface-2); }
.pager button.cur { background: var(--primary); color: var(--primary-text); }
.pager button[disabled] { opacity: .35; cursor: default; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }

/* ── Painel de detalhe ── */
.detail { position: sticky; top: 82px; max-height: calc(100vh - 100px); overflow: auto; padding: 20px; }
.detail-head { display: flex; align-items: center; gap: 10px; }
.detail h2 { font-size: 18px; margin: 10px 0 2px; }
.dl { display: grid; grid-template-columns: 112px 1fr; gap: 10px 12px; margin: 16px 0; font-size: 13px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; word-break: break-word; }
.detail .btns { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.hist { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.hist li { font-size: 12.5px; margin-bottom: 8px; list-style: none; } .hist ul { padding: 0; margin: 10px 0 0; }

/* ── Modal / drawer ── */
.overlay { position: fixed; inset: 0; background: rgba(13, 11, 28, .55); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: min(860px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow); border: 1px solid var(--border); }
.modal.sm { width: min(460px, 100%); }
.modal header { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal header h2 { font-size: 18px; flex: 1; }
.modal .body { padding: 20px 22px; overflow: auto; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-grid .span2 { grid-column: span 2; } .form-grid .span3 { grid-column: 1 / -1; }
.form-sec { grid-column: 1 / -1; font: 700 11px var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.form-sec:first-child { margin-top: 0; padding-top: 0; border: 0; }

/* ── Toasts ── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--indigo); color: #fff; padding: 12px 16px; border-radius: var(--r); box-shadow: var(--shadow); max-width: 380px; border-left: 4px solid var(--gold); animation: up .2s ease; }
.toast.err { border-left-color: #e5484d; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ── Gráficos ── */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--indigo); }
:root[data-theme="dark"] .bar-fill { background: var(--gold); }
.bar-fill.ok { background: #2fa866; } .bar-fill.warn { background: var(--gold); } .bar-fill.err { background: #e5484d; } .bar-fill.info { background: #4a7bec; } .bar-fill.neutral { background: #8b88a8; }
.cols { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 10px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.col .b { width: 100%; max-width: 44px; background: var(--indigo); border-radius: 8px 8px 3px 3px; min-height: 3px; }
:root[data-theme="dark"] .col .b { background: #3f3a73; }
.col.cur .b { background: var(--gold) !important; }
.col small { font-size: 11px; color: var(--muted); } .col .v { font-size: 10.5px; color: var(--muted); }
.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); text-decoration: none; border: 1px solid transparent; }
a.alert:hover { border-color: var(--border); background: var(--row-hover); }
.alert b { display: block; font-size: 14px; } .alert small { color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; } .timeline li:last-child { border: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 10px 14px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center; }
.tab.active { color: var(--text); border-bottom-color: var(--gold); }
.tab .n { background: var(--neutral-bg); color: var(--neutral); border-radius: 99px; padding: 0 8px; font-size: 11.5px; }
.note { padding: 12px 14px; border-radius: var(--r); background: var(--info-bg); color: var(--info); font-size: 13px; display: flex; gap: 10px; }
.code { font: 12px ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 16px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ── Login ── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--indigo); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 42px; font-weight: 800; letter-spacing: -.02em; max-width: 520px; }
.login-art p { color: rgba(255, 255, 255, .78); max-width: 460px; font-size: 16px; }
.login-art ul { list-style: none; padding: 0; display: grid; gap: 12px; color: rgba(255, 255, 255, .82); }
.login-art li { display: flex; gap: 10px; align-items: center; } .login-art li .icon { color: var(--gold); }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.login-form form { width: min(400px, 100%); display: grid; gap: 16px; }
.login-form h2 { font-size: 26px; } .error-msg { color: var(--err); background: var(--err-bg); padding: 10px 12px; border-radius: var(--r); font-size: 13px; }

@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(2, 1fr); } .filters { grid-template-columns: repeat(3, 1fr); } .split.open { grid-template-columns: 1fr; } .detail { position: static; max-height: none; } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; } .sidebar { display: none; } .page { padding: 20px 16px 40px; } .topbar { padding: 12px 16px; }
  .grid-3, .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: auto; } .login { grid-template-columns: 1fr; } .login-art { display: none; } .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } .user > div:not(.avatar) { display: none; } }

/* com painel de detalhe aberto, esconde colunas secundárias */
.split.open table th:nth-child(5), .split.open table td:nth-child(5), .split.open table th:nth-child(8), .split.open table td:nth-child(8), .split.open table th:nth-child(10), .split.open table td:nth-child(10), .split.open table th:nth-child(4), .split.open table td:nth-child(4) { display: none; }
.split > .card { min-width: 0; }

.kpi > div:last-child { min-width: 0; }
.kpi-value { font-size: clamp(18px, 1.7vw, 26px); white-space: nowrap; }

.kpi-value { font-size: clamp(17px, 1.45vw, 26px); }

.tab-v { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: var(--r); cursor: pointer; font-weight: 500; color: var(--muted); }
.tab-v:hover { background: var(--surface-2); color: var(--text); }
.tab-v.active { background: var(--row-sel); color: var(--text); font-weight: 700; box-shadow: inset 3px 0 0 var(--gold); }
@media (max-width: 900px) { #pgrid { grid-template-columns: 1fr !important; } }

/* edição direta na tabela */
.inl { height: 30px; border: 1px solid transparent; border-radius: 8px; background: var(--surface-2); padding: 0 8px; font-size: 12.5px; font-weight: 600; max-width: 190px; cursor: pointer; }
select.inl { appearance: none; -webkit-appearance: none; padding-right: 8px; background: var(--neutral-bg); color: var(--neutral); border-radius: 99px; }
select.inl.ok { background: var(--ok-bg); color: var(--ok); } select.inl.warn { background: var(--warn-bg); color: var(--warn); }
select.inl.err { background: var(--err-bg); color: var(--err); } select.inl.info { background: var(--info-bg); color: var(--info); }
.inl:hover { border-color: var(--muted); } .inl:focus-visible { border-color: transparent; }
input.inl { width: 128px; font-weight: 500; background: transparent; } input.inl.num { width: 112px; text-align: right; font-weight: 700; }
input.inl:hover, input.inl:focus { background: var(--surface); }
.inl.saved { animation: flash .9s; } @keyframes flash { 30% { box-shadow: 0 0 0 3px rgba(47,168,102,.45); } }
.grid-edit input, .grid-edit select { height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 0 8px; width: 100%; min-width: 0; }
.grid-edit td { padding: 6px 6px; border-bottom: 1px solid var(--border); } .grid-edit th { padding: 8px 6px; }
.modal.xl { width: min(1280px, 100%); }

/* janela de pagamento: formulário + lateral com situação, pasta e histórico */
.pay-modal { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.pay-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.side-box { border: 1px solid var(--border); border-radius: var(--r); padding: 14px; background: var(--surface-2); }
.side-box > b { display: block; margin-bottom: 8px; font-family: var(--font-head); font-size: 13px; }
.side-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 13px; }
.side-sub { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12.5px; }
.hist-list { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow: auto; } .hist-list li { font-size: 12.5px; margin-bottom: 10px; }
@media (max-width: 1000px) { .pay-modal { grid-template-columns: 1fr; } .pay-side { position: static; } }

/* notificações */
.badge { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #e5484d; color: #fff; font: 700 10.5px/18px var(--font); text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.modal.md { width: min(560px, 100%); }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.notif-item { display: flex; gap: 12px; width: 100%; text-align: left; padding: 11px 12px; border: 1px solid transparent; border-radius: var(--r); background: none; cursor: pointer; align-items: flex-start; position: relative; }
.notif-item:hover { background: var(--row-hover); border-color: var(--border); }
.notif-item.unread { background: var(--row-sel); }
.notif-item.unread::after { content: ''; position: absolute; right: 12px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.notif-ic { width: 32px; height: 32px; border-radius: 10px; padding: 0; justify-content: center; flex: none; }
.notif-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; padding-right: 18px; }
.notif-txt b { font-size: 13.5px; } .notif-txt small { font-size: 11.5px; }

/* ───────── menu lateral recolhível + gaveta no celular ───────── */
.app { transition: grid-template-columns .2s ease; }
.app.collapsed { grid-template-columns: 72px 1fr; }
.app.collapsed .sidebar { padding: 20px 10px; }
.app.collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.app.collapsed .brand > div:last-child, .app.collapsed .nav a span, .app.collapsed .nav-label, .app.collapsed .side-foot { display: none; }
.app.collapsed .nav a { justify-content: center; padding: 11px 0; }
.app.collapsed .nav a.active::before { left: -10px; }
.app.collapsed .nav .count { display: none; }
.scrim { display: none; }
.topbar .search { min-width: 0; }

/* ───────── tabela de pagamentos compacta ───────── */
table.compact th { padding: 8px 10px; font-size: 11.5px; }
table.compact td { padding: 5px 10px; font-size: 13px; }
table.compact td.trunc { max-width: 190px; }
table.compact .inl { height: 26px; font-size: 12px; }
table.compact select.inl { padding: 0 9px; }
table.compact input.inl { width: 116px; padding: 0 6px; } table.compact input.inl.num { width: 96px; }
table.compact input.inl[data-inl="sdcv"] { width: 92px !important; }
table.compact .chip { padding: 1px 8px; font-size: 11.5px; }
table.compact .icon-btn { width: 28px; height: 28px; }
table.compact td:nth-child(2) { font-variant-numeric: tabular-nums; }

/* ───────── responsivo ───────── */
.page { min-width: 0; } .main { min-width: 0; }
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
@media (max-width: 1280px) {
}
@media (max-width: 1100px) {
  .page { padding: 22px 20px 40px; } .topbar { padding: 12px 20px; }
}
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: 264px; height: 100dvh; z-index: 80; transform: translateX(-102%); transition: transform .22s ease; box-shadow: none; }
  .app.collapsed .sidebar { padding: 20px 14px; }
  .app.collapsed .brand > div:last-child, .app.collapsed .nav a span, .app.collapsed .nav-label, .app.collapsed .side-foot { display: revert; }
  .app.collapsed .nav a { justify-content: flex-start; padding: 10px 12px; } .app.collapsed .brand { justify-content: flex-start; padding: 4px 10px 22px; }
  .app.drawer-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .45); }
  .app.drawer-open .scrim { display: block; position: fixed; inset: 0; background: rgba(13, 11, 28, .55); z-index: 70; }
  .page-head h1 { font-size: 24px; } .page-head .actions { margin-left: 0; width: 100%; }
  .topbar .search kbd { display: none; } .menu { right: 16px; }
  .overlay { padding: 8px; } .modal { max-height: 96vh; } .modal header, .modal .body, .modal footer { padding-left: 16px; padding-right: 16px; }
  .modal footer { flex-wrap: wrap; } .detail { position: static; }
  .bar-row { grid-template-columns: 110px 1fr auto; } .cols { gap: 4px; } .col .v { display: none; }
  .table-foot { padding: 10px 14px; } .pager { margin-left: 0; width: 100%; justify-content: center; flex-wrap: wrap; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; } .tab { white-space: nowrap; }
}
@media (max-width: 700px) {
  .filters { grid-template-columns: 1fr 1fr; padding: 12px; } .filters .search-field, .filters #f-clear { grid-column: 1 / -1; }
  .page { padding: 16px 12px 32px; } .topbar { gap: 8px; padding: 10px 12px; }
  .top-actions { gap: 4px; } .user { padding: 3px; } .user .icon { display: none; }
  .btn { padding: 0 12px; } .page-head .actions .btn { flex: 1 1 auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; } .kpi { padding: 14px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; } .toast { max-width: none; }
  .dl { grid-template-columns: 96px 1fr; }
}
@media (max-width: 480px) {
  .filters { grid-template-columns: 1fr; } .kpis { grid-template-columns: 1fr; }
  .login-form { padding: 20px; } .page-head h1 { font-size: 22px; }
}
/* barra de ordenação e filtros avançados */
.toolbar { display: flex; gap: 10px; align-items: center; padding: 10px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.sortbox { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-left: auto; }
.sortbox select { height: 32px; width: auto; font-size: 13px; }
.filters.adv { background: var(--surface-2); grid-template-columns: repeat(5, minmax(0, 1fr)); }
.checks { grid-column: 1 / -1; display: flex; gap: 22px; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; }
.th-sort { cursor: pointer; user-select: none; } .th-sort:hover { color: var(--text); }
@media (max-width: 1280px) { .filters.adv { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .filters.adv { grid-template-columns: 1fr 1fr; } .sortbox { margin-left: 0; width: 100%; } .sortbox select { flex: 1; } .toolbar { padding: 10px 12px; } }
@media (max-width: 480px) { .filters.adv { grid-template-columns: 1fr; } }
/* correções de overflow em telas estreitas */
@media (max-width: 900px) {
  #pgrid { grid-template-columns: minmax(0, 1fr) !important; }
  #gnav { display: flex; overflow-x: auto; gap: 4px; }
  #gnav .tab-v { width: auto; white-space: nowrap; flex: none; }
  #gnav .tab-v.active { box-shadow: inset 0 -3px 0 var(--gold); }
}
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpi-value { white-space: normal; overflow-wrap: anywhere; } }
.kpis, .grid-2, .grid-3 { min-width: 0; } .card, .kpi { min-width: 0; }
.cols { overflow: hidden; }
.bar-row { grid-template-columns: minmax(90px, 150px) minmax(0, 1fr) auto; }
.bar-row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .bar-row { grid-template-columns: minmax(80px, 110px) minmax(0, 1fr) auto; } }
.timeline li { flex-wrap: wrap; gap: 2px 12px; } .timeline li > span:last-child { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 700px) { .timeline li > * { min-width: 0 !important; } }
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-2.even { grid-template-columns: minmax(0, 1fr); } }
.search { max-width: none; } .search input { min-width: 0; }
.search { flex: 1 1 0; max-width: 560px; }
@media (max-width: 700px) {
  .topbar { gap: 6px; } .icon-btn { width: 36px; height: 36px; } .topbar .search input { padding-left: 34px; } .search .icon { left: 10px; }
  .user { flex: none; } .top-actions { flex: none; margin-left: 0; }
}
/* conciliação: chips de filtro e tabela */
.fchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); cursor: pointer; opacity: .55; }
.fchip b { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.fchip.on { opacity: 1; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(254, 197, 62, .35); }
.fchip:hover { opacity: 1; }
.conc-table td .sub { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ───────── login: moderno, com animação de entrada ───────── */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes spinr { to { transform: rotate(360deg); } }
@keyframes ringfill { from { stroke-dasharray: 0 100; } to { stroke-dasharray: 94 100; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(254, 197, 62, .6); } 100% { box-shadow: 0 0 0 12px rgba(254, 197, 62, 0); } }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes splash-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes splash-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; transform: scale(1.03); } }

.splash { position: fixed; inset: 0; z-index: 200; background: var(--indigo); display: grid; place-content: center; justify-items: center; gap: 14px; animation: splash-out .55s ease 1.35s forwards; }
.splash-mark { width: 76px; height: 76px; border-radius: 22px; background: var(--gold); color: var(--indigo); display: grid; place-items: center; font: 800 40px var(--font-head); animation: splash-in .6s cubic-bezier(.2, 1.3, .4, 1) both; }
.splash-line { width: 120px; height: 3px; border-radius: 3px; background: var(--gold); transform-origin: left; animation: splash-line .6s ease .45s both; }
.splash-name { font: 700 22px var(--font-head); color: #fff; letter-spacing: .12em; text-transform: uppercase; animation: rise .5s ease .7s both; }

.login.intro { animation: rise .01s linear 0s both; }
.rise { opacity: 0; animation: rise .7s cubic-bezier(.2, .7, .2, 1) calc(var(--d, 0s) + 1.35s) forwards; }
.login.quick .rise { animation-delay: var(--d, 0s); }
.login.quick .art-card .rg, .login.quick .mini-bars i { animation-delay: .6s; }

.login { grid-template-columns: 1.15fr 1fr; overflow: hidden; }
.login-art { position: relative; overflow: hidden; display: grid; grid-template-rows: auto auto 1fr auto; gap: 22px; padding: 44px 56px; }
.login-art > * { position: relative; z-index: 1; }
.art-rings { position: absolute !important; inset: 0; z-index: 0 !important; pointer-events: none; }
.art-rings i { position: absolute; border: 1.5px solid rgba(255, 255, 255, .07); border-radius: 50%; right: -180px; top: -140px; width: 620px; height: 620px; animation: spin-slow 80s linear infinite; }
.art-rings i:nth-child(2) { width: 440px; height: 440px; right: -90px; top: -50px; border-color: rgba(254, 197, 62, .14); animation-duration: 55s; animation-direction: reverse; }
.art-rings i:nth-child(3) { width: 760px; height: 760px; left: -300px; right: auto; top: auto; bottom: -420px; animation-duration: 110s; }
.art-rings i::after { content: ''; position: absolute; top: 12%; left: 8%; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.art-copy h1 { font-size: clamp(30px, 3.2vw, 46px); font-weight: 800; letter-spacing: -.02em; max-width: 560px; line-height: 1.1; }
.art-copy h1 em { font-style: normal; color: var(--gold); }
.art-copy p { margin-top: 16px; }
.art-stage { position: relative; min-height: 230px; max-width: 520px; }
.art-card { position: absolute; background: #28234c; border: 1px solid rgba(255, 255, 255, .1); border-radius: 16px; padding: 14px 16px; color: #fff; box-shadow: 0 14px 34px rgba(0, 0, 0, .28); display: flex; gap: 12px; align-items: center; }
.art-card small { display: block; color: rgba(255, 255, 255, .62); font-size: 11.5px; }
.art-card strong { font: 600 14px var(--font-head); }
.art-card.c1 { left: 0; top: 4px; animation: floaty 6s ease-in-out infinite; }
.art-card.c2 { left: 190px; top: 74px; flex-direction: column; align-items: stretch; gap: 8px; width: 210px; animation: floaty 7s ease-in-out -2s infinite; }
.art-card.c3 { left: 28px; top: 150px; font-size: 13px; animation: floaty 8s ease-in-out -4s infinite; }
.art-card.rise { animation: rise .7s cubic-bezier(.2, .7, .2, 1) calc(var(--d, 0s) + 1.35s) forwards, floaty 6s ease-in-out calc(var(--d, 0s) + 2.2s) infinite; }
.login.quick .art-card.rise { animation-delay: var(--d, 0s), calc(var(--d, 0s) + .8s); }
.ring { position: relative; width: 52px; height: 52px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); fill: none; stroke-width: 3.4; }
.rg-bg { stroke: rgba(255, 255, 255, .12); } .rg { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 0 100; animation: ringfill 1.4s ease calc(2.2s) forwards; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 13px var(--font-head); }
.mini-bars { display: flex; align-items: flex-end; gap: 6px; height: 44px; }
.mini-bars i { flex: 1; height: var(--h); border-radius: 4px 4px 2px 2px; background: rgba(255, 255, 255, .22); transform-origin: bottom; transform: scaleY(0); animation: grow .6s ease calc(2.2s + var(--i) * .07s) forwards; }
.mini-bars i:last-child { background: var(--gold); }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); animation: pulse 1.8s ease-out infinite; flex: none; }
.art-list { margin: 0; padding: 0; }

.login-form { padding: 32px; background: var(--bg); display: grid; place-items: center; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 34px 32px 26px; display: grid; gap: 18px; box-shadow: var(--shadow); }
.login-card.shake { animation: shake .45s ease; opacity: 1; }
.lc-head { display: flex; gap: 14px; align-items: center; }
.lc-head h2 { font-size: 22px; } .lc-head p { margin: 4px 0 0; font-size: 13px; }
.brand-mark.sm { width: 42px; height: 42px; border-radius: 12px; font-size: 22px; flex: none; }
.icon-field .inp { position: relative; } .icon-field .inp > .icon { position: absolute; left: 13px; top: 13px; color: var(--muted); pointer-events: none; }
.icon-field .input { height: 46px; padding-left: 42px; padding-right: 44px; border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
.icon-field .input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px rgba(108, 92, 231, .16); }
:root[data-theme="dark"] .icon-field .input:focus { box-shadow: 0 0 0 4px rgba(254, 197, 62, .18); }
.eye { position: absolute; right: 6px; top: 6px; width: 34px; height: 34px; border: 0; background: none; border-radius: 9px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.eye:hover { background: var(--surface-2); color: var(--text); }
.login-btn { height: 48px; border-radius: 12px; font-size: 15px; position: relative; overflow: hidden; transition: transform .12s ease, background .15s; }
.login-btn:not([disabled]):hover { transform: translateY(-1px); } .login-btn:active { transform: translateY(0); }
.login-btn .spin { display: none; width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spinr .7s linear infinite; }
.login-btn.loading span { display: none; } .login-btn.loading .spin { display: block; }
.lc-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; text-align: center; }
.error-msg { animation: rise .25s ease both; }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } .login-form { min-height: 100vh; padding: 20px; } .login-card { padding: 28px 22px 22px; } .rise { animation-delay: calc(var(--d, 0s) + 1.1s); } }
@media (prefers-reduced-motion: reduce) {
  .splash, .rise, .art-card, .art-rings i, .mini-bars i, .rg, .pulse { animation: none !important; opacity: 1 !important; transform: none !important; }
  .splash { display: none; } .rg { stroke-dasharray: 94 100; }
}
/* ───────── login: conteúdo centralizado e sem deslocamento lateral ───────── */
.login, .login-art { overflow: clip; }
.art-rings { overflow: hidden; }
.login-art { grid-template-rows: none; justify-items: center; align-content: center; gap: 36px; padding: 40px clamp(24px, 4vw, 64px); }
.login-art > * { width: min(560px, 100%); }
.login-art > .art-rings { width: auto; }
.login-art .brand { padding: 0; }
.art-stage { max-width: none; }
.art-copy h1 { max-width: none; }
/* logo da lateral: atalho para o Dashboard */
a.brand { text-decoration: none; cursor: pointer; border-radius: var(--r); transition: opacity .15s; }
a.brand:hover { opacity: .85; }
a.brand .brand-mark { transition: transform .2s ease; } a.brand:hover .brand-mark { transform: scale(1.06) rotate(-3deg); }

/* conciliação: tabela que ocupa a largura toda e se reorganiza em telas menores */
.conc-table { width: 100%; }
.conc-table td.trunc { max-width: 170px; }
.conc-table .c-sit { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.conc-table .c-sit .apply { height: 24px; padding: 0 8px; font-size: 11.5px; }
.conc-table .c-nf b, .conc-table .c-val .inl { display: block; }
.conc-table .c-val { text-align: right; } .conc-table .c-val .inl { margin-left: auto; }
.conc-table td .sub { font-size: 11.5px; }

/* conciliação: colunas por largura de tela (sem rolagem lateral em notebooks) */
.conc-table .fn-narrow { display: none; }
@media (max-width: 1600px) { .conc-table th:nth-child(9), .conc-table td:nth-child(9) { display: none; } }   /* OBC */
@media (max-width: 1450px) { .conc-table th:nth-child(6), .conc-table td:nth-child(6) { display: none; } }   /* vencimento */
@media (max-width: 1180px) {
  .conc-table th:nth-child(4), .conc-table td:nth-child(4) { display: none; }                                  /* fornecedor vai para baixo do NF */
  .conc-table .fn-narrow { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 1100px) { .conc-table td:nth-child(8) .sub { display: none; } }
@media (max-width: 640px)  { .conc-table th:nth-child(8), .conc-table td:nth-child(8) { display: none; } }

@media (max-width: 1100px) {
  .conc-table th, .conc-table td { padding-left: 6px; padding-right: 6px; }
  .conc-table .inl.num { width: 84px; } .conc-table select.inl { max-width: 118px; font-size: 11.5px; }
  .conc-table .c-sit .apply { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
  .conc-table .chip { font-size: 11px; padding: 1px 7px; }
}
.conc-table td.c-nf .sub { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conc-table td.c-val .sub { white-space: nowrap; }

/* pagamentos: colunas por largura de tela (sem rolagem lateral em notebooks) */
.pay-table .sub-m { display: none; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-table .sub-m .mm { display: none; }
@media (max-width: 1600px) {
  .pay-table th:nth-child(5), .pay-table td:nth-child(5), .pay-table th:nth-child(8), .pay-table td:nth-child(8) { display: none; }   /* tipo, SDCV */
  .pay-table .sub-m { display: block; }
}
@media (max-width: 1450px) { .pay-table th:nth-child(10), .pay-table td:nth-child(10) { display: none; } }                          /* OBC */
@media (max-width: 1180px) {
  .pay-table th:nth-child(4), .pay-table td:nth-child(4), .pay-table th:nth-child(11), .pay-table td:nth-child(11) { display: none; }   /* marca, pasta */
  .pay-table .sub-m .mm { display: inline; }
}
@media (max-width: 900px) { .pay-table th:nth-child(6), .pay-table td:nth-child(6) { display: none; } }                              /* vencimento */
@media (max-width: 640px) { .pay-table th:nth-child(7), .pay-table td:nth-child(7) { display: none; } }

@media (max-width: 1100px) {
  .pay-table th, .pay-table td { padding-left: 6px; padding-right: 6px; }
  .pay-table input.inl { width: 108px; } .pay-table input.inl.num { width: 86px; } .pay-table select.inl { max-width: 122px; }
  .pay-table td.trunc { max-width: 150px; }
}
@media (max-width: 1060px) { .pay-table input.inl:not(.num) { width: 100px; } .pay-table td.trunc { max-width: 125px; } .pay-table .sub-m { max-width: 125px; } }