/* EXEQ Ledger — Hub V4 (temas: original · dark-tech · light-tech) */
@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;600&display=swap");

:root {
  --touch: 44px;
  --sidebar-w: 260px;
  --sidebar-w-compact: 72px;
  --header-h: 56px;
  --fs-base: 15px;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.3125rem;
  --fs-2xl: 1.5625rem;
  --fs-display: 1.75rem;
  --lh-base: 1.5;
  --lh-tight: 1.35;
  --chip-bg: #eef1f4;
}

:root,
[data-theme="original"] {
  --bg: #F6F7F9;
  --surface: #ffffff;
  --surface-alt: #f8fafd;
  --sidebar-bg: #0B1220;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: #1E293B;
  --border: #E2E5EA;
  --border-strong: #D3D8DF;
  --text: #0B1220;
  --text-muted: #475569;
  --text-secondary: #5B6472;
  --primary: #0B1220;
  --primary-contrast: #ffffff;
  --step-active-bg: var(--primary);
  --step-active-text: var(--primary-contrast);
  --accent: #0F6B5C;
  --accent-hover: #0B5446;
  --accent-contrast: #ffffff;
  --accent-bg: #E7F2EF;
  --data: #0F6B5C;
  --data-bg: #E7F2EF;
  --success: #147C5C;
  --success-bg: #E6F4F0;
  --warning: #B45309;
  --warning-bg: #FEF3E2;
  --danger: #B42318;
  --danger-bg: #FDECEC;
  --info: #2563eb;
  --info-bg: #e8f0fe;
  --radius: 10px;
  --radius-sm: 6px;
  --font-display: "Manrope", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --glow-accent: none;
  --topbar-bg: #ffffff;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --chip-bg: #eef1f4;
  --card: var(--card-bg);
  --neutral-bg: #eef1f4;
  --neutral-text: #475569;
  --neutral: #475569;
  --surface-muted: rgba(0, 0, 0, 0.03);
  --table-head-bg: #fafbfc;
  --table-row-hover: #fafbfc;
  --elevated-surface: #fafbfc;
  --upload-hover-bg: #eef7f5;
  --row-attention-hover: #fad4d2;
  --skeleton-highlight: #ffffff;
  --control-hover-bg: #f0f1f3;
  --banner-success-border: #c5e8dc;
  --banner-warning-border: #f5d9b0;
  --banner-error-border: #f5c5c0;
  --totalcard-border: #c6e2da;
  --chip-danger-bg: #fee;
  --chip-danger-text: #b42318;
}

[data-theme="dark-tech"] {
  --bg: #0f172a;
  --surface: #111827;
  --surface-alt: #0f172a;
  --sidebar-bg: #060911;
  --sidebar-text: #7c88a6;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: #5b6ef5;
  --border: #334155;
  --border-strong: #475569;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-secondary: #cbd5e1;
  --primary: #f1f5f9;
  --primary-contrast: #0f172a;
  --step-active-bg: var(--accent);
  --step-active-text: var(--accent-contrast);
  --accent: #5B6EF5;
  --accent-hover: #4657DE;
  --accent-contrast: #ffffff;
  --accent-bg: rgba(91, 110, 245, 0.14);
  --data: #22D3EE;
  --data-bg: rgba(34, 211, 238, 0.12);
  --success: #34D399;
  --success-bg: rgba(52, 211, 153, 0.14);
  --warning: #F5A623;
  --warning-bg: rgba(245, 166, 35, 0.14);
  --danger: #F0533D;
  --danger-bg: rgba(240, 83, 61, 0.14);
  --info: #38BDF8;
  --info-bg: rgba(56, 189, 248, 0.14);
  --radius: 10px;
  --radius-sm: 7px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --glow-accent: 0 0 0 1px rgba(91, 110, 245, 0.35), 0 8px 24px -8px rgba(91, 110, 245, 0.45);
  --topbar-bg: #111827;
  --card-bg: #111827;
  --input-bg: #1e293b;
  --chip-bg: rgba(255, 255, 255, 0.08);
  --card: var(--card-bg);
  --neutral-bg: rgba(255, 255, 255, 0.08);
  --neutral-text: var(--text-muted);
  --neutral: var(--text-muted);
  --surface-muted: rgba(255, 255, 255, 0.04);
  --table-head-bg: rgba(255, 255, 255, 0.05);
  --table-row-hover: rgba(51, 65, 85, 0.35);
  --elevated-surface: #1e293b;
  --upload-hover-bg: rgba(91, 110, 245, 0.1);
  --row-attention-hover: rgba(240, 83, 61, 0.22);
  --skeleton-highlight: rgba(255, 255, 255, 0.12);
  --control-hover-bg: rgba(255, 255, 255, 0.08);
  --banner-success-border: rgba(52, 211, 153, 0.35);
  --banner-warning-border: rgba(245, 166, 35, 0.35);
  --banner-error-border: rgba(240, 83, 61, 0.35);
  --totalcard-border: rgba(91, 110, 245, 0.35);
  --chip-danger-bg: rgba(240, 83, 61, 0.14);
  --chip-danger-text: var(--danger);
}

