/* 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;
  --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;
}

[data-theme="dark-tech"] {
  --bg: #0A0E17;
  --surface: #101728;
  --surface-alt: #0C1220;
  --sidebar-bg: #060911;
  --sidebar-text: #7C88A6;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: #5B6EF5;
  --border: #212B42;
  --border-strong: #2C3856;
  --text: #E8ECF7;
  --text-muted: #8A94B3;
  --text-secondary: #8A94B3;
  --primary: #E8ECF7;
  --primary-contrast: #0A0E17;
  --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: #101728;
  --card-bg: #101728;
  --input-bg: #0C1220;
  --chip-bg: rgba(255, 255, 255, 0.08);
}

[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;
  --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;
}

*, *::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: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--glow-accent);
}
.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-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  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-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-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: #EEF1F4; color: #475569; }
.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: #c5e8dc; }
.banner-warning { background: var(--warning-bg); color: var(--warning); border-color: #f5d9b0; }

/* 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: #fad4d2; }

/* 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: #eef7f5;
}
.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(--surface-alt, #fafbfc);
}
.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;
}

.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);
}
.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 tr:last-child td { border-bottom: 0; }
.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);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.wizard-steps .step.is-active { background: var(--primary); color: #fff; }
.wizard-steps .step.is-done { background: var(--success-bg); color: var(--success); }
.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(--primary); color: #fff; border-color: var(--primary); }
.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: #c5e8dc; }
.messages .error { background: var(--danger-bg); color: var(--danger); border-color: #f5c5c0; }
.messages .warning { background: var(--warning-bg); color: var(--warning); border-color: #f5d9b0; }
.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%, #fff 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;
}

/* Login */
.login-page {
  min-height: 100vh;
  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; }
.login-card .field { margin-bottom: 12px; }
.login-card input { width: 100%; }
.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; }
.brand-sub { font-size: .68rem !important; color: #8B96A5 !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: #FAFBFC;
}
.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: #FAFBFC; }

.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: #FAFBFC;
}

.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: #FAFBFC;
}
.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: #fee; color: #b42318; }
.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 #C6E2DA;
  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: #EEF1F4; color: #475569; }
.st-neutral .d { background: #475569; }

.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: #475569; }
.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: #FAFBFC;
  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: #FAFBFC;
}
.filerow {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FAFBFC;
  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: #EEF1F4;
  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: #c5e8dc; }
.hub-toast.success .hub-toast-dot { background: var(--success); }
.hub-toast.error { background: var(--danger-bg); color: var(--danger); border-color: #f5c5c0; }
.hub-toast.error .hub-toast-dot { background: var(--danger); }
.hub-toast.warning { background: var(--warning-bg); color: var(--warning); border-color: #f5d9b0; }
.hub-toast.warning .hub-toast-dot { background: var(--warning); }

.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: hidden;
}
.nfce-lines-head,
.nfce-line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 108px 100px 36px;
  gap: 10px;
  align-items: center;
  padding: 0 12px;
}
.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;
}
.nfce-line-row + .nfce-line-row {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.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: #F0F1F3;
  color: var(--danger);
}
@media (max-width: 640px) {
  .nfce-lines-head { display: none; }
  .nfce-line-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "product product"
      "qty price"
      "subtotal remove";
    gap: 8px;
    padding: 12px;
  }
  .nfce-line-row .line-product { 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; }
  .nfce-line-row .nfce-line-remove { grid-area: remove; justify-self: end; }
}

@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 — 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, #0A0E17);
}
.hub-theme-swatch.sw-light-tech {
  background: linear-gradient(135deg, #4F5BE0, #F7F8FC);
}
