/* UpTech Brasil — linguagem visual aprovada para a plataforma inteira. */
:root {
  --bg: #0D0E10;
  --panel: #0D0E10;
  --panel-2: #17191D;
  --border: #282A30;
  --border-2: #383B43;
  --text: #F4F4F5;
  --muted: #A1A1AA;
  --gold: #FFBF16;
  --gold-2: #FFD056;
  --green: #63D391;
  --red: #FF626A;
  --blue: #79AFFF;
  --radius: 8px;
  --sidebar-bg: #101114;
  --side-active-bg: #1A1C20;
  --side-hover-bg: #17191D;
  --side-icon: #A1A1AA;
  --focus: #FFD056;
  color-scheme: dark;
}

html { background: var(--bg); scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-size: 13.5px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
::selection { background: rgba(255, 191, 22, .28); color: var(--text); }
* { scrollbar-color: var(--border-2) transparent; scrollbar-width: thin; }

.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 500; transform: translateY(-160%);
  background: var(--gold); color: #171100; padding: 8px 12px; border-radius: 6px; font-weight: 700;
}
.skip-link:focus { transform: translateY(0); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus) !important; outline-offset: 2px;
}

/* Shell e navegação */
.sidebar {
  --side-w: 280px;
  --side-w-collapsed: 68px;
  background: var(--sidebar-bg);
  border-right-color: var(--border);
  padding: 16px 10px 14px;
}
.sidebar-top { min-height: 62px; margin: 0 4px 10px; }
.sidebar .brand { width: 56px; height: 56px; border-radius: 0; }
.side-link, .side-group-btn { min-height: 42px; padding: 9px 11px; border-radius: 7px; font-size: 13.5px; }
.side-link.active, .side-sublink.active { background: var(--side-active-bg); }
.side-link.active::before, .side-sublink.active::before {
  left: -10px; top: 0; bottom: 0; width: 3px; border-radius: 0;
}
.side-sublink { height: 39px; padding: 0 9px; border-radius: 6px; }
.side-group-panel-inner { padding-left: 18px; margin-left: 17px; }
.side-group-panel-inner::before { background: var(--border); }
.side-toggle, .mobile-drawer-close, .mobile-menu-btn { border-radius: 7px; }
.side-user-avatar { background: #3A3D45; color: var(--text); font-weight: 700; }
.side-user-role { font-weight: 500; }
.side-user-company { display: none; }
.side-collapsed .sidebar .brand { width: 40px; height: 40px; }

.container { max-width: 820px; padding: 28px 32px 64px; }
.container.wide { max-width: 1480px; }
.shell { background: var(--bg); }

/* Cabeçalho da página */
.page-header { gap: 20px; margin-bottom: 24px; align-items: flex-start; }
.page-header .titles { max-width: 760px; }
.page-header .page-context {
  color: var(--muted); font-size: 12px; margin-bottom: 12px;
}
.page-header h1, .hero h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.025em; }
.page-header .desc, .hero p { color: #B8BAC2; font-size: 13.5px; line-height: 1.45; margin-top: 6px; }
.page-header .ph-actions { gap: 10px; align-items: center; }
.hero { text-align: left; margin-bottom: 24px; }

/* Ações e controles */
.btn {
  min-height: 40px; padding: 9px 15px; border-radius: 7px; background: var(--gold); color: #171100;
  font-weight: 650; font-size: 13px; border: 1px solid var(--gold); transition: background .14s, border-color .14s, color .14s;
}
.btn:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn.ghost { background: transparent; color: #D4D4D8; border-color: var(--border-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); border-color: #4B4E57; }
.btn.danger { background: var(--red); border-color: var(--red); color: #220407; }
.btn.danger:hover { background: #FF7D84; border-color: #FF7D84; }
.btn.compact { min-height: 34px; padding: 6px 11px; }
.btn svg { width: 16px; height: 16px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 7px; background: transparent; border-color: var(--border-2);
}
.icon-btn:hover { background: var(--panel-2); }
.month-selector {
  min-height: 40px; background: transparent; border-color: var(--border-2); border-radius: 7px; padding: 8px 11px;
}
.month-selector input[type=month], .month-selector select { font-size: 12.5px; font-weight: 500; }
.ph-meta { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

.field { margin-bottom: 16px; }
.field label { color: #B8BAC2; font-size: 12px; margin-bottom: 6px; font-weight: 550; }
.field input, .field select, .field textarea,
input.search, .filter-control, .toolbar-control {
  min-height: 40px; background: #111317; border: 1px solid var(--border-2); color: var(--text);
  border-radius: 7px; padding: 9px 11px; font-size: 13px;
}
.field textarea { min-height: 110px; }
.field input:focus, .field select:focus, .field textarea:focus,
input.search:focus, .filter-control:focus, .toolbar-control:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,191,22,.1); }
input::placeholder, textarea::placeholder { color: #71717A; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }

/* Abas — sempre linha e sublinhado, sem pílulas. */
.tabbar-sub, .tabs {
  display: flex; justify-content: flex-start; gap: 28px; margin: 0 0 22px; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tabbar-sub::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.tab-sub, .tabs [role=tab] {
  position: relative; flex: 0 0 auto; min-height: 42px; padding: 10px 0; border: 0; border-radius: 0;
  background: transparent; color: #B8BAC2; font-size: 13px; font-weight: 500; cursor: pointer;
}
.tab-sub:hover, .tabs [role=tab]:hover { color: var(--text); border-color: transparent; }
.tab-sub.sel, .tabs [role=tab][aria-selected=true] {
  background: transparent; color: var(--gold); border-color: transparent;
}
.tab-sub.sel::after, .tabs [role=tab][aria-selected=true]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--gold);
}
[role=tabpanel][hidden] { display: none !important; }

/* Indicadores em faixa contínua. */
.metrics-row, .stats-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
  margin: 0 0 28px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.metric-card, .stats-grid .stat {
  min-width: 0; min-height: 96px; background: transparent; border: 0; border-right: 1px solid var(--border);
  border-radius: 0; padding: 17px 20px; display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.metric-card:first-child, .stats-grid .stat:first-child { padding-left: 0; }
.metric-card:last-child, .stats-grid .stat:last-child { border-right: 0; }
.stats-grid .stat:nth-child(4n) { border-right: 0; }
.stats-grid .stat:nth-child(n+5) { border-top: 1px solid var(--border); }
.stats-grid .stat:nth-child(5) { padding-left: 0; }
.metric-card .mc-top { display: contents; }
.metric-card .mc-icon { display: none; }
.metric-card .mc-label, .stats-grid .stat .label {
  color: var(--muted); font-size: 11.5px; font-weight: 500; text-transform: none; letter-spacing: 0; margin: 0;
}
.metric-card .mc-value, .stats-grid .stat .value {
  color: var(--text); font-size: clamp(17px, 1.5vw, 22px); font-weight: 650; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.metric-card.green .mc-value, .metric-card.red .mc-value, .metric-card.blue .mc-value,
.stats-grid .stat.green .value, .stats-grid .stat.red .value, .stats-grid .stat.gold .value { color: var(--text); }
.metric-card .mc-compare { display: block; font-size: 11px; color: var(--muted); }
.metric-card .mc-compare.good { color: var(--green); }
.metric-card .mc-compare.bad { color: var(--red); }
.metric-card .mc-compare .lbl { color: var(--muted); }

/* Seções diretamente na página, separadas por espaço e linhas. */
.section-card, .panel {
  background: transparent; border: 0; border-top: 1px solid var(--border); border-radius: 0;
  padding: 24px 0; margin: 0;
}
.panel { overflow-x: auto; }
.section-card + .section-card, .panel + .panel { margin-top: 0; }
.section-card .sc-head { align-items: center; margin-bottom: 16px; }
.section-card .sc-head h2, .panel h3 { font-size: 15px; font-weight: 650; }
.section-card .sc-head .sc-desc { max-width: 800px; color: var(--muted); line-height: 1.45; }
.section-card .sc-head .sc-action { flex-shrink: 0; }
.grid-2 { grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 0; margin-bottom: 24px; }
.grid-2 > .section-card { border-top: 1px solid var(--border); padding-right: 28px; }
.grid-2 > .section-card + .section-card { border-left: 1px solid var(--border); padding-left: 28px; padding-right: 0; }
.content-block { padding: 22px 0; border-top: 1px solid var(--border); }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-title h2, .section-title h3 { margin: 0; font-size: 15px; }
.section-title .action { margin-left: auto; }

/* Barra de busca, filtros e ações. */
.table-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 0 0 14px;
}
.table-toolbar .search-wrap { position: relative; flex: 1 1 260px; max-width: 360px; }
.table-toolbar .search-wrap input {
  width: 100%; min-height: 40px; padding: 9px 11px 9px 36px;
  background: #111317; border: 1px solid var(--border-2); border-radius: 7px; color: var(--text);
}
.table-toolbar .search-wrap svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.table-toolbar .filters { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar { gap: 10px; }

/* Tabelas operacionais. */
.data-table-wrap, .grid-wrap { width: 100%; overflow-x: auto; border: 0; border-radius: 0; background: transparent; }
table, table.data-table { width: 100%; border-collapse: collapse; margin-top: 0; font-size: 13px; }
table th, table.data-table thead th {
  position: static; background: transparent; color: #C2C3C9; text-align: left; font-size: 11.5px;
  text-transform: none; letter-spacing: 0; font-weight: 550; padding: 10px 12px; border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}
table td, table.data-table td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table tbody tr:hover, table.data-table tbody tr:hover { background: rgba(255,255,255,.018); }
table td.num, table th.num, table.data-table td.num, table.data-table th.num {
  text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
}
table td:first-child, table th:first-child { padding-left: 12px; }
table td:last-child, table th:last-child { padding-right: 12px; }
.row-click { cursor: pointer; }
.row-click:focus-within, .row-click:hover { background: rgba(255,255,255,.024); }
.table-count { color: var(--muted); font-size: 12px; padding-top: 12px; }

.status-badge, .service-badge, .tipo-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 0; background: transparent !important;
  border: 0 !important; border-radius: 0; color: #D4D4D8 !important; font-size: 11.5px; font-weight: 500;
  text-transform: none; letter-spacing: 0; white-space: nowrap;
}
.status-badge i, .service-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-badge.ok i { background: var(--green); }
.status-badge.pendente i { background: var(--gold); }
.status-badge.erro i { background: var(--red); }
.service-badge.sms i { background: var(--blue); }
.service-badge.rcs i { background: var(--gold); }
.service-badge.higienizacao i { background: #C89BFF; }
.service-badge.whatsapp i { background: var(--green); }
.tipo-badge.credito::before, .tipo-badge.debito::before, .tipo-badge.estorno::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
}
.tipo-badge.credito::before { background: var(--green); }
.tipo-badge.debito::before { background: var(--red); }
.tipo-badge.estorno::before { background: var(--gold); }
.badge {
  border: 1px solid var(--border-2); background: transparent; color: #C5C6CC; border-radius: 999px;
  padding: 3px 8px; font-size: 11px;
}

/* Avisos e estados. */
.notice, .aviso-seguranca {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 0 18px; padding: 11px 13px;
  background: #14161A; border: 1px solid var(--border); border-left: 2px solid var(--blue);
  border-radius: 6px; color: #D7D7DB; font-size: 12.5px;
}
.notice.warn { border-left-color: var(--gold); }
.notice.error, .aviso-seguranca { border-left-color: var(--red); }
.notice.success { border-left-color: var(--green); }
.notice > .notice-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--blue); flex: 0 0 auto; }
.notice.warn > .notice-dot { background: var(--gold); }
.notice.error > .notice-dot { background: var(--red); }
.notice.success > .notice-dot { background: var(--green); }
.notice strong { display: inline; font-size: 12.5px; }
.notice strong + span { margin-left: 7px; color: var(--muted); }
.notice .notice-actions { margin-left: auto; flex-shrink: 0; }
details.notice { display: block; }
details.notice summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
details.notice summary::-webkit-details-marker { display: none; }
details.notice .notice-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
details.notice.success .notice-dot { background: var(--green); }
details.notice.error .notice-dot { background: var(--red); }
.notice-body { color: var(--muted); padding: 9px 0 0 17px; }
.empty-state { text-align: left; padding: 22px 0; border-bottom: 1px solid var(--border); }
.empty-state .es-icon { display: none; }
.empty-state .es-title { font-size: 13px; font-weight: 600; }
.empty-state .es-text { margin-top: 3px; max-width: 620px; color: var(--muted); }
.empty-state .es-action { margin-top: 12px; }
.error { background: rgba(255,98,106,.07); border-left: 2px solid var(--red); border-radius: 4px; padding: 9px 11px; color: #FF9BA0; }
.hint { color: var(--muted); }

.perm-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.perm-grid .stat { background: transparent; border: 0; border-radius: 0; padding: 16px 18px; }
.perm-grid .stat + .stat { border-left: 1px solid var(--border); }
.perm-grid .stat .label { color: var(--muted); font-size: 11.5px; text-transform: none; letter-spacing: 0; }
.perm-grid .stat .value { margin-top: 8px; color: var(--text); font-size: 13px; line-height: 1.45; }

/* Listas que antes pareciam cards passam a se comportar como linhas. */
.wallet-list { gap: 0; margin-top: 0; border-top: 1px solid var(--border-2); }
.wallet-item {
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; padding: 13px 12px;
}
.wallet-item:hover { border-color: var(--border); background: rgba(255,255,255,.018); }
.wallet-item .nome { font-size: 13px; font-weight: 600; }
.wallet-item .taxa { font-size: 11.5px; }
.wallet-item .metrics .l { text-transform: none; letter-spacing: 0; }
.wallet-item .metrics .v { font-size: 13px; }
.quick-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.quick-action {
  width: auto; min-width: 210px; background: transparent; border-color: var(--border); border-radius: 7px; padding: 10px 12px;
}
.quick-action:hover { background: var(--panel-2); border-color: var(--border-2); }
.quick-action .qa-icon { display: none; }

/* Diretório exibido para perfis sem acesso ao dashboard financeiro. */
.main-content { max-width: 980px !important; margin: 0 !important; }
.main-content .cards { display: block !important; border-top: 1px solid var(--border); }
.main-content .card {
  display: grid; grid-template-columns: minmax(190px, .7fr) minmax(260px, 1.4fr) auto;
  gap: 20px; align-items: center; padding: 16px 0; background: transparent; border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0; transform: none;
}
.main-content .card:hover { background: rgba(255,255,255,.018); transform: none; border-color: var(--border); }
.main-content .card .ico { display: none; }
.main-content .card h3, .main-content .card p { margin: 0; }
.main-content .card h3 { font-size: 14px; }
.main-content .card p { font-size: 12.5px; }
.main-content .card .btn { justify-self: end; }

/* Gráfico e fechamento */
.chart-wrap { min-height: 235px; }
.chart-svg { min-height: 210px; }
.chart-legend { margin-top: 8px; }
.chart-legend i { width: 14px; height: 2px; border-radius: 0; }
.closing-pct { color: var(--text); font-size: 22px; }
.closing-bar { height: 5px; background: var(--border); border-radius: 2px; }
.closing-bar > span { border-radius: 2px; }
.checklist { margin-bottom: 14px; }
.checklist .ci { width: 17px; height: 17px; }
.checklist li.done .ci { background: transparent; color: var(--green); border: 1px solid var(--green); }
.wizard-steps { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 24px; }
.wizard-step .ws-num { width: 24px; height: 24px; border-width: 1px; }
.wizard-step.done .ws-num { background: transparent; color: var(--green); border-color: var(--green); }
.wizard-step.active .ws-num { color: #171100; }
.wizard-connector { height: 1px; width: 20px; }

/* Painel lateral compartilhado. */
.drawer { position: fixed; inset: 0; z-index: 300; display: grid; grid-template-columns: 1fr minmax(360px, 500px); }
.drawer[hidden] { display: none; }
.drawer-backdrop { grid-column: 1 / -1; grid-row: 1; border: 0; background: rgba(0,0,0,.62); cursor: default; }
.drawer-panel {
  grid-column: 2; grid-row: 1; position: relative; height: 100vh; min-width: 0; overflow-y: auto;
  background: var(--panel-2); border-left: 1px solid var(--border-2); box-shadow: -18px 0 44px rgba(0,0,0,.28);
  animation: drawer-in .18s ease-out;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; gap: 16px; align-items: flex-start; padding: 22px 22px 18px; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.drawer-head > div { flex: 1; }
.drawer-head h2 { margin: 0; font-size: 18px; }
.drawer-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.drawer-close { flex: 0 0 auto; font-size: 22px; line-height: 1; }
.drawer-body { padding: 22px; }
.drawer .panel, .drawer .section-card { padding: 0; border: 0; }
body.drawer-open { overflow: hidden; }

/* Confirmação acessível compartilhada. */
.confirm-dialog { position: fixed; inset: 0; z-index: 360; display: grid; place-items: center; padding: 16px; }
.confirm-dialog[hidden] { display: none; }
.confirm-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0,0,0,.68); }
.confirm-panel { position: relative; width: min(420px, 100%); background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 22px; }
.confirm-panel h2 { margin: 0 0 8px; font-size: 17px; }
.confirm-panel p { margin: 0; color: #C7C7CC; white-space: pre-line; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

/* Ferramentas específicas herdando o mesmo ritmo. */
.drop { background: transparent; border-color: var(--border-2); border-radius: 8px; }
.drop:hover, .drop.over { background: rgba(255,191,22,.025); border-color: var(--gold); }
.options { gap: 8px; }
.opt { background: #111317; border-radius: 7px; padding: 11px; }
.opt.sel { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.opt .t { font-size: 13px; }
.result { background: #111317; border-radius: 7px; }
.result .big { color: var(--text); }
.pager { margin-top: 14px; }
.pager a, .pager span.pg, .pager button { border-radius: 6px; }
.action-menu .am-list, .side-user-panel, .side-collapsed .side-group-panel.flyout-open {
  background: var(--panel-2); border-radius: 7px; box-shadow: 0 12px 32px rgba(0,0,0,.35);
}

/* Ocultar valores mantém a estrutura e alcança gráficos e detalhes marcados. */
.values-hidden [data-sensitive] { color: transparent !important; position: relative; user-select: none; }
.values-hidden [data-sensitive]::after { content: "••••"; position: absolute; inset: 0 auto auto 0; color: var(--muted); letter-spacing: 2px; }
.values-hidden .chart-lines { visibility: hidden; }

/* Login é a única superfície central elevada. */
.login-card { background: var(--panel-2) !important; border-color: var(--border-2) !important; border-radius: 10px !important; }

@media (max-width: 1100px) {
  .metrics-row, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .metric-card:nth-child(2n), .stats-grid .stat:nth-child(2n) { border-right: 0; }
  .metric-card:nth-child(n+3), .stats-grid .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .metric-card:nth-child(3), .stats-grid .stat:nth-child(3) { padding-left: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 > .section-card { padding-right: 0; }
  .grid-2 > .section-card + .section-card { border-left: 0; padding-left: 0; }
}

@media (max-width: 720px) {
  .mobile-topbar { height: 54px; background: rgba(13,14,16,.96); backdrop-filter: blur(10px); }
  .mobile-topbar-logo { height: 32px; }
  .container, .container.wide { padding: 22px 16px 48px; }
  .page-header { margin-bottom: 18px; }
  .page-header h1, .hero h1 { font-size: 24px; }
  .page-header .ph-actions { width: 100%; margin-left: 0; }
  .page-header .ph-actions > :first-child:not(.ph-meta) { margin-left: 0; }
  .table-toolbar .filters { margin-left: 0; width: 100%; }
  .table-toolbar .filters > * { flex: 1; }
  .section-card .sc-head { align-items: flex-start; flex-direction: column; }
  .section-card .sc-head .sc-action { margin-left: 0; }
  .wallet-item .metrics { width: 100%; margin-left: 0; justify-content: space-between; gap: 10px; }
  .wallet-item .metrics div { text-align: left; }
  .quick-action { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .drawer { grid-template-columns: 1fr; }
  .drawer-panel { grid-column: 1; width: 100%; }
  .drawer-head, .drawer-body { padding-left: 18px; padding-right: 18px; }
  .wizard-step .ws-label { display: none; }
  table.data-table { min-width: 680px; }
  table.data-table.compact-mobile { min-width: 560px; }
  .main-content .card { grid-template-columns: 1fr; gap: 8px; }
  .main-content .card .btn { justify-self: start; }
  .perm-grid { grid-template-columns: 1fr; }
  .perm-grid .stat + .stat { border-left: 0; border-top: 1px solid var(--border); }
}

@media (max-width: 480px) {
  .metrics-row, .stats-grid { grid-template-columns: 1fr !important; }
  .metric-card, .stats-grid .stat { border-right: 0; border-top: 1px solid var(--border); padding-left: 0; min-height: 78px; }
  .metric-card:first-child, .stats-grid .stat:first-child { border-top: 0; }
  .month-selector { max-width: 100%; }
  .ph-actions .btn { flex: 1 1 auto; }
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Campos em reais (máscara em static/js/ui.js): dígitos alinhados. */
input[data-money] { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   Seletor de data/mês (static/js/datepicker.js), no padrão do shadcn/ui:
   botão com o valor + popover com calendário. O input nativo fica escondido
   e continua guardando o valor. */
.dp-nativo { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important;
  pointer-events: none !important; overflow: hidden; clip: rect(0 0 0 0); }
.dp-trigger { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-2); color: var(--text);
  font: inherit; font-size: 13px; text-align: left; cursor: pointer; white-space: nowrap;
  transition: border-color .15s ease, box-shadow .15s ease; }
.dp-trigger svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.dp-trigger:hover { border-color: var(--border-2); }
.dp-trigger:focus-visible, .dp-trigger[aria-expanded="true"] { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,191,22,.15); }
.dp-trigger:disabled { opacity: .6; cursor: default; }
.dp-texto { overflow: hidden; text-overflow: ellipsis; }
.dp-vazio { color: var(--muted); }
/* Dentro do seletor de mês do topo das telas: o ícone e a borda já são dele. */
.dp-trigger.dp-no-seletor { width: auto; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none;
  font-size: 12.5px; font-weight: 500; }
.dp-trigger.dp-no-seletor:focus-visible { box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }
/* Célula da grade do Financeiro: some com a borda pra ficar igual aos outros campos. */
.dp-trigger.dp-compacto { min-height: 0; height: 100%; padding: 8px; border: 0; border-radius: 0; background: transparent; }
.dp-trigger.dp-compacto:focus-visible { box-shadow: inset 0 0 0 1px var(--gold); background: rgba(224,168,46,.12); }

.dp-popover { position: fixed; z-index: 1000; width: 284px; max-width: calc(100vw - 16px); padding: 12px;
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45); color: var(--text); font-size: 13px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dp-title { font-weight: 600; font-size: 14px; }
.dp-nav { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.dp-nav svg { width: 15px; height: 15px; }
.dp-nav:hover { color: var(--text); border-color: var(--border-2); }
.dp-grid { display: grid; gap: 2px; }
.dp-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-wd { display: flex; align-items: center; justify-content: center; height: 28px; color: var(--muted); font-size: 11.5px; }
.dp-cell { height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; }
.dp-cell:hover:not(:disabled) { background: var(--border); }
.dp-cell.is-outside { color: var(--muted); opacity: .5; }
.dp-cell.is-today { background: rgba(255,255,255,.06); font-weight: 600; }
.dp-cell.is-selected, .dp-cell.is-selected:hover { background: var(--gold); color: #141414; font-weight: 600; opacity: 1; }
.dp-cell:disabled { opacity: .25; cursor: not-allowed; }
.dp-cell:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.dp-cell.is-selected:focus-visible { outline-color: var(--text); }
.dp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dp-month { height: 40px; text-transform: capitalize; }
.dp-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.dp-link { padding: 4px 2px; border: 0; background: none; color: var(--gold-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.dp-link:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .dp-popover { animation: dp-entra .12s ease-out; }
  @keyframes dp-entra { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
}

/* ---------------------------------------------------------------------------
   Lista de opções (static/js/select.js), no mesmo padrão do seletor de data.
   O <select> nativo fica escondido e continua guardando o valor. */
select { color-scheme: dark; }                       /* se o JS não carregar, a lista nativa ao menos abre escura */
select option { background: var(--panel-2); color: var(--text); }
.us-nativo { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important;
  pointer-events: none !important; overflow: hidden; clip: rect(0 0 0 0); }
.us-trigger { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 36px;
  padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-2);
  color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease; }
.us-trigger svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.us-trigger:hover { border-color: var(--border-2); }
.us-trigger:focus-visible, .us-trigger[aria-expanded="true"] { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,191,22,.15); }
.us-trigger:disabled { opacity: .6; cursor: default; }
.us-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-vazio-txt { color: var(--muted); }
/* Serviço na grade do Financeiro: pílula enxuta, sem caixa em volta. */
.us-trigger.us-compacto { min-height: 30px; padding: 4px 8px; border-color: transparent; background: transparent;
  font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.us-trigger.us-compacto:hover:not(:disabled) { border-color: var(--border); background: var(--panel-2); }
.us-trigger.us-compacto:disabled { opacity: .85; }
.us-trigger.us-compacto:disabled svg { display: none; }
.us-trigger.us-no-seletor { width: auto; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; font-size: 12.5px; font-weight: 500; }

.us-popover { position: fixed; z-index: 1000; max-width: calc(100vw - 16px); max-height: min(320px, 60vh); overflow-y: auto;
  padding: 4px; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45); color: var(--text); font-size: 13px; }
.us-opcao { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px;
  border-radius: 6px; cursor: pointer; white-space: nowrap; }
.us-opcao svg { width: 14px; height: 14px; color: var(--gold); flex-shrink: 0; }
.us-opcao:hover, .us-opcao:focus-visible { background: var(--border); outline: none; }
.us-opcao.is-selected { color: var(--gold-2); font-weight: 600; }
.us-opcao[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.us-vazio { padding: 8px 10px; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .us-popover { animation: dp-entra .12s ease-out; }
}