[data-theme="light-tech"] {
  --bg: #F7F8FC;
  --surface: #FFFFFF;
  --surface-alt: #F1F3FA;
  --sidebar-bg: #0B1020;
  --sidebar-text: #8E97B8;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: #4F5BE0;
  --border: #E3E6F0;
  --border-strong: #CBD0E3;
  --text: #111527;
  --text-muted: #5C6584;
  --text-secondary: #5C6584;
  --primary: #111527;
  --primary-contrast: #ffffff;
  --step-active-bg: var(--primary);
  --step-active-text: var(--primary-contrast);
  --accent: #4F5BE0;
  --accent-hover: #3E49C4;
  --accent-contrast: #ffffff;
  --accent-bg: #EEF0FE;
  --data: #0E7C86;
  --data-bg: #E4F5F4;
  --success: #0F9D63;
  --success-bg: #E5F7EE;
  --warning: #C2760A;
  --warning-bg: #FDF1DF;
  --danger: #D8362A;
  --danger-bg: #FCEAE8;
  --info: #2563EB;
  --info-bg: #EAF1FE;
  --radius: 10px;
  --radius-sm: 7px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --glow-accent: 0 0 0 1px rgba(79, 91, 224, 0.25), 0 8px 20px -8px rgba(79, 91, 224, 0.35);
  --topbar-bg: #ffffff;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --chip-bg: #eef1f4;
  --card: var(--card-bg);
  --neutral-bg: #eef1f4;
  --neutral-text: #475569;
  --neutral: #475569;
  --surface-muted: rgba(0, 0, 0, 0.03);
  --table-head-bg: #fafbfc;
  --table-row-hover: #fafbfc;
  --elevated-surface: #fafbfc;
  --upload-hover-bg: #eef7f5;
  --row-attention-hover: #fad4d2;
  --skeleton-highlight: #ffffff;
  --control-hover-bg: #f0f1f3;
  --banner-success-border: #c5e8dc;
  --banner-warning-border: #f5d9b0;
  --banner-error-border: #f5c5c0;
  --totalcard-border: #c6e2da;
  --chip-danger-bg: #fee;
  --chip-danger-text: #b42318;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body.hub-v4 {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--bg);
  line-height: var(--lh-base);
  transition: background 0.2s ease, color 0.2s ease;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Shell */
.hub-shell { display: flex; min-height: 100vh; }
.hub-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  overflow: hidden;
  transition: transform .2s ease, width .2s ease;
}
.hub-sidebar .brand {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-lg);
  color: #fff;
  padding: 18px 16px 8px;
  letter-spacing: .02em;
  background: var(--sidebar-bg);
}
.hub-sidebar .brand span {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--sidebar-text);
  margin-top: 2px;
}
.nav-group-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b849e;
  padding: 14px 16px 4px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  padding: 0 14px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 500;
  text-decoration: none;
  border: 0;
  background: transparent;
  width: calc(100% - 16px);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-sm);
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
  box-shadow: none;
  border-left: 3px solid rgba(255, 255, 255, 0.55);
  padding-left: 11px;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.hub-sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 8px;
  background: var(--sidebar-bg);
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, .45) var(--sidebar-bg);
}
.hub-sidebar-nav::-webkit-scrollbar { width: 6px; }
.hub-sidebar-nav::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.hub-sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, .35);
  border-radius: 999px;
}
.nav-separator {
  height: 1px;
  margin: 8px 12px;
  background: rgba(255,255,255,.08);
}
.nav-accordion { margin: 2px 0; }
.nav-accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 16px);
  margin: 2px 8px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #8fa8c4;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  font-family: inherit;
}
.nav-accordion-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  text-align: left;
}
.nav-accordion-trigger:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-accordion-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform .2s ease;
}
.nav-accordion.is-open .nav-accordion-chevron { transform: rotate(180deg); }
.nav-accordion-panel {
  overflow: hidden;
  max-width: 100%;
}
.nav-accordion-panel .nav-item { margin-left: 4px; }
.nav-subgroup { margin: 4px 0 2px 4px; }
.nav-subgroup-trigger {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #8fa8c4;
  padding: 8px 10px;
}
.nav-subgroup-panel { padding-left: 6px; }
.nav-item--nested {
  margin-left: 12px;
  padding-left: 28px;
  font-size: var(--fs-xs);
}
.nav-item--nested .label { opacity: 0.95; }
.nav-group-static .nav-group-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b849e;
  padding: 14px 16px 4px;
  font-weight: 600;
}

.hub-topbar-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.hub-sidebar-toggle { display: none; }

body.sidebar-collapsed .hub-sidebar {
  width: var(--sidebar-w-compact);
}
body.sidebar-collapsed .hub-sidebar .brand span,
body.sidebar-collapsed .hub-sidebar .nav-accordion-title,
body.sidebar-collapsed .hub-sidebar .nav-group-label,
body.sidebar-collapsed .hub-sidebar .nav-item span.label,
body.sidebar-collapsed .hub-sidebar .nav-accordion-chevron,
body.sidebar-collapsed .hub-sidebar-footer .hub-session-meta {
  display: none;
}
body.sidebar-collapsed .hub-sidebar .nav-item {
  justify-content: center;
  padding: 0;
  width: calc(100% - 12px);
  margin: 4px 6px;
}
body.sidebar-collapsed .hub-sidebar .nav-accordion-trigger {
  justify-content: center;
  padding: 10px 8px;
}
body.sidebar-collapsed .hub-sidebar .nav-accordion-panel {
  display: none !important;
}
body.sidebar-collapsed .hub-sidebar .nav-accordion.is-open .nav-accordion-panel {
  display: none !important;
}
body.sidebar-collapsed .hub-sidebar .brand {
  text-align: center;
  padding: 16px 8px;
  font-size: .95rem;
}

@media (min-width: 1024px) {
  .hub-sidebar-toggle { display: inline-flex; }
}
.hub-sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 12px 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: var(--fs-sm);
  color: var(--sidebar-text);
  background: var(--sidebar-bg);
}
.hub-sidebar-footer b { color: #fff; display: block; font-size: var(--fs-sm); }
.hub-session-meta span { display: block; font-size: var(--fs-xs); margin-top: 2px; }
.hub-tenant-slug { color: #8fa8c4; font-family: var(--font-mono); font-size: .72rem !important; }
.hub-tenant-label strong { color: #c5d4e8; font-weight: 600; }
.hub-logout-form { margin: 0; }
.hub-logout-form .btn-logout-sidebar {
  width: 100%;
  margin-top: 8px;
  color: #fff;
  border-color: rgba(255,255,255,.2);
  background: transparent;
}
.hub-logout-form--inline { display: inline; }
.hub-logout-icon {
  font-size: 1.1rem;
  line-height: 1;
}
.hub-mobile-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.hub-mobile-tenant {
  display: block;
  font-size: .65rem;
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.hub-topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.hub-logout-topbar { display: none; }

.hub-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hub-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--header-h);
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.hub-mobile-header .title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}
.icon-btn {
  min-width: var(--touch);
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.hub-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  transition: background 0.2s ease;
}
.hub-topbar h1,
.hub-topbar .pagetitle {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -.01em;
}
.page-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: 3px;
}
.hub-topbar .crumb { display: none; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.active-company {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  max-width: 42rem;
}
.active-company.is-empty { color: var(--text-muted); }
.active-company-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
}
.active-company strong { color: var(--text); }
.active-company .mono {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-muted);
}
.link-muted { color: var(--text-muted); font-size: .8rem; }
.plan-usage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--info-bg);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  color: var(--text);
}
.plan-usage-card .plan-meters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.plan-meter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.plan-meter-head strong {
  color: var(--text);
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
.plan-meter-track {
  height: 8px;
  border-radius: 999px;
  background: var(--chip-bg);
  overflow: hidden;
}
.plan-meter-track--open {
  opacity: .55;
}
.plan-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  min-width: 0;
  transition: width .2s ease;
}
.plan-meter-fill.is-amber { background: var(--warning); }
.plan-meter-fill.is-warn { background: var(--danger); }
.plan-meter-fill.is-open { background: var(--info); }
.plan-meter-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin-top: 8px;
  font-size: .8rem;
}
.plan-meter-foot a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.plan-meter-foot a:hover { text-decoration: underline; }
.plan-meter.is-limit .plan-meter-head strong { color: var(--danger); }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
}
.chip-sm { font-size: .7rem; padding: 1px 6px; }
.chip-warn { background: var(--warning-bg); color: var(--warning); }
.chip-accent { background: var(--success-bg); color: var(--success); }
.meta-muted { color: var(--text-muted); font-size: .82rem; margin-top: 2px; }
tr.is-active-row td { background: var(--success-bg); }
.lookup-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: .88rem;
}
.lookup-banner.info { background: var(--info-bg); color: var(--info); }
.lookup-banner.warn { background: var(--warning-bg); color: var(--warning); }
.lookup-banner.ok { background: var(--success-bg); color: var(--success); }
.lookup-banner.err { background: var(--danger-bg); color: var(--danger); }
.hub-content { padding: 20px 24px 32px; flex: 1; }

/* Overlay drawer */
.hub-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, .45);
  z-index: 35;
}
body.drawer-open .hub-drawer-backdrop { display: block; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--fs-sm);
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); filter: none; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .82rem; }

/* Cards / KPI */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: background 0.2s ease;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.kpi-grid .metric {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.kpi-card .kpi-label { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 500; }
.kpi-card .kpi-value {
  font-family: var(--font-display);
  font-weight: 750;
  font-size: var(--fs-2xl);
  margin-top: 4px;
}
.pending-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 12px 0 20px;
}
.pending-card {
  border-left: 4px solid var(--info);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pending-card.tone-danger { border-left-color: var(--danger); }
.pending-card.tone-warning { border-left-color: var(--warning); }
.pending-card.tone-amber { border-left-color: #d97706; }
.pending-card.tone-info { border-left-color: var(--info); }
.pending-card .cta {
  font-weight: 600;
  color: var(--accent);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

/* Status badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--chip-bg);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral-text); }
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Banners */
.banner {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid var(--border);
  font-size: .92rem;
}
.banner-success { background: var(--success-bg); color: var(--success); border-color: var(--banner-success-border); }
.banner-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--banner-warning-border); }

#st-retention-section.is-st-required {
  border-color: var(--warning);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 35%, transparent);
}
#st-retention-section.is-st-required .st-retention-hint {
  display: block;
}
#st-retention-section.is-st-attention {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 25%, transparent);
  animation: st-section-pulse 1.2s ease-in-out 2;
}
#st-retention-section .st-retention-hint {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: .9rem;
}
#st-retention-section .st-retention-error-banner {
  margin-bottom: 12px;
}
#st-retention-section .st-retention-error-banner p {
  font-size: .92rem;
  line-height: 1.45;
}
@keyframes st-section-pulse {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 25%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 40%, transparent); }
}

/* KPI / metrics */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.kpi-card .kpi-value { font-variant-numeric: tabular-nums; }
.data tbody tr.row-attention { background: var(--danger-bg); }
.data tbody tr.row-attention:hover { background: var(--row-attention-hover); }

/* Upload dropzone */
.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 160px;
  margin-top: 12px;
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  cursor: pointer;
  text-align: center;
  transition: border-color .2s ease, background .2s ease;
}
.upload-dropzone:hover,
.upload-dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--upload-hover-bg);
}
.upload-dropzone-title { font-weight: 600; color: var(--text); }
.upload-dropzone-meta { font-size: .82rem; color: var(--text-muted); }
.upload-dropzone-file { font-size: .85rem; color: var(--accent); font-weight: 500; }

.card-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.card-title { margin: 0; font-size: 1.1rem; font-family: var(--font-display); }

.form-sticky-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}
.form-sticky-footer .btn-primary { margin-left: auto; }

/* Detail layout (NFS-e, documentos) */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.detail-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}
.detail-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: .9rem;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px 20px;
}
.detail-field span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-weight: 500;
}
.detail-field--wide { grid-column: span 2; }
.detail-field--full { grid-column: 1 / -1; }
.detail-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  font-size: .92rem;
}
.detail-text--danger { color: var(--danger); }
.fiscal-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 20px;
}
.fiscal-summary-grid .detail-field--full {
  grid-column: 1 / -1;
}
.fiscal-summary-kpi {
  padding: 12px 14px;
  background: var(--accent-bg, #eef6ff);
  border: 1px solid #c6e2da;
  border-radius: 8px;
}
.fiscal-summary-kpi span {
  display: block;
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-weight: 500;
}
.fiscal-summary-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-hover, #0f5132);
}
.nfce-items-card .section-label.nfce-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
  margin-bottom: 0;
}
.nfce-items-card .table-wrap { padding: 0 16px 16px; }
.nfce-items-card .rowcards { padding: 0 12px 12px; }
.nfce-items-card .data tfoot td {
  border-top: 1px solid var(--border);
  background: var(--elevated-surface);
}
.rejection-alert {
  border-color: #f5c5c0;
  background: var(--danger-bg, #fef3f2);
}
.rejection-alert-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.rejection-alert-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--danger, #b42318);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
}
.rejection-alert-title {
  font-weight: 700;
  color: var(--danger, #b42318);
  margin-bottom: 4px;
}
.rejection-alert-message {
  margin: 0;
  color: var(--text);
  font-size: .92rem;
  line-height: 1.45;
}
.rejection-alert-hint {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .86rem;
  color: var(--text-secondary);
}
.rejection-alert-code {
  margin: 10px 0 0;
  font-size: .78rem;
  color: var(--text-muted);
}
.detail-chave { word-break: break-all; font-size: .85rem; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.detail-doc-list { margin: 0; padding-left: 18px; }
.card-danger { border-color: #f5c5c0; }
.section-label--danger { color: var(--danger); }
.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
}

.table-actions--documentos {
  justify-content: flex-start;
  gap: 6px;
}

.table-actions--documentos .table-actions__downloads {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.table-actions--documentos .table-actions__extra {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.table-actions--documentos .table-actions__view {
  margin-left: auto;
}

.num { font-variant-numeric: tabular-nums; }

.nfce-pdv-form { max-width: 720px; }
.nfce-total-card { margin-top: 16px; padding: 12px 16px; }
.nfce-consumer-fieldset { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-bar .field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 160px; }
.filter-bar label { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500; }
.filter-bar input, .filter-bar select, .field input, .field select, .field textarea {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font: inherit;
  font-size: var(--fs-sm);
  background: var(--input-bg);
  color: var(--text);
}
.filter-bar input::placeholder,
.filter-bar textarea::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}
.filter-bar input:disabled,
.filter-bar select:disabled,
.filter-bar textarea:disabled,
.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: var(--surface-muted);
  color: var(--text-muted);
}
.hub-v4 input:-webkit-autofill,
.hub-v4 input:-webkit-autofill:hover,
.hub-v4 input:-webkit-autofill:focus,
.hub-v4 textarea:-webkit-autofill,
.hub-v4 select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
  box-shadow: 0 0 0 1000px var(--input-bg) inset;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .75rem;
  font-weight: 500;
}

/* Table */
.table-wrap { overflow: visible; }
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table.data th, table.data td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--surface-alt);
}
table.data td {
  font-size: var(--fs-sm);
}
table.data td.nfce-csc-token-cell {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  white-space: nowrap;
  min-width: 18rem;
}
table.data tr:last-child td { border-bottom: 0; }

table.data td.cell-recibo {
  min-width: 6.5rem;
  max-width: 10.5rem;
  vertical-align: middle;
}
table.data .cell-primary {
  display: block;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--data);
  line-height: 1.25;
  white-space: nowrap;
}
table.data .cell-secondary {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 2px;
}
table.data.table-fiscal-queue td.col-total,
table.data.table-fiscal-queue td.col-date,
table.data.table-fiscal-queue td.col-sla {
  white-space: nowrap;
}
table.data.table-fiscal-queue td.col-status {
  min-width: 7.5rem;
  max-width: 12rem;
}
table.data.table-fiscal-queue .cell-status-hint {
  margin-top: 4px;
  font-size: var(--fs-xs);
  line-height: 1.35;
  color: var(--text-muted);
  max-width: 13rem;
}
table.data.table-fiscal-queue td.col-docs {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}
table.data.table-fiscal-queue td.col-party {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--data);
  font-weight: 600;
}

/* Menu ⋮ */
.row-menu { position: relative; }
.row-menu summary {
  list-style: none;
  cursor: pointer;
  min-width: var(--touch);
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  user-select: none;
}
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu .menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: none;
}
.row-menu .menu a, .row-menu .menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  text-decoration: none;
}
.row-menu .menu a:hover, .row-menu .menu button:hover { background: var(--surface-alt); }

/* Mobile cards (hidden desktop) */
.mobile-cards { display: none; }
.mobile-data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.mobile-data-card .title { font-weight: 700; font-family: var(--font-display); }
.mobile-data-card .meta { color: var(--text-muted); font-size: var(--fs-sm); margin: 4px 0; }
.mobile-data-card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }

/* Empty / timeline */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state h3 { margin: 0 0 8px; font-family: var(--font-display); }
.empty-state p { color: var(--text-muted); margin: 0 0 16px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-left: 2px solid var(--border);
  margin-left: 8px;
  padding-left: 16px;
  position: relative;
}
.timeline li::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  position: absolute;
  left: -6px;
  top: 12px;
}
.timeline li.done::before { background: var(--success); }
.timeline li.current::before { background: var(--accent); box-shadow: 0 0 0 3px var(--success-bg); }
.timeline li.done { border-left-color: var(--success); }

/* Wizard */
.wizard-steps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.wizard-steps .step {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--chip-bg);
  border: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary, var(--text-muted));
  cursor: default;
}
.wizard-steps .step.is-active {
  background: var(--step-active-bg);
  color: var(--step-active-text);
  border-color: var(--step-active-bg);
}
.wizard-steps .step.is-done { background: var(--success-bg); color: var(--success); border-color: transparent; }
.wizard-pane { display: none; }
.wizard-pane.is-active { display: block; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.lookup-ok { color: var(--success); font-size: .82rem; font-weight: 600; margin-top: 6px; }

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 45, .45);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  padding: 20px;
  border: 1px solid var(--border);
}
.modal h3 { margin: 0 0 8px; font-family: var(--font-display); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal--nfse-confirm {
  max-width: min(540px, 92vw);
  padding: 24px 26px;
}
.modal--nfse-confirm-lead {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.modal-summary {
  margin: 0;
  display: grid;
  gap: 10px;
  font-size: var(--fs-sm);
}
.modal-summary > div {
  display: grid;
  grid-template-columns: minmax(6.5rem, 34%) 1fr;
  gap: 8px 14px;
  align-items: start;
}
.modal-summary dt {
  margin: 0;
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.modal-summary dd {
  margin: 0;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
  line-height: var(--lh-tight);
}
.modal-summary dd[data-sum-descricao],
.modal-summary dd[data-sum-info-compl],
.modal-summary dd[data-sum-nbs] {
  line-height: var(--lh-base);
}

/* Cert progress */
.cert-bar {
  height: 8px;
  background: var(--chip-bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.cert-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.cert-bar.is-danger > span { background: var(--danger); }
.cert-bar.is-warning > span { background: var(--warning); }

/* Docs tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tabs button.is-active {
  background: var(--step-active-bg);
  color: var(--step-active-text);
  border-color: var(--step-active-bg);
}
.pre-json {
  background: #0f1b2d;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: .78rem;
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 420px;
  white-space: pre-wrap;
  word-break: break-word;
}

.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.messages li {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: .9rem;
  border: 1px solid var(--border);
  animation: hub-toast-in .22s ease;
}
@keyframes hub-toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.messages .success { background: var(--success-bg); color: var(--success); border-color: var(--banner-success-border); }
.messages .error { background: var(--danger-bg); color: var(--danger); border-color: var(--banner-error-border); }
.messages .warning { background: var(--warning-bg); color: var(--warning); border-color: var(--banner-warning-border); }
.messages .info { background: var(--neutral-bg); color: var(--neutral); }

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: .85rem;
  color: var(--text-muted);
}

.skeleton {
  background: linear-gradient(90deg, var(--chip-bg) 25%, var(--skeleton-highlight) 50%, var(--chip-bg) 75%);
  background-size: 200% 100%;
  animation: sk 1.2s infinite;
  border-radius: 4px;
  height: 14px;
}
@keyframes sk { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

.section-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  margin: 20px 0 10px;
}
.section-label--flush { margin-top: 0; }

.card--stack { margin-bottom: 12px; }
.card--danger { border-color: var(--danger); }

.detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.detail-title-lg {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.detail-subtitle-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.field-label-sm {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.text-break { word-break: break-all; }
.text-break-sm { word-break: break-all; font-size: 0.85rem; }
.banner--stack { margin-bottom: 12px; }
.wizard-nav--end { margin-top: 12px; justify-content: flex-end; }
.hint-line--flush { margin: 0; }
.hint-line--top-sm { margin-top: 8px; }
.hint-line--top { margin-top: 10px; }
.form-stack-top { margin-top: 14px; }
.inline-flex-gap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-field-grow { flex: 2; }
.btn--stack-top { margin-top: 10px; }

.form-inline { display: inline; }
.kpi-row--stack { margin-bottom: 12px; }
.flex-gap-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-label--inline { margin: 0; }
.lead-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0;
}
.text-muted-plain { color: var(--text-muted); }
.form-grid--stack { margin-bottom: 12px; }
.field--narrow-top {
  margin-top: 12px;
  max-width: 240px;
}
.stack-top-sm { margin-top: 12px; }
.chip--clickable { cursor: pointer; }
.chip--clickable input[type="checkbox"] { margin-right: 6px; }
.table-col-check { width: 40px; }
.cell-subline { color: var(--text-muted); font-size: 0.8rem; }
.rowcard-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.banner--stack-md { margin-bottom: 14px; }
.banner--stack-lg { margin-bottom: 16px; }
.banner-lead { margin: 0 0 8px; }
.banner-lead-lg { margin: 0 0 10px; }
.link-offset { margin-left: 8px; }
.field-label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 6px;
}
.label-flush { margin: 0; }
.stack-top-md { margin-top: 16px; }
.table-wrap--stack { margin-top: 12px; }
.page-actions--stack { margin-bottom: 12px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.panel-head h3 { margin: 0; }
.details-advanced > summary {
  cursor: pointer;
  font-weight: 600;
}
.summary-clickable { cursor: pointer; }
.stickyfoot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wizard-nav--compact {
  margin-top: 8px;
  justify-content: flex-end;
}
.checkbox-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.text-right { text-align: right; }

/* Login — viewport fixo, sem scroll */
html:has(body.hub-login) {
  overflow: hidden;
  height: 100%;
}
body.hub-v4.hub-login {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overscroll-behavior: none;
}
body.hub-v4.hub-login .login-page {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 0 0 4px;
}
.login-card .sub { color: var(--text-muted); margin-bottom: 18px; font-size: .9rem; line-height: 1.45; }
.login-card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}
.login-card .field { margin-bottom: 12px; }
.login-card input { width: 100%; }
.login-auth-link {
  margin: 14px 0 0;
  text-align: center;
  font-size: .88rem;
}
.login-auth-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.login-auth-link a:hover { text-decoration: underline; }
.field-error { color: var(--danger); font-size: .85rem; margin-top: 8px; }

/* Wizard + Documents refinements */
.step-lead { color: var(--text-muted); margin: 0 0 14px; font-size: .9rem; }
.hint-line { color: var(--text-muted); font-size: .82rem; margin: 4px 0 0; }
.field-tip {
  margin-left: 4px;
  font-size: .78rem;
  color: var(--text-muted);
  text-decoration: none;
  cursor: help;
  border-bottom: 1px dotted var(--text-muted);
}
.nbs-picker-filter {
  width: 100%;
  margin-bottom: 8px;
}
.dropdown-select {
  position: relative;
  width: 100%;
}
.dropdown-select-trigger {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.dropdown-select-trigger:hover {
  border-color: var(--border-strong, #cbd5e1);
}
.dropdown-select.is-open .dropdown-select-trigger {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.dropdown-select-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .88rem;
}
.dropdown-select-chevron {
  color: var(--text-muted);
  font-size: .75rem;
}
.dropdown-select-panel {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 8px;
}
.dropdown-select-filter {
  width: 100%;
  min-height: 38px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 0 10px;
  font: inherit;
}
.dropdown-select-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 14rem;
  overflow-y: auto;
}
.dropdown-select-option {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: .82rem;
  line-height: 1.35;
  cursor: pointer;
}
.dropdown-select-option:hover,
.dropdown-select-option[aria-selected="true"] {
  background: var(--accent-bg, #eef6ff);
}
.dropdown-select-more {
  padding: 8px 10px;
  pointer-events: none;
}
.dropdown-select-empty,
.dropdown-select-catalog-empty {
  margin: 6px 2px 0;
}
.nbs-picker-list {
  width: 100%;
  min-height: 11rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .82rem;
  line-height: 1.35;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  padding: 4px;
}
.nbs-picker-list option {
  padding: 6px 8px;
  white-space: normal;
}
.nbs-picker-list:focus {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 1px;
}
.wizard-nav {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
input.is-readonly, textarea.is-readonly, select.is-readonly {
  background: var(--surface-alt);
  color: var(--text-muted);
}
.tax-panel {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.tax-panel-title {
  font-weight: 700;
  font-family: var(--font-display);
  font-size: .9rem;
  margin-bottom: 4px;
}
.review-grid {
  display: grid;
  gap: 10px;
  margin: 12px 0 8px;
}
.review-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.review-item span {
  color: var(--text-muted);
  font-size: .82rem;
  flex: 0 0 auto;
  min-width: 7.5rem;
}
.review-item strong {
  text-align: right;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
  line-height: 1.45;
}
.review-item--wide strong { max-width: 72%; }
.review-item--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.review-item--stack span { min-width: 0; }
.review-item--text .review-text {
  font-size: .92rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: min(14rem, 40vh);
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.review-item--text .review-text--empty {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}
@media (max-width: 640px) {
  .review-item {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .review-item strong {
    text-align: left;
    max-width: none;
  }
  .review-item--wide strong { max-width: none; }
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.doc-quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.document-viewer { padding: 4px 0 8px; }
.doc-viewer-title { font-family: var(--font-display); font-weight: 700; }
.doc-preview-hint {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: .85rem;
}
.doc-empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-muted);
}
#wizard-step-error:not([hidden]) {
  display: block;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-weight: 500;
}

/* Food piloto — telas fora do escopo (visíveis, sem ação) */
.nav-item--future,
.btn--future {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  text-decoration: line-through;
  text-decoration-style: dashed;
}
.nav-item--future .label,
.btn--future {
  text-decoration: line-through;
  text-decoration-style: dashed;
}
.admin-model-future {
  color: var(--body-quiet-color, #666);
  text-decoration: line-through;
  text-decoration-style: dashed;
  cursor: not-allowed;
}
tr.model--future th,
tr.model--future td {
  opacity: 0.65;
}

/* Wizard · etapa Serviço */
.field-service-select {
  min-height: 44px;
  width: 100%;
  font-size: .95rem;
}
.field-lc116 {
  width: 100% !important;
  min-height: 48px !important;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.field-service-desc,
#id_service_desc.field-service-desc {
  width: 100%;
  min-height: 140px !important;
  height: auto;
  padding: 12px 14px !important;
  line-height: 1.5;
  resize: vertical;
  font-size: .92rem;
  white-space: pre-wrap;
}

/* ===== Breakpoints ===== */
/* Desktop médio 1024–1439 — mantém sidebar expandido; colapso só via toggle manual */
@media (max-width: 1439px) and (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .hub-logout-topbar { display: block; }
}

/* Tablet */
@media (max-width: 1023px) {
  .hub-sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    width: min(280px, 86vw);
    box-shadow: none;
    height: 100dvh;
    max-height: 100dvh;
  }
  body.drawer-open .hub-sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(11, 18, 32, .35);
  }
  .hub-mobile-header { display: flex; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .plan-usage-card .plan-meters { grid-template-columns: 1fr; }
  .pending-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 767px) {
  .hub-content, .hub-topbar { padding-left: 14px; padding-right: 14px; }
  .hub-content { padding-bottom: 80px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-status .metric-value { font-size: var(--fs-base); }
  .kpi-grid .metric-status { min-height: 72px; }
  .desktop-only { display: none !important; }
  .mobile-cards { display: block; }
  .filter-bar.is-collapsible.mobile-collapsed .filter-extra { display: none; }
  table.data.stack-on-mobile { display: none; }
}
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
}

/* ===== Mockup v3 (hub_exeq_redesign_mockup_3) ===== */
.companychip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: .84rem;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.companychip-label {
  color: var(--text-muted);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.companychip-doc { color: var(--text-secondary); }
.companychip-pill {
  background: var(--neutral-bg, #EEF1F4);
  color: var(--neutral-text, #475569);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: .72rem;
  font-weight: 600;
}
.companychip-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-left: 4px;
}
.companychip-link:hover { text-decoration: underline; }

/* Seletor global de empresa ativa */
.company-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.company-switcher-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 4px;
  border-radius: 4px;
}
.company-switcher--dashboard .company-switcher-trigger {
  margin-left: 0;
  font-size: 15px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.company-switcher-trigger:hover {
  text-decoration: underline;
}
.company-switcher--dashboard .company-switcher-trigger:hover {
  text-decoration: none;
  border-color: var(--accent);
}
.company-switcher.is-open .company-switcher-trigger {
  text-decoration: none;
}
.company-switcher-chevron {
  font-size: .72rem;
  color: var(--text-muted);
}
.company-switcher-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  right: 0;
  min-width: min(320px, 92vw);
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  padding: 8px;
}
.company-switcher--chip .company-switcher-panel {
  left: 0;
  right: auto;
}
.company-switcher-filter {
  width: 100%;
  min-height: 36px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 0 10px;
  font: inherit;
}
.company-switcher-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 16rem;
  overflow-y: auto;
}
.company-switcher-form {
  margin: 0;
}
.company-switcher-option {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.company-switcher-option:hover,
.company-switcher-option.is-active {
  background: var(--accent-bg, #eef6ff);
}
.company-switcher-option-name {
  font-weight: 600;
  font-size: .84rem;
  line-height: 1.3;
}
.company-switcher-option-doc {
  font-size: .75rem;
  color: var(--text-secondary);
}
.company-switcher-option-badge {
  margin-top: 2px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.company-switcher-empty {
  margin: 4px 2px 0;
}

.brand-sub { font-size: .68rem !important; color: var(--text-muted) !important; margin-top: 2px !important; }

.card.filters {
  display: flex;
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.card.filters .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 160px;
  min-width: 0;
}
.card.filters .field-grow { flex: 2 1 280px; }
.card.filters .field-narrow { flex: 0 1 180px; max-width: 220px; }
.card.filters .btn-primary { flex-shrink: 0; }
.card.table-card { padding: 0; overflow: hidden; }
.card.table-card .data thead th {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--table-head-bg);
}
.card.table-card .data tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .84rem;
}
.card.table-card .data tbody tr:last-child td { border-bottom: none; }
.card.table-card .data tbody tr:hover { background: var(--table-row-hover); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: .82rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

.rowcards { display: none; }
.rowcard {
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
}
.rowcard:last-child { border-bottom: none; }
.rowcard-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.rowcard-title { font-weight: 600; font-size: var(--fs-sm); }
.rowcard-kv {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  padding: 3px 0;
  color: var(--text-secondary);
}
.rowcard-kv b { color: var(--text); font-weight: 500; }

.formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.formgrid.formgrid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.formgrid.formgrid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.card.section { padding: 20px; margin-bottom: 16px; }
.card.section h3 {
  font-size: .88rem;
  font-weight: 600;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.formgrid .fullrow { grid-column: 1 / -1; }
.formgrid .field-wide { grid-column: span 2; }
.formgrid .field-narrow { max-width: 100%; }
.field-lookup-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.field-lookup-row .field-action {
  align-self: end;
}
.field-lookup-row .field-action .btn {
  width: auto;
  min-width: 112px;
  min-height: 40px;
  white-space: nowrap;
}

.form-page .card.section:last-of-type { margin-bottom: 0; }

.field input,
.field select,
.field textarea {
  width: 100%;
  box-sizing: border-box;
}
.field input[type="checkbox"],
.field input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: auto;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.field textarea { min-height: 96px; resize: vertical; padding: 10px; }
.field-action {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.field-action .btn { width: 100%; }

.itemcard {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--elevated-surface);
}

.stickyfoot,
.form-sticky-footer {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  z-index: 5;
  margin-top: 0;
}
.stickyfoot-left,
.form-sticky-footer .stickyfoot-left { display: flex; gap: 8px; flex-wrap: wrap; }
.stickyfoot-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.form-sticky-footer .btn-primary { margin-left: auto; }

.cert-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.cert-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--elevated-surface);
}
.cert-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.cert-card-title {
  font-family: var(--font-display);
  font-weight: 700;
}
.cert-card-meta {
  color: var(--text-muted);
  font-size: .85rem;
  margin-top: 4px;
}
.cert-card-foot {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.chip-danger { background: var(--chip-danger-bg); color: var(--chip-danger-text); }
.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.checkbox-grid--services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: border-color .15s ease, background .15s ease;
}
.checkbox-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}
.checkbox-chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.checkbox-chip input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.checkbox-chip-label {
  line-height: 1.2;
  user-select: none;
}
.field-hint {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
}

/* Pronto para emitir (N1) */
.readiness-page .card.section h3 {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: .02em;
}
.readiness-status {
  border-left-width: 4px;
  border-left-style: solid;
}
.readiness-status.is-ready {
  border-left-color: var(--success);
  background: linear-gradient(90deg, var(--success-bg) 0%, var(--surface) 28%);
}
.readiness-status.is-pending {
  border-left-color: var(--danger);
  background: linear-gradient(90deg, var(--danger-bg) 0%, var(--surface) 28%);
}
.readiness-status-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
}
.readiness-status.is-ready .readiness-status-title { color: var(--success); }
.readiness-status.is-pending .readiness-status-title { color: var(--danger); }
.readiness-status-detail,
.readiness-tool-lead {
  margin: 8px 0 0;
}
.readiness-empty {
  margin: 0;
}
.readiness-tool .readiness-form {
  margin-top: 4px;
}
.readiness-tool .card.section h3,
.readiness-tool h3 {
  margin-bottom: 8px;
}
.card.section form > .card.stickyfoot,
.card.section form > .stickyfoot {
  margin: 20px 0 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  position: static;
}
.card.section.filters h3 { margin-bottom: 12px; }

.totalcard {
  background: var(--accent-bg);
  border: 1px solid var(--totalcard-border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 16px 0;
}
.totalcard-amt {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-hover);
  font-variant-numeric: tabular-nums;
}
.totalcard-cap {
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.pill-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.pill-status .d {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.st-success { background: var(--success-bg); color: var(--success); }
.st-success .d { background: var(--success); }
.st-danger { background: var(--danger-bg); color: var(--danger); }
.st-danger .d { background: var(--danger); }
.st-warning { background: var(--warning-bg); color: var(--warning); }
.st-warning .d { background: var(--warning); }
.st-neutral { background: var(--neutral-bg); color: var(--neutral-text); }
.st-neutral .d { background: var(--neutral-text); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.badge-dot, .badge .badge-dot { width: 6px; height: 6px; border-radius: 50%; }

.metricgrid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.metric,
.kpi-card.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: none;
}
.metric-label,
.kpi-card .metric-label,
.kpi-card .kpi-label {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.metric-value,
.kpi-card .metric-value,
.kpi-card .kpi-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.metric-total .metric-value { color: var(--text); }
.metric-ok .metric-value { color: var(--success); }
.metric-warn .metric-value { color: var(--warning); }
.metric-err .metric-value { color: var(--danger); }
.metric-skip .metric-value { color: var(--neutral-text); }
.metric-hint {
  margin-top: 4px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.metric-status .metric-value {
  font-size: var(--fs-lg);
  line-height: 1.25;
  word-break: break-word;
  hyphens: auto;
}
.kpi-grid .metric-status {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 10px;
  padding: 36px 20px;
  text-align: center;
  background: var(--elevated-surface);
  cursor: pointer;
}
.dropzone-icon { font-size: 1.6rem; margin-bottom: 8px; }
.dropzone-title { font-size: .88rem; font-weight: 600; margin-bottom: 4px; }
.dropzone-sub { font-size: .78rem; color: var(--text-secondary); margin-bottom: 14px; }
.upload-dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 10px;
  padding: 36px 20px;
  text-align: center;
  background: var(--elevated-surface);
}
.filerow {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--elevated-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 14px;
}
.filerow-name { font-size: .82rem; font-weight: 600; flex: 1; }
.filerow-size { font-size: .75rem; color: var(--text-muted); }

.helpicon,
.field-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neutral-bg);
  color: var(--text-secondary);
  font-size: .66rem;
  font-weight: 700;
  cursor: help;
  margin-left: 4px;
  text-decoration: none;
  border: 0;
}

.btn-icon {
  padding: 8px;
  min-width: auto;
  border-color: var(--border);
}

.hub-toast-stack { list-style: none; padding: 0; margin: 0 0 16px; }
.hub-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .84rem;
  border: 1px solid var(--border);
  animation: hub-toast-in .22s ease;
}
.hub-toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.hub-toast.success { background: var(--success-bg); color: var(--success); border-color: var(--banner-success-border); }
.hub-toast.success .hub-toast-dot { background: var(--success); }
.hub-toast.error { background: var(--danger-bg); color: var(--danger); border-color: var(--banner-error-border); }
.hub-toast.error .hub-toast-dot { background: var(--danger); }
.hub-toast.warning { background: var(--warning-bg); color: var(--warning); border-color: var(--banner-warning-border); }
.hub-toast.warning .hub-toast-dot { background: var(--warning); }

.nfe-fiscal-warnings-list {
  margin: 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nfe-fiscal-warnings-list li {
  line-height: 1.45;
}
.nfe-fiscal-warnings.is-attention {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--warning) 35%, transparent);
}

.banner.success, .banner-success { background: var(--success-bg); color: var(--success); }
.banner.warning, .banner-warning { background: var(--warning-bg); color: var(--warning); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: .84rem;
}
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.checkbox-row label { font-weight: 400; font-size: .84rem; }
.checkbox-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.prefs-master-toggle {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 12px 0 18px;
}
.prefs-master-toggle .checkbox-row {
  margin-bottom: 0;
  font-weight: 500;
}
.nfce-consumer-grid { margin-top: 0; }

/* NFC-e avulsa — grid de linhas (layout limpo, uma borda no painel) */
.nfce-items-section h3 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 12px;
}
.nfce-lines-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: visible;
}
.nfce-lines-head,
.nfce-line-row {
  display: grid;
  grid-template-columns:
    minmax(200px, 2.4fr)
    minmax(72px, 0.55fr)
    minmax(104px, 0.75fr)
    minmax(96px, 0.65fr)
    36px;
  gap: 12px;
  align-items: center;
  padding: 0 12px;
}
.nfce-lines-panel--ped .nfce-lines-head,
.nfce-lines-panel--ped .nfce-line-row {
  grid-template-columns:
    minmax(200px, 2.2fr)
    minmax(72px, 0.5fr)
    minmax(56px, 0.42fr)
    minmax(104px, 0.72fr)
    minmax(96px, 0.62fr)
    36px;
}
.nfce-line-row .line-n-item-ped {
  min-width: 0;
  text-align: center;
}
.nfce-lines-head {
  padding-top: 10px;
  padding-bottom: 4px;
}
.nfce-lines-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
}
.nfce-line-row {
  padding-top: 8px;
  padding-bottom: 12px;
  position: relative;
  z-index: 1;
}
.nfce-line-row:has(.line-product-wrap.is-open) {
  z-index: 30;
}
.nfce-line-row + .nfce-line-row {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.nfce-line-row .line-product-wrap {
  min-width: 0;
  width: 100%;
}
.nfce-line-row .line-product-wrap .dropdown-select-trigger {
  min-height: 36px;
  width: 100%;
  font-size: .84rem;
}
.nfce-line-row .dropdown-select-panel.is-fixed-overlay {
  position: fixed;
  z-index: 1100;
  max-height: min(16rem, 42vh);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}
.nfce-line-row .dropdown-select-option {
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}
.nfce-line-row .dropdown-select-option.is-active,
.nfce-line-row .dropdown-select-option.is-active:hover {
  background: var(--accent-bg, #eef6ff);
}
.nfce-line-row .line-qty,
.nfce-line-row .line-price {
  min-width: 0;
}
.nfce-line-row .line-field {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong, #D3D8DF);
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
  font-size: .84rem;
  color: var(--text);
  box-sizing: border-box;
}
.nfce-line-row select.line-field {
  cursor: pointer;
  padding-right: 24px;
}
.nfce-line-row .line-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg, #E7F2EF);
}
.nfce-line-row .line-qty,
.nfce-line-row .line-price,
.nfce-line-row .line-subtotal {
  text-align: right;
}
.nfce-line-row .line-subtotal {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 8px 4px 8px 0;
  color: var(--text);
}
.nfce-line-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.nfce-line-remove:hover {
  background: var(--control-hover-bg);
  color: var(--danger);
}
@media (max-width: 960px) {
  .nfce-lines-head { display: none; }
  .nfce-line-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "product product"
      "qty price"
      "subtotal remove";
    gap: 10px;
    padding: 12px;
    align-items: stretch;
  }
  .nfce-line-row .line-product-wrap { grid-area: product; }
  .nfce-line-row .line-qty { grid-area: qty; }
  .nfce-line-row .line-price { grid-area: price; }
  .nfce-line-row .line-subtotal {
    grid-area: subtotal;
    align-self: center;
    text-align: left;
  }
  .nfce-line-row .nfce-line-remove { grid-area: remove; justify-self: end; align-self: center; }
}

@media (max-width: 1023px) {
  .fiscal-summary-grid { grid-template-columns: 1fr 1fr; }
  .fiscal-summary-kpi { grid-column: 1 / -1; }
  .formgrid.formgrid--3,
  .formgrid.formgrid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .formgrid .field-wide { grid-column: span 1; }
  .card.filters .field-narrow { flex: 1 1 140px; max-width: none; }
}

@media (max-width: 767px) {
  .formgrid,
  .formgrid.formgrid--3,
  .formgrid.formgrid--4 { grid-template-columns: 1fr; }
  .formgrid .field-wide { grid-column: span 1; }
  .metricgrid, .metric-grid { grid-template-columns: 1fr 1fr; }
  .card.filters { flex-direction: column; align-items: stretch; }
  .card.filters .field-grow,
  .card.filters .field-narrow { flex: 1 1 auto; max-width: none; }
  .card.filters .btn-primary { width: 100%; }
  .card.table-card .data { display: none; }
  .card.table-card .rowcards { display: block; }
}

/* Preferências — grid 12 colunas, largura total */
.hub-prefs-page .hub-content {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.hub-prefs-page .active-company {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}
.prefs-page {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.prefs-panel--conta { grid-column: span 4; }
.prefs-panel--aparencia { grid-column: span 4; }
.prefs-panel--plano { grid-column: span 4; }
.prefs-panel--modulos { grid-column: span 12; }
.prefs-panel--notif { grid-column: span 4; }
.prefs-panel--das { grid-column: span 8; }
.prefs-page .prefs-card {
  margin-bottom: 0;
  min-width: 0;
}
.prefs-page .prefs-card h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.prefs-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.prefs-panel-head h3 {
  border-bottom: none;
  padding-bottom: 0;
  margin: 0;
}
.prefs-panel-head-note {
  margin: 0;
  font-size: var(--fs-xs);
}
.prefs-intro {
  margin: 14px 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}
.prefs-kv-grid {
  display: grid;
  gap: 16px 24px;
  align-items: start;
}
.prefs-kv-grid--stack {
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}
.prefs-kv-grid--plan {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.prefs-kv-grid--modules {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}
.prefs-kv--plan-head {
  margin-top: 14px;
}
.prefs-kv-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}
.prefs-kv-value {
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}
.prefs-kv-value strong {
  font-size: var(--fs-md);
  font-weight: 600;
}
.prefs-kv-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: var(--lh-tight);
  margin-top: 6px;
}
.prefs-kv-link {
  display: inline-block;
  margin-top: 8px;
  font-size: var(--fs-xs);
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.prefs-kv-link:hover {
  text-decoration: underline;
}
.prefs-kv--module .prefs-kv-value {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.prefs-form {
  display: flex;
  flex-direction: column;
}
.prefs-page .prefs-master-toggle {
  margin: 0 0 16px;
  padding: 14px 16px;
}
.prefs-field-channel {
  max-width: 100%;
}
.prefs-field-channel label {
  font-size: var(--fs-xs);
}
.prefs-section-label {
  margin: 4px 0 12px;
  font-size: var(--fs-sm);
}
.prefs-contacts-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 18px;
}
.prefs-field-hint {
  margin: 6px 0 0;
}
.prefs-checkbox-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 20px;
}
.prefs-checkbox-row .checkbox-row {
  margin-bottom: 0;
  font-size: var(--fs-sm);
}
.prefs-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.prefs-page .hub-theme-picker {
  margin-top: 14px;
}

@media (max-width: 1199px) {
  .prefs-panel--conta,
  .prefs-panel--aparencia {
    grid-column: span 6;
  }
  .prefs-panel--plano,
  .prefs-panel--modulos,
  .prefs-panel--notif,
  .prefs-panel--das {
    grid-column: span 12;
  }
  .prefs-kv-grid--plan,
  .prefs-kv-grid--modules {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .prefs-contacts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .prefs-panel--conta,
  .prefs-panel--aparencia,
  .prefs-panel--plano,
  .prefs-panel--modulos,
  .prefs-panel--notif,
  .prefs-panel--das {
    grid-column: span 12;
  }
  .prefs-kv-grid--plan,
  .prefs-kv-grid--modules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .prefs-contacts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .prefs-checkbox-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .prefs-page {
    gap: 16px;
  }
  .prefs-kv-grid--plan,
  .prefs-kv-grid--modules,
  .prefs-contacts-grid {
    grid-template-columns: 1fr;
  }
  .prefs-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Preferências — seletor de tema */
.hub-theme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.hub-theme-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.hub-theme-option:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.hub-theme-option.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--glow-accent);
}
.hub-theme-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.hub-theme-swatch.sw-original {
  background: linear-gradient(135deg, #0F6B5C, #F6F7F9);
}
.hub-theme-swatch.sw-dark-tech {
  background: linear-gradient(135deg, #5b6ef5, #0f172a);
}

/* Parametrização ISS — hub fiscal unificado */
.iss-hub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.iss-hub-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}
.iss-hub-tab:hover {
  color: var(--text);
  text-decoration: none;
}
.iss-hub-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.iss-hub-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.iss-hub-perfis {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.iss-hub-master-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.iss-hub-master-list a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--fs-sm);
}
.iss-hub-master-list a:hover {
  background: var(--table-row-hover);
}
.iss-hub-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.55);
}
.iss-hub-drawer-backdrop[hidden] {
  display: none !important;
}
.iss-hub-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(480px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.iss-hub-drawer[hidden] {
  display: none !important;
}
.iss-hub-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.iss-hub-drawer-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
  font-family: var(--font-display);
  color: var(--text);
}
.iss-hub-drawer-body {
  padding: 16px 18px 24px;
  overflow-y: auto;
  flex: 1;
}
body.iss-hub-drawer-open {
  overflow: hidden;
}
@media (max-width: 900px) {
  .iss-hub-grid-2,
  .iss-hub-perfis {
    grid-template-columns: 1fr;
  }
}
.hub-theme-swatch.sw-light-tech {
  background: linear-gradient(135deg, #4F5BE0, #F7F8FC);
}
