:root {
  color-scheme: light;
  --ink: #1f2b38;
  --muted: #697684;
  --line: #d7dee5;
  --canvas: #f2f4f6;
  --surface: #ffffff;
  --primary: #d52b1e;
  --primary-dark: #ad2118;
  --primary-soft: #fbe9e7;
  --info: #0068a9;
  --info-soft: #e6f1f8;
  --success: #287a4b;
  --success-soft: #e7f3eb;
  --warning: #a8670c;
  --warning-soft: #fff3d9;
  --danger: #a53d48;
  --danger-soft: #fbe9eb;
  --nav: #003b65;
  --nav-soft: #07537f;
  --brand-accent: #ffffff;
  --shadow: 0 12px 34px rgba(0, 59, 101, .09);
}

.contract-document-actions { display: flex; flex-wrap: wrap; gap: 8px; min-width: 220px; }
.contract-document-actions .row-action { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  color: #f7fbf8;
  background: var(--nav);
}

.brand { display: flex; align-items: center; margin-bottom: 26px; padding: 10px; border-radius: 12px; background: #ffffff; overflow: hidden; }
.brand-logo { display: block; width: 100%; height: auto; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--primary);
  background: var(--brand-accent);
  font-weight: 800;
  letter-spacing: -.04em;
}
.brand strong, .brand small { display: block; }
.brand small, .sidebar-note small { margin-top: 3px; color: #c0d2df; }

nav { display: grid; gap: 7px; }
.nav-item { 
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  text-align: left;
  color: #c2d1de;
  background: transparent;
}
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,.09); }
.nav-config { border-radius: 10px; color: #c2d1de; background: rgba(255,255,255,.04); }
.nav-config summary { padding: 12px 14px; cursor: pointer; font-weight: 700; list-style-position: inside; }
.nav-config > div { display: grid; gap: 3px; padding: 0 7px 7px; }
.nav-config .nav-item { padding: 9px 12px; font-size: 12px; }
.portal-external-link { margin-top: 4px; padding: 11px 14px; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; color: #fff; text-decoration: none; font-size: 12px; font-weight: 750; }
.billing-uf-control { display: flex; align-items: end; gap: 9px; }
.billing-uf-control label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.billing-uf-control input { width: 180px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; }
.billing-inline-control { width: 100%; min-width: 125px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: inherit; }
.billing-amount-input { min-width: 105px; text-align: right; }
.billing-invoice-input { min-width: 120px; }
.progress-track { height: 6px; margin: 8px 0 4px; overflow: hidden; border-radius: 999px; background: #dfe7eb; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.client-status-dashboard { margin-bottom: 18px; }
.status-chart { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.status-chart article > div:first-child { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: 12px; }
.status-chart article span { color: var(--muted); }
.status-bar { height: 12px; overflow: hidden; border-radius: 999px; background: #e4eaee; }
.status-bar span { display: block; height: 100%; border-radius: inherit; }
.status-bar .success { background: var(--success); }
.status-bar .danger { background: var(--danger); }
.status-bar .info { background: var(--info); }
.status-bar .warning { background: var(--warning); }
.status-bar .neutral { background: #7b8792; }

.sidebar-note { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-note strong, .sidebar-note small { display: block; font-size: 12px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #f5b544; box-shadow: 0 0 0 4px rgba(245,181,68,.15); }
.sidebar-note.integration-connected .status-dot { background: #35c477; box-shadow: 0 0 0 4px rgba(53,196,119,.18); }
.sidebar-note.integration-error .status-dot { background: #e05252; box-shadow: 0 0 0 4px rgba(224,82,82,.18); }
.creator-credit { margin: 16px 10px 0; color: #c0d2df; font-size: 10px; line-height: 1.45; }
.creator-credit strong { color: #ffffff; font-weight: 700; }

main { min-width: 0; padding: 0 38px 44px; }
.client-portal-mode .app-shell { display: block; min-height: 100vh; }
.client-portal-mode .sidebar,
.client-portal-mode .topbar { display: none !important; }
.client-portal-mode main { min-height: 100vh; padding: 0; }
.client-portal-mode .view { display: none !important; }
.client-portal-mode #view-portal.active { display: block !important; }
.client-portal-mode #portalAuthenticated { padding: 28px 38px 44px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 70;
  min-height: 106px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(242, 244, 246, .96);
  border-bottom: 1px solid rgba(215, 222, 229, .9);
  box-shadow: 0 8px 18px rgba(0, 59, 101, .05);
  backdrop-filter: blur(10px);
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 27px; letter-spacing: -.04em; }
.period-selector-wrap { display: flex; align-items: center; gap: 9px; }
.period-selector-wrap select { min-width: 190px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); font-size: 18px; font-weight: 760; }
h2 { margin-bottom: 0; font-size: 26px; letter-spacing: -.035em; }
h3 { margin-bottom: 0; font-size: 18px; }
.eyebrow { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 13px; }

.topbar-actions, .filters, .client-toolbar { display: flex; align-items: center; gap: 10px; }
.group-filter-label select, .horizontal-guide select { min-width: 170px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); }
.admin-context { display: flex; align-items: center; gap: 9px; margin-right: 4px; }
.admin-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: #ffffff; background: var(--info); font-size: 11px; font-weight: 800; }
.admin-context strong, .admin-context small { display: block; }
.admin-context strong { font-size: 12px; }
.admin-context small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.search-field input {
  width: 240px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.search-field input:focus { border-color: var(--info); box-shadow: 0 0 0 3px rgba(0,104,169,.13); }
.button { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 700; }
.button.primary { color: white; background: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.button.danger { margin-left: auto; border: 1px solid var(--danger); color: var(--danger); background: var(--surface); }
.button.danger:hover { color: #ffffff; background: var(--danger); }

.view { display: none; }
.view.active { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 8px 0 22px; }
.tag, .badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; font-size: 12px; font-weight: 750; }
.tag { padding: 7px 10px; color: var(--info); background: var(--info-soft); }
.badge { padding: 5px 8px; }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.neutral { color: #56615c; background: #edf0ee; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric, .panel, .process-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.metric { padding: 19px; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-value { display: block; margin-top: 7px; font-size: 29px; font-weight: 760; letter-spacing: -.04em; }
.metric-context { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .75fr); gap: 18px; }
.panel { padding: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.text-button { border: 0; padding: 0; color: var(--info); background: none; font-weight: 750; }

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline-item { position: relative; display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; min-height: 78px; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 23px; top: 39px; bottom: -2px; width: 1px; background: var(--line); }
.timeline-day { position: relative; z-index: 1; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 800; }
.timeline-day.done { border-color: var(--info); color: white; background: var(--info); }
.timeline-copy strong, .timeline-copy small { display: block; }
.timeline-copy strong { margin-top: 3px; }
.timeline-copy small { margin-top: 5px; color: var(--muted); line-height: 1.4; }
.timeline-state { margin-top: 8px; }

.attention-list { display: grid; gap: 10px; }
.attention-item { padding: 13px 0; border-top: 1px solid var(--line); }
.attention-item:first-child { border-top: 0; padding-top: 0; }
.attention-top { display: flex; justify-content: space-between; gap: 12px; }
.attention-item p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.filter { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface); }
.filter.active { border-color: var(--info); color: white; background: var(--info); }
.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: #f8fafc; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbfd; }
.client-name strong, .client-name small { display: block; }
.client-name small { margin-top: 4px; color: var(--muted); }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.row-action { border: 0; color: var(--info); background: none; font-weight: 750; }
.row-action.danger { color: var(--danger); }
.row-action.danger:hover { text-decoration: underline; }
.row-actions { display: flex; align-items: center; gap: 10px; }
.empty-state { padding: 36px; text-align: center; color: var(--muted); }

.process-board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.process-card { position: relative; padding: 18px; box-shadow: none; }
.process-card:not(:last-child)::after { content: "→"; position: absolute; right: -13px; top: 50%; z-index: 2; color: var(--primary); font-weight: 900; }
.process-number { color: var(--primary); font-size: 11px; font-weight: 850; letter-spacing: .1em; }
.process-card h3 { margin: 8px 0; font-size: 16px; }
.process-card p { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.preiva-delivery-control { margin-top: 18px; padding: 22px; }
.preiva-control-header, .preiva-control-actions, .preiva-delivery-visual, .preiva-progress-label, .preiva-detail-heading, .preiva-detail-heading > div { display: flex; align-items: center; }
.preiva-control-header { justify-content: space-between; gap: 20px; }
.preiva-control-header h3 { margin: 4px 0; font-size: 20px; }
.preiva-control-actions { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.preiva-panel-body[hidden] { display: none !important; }
.capture-status-control { border-top: 4px solid var(--primary); }
.closing-status-control { border-top: 4px solid #d77a00; }
.closing-status-control .capture-step-number { background: #b96500; }
.approval-status-control { border-top: 4px solid #6750a4; }
.payment-status-control { border-top: 4px solid #16817a; }
.payment-status-control .approval-icon { background: #16817a; }
.payment-status-control .approval-gate > i { color: #16817a; }
.final-status-control { border-top: 4px solid #274c77; }
.final-status-control .approval-icon { background: #274c77; }
.final-status-control .approval-gate > i { color: #274c77; }
.capture-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 12px; margin-top: 18px; }
.capture-flow > article { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, #fff, #f4f9fc); }
.capture-flow > article .badge { grid-column: 2; justify-self: start; }
.capture-flow > i { align-self: center; color: var(--primary); font-size: 22px; font-style: normal; font-weight: 900; }
.capture-flow strong, .capture-flow small { display: block; }
.capture-flow small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.capture-step-number { display: grid; place-items: center; grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 50%; color: white; background: var(--primary); font-weight: 900; }
.capture-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.capture-summary article { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.capture-summary span, .capture-summary strong, .capture-summary small { display: block; }
.capture-summary span, .capture-summary small { color: var(--muted); font-size: 10px; }
.capture-summary strong { margin: 5px 0 2px; font-size: 24px; }
.capture-summary .capture-date { font-size: 17px; }
.capture-ready-message { margin: 16px 0 0; padding: 13px 15px; border-radius: 10px; color: #155c3b; background: #eaf7f0; font-size: 12px; }
.purchase-closing-table { min-width: 780px; margin-top: 10px; }
.purchase-closing-table td { vertical-align: middle; font-size: 11px; }
.purchase-closing-table td small { display: block; margin-top: 3px; color: var(--muted); }
.approval-gate { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 12px; margin-top: 18px; }
.approval-gate > article { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, #fff, #f7f4fc); }
.approval-gate > i { align-self: center; color: #6750a4; font-size: 22px; font-style: normal; font-weight: 900; }
.approval-gate strong, .approval-gate small { display: block; }
.approval-gate small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.approval-icon { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border-radius: 12px; color: white; background: #6750a4; font-size: 12px; font-weight: 900; }
.approval-gate-step { flex-wrap: wrap; }
.gate-lock { width: 100%; padding: 5px 8px; border-radius: 7px; color: #654b00; background: #fff1c7; font-size: 10px; font-weight: 800; text-align: center; }
.approval-summary article.has-error { border-color: rgba(190,45,45,.35); background: #fff4f4; }
.approval-status-table { min-width: 1180px; margin-top: 10px; }
.approval-status-table td { vertical-align: middle; font-size: 11px; }
.approval-status-table td small { display: block; margin-top: 3px; color: var(--muted); }
.approval-complete { color: var(--success); font-weight: 800; }
.approval-blocked { color: var(--muted); font-size: 10px; font-weight: 700; }
.approval-rule-message { margin: 16px 0 0; padding: 13px 15px; border-radius: 10px; color: #4c3b78; background: #f0ebfa; font-size: 12px; }
.payment-summary article.has-warning { border-color: rgba(205,126,0,.35); background: #fff8e8; }
.workflow-status-table { min-width: 1020px; margin-top: 10px; }
.workflow-status-table td { vertical-align: middle; font-size: 11px; line-height: 1.45; }
.workflow-status-table td small { display: block; margin-top: 3px; color: var(--muted); }
.payment-rule-message, .final-rule-message { margin: 16px 0 0; padding: 13px 15px; border-radius: 10px; font-size: 12px; }
.payment-rule-message { color: #105f59; background: #e7f7f5; }
.final-rule-message { color: #274c77; background: #edf3f8; }
.preiva-delivery-visual { gap: 22px; margin-top: 18px; padding: 18px; border-radius: 14px; background: linear-gradient(135deg, #eaf4fb, #f7fbfd); }
.preiva-mail-illustration { position: relative; flex: 0 0 88px; height: 64px; }
.mail-envelope { display: grid; place-items: center; width: 80px; height: 54px; border: 2px solid var(--info); border-radius: 8px; color: var(--info); background: white; font-size: 13px; font-weight: 900; box-shadow: 0 7px 18px rgba(0,59,101,.12); }
.mail-envelope::before, .mail-envelope::after { content: ""; position: absolute; top: 7px; width: 45px; height: 2px; background: var(--info); transform-origin: center; }
.mail-envelope::before { left: 3px; transform: rotate(33deg); }
.mail-envelope::after { right: 11px; transform: rotate(-33deg); }
.mail-status-dot { position: absolute; right: 0; bottom: 2px; width: 20px; height: 20px; border: 4px solid white; border-radius: 50%; background: var(--success); }
.mail-status-dot.danger { background: var(--danger); }
.preiva-progress-area { flex: 1; min-width: 0; }
.preiva-progress-label { justify-content: space-between; gap: 16px; font-size: 13px; }
.preiva-progress-track { height: 9px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #d8e4ea; }
.preiva-progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--info), var(--success)); }
.preiva-progress-area p { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.preiva-delivery-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.preiva-delivery-kpis article { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.preiva-delivery-kpis article.has-error { border-color: rgba(190,45,45,.35); background: #fff4f4; }
.preiva-delivery-kpis span, .preiva-delivery-kpis strong, .preiva-delivery-kpis small { display: block; }
.preiva-delivery-kpis span { color: var(--muted); font-size: 11px; }
.preiva-delivery-kpis strong { margin: 5px 0 2px; font-size: 25px; }
.preiva-delivery-kpis small { color: var(--muted); font-size: 10px; }
.preiva-detail-heading { justify-content: space-between; gap: 16px; margin-top: 22px; }
.preiva-detail-heading > div { align-items: baseline; gap: 10px; }
.preiva-detail-heading span { color: var(--muted); font-size: 11px; }
.preiva-delivery-table { min-width: 1120px; margin-top: 10px; }
.preiva-delivery-table td { vertical-align: top; font-size: 11px; line-height: 1.45; }
.delivery-resolution { color: var(--info); font-weight: 700; }
.preiva-error-example { margin: 14px 0 0; padding: 12px 14px; border-left: 4px solid var(--info); border-radius: 8px; color: var(--muted); background: var(--info-soft); font-size: 11px; line-height: 1.5; }
.period-policy { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.period-policy p { max-width: 760px; margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.period-admin-control { display: grid; justify-items: end; gap: 8px; min-width: 220px; }
.period-admin-control small { color: var(--muted); font-size: 10px; }
.unlock-countdown { color: var(--warning); font-size: 13px; font-variant-numeric: tabular-nums; }
.calculation-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.calculation-result { grid-column: 1 / -1; }
.calculation-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.calculation-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.calculation-fields input, .calculation-fields select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); }
.manual-inputs { border-top: 4px solid var(--warning); }
.calculation-breakdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.calculation-breakdown div { padding: 13px; border-radius: 10px; background: var(--canvas); }
.calculation-breakdown span, .calculation-breakdown strong { display: block; }
.calculation-breakdown span { color: var(--muted); font-size: 11px; }
.calculation-breakdown strong { margin-top: 6px; font-size: 14px; }
.calculation-grand-total { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; padding: 18px; border-radius: 12px; color: #fff; background: var(--nav); }
.calculation-grand-total span { font-weight: 700; }
.calculation-grand-total strong { font-size: 26px; }
.sii-comparison { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; padding: 12px 15px; border-radius: 9px; font-size: 12px; }
.sii-comparison.neutral { background: #edf0ee; }
.sii-comparison.match { color: var(--success); background: var(--success-soft); }
.sii-comparison.mismatch { color: var(--danger); background: var(--danger-soft); }
.calculation-save { margin-top: 14px; }
.calculation-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.calculation-header-actions select { min-width: 180px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.calculation-filter-panel { margin-bottom: 16px; padding: 18px; }
.calculation-filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.calculation-filter-heading strong, .calculation-filter-heading small { display: block; }
.calculation-filter-heading small { margin-top: 4px; color: var(--muted); }
.calculation-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.calculation-filter-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.calculation-filter-grid input, .calculation-filter-grid select { width: 100%; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 400; }
.calculation-active-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.calculation-active-filters span { padding: 5px 9px; border-radius: 999px; background: #e8f1fb; color: #24578d; font-size: 12px; }
.calculation-filter-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
@media (max-width: 1000px) { .calculation-filter-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); } }
@media (max-width: 600px) { .calculation-filter-grid { grid-template-columns: 1fr; } .calculation-filter-actions { justify-content: stretch; } .calculation-filter-actions .button { flex: 1; } }
.approval-button { color: white; border-color: #16734a; background: #16734a; }
.approval-button:hover:not(:disabled) { background: #105c3a; }
.approval-button:disabled { color: #7b8790; border-color: #d9e0e4; background: #edf1f3; cursor: not-allowed; }
.f29-detail-identity { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 12px; margin-bottom: 16px; padding: 18px; border-top: 4px solid var(--primary); }
.f29-detail-identity div { padding: 12px; border-radius: 10px; background: var(--canvas); }
.f29-detail-identity span, .f29-detail-identity strong, .f29-detail-identity small { display: block; }
.f29-detail-identity span, .f29-detail-identity small { color: var(--muted); font-size: 10px; }
.f29-detail-identity strong { margin: 5px 0 3px; font-size: 15px; }
.f29-detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.f29-form-section, .f29-result-section { padding: 20px; }
.f29-section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.f29-section-title > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: white; background: var(--primary); font-weight: 900; }
.f29-section-title h3, .f29-section-title p { margin: 0; }
.f29-section-title p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.f29-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f29-edit-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.f29-edit-grid input { width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; text-align: right; }
.f29-edit-grid input:focus { outline: 3px solid rgba(0,104,169,.12); border-color: var(--info); }
.f29-edit-grid input:disabled { background: #edf1f3; }
.f29-inline-result { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 12px; border-radius: 9px; background: var(--info-soft); }
.f29-result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f29-result-grid article { padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.f29-result-grid span, .f29-result-grid strong { display: block; }
.f29-result-grid span { color: var(--muted); font-size: 11px; }
.f29-result-grid strong { margin-top: 6px; font-size: 20px; }
.f29-grand-total { grid-column: 1 / -1; color: white; background: var(--primary); }
.f29-grand-total span { color: rgba(255,255,255,.75); }
.f29-grand-total strong { font-size: 28px; }
.f29-detail-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px; border-radius: 14px; background: white; box-shadow: var(--shadow); }
.f29-detail-actions p { margin: 0; color: var(--muted); font-size: 11px; }
.f29-detail-actions > div { display: flex; gap: 10px; }
.official-f29-sheet { overflow: visible; border: 1px solid #91a2aa; border-radius: 4px; color: #182126; background: #fff; box-shadow: var(--shadow); }
.f29-sticky-identity { position: sticky; top: 82px; z-index: 20; background: #fff; box-shadow: 0 5px 12px rgba(31,43,56,.13); }
.f29-detail-heading { position: sticky; top: 0; z-index: 40; padding: 12px 0; background: var(--canvas); }
.official-f29-header { display: grid; grid-template-columns: 1fr 1.6fr; border-bottom: 3px solid #c7352d; }
.official-f29-title { display: grid; align-content: center; padding: 16px 20px; color: white; background: #c7352d; }
.official-f29-title span { font-size: 9px; letter-spacing: .08em; }
.official-f29-title strong { font-size: 30px; line-height: 1; }
.official-f29-title small { margin-top: 5px; }
.official-f29-period { display: grid; grid-template-columns: 1.2fr 1.3fr .8fr; }
.official-f29-period label { display: grid; align-content: center; gap: 5px; padding: 10px 12px; border-left: 1px solid #91a2aa; font-size: 9px; font-weight: 800; }
.official-f29-period label > strong { font-size: 15px; }
.official-f29-period label div { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 6px; }
.official-f29-period label div strong { padding: 5px; border: 1px solid #6e7d84; text-align: center; }
.official-f29-print-logo { display: none; }
.official-f29-print-footer { display: none; }
.official-f29-taxpayer { display: grid; grid-template-columns: auto 2fr auto 1.2fr auto 1fr; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #91a2aa; font-size: 10px; }
.official-f29-taxpayer span { color: #58676e; font-weight: 700; }
.official-f29-warning { margin: 0; padding: 9px 14px; color: #6f5300; background: #fff3c8; font-size: 10px; }
.official-f29-block { margin: 14px; border: 2px solid #5d6c73; }
.official-block-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; color: white; background: #4c5e66; }
.official-block-title strong { font-size: 13px; letter-spacing: .04em; }
.official-block-title span { font-size: 9px; }
.official-f29-table { width: 100%; min-width: 930px; border-collapse: collapse; }
.official-f29-table th, .official-f29-table td { padding: 6px 7px; border: 1px solid #9aa7ad; font-size: 9px; }
.official-f29-table th { color: #25343b; background: #dce4e7; }
.official-f29-table td:first-child { width: 34px; font-weight: 800; text-align: center; }
.official-f29-table input { width: 100%; min-width: 90px; padding: 7px; border: 1px solid #72858e; border-radius: 2px; background: #fffef1; text-align: right; font: inherit; font-weight: 750; }
.official-f29-table input:disabled { color: #7a858a; background: #edf1f2; }
.official-signed-input { display: flex; align-items: center; gap: 6px; }
.official-signed-input > strong { min-width: 12px; color: #365b7d; font-size: 16px; text-align: center; }
.official-signed-input input { flex: 1; min-width: 88px; }
.official-code { width: 55px; color: #9c2f29; background: #fff1ef; font-weight: 900; text-align: center; }
.official-code-input { display: flex; align-items: center; gap: 6px; }
.official-code-input span { flex: none; color: #9c2f29; font-weight: 900; }
.official-muted-row { color: #7a858a; }
.official-active-row td { background: #fffdf0; }
.official-active-row td:first-child, .official-active-row .official-code { color: #9c2f29; font-weight: 900; }
.official-editable-row td { color: #45545b; background: #fbfcfc; }
.official-editable-row:hover td { background: #f1f7fa; }
.official-editable-row input:not(:disabled) { border-color: #8ca6b2; background: white; }
.official-total-row td { background: #e9eef0; }
.official-result-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #9c2f29; font-size: 9px; font-weight: 900; }
.official-result-box strong { color: #17232f; font-size: 13px; }
.official-secondary-result { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.official-eva-adjustment { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 10px; background: #f4f8fa; }
.official-eva-adjustment label { display: flex; align-items: center; gap: 8px; font-size: 9px; font-weight: 800; }
.official-eva-adjustment input { width: 130px; padding: 6px; text-align: right; }
.official-eva-adjustment small { color: var(--muted); font-size: 8px; }
.official-other-codes { margin: 14px; border: 1px solid #9aa7ad; }
.official-other-codes summary { padding: 11px 13px; background: #e9eef0; font-size: 11px; font-weight: 800; cursor: pointer; }
.official-other-codes div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
.official-other-codes p { margin: 0; padding: 9px; border: 1px solid #d8e0e3; font-size: 9px; }
.official-other-codes > small { display: block; padding: 0 12px 12px; color: var(--muted); font-size: 9px; }
.official-f29-payment { display: grid; grid-template-columns: 1fr 1fr; margin: 14px; border: 3px solid #c7352d; }
.official-f29-payment > div { display: grid; gap: 5px; padding: 14px; }
.official-f29-payment > div:first-child { border-right: 1px solid #c7352d; }
.official-f29-payment span, .official-f29-payment small { font-size: 10px; font-weight: 800; }
.official-f29-payment strong { font-size: 20px; }
.official-pay-total { color: white; background: #c7352d; }
.official-pay-total strong { font-size: 28px; text-align: right; }
.official-f29-sheet .f29-detail-actions { margin: 14px; border: 1px solid var(--line); box-shadow: none; }
.print-report-header { display: none; }
.horizontal-calculation-panel { padding: 0; overflow: hidden; }
.horizontal-calculation-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.horizontal-calculation-toolbar strong, .horizontal-calculation-toolbar small { display: block; }
.horizontal-calculation-toolbar small { margin-top: 4px; color: var(--muted); }
.horizontal-calculation-panel .table-wrap { max-height: calc(100vh - 255px); overflow: auto; }
.calculation-table { min-width: 1760px; }
.calculation-table th { white-space: normal; line-height: 1.25; }
.calculation-table thead th { position: sticky; top: 0; z-index: 4; background: #f8fafc; box-shadow: 0 1px 0 var(--line); }
.calculation-table th:first-child, .calculation-table td:first-child { position: sticky; left: 0; z-index: 2; min-width: 230px; background: var(--surface); box-shadow: 7px 0 12px rgba(0, 59, 101, .05); }
.calculation-table th:first-child { z-index: 6; background: #f8fafc; }
.calculation-table tfoot td { position: sticky; bottom: 0; z-index: 3; border-top: 2px solid #1649b8; background: #edf4ff; }
.calculation-table tfoot td:first-child { z-index: 5; background: #dfeaff; }
.calculation-total-row small { display: block; margin-top: 3px; color: var(--muted); }
.calculation-rate-total { text-align: center; font-weight: 800; }
.calculation-final-total { color: #fff; background: #1649b8 !important; }
.calculation-company strong, .calculation-company small { display: block; }
.calculation-company small { margin-top: 4px; color: var(--muted); }
.manual-column { background: var(--warning-soft) !important; }
.table-number-input { width: 112px; padding: 8px 9px; border: 1px solid #e3b96f; border-radius: 7px; text-align: right; color: var(--ink); background: #fffdf7; font-variant-numeric: tabular-nums; }
.table-number-input:focus { outline: 0; border-color: var(--warning); box-shadow: 0 0 0 3px rgba(168, 103, 12, .12); }
.worker-tax-code-grid { display: grid; gap: 7px; min-width: 150px; }
.worker-tax-code-grid label, .official-worker-tax-fields label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }
.worker-tax-code-grid .table-number-input { width: 100%; }
.api-locked-column { background: #f1f5f7 !important; }
.api-locked-field { display: grid; gap: 4px; min-width: 125px; }
.api-locked-field small { color: #416373; font-weight: 700; }
.api-locked-input, .api-locked-input:focus { border-color: #b9cbd3 !important; background: #e9f0f3 !important; color: #294b5a !important; cursor: not-allowed; box-shadow: none !important; }
.official-worker-tax-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.official-worker-tax-fields label { min-width: 0; }
.official-worker-tax-fields label > span { color: var(--ink); font-size: 10px; font-weight: 800; white-space: nowrap; }
.official-worker-tax-fields input { width: 100%; min-width: 0; }
.portal-client-select { display: grid; gap: 6px; min-width: 260px; color: var(--muted); font-size: 11px; font-weight: 700; }
.portal-client-select[hidden] { display: none !important; }
.portal-client-select select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
.portal-client-identity { min-width: 260px; display: grid; gap: 3px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.portal-client-identity[hidden] { display: none !important; }
.portal-client-identity span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.portal-client-identity strong { color: var(--ink); font-size: 14px; }
.portal-client-identity small { color: var(--muted); font-size: 12px; }
.portal-login-shell { display: grid; min-height: calc(100vh - 150px); place-items: center; padding: 32px 16px; }
.portal-login-shell[hidden],
#portalAuthenticated[hidden] { display: none !important; }
.portal-login-card { display: grid; width: min(100%, 460px); gap: 18px; padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.portal-login-card label { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
.portal-login-card input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.portal-login-card small { color: var(--muted); line-height: 1.5; }
.pwa-install-action { justify-content: center; }
.pwa-install-note { margin: -8px 0 0; padding: 10px 12px; border-radius: 9px; color: #24485d; background: #edf6fb; font-size: 12px; line-height: 1.45; }
.pwa-install-note[hidden], .pwa-install-action[hidden] { display: none !important; }
.portal-login-brand { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.portal-login-brand img { width: 116px; height: 72px; object-fit: contain; object-position: left center; }
.portal-login-brand p { margin: 0; color: var(--muted); font-size: 11px; }
.portal-session-actions { display: flex; align-items: end; gap: 10px; }
.portal-session-actions #portalLogout { margin-left: auto; }
.portal-session-actions .portal-client-select { min-width: 230px; }
.portal-welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding: 22px; border-radius: 16px; color: #fff; background: linear-gradient(120deg, var(--nav), var(--info)); box-shadow: var(--shadow); }
.portal-welcome .eyebrow, .portal-welcome p { color: #d8eaf4; }
.portal-welcome h3 { margin-bottom: 6px; font-size: 22px; }
.portal-welcome p { margin-bottom: 0; font-size: 13px; }
.portal-tabs { display: flex; gap: 8px; margin: 18px 0 14px; overflow-x: auto; }
.portal-mobile-home { display: flex; align-items: center; gap: 18px; margin: 0 0 14px; padding: 18px 22px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #063a66, #0d75ad); box-shadow: 0 10px 24px rgba(2, 53, 91, .2); }
.portal-mobile-home[hidden] { display: none !important; }
.portal-mobile-home img { width: 116px; height: 70px; padding: 7px; border-radius: 12px; object-fit: contain; background: rgba(255,255,255,.96); }
.portal-mobile-home span { color: #cfe9f7; font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.portal-mobile-home h3 { margin: 4px 0; color: #fff; font-size: 20px; }
.portal-mobile-home p { margin: 0; color: #dceef7; font-size: 12px; }
.portal-tab { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); font-weight: 750; white-space: nowrap; }
.portal-tab.active { border-color: var(--info); color: #fff; background: var(--info); }
.portal-tab[hidden] { display: none !important; }
.portal-panel { display: none; }
.portal-panel.active { display: block; }
.portal-panel-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; }
.portal-panel-title .eyebrow { margin-bottom: 4px; }
.portal-subtitle { margin: 6px 0 0; }
.portal-toolbar { display: flex; align-items: end; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.portal-upload-button { position: relative; cursor: pointer; }
.portal-bulk-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 22px 18px; }
.portal-bulk-actions label { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 750; }
.portal-bulk-actions span { margin-right: auto; color: var(--muted); font-size: 12px; }
.portal-document-grid { display: grid; gap: 10px; padding: 0 22px 22px; }
.portal-history-table { max-height: 580px; margin: 0 22px 22px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.portal-report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 0 22px 22px; }
.portal-report-grid[hidden] { display: none !important; }
.role-accounting-assistant .portal-email-bar,
.role-accounting-assistant [data-request-special-report-quote] { display: none !important; }
.portal-report-grid article { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--canvas); }
.portal-report-grid article > :last-child { grid-column: 1 / -1; justify-self: start; }
.portal-report-grid h4, .portal-report-grid p { margin: 0; }
.portal-report-grid p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.report-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--info); font-weight: 850; }
.folder-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--canvas); }
.folder-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.portal-document-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.portal-document-actions label { font-size: 12px; color: var(--muted); }
.portal-document-download-bar { padding-top: 0; }
.portal-email-bar { margin: 0 22px 20px; padding: 14px 16px; border: 1px solid #cbd8ea; border-radius: 12px; background: #f6f9fe; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(180px, 1fr) auto; gap: 14px; align-items: end; }
.portal-email-bar label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink); }
.portal-email-bar input { width: 100%; }
.portal-email-bar small { color: var(--muted); align-self: center; }
.document-icon { width: 48px; height: 56px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--primary); font-size: 11px; font-weight: 850; }
.integral-legend { display: flex; flex-wrap: wrap; gap: 16px; color: var(--ink); font-size: 14px; font-weight: 700; }
.integral-legend span { display: flex; align-items: center; gap: 5px; }
.status-circle { width: 15px; height: 15px; display: inline-block; flex: none; border-radius: 50%; }
.status-circle.ok { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.status-circle.review { background: var(--primary); box-shadow: 0 0 0 4px var(--danger-soft); }
.status-circle.pending { background: var(--muted); box-shadow: 0 0 0 4px #edf0ee; }
.integral-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 22px 22px; }
.integral-month { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.integral-month span { color: var(--muted); font-size: 11px; }
.integral-month strong { grid-column: 1 / -1; font-size: 13px; }
.integral-summary { margin: 0 22px 22px; padding: 14px 16px; border-left: 4px solid var(--info); border-radius: 8px; background: var(--info-soft); }
.integral-summary p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.integral-matrix { margin: 0 22px 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.integral-matrix-head, .integral-matrix-row { display: grid; grid-template-columns: minmax(110px, .7fr) repeat(2, minmax(180px, 1fr)); align-items: center; }
.integral-matrix-head { color: #fff; background: var(--nav); }
.integral-matrix-head > *, .integral-matrix-row > * { padding: 12px 16px; }
.integral-matrix-head strong { text-align: center; }
.integral-matrix-row { border-top: 1px solid var(--line); }
.integral-matrix-row:nth-child(odd) { background: #f8fafc; }
.integral-matrix-row > strong { font-size: 12px; }
.integral-year-cell { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; border-left: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 650; }
.tgr-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 22px 22px; }
.tgr-overview article { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); }
.tgr-overview span, .tgr-overview strong { display: block; }
.tgr-overview span { color: var(--muted); font-size: 11px; }
.tgr-overview strong { margin-top: 7px; font-size: 14px; }
.tgr-clear { color: var(--success); }
.tgr-debt { color: var(--danger); }
.tgr-note { margin: 18px 22px 22px; }
.annual-year-filter { display: grid; gap: 5px; min-width: 120px; color: var(--muted); font-size: 11px; font-weight: 700; }
.annual-year-filter select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); font-weight: 700; }
.annual-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0 22px 20px; }
.annual-kpis article { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); }
.annual-kpis article:first-child { color: #fff; background: var(--nav); }
.annual-kpis span, .annual-kpis strong, .annual-kpis small { display: block; }
.annual-kpis span { color: var(--muted); font-size: 11px; }
.annual-kpis article:first-child span, .annual-kpis article:first-child small { color: #c9dce8; }
.annual-kpis strong { margin-top: 7px; font-size: 20px; }
.annual-kpis small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.annual-tax-table { min-width: 1280px; }
.annual-total-row td { border-top: 2px solid var(--nav); color: var(--nav); background: var(--info-soft); }
.portal-scroll-hint { display: none; }
@media (max-width: 850px) { .portal-report-grid { grid-template-columns: 1fr; } .portal-panel-title { align-items: flex-start; flex-direction: column; } }
@media (max-width: 850px) { .portal-email-bar { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .portal-login-shell { min-height: 100dvh; padding: 14px; }
  .portal-login-card { gap: 15px; padding: 22px 18px; border-radius: 18px; }
  .portal-login-brand { align-items: flex-start; flex-direction: column; }
  .portal-heading { align-items: flex-start; }
  .portal-session-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .portal-session-actions .portal-client-select, .portal-client-identity { width: 100%; min-width: 0; }
  .portal-session-actions .button { width: 100%; justify-content: center; }
  .portal-tabs { width: 100%; margin: 12px 0; padding: 0; overflow: visible; flex-direction: column; gap: 6px; }
  .portal-mobile-home { align-items: center; gap: 14px; margin: 10px 0 14px; padding: 16px; }
  .portal-mobile-home img { width: 92px; height: 58px; padding: 6px; border-radius: 12px; object-fit: contain; background: rgba(255,255,255,.96); }
  .portal-mobile-home span { color: #cfe9f7; font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
  .portal-mobile-home h3 { margin: 4px 0; color: #fff; font-size: 16px; }
  .portal-mobile-home p { margin: 0; color: #dceef7; font-size: 11px; line-height: 1.4; }
  .portal-tab { width: 100%; padding: 11px 14px; text-align: left; }
  .portal-tab.active { box-shadow: 0 3px 10px rgba(0, 91, 143, .18); }
  .portal-welcome { margin-bottom: 10px; padding: 16px; }
  .portal-welcome h3 { font-size: 18px; }
  .portal-panel-title { gap: 12px; padding: 14px; }
  .portal-panel-title h3 { font-size: 17px; }
  .portal-subtitle { font-size: 11px; }
  .portal-toolbar { width: 100%; justify-content: stretch; }
  .portal-toolbar .button, .portal-toolbar .annual-year-filter { flex: 1 1 140px; justify-content: center; }
  .portal-bulk-actions, .portal-document-grid { padding-inline: 12px; }
  .portal-bulk-actions { gap: 8px; padding-bottom: 12px; }
  .portal-bulk-actions .button { width: 100%; justify-content: center; }
  .portal-document-grid { gap: 8px; padding-bottom: 14px; }
  .portal-scroll-hint { display: block; margin: 0 12px 10px; padding: 9px 11px; border-left: 3px solid var(--info); border-radius: 7px; color: #31576b; background: #eef7fb; font-size: 11px; line-height: 1.4; }
  .sales-line-chart .portal-scroll-hint { margin: 8px 0; }
  .folder-card { grid-template-columns: 38px 1fr; gap: 10px; padding: 12px; }
  .document-icon { width: 38px; height: 44px; }
  .folder-card p { font-size: 11px; }
  .folder-card > :last-child { grid-column: 1 / -1; width: 100%; }
  .portal-document-actions .button { width: 100%; justify-content: center; }
  .portal-email-bar { margin: 0 12px 14px; padding: 12px; }
  .portal-f29-table th, .portal-f29-table td { padding: 9px 7px; font-size: 11px; }
  .portal-f29-table th:first-child, .portal-f29-table td:first-child { width: 34px; }
  .portal-f29-table .row-action { padding: 6px; font-size: 11px; }
  .portal-history-table { margin-inline: 12px; }
  .portal-report-detail { margin: 0 12px 14px; }
  .annual-kpis, .tgr-overview { grid-template-columns: 1fr; padding-inline: 16px; }
}
.tgr-status-card { border-width: 2px !important; }
.tgr-traffic { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.tgr-traffic i, .tgr-table-state i { display: inline-block; flex: none; border-radius: 50%; }
.tgr-traffic i { width: 22px; height: 22px; }
.tgr-traffic.green i { background: var(--success); box-shadow: 0 0 0 6px var(--success-soft); }
.tgr-traffic.red i { background: var(--primary); box-shadow: 0 0 0 6px var(--danger-soft); }
.tgr-traffic.green strong { color: var(--success); }
.tgr-traffic.red strong { color: var(--danger); }
.tgr-traffic.neutral i { background: var(--muted); box-shadow: 0 0 0 6px #edf0ee; }
.tgr-traffic.neutral strong { color: var(--muted); }
.tgr-table-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 750; }
.tgr-table-state i { width: 13px; height: 13px; }
.tgr-table-state.clear { color: var(--success); }
.tgr-table-state.clear i { background: var(--success); }
.tgr-table-state.debt { color: var(--danger); }
.tgr-table-state.debt i { background: var(--primary); }
.portal-report-detail[hidden] { display: none !important; }
.portal-report-detail { margin: 0 22px 22px; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.reports-panel.report-detail-active > .portal-panel-title:first-child { display: none; }
.reports-panel.report-detail-active .portal-report-detail:not([hidden]) {
  position: fixed;
  inset: 24px;
  z-index: 1200;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  overflow: auto;
  box-shadow: 0 0 0 100vmax rgba(14, 30, 48, .56), 0 24px 70px rgba(14, 30, 48, .3);
}
@media (max-width: 700px) {
  .reports-panel.report-detail-active .portal-report-detail:not([hidden]) { inset: 10px; border-radius: 12px; }
}
.sales-legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 12px; font-weight: 700; }
.sales-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sales-dot { width: 10px; height: 10px; border-radius: 50%; }
.sales-year-kpis article small { color: var(--muted); font-size: 11px; }
.sales-history-table { margin-top: 18px; }
.sales-history-table th:not(:first-child), .sales-history-table td:not(:first-child) { text-align: right; white-space: nowrap; }
.sales-total-row { background: #f3f8fb; }
.sales-horizontal-chart { display: grid; gap: 12px; margin-top: 20px; padding: 20px 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(135deg, #fff, #f7fafc); }
.sales-chart-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.sales-chart-heading span { color: var(--muted); font-size: 12px; }
.sales-horizontal-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: start; }
.sales-horizontal-row > strong { padding-top: 5px; font-size: 11px; text-transform: uppercase; }
.sales-horizontal-series { display: grid; gap: 5px; }
.sales-horizontal-item { display: grid; grid-template-columns: 38px minmax(100px, 1fr) 108px; gap: 8px; align-items: center; min-height: 20px; }
.sales-horizontal-item > span { color: var(--muted); font-size: 10px; font-weight: 800; }
.sales-horizontal-item > small { color: var(--muted); font-size: 10px; text-align: right; white-space: nowrap; }
.sales-horizontal-track { height: 12px; overflow: hidden; border-radius: 999px; background: #e8eff3; }
.sales-horizontal-bar { display: block; height: 100%; min-width: 0; border-radius: inherit; transition: width .2s ease; }
.sales-month-chart { display: grid; gap: 14px; margin-top: 20px; padding: 20px 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(135deg, #fff, #f7fafc); }
.sales-month-axis { display: grid; grid-template-columns: repeat(12, minmax(68px, 1fr)); align-items: end; gap: 10px; min-height: 210px; overflow-x: auto; padding: 12px 4px 4px; }
.sales-month-column { display: grid; justify-items: center; gap: 8px; min-width: 68px; }
.sales-month-column > strong { font-size: 11px; text-transform: uppercase; }
.sales-vertical-bars { display: flex; align-items: end; justify-content: center; gap: 4px; height: 170px; }
.sales-vertical-bar { position: relative; display: block; width: 14px; min-height: 4px; border-radius: 5px 5px 2px 2px; }
.sales-vertical-bar span { position: absolute; left: 50%; bottom: -16px; display: none; color: var(--muted); font-size: 8px; transform: translateX(-50%); }
.sales-vertical-bar.empty { height: 0; min-height: 0; }
.sales-line-chart { display: grid; gap: 14px; margin-top: 20px; padding: 20px 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(135deg, #fff, #f7fafc); }
.sales-line-scroll { overflow-x: auto; }
.sales-line-svg { display: block; width: 100%; min-width: 900px; height: auto; }
.sales-grid-line { stroke: #dfe8ed; stroke-width: 1; stroke-dasharray: 4 5; }
.sales-line-series { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.sales-line-point { stroke: #fff; stroke-width: 2; cursor: help; }
.sales-month-label { fill: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
@media (max-width: 700px) {
  .sales-chart-heading { align-items: flex-start; flex-direction: column; }
  .sales-horizontal-item { grid-template-columns: 34px minmax(80px, 1fr) 88px; }
}
.team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.team-card { display: grid; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.team-card-head { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: 50%; color: #ffffff; background: var(--info); font-weight: 800; }
.team-card h3 { font-size: 16px; }
.team-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.team-stats { display: flex; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.team-stats span, .team-stats strong { display: block; }
.team-stats span { color: var(--muted); font-size: 11px; }
.team-stats strong { margin-top: 4px; font-size: 18px; }
.team-delete { justify-self: start; border: 0; padding: 0; color: var(--danger); background: transparent; font-size: 12px; font-weight: 700; }
.team-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.team-edit { border: 0; padding: 0; color: var(--info); background: transparent; font-size: 12px; font-weight: 700; }
.roles-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.groups-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.group-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.group-card-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--nav); font-size: 12px; font-weight: 800; }
.group-card h3 { font-size: 15px; }
.group-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.group-card-count { text-align: center; }
.group-card-count strong, .group-card-count span { display: block; }
.group-card-count strong { color: var(--info); font-size: 22px; }
.group-card-count span { color: var(--muted); font-size: 10px; }
.role-card { display: grid; align-content: start; gap: 15px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.role-card p { margin: 0; color: var(--muted); font-size: 12px; }
.permission-list { display: flex; flex-wrap: wrap; gap: 6px; }
.permission-chip { padding: 5px 7px; border-radius: 7px; color: var(--info); background: var(--info-soft); font-size: 10px; font-weight: 700; }
.standalone-field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.standalone-field input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); }
.standalone-field textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); resize: vertical; font: inherit; }
.group-description-field { margin-top: 14px; }
.permission-fieldset { margin: 18px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; }
.permission-fieldset legend { padding: 0 6px; color: var(--ink); font-size: 12px; font-weight: 700; }
.permission-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.permission-option { display: flex; align-items: start; gap: 8px; color: var(--ink); font-size: 12px; }
.permission-option input { margin-top: 2px; accent-color: var(--info); }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 340px; padding: 13px 16px; border-radius: 10px; color: white; background: var(--nav); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

dialog { width: min(560px, calc(100% - 30px)); border: 0; border-radius: 18px; padding: 24px; color: var(--ink); box-shadow: 0 24px 80px rgba(17,35,28,.28); }
dialog::backdrop { background: rgba(16,31,25,.45); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 8px; color: var(--muted); background: #eff2f0; font-size: 22px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-cell { padding: 13px; border-radius: 11px; background: var(--canvas); }
.detail-cell span, .detail-cell strong { display: block; }
.detail-cell span { color: var(--muted); font-size: 11px; }
.detail-cell strong { margin-top: 5px; font-size: 14px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.form-grid label small { color: var(--muted); font-size: 11px; font-weight: 400; }
.form-grid input, .form-grid select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); outline: none; }
.form-grid input:focus, .form-grid select:focus { border-color: var(--info); box-shadow: 0 0 0 3px rgba(0,104,169,.13); }
.password-field { display: grid; grid-template-columns: 1fr auto; align-items: stretch; gap: 6px; }
.password-field input { min-width: 0; }
.password-toggle { border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: var(--surface); color: var(--info); font-weight: 700; cursor: pointer; }
.password-toggle:hover { background: var(--info-soft); }
.full-field { grid-column: 1 / -1; }
.form-divider { display: grid; gap: 3px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-divider strong { color: var(--ink); font-size: 13px; }
.form-divider span, .security-note { color: var(--muted); font-size: 11px; }
.security-note { margin: 10px 0 0; padding: 10px 12px; border-radius: 9px; background: var(--info-soft); }
.form-error { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: 12px; }
.auth-link { display: inline-block; margin-top: 14px; color: var(--info); font-weight: 700; text-align: center; }
.complement-context { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.complement-context div { padding: 12px; border-radius: 10px; background: var(--canvas); }
.complement-context span, .complement-context strong { display: block; }
.complement-context span { color: var(--muted); font-size: 11px; }
.complement-context strong { margin-top: 5px; font-size: 13px; }
.complement-grid { margin-top: 16px; }
.complement-total { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 14px 16px; border-radius: 10px; color: var(--nav); background: var(--info-soft); }
.complement-total span { font-size: 12px; font-weight: 700; }
.complement-total strong { font-size: 20px; }
.email-test-dialog { width: min(720px, calc(100% - 30px)); }
.email-test-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 11px 14px; border: 1px solid #efc06a; border-radius: 10px; color: #7b4a00; background: #fff7e4; }
.email-test-banner strong { font-size: 12px; letter-spacing: .08em; }
.email-test-banner span { font-size: 11px; }
.email-preview { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; }
.email-preview-brand { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 18px; color: white; background: var(--nav); }
.email-preview-brand img { width: 90px; height: 38px; object-fit: contain; object-position: left center; }
.email-preview-brand span { font-size: 11px; }
#preIvaEmailPreview { padding: 20px; color: var(--ink); font-size: 13px; line-height: 1.55; }
#preIvaEmailPreview p { margin: 0 0 14px; }
.email-tax-amount { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 18px 0; padding: 16px 18px; border-radius: 11px; color: var(--nav); background: var(--info-soft); }
.email-tax-amount span { font-size: 12px; font-weight: 700; }
.email-tax-amount strong { font-size: 24px; }
.email-client-summary { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1px; margin: 18px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.email-client-summary div { padding: 11px 12px; background: white; }
.email-client-summary span, .email-client-summary strong { display: block; }
.email-client-summary span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.email-client-summary strong { margin-top: 4px; font-size: 12px; }
.email-tax-section { margin: 14px 0; border-bottom: 2px solid var(--ink); }
.email-tax-section h4 { margin: 0; padding: 8px 10px; color: white; background: var(--nav); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.email-tax-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.email-tax-row:last-child { border-bottom: 0; }
.email-tax-row.total { font-weight: 800; background: var(--canvas); }
.tax-debit { color: #c62828; }
.tax-credit { color: #0068a9; }
.email-result-table { margin-top: 18px; border: 1px solid var(--ink); }
.email-result-table div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 7px 10px; border-bottom: 1px solid var(--ink); font-size: 12px; }
.email-result-table div:last-child { border-bottom: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 205px 1fr; }
  .sidebar { padding-inline: 12px; }
  .brand { width: 100%; height: auto; justify-content: flex-start; margin-inline: auto; padding: 6px; }
  .brand-logo { width: 100%; max-width: none; flex: none; }
  .nav-item { text-align: left; font-size: 13px; }
  .sidebar-note { justify-content: flex-start; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process-card::after { display: none; }
  .preiva-delivery-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .capture-flow { grid-template-columns: 1fr; }
  .capture-flow > i { display: none; }
  .capture-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .approval-gate { grid-template-columns: 1fr; }
  .approval-gate > i { display: none; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px 16px; flex-direction: row; align-items: center; gap: 12px; }
  .brand { width: 142px; height: 44px; margin: 0; padding: 6px; }
  .brand-logo { width: 130px; max-width: 130px; }
  .brand-mark { width: 38px; height: 38px; }
  nav { display: flex; margin-left: auto; }
  .nav-item { padding: 9px; }
  .sidebar-note, .creator-credit { display: none; }
  main { padding: 0 18px 32px; }
  .topbar, .section-heading { align-items: stretch; flex-direction: column; }
  .topbar { padding: 22px 0; }
  .topbar-actions, .search-field input { width: 100%; }
  .period-selector-wrap { align-items: stretch; flex-direction: column; }
  .period-selector-wrap select { width: 100%; }
  .topbar-actions { align-items: stretch; flex-direction: column; }
  .admin-context { margin: 0 0 4px; }
  .metrics, .content-grid, .process-board { grid-template-columns: 1fr; }
  .calculation-layout, .calculation-fields, .calculation-breakdown { grid-template-columns: 1fr; }
  .f29-detail-identity, .f29-detail-layout, .f29-edit-grid, .f29-result-grid { grid-template-columns: 1fr; }
  .f29-grand-total { grid-column: auto; }
  .f29-detail-actions { align-items: stretch; flex-direction: column; }
  .official-f29-header, .official-f29-period, .official-f29-payment { grid-template-columns: 1fr; }
  .official-f29-period label { border-top: 1px solid #91a2aa; border-left: 0; }
  .official-f29-taxpayer { grid-template-columns: 1fr 2fr; }
  .official-other-codes div { grid-template-columns: 1fr; }
  .calculation-result { grid-column: auto; }
  .team-grid { grid-template-columns: 1fr; }
  .roles-grid { grid-template-columns: 1fr; }
  .groups-grid { grid-template-columns: 1fr; }
  .client-toolbar { align-items: stretch; flex-direction: column; }
  .filters { overflow-x: auto; padding-bottom: 2px; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .permission-options { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .portal-heading, .portal-welcome, .portal-panel-title { align-items: stretch; flex-direction: column; }
  .portal-client-select { min-width: 0; }
  .integral-grid { grid-template-columns: 1fr; }
  .integral-matrix { overflow-x: auto; }
  .integral-matrix-head, .integral-matrix-row { min-width: 570px; }
  .tgr-overview { grid-template-columns: 1fr; }
  .annual-kpis { grid-template-columns: 1fr; }
  .folder-card { grid-template-columns: auto 1fr; }
  .folder-card .button { grid-column: 1 / -1; }
  .period-policy { align-items: stretch; flex-direction: column; }
  .period-admin-control { justify-items: stretch; min-width: 0; }
  .preiva-control-header, .preiva-delivery-visual, .preiva-detail-heading { align-items: stretch; flex-direction: column; }
  .preiva-control-actions { justify-content: flex-start; }
  .preiva-control-actions .button { flex: 1 1 190px; }
  .preiva-delivery-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .capture-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body.printing-portal-annual { background: #fff; color: #17232f; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.printing-portal-annual .sidebar, body.printing-portal-annual .topbar, body.printing-portal-annual .view, body.printing-portal-annual #toast { display: none !important; }
  body.printing-portal-annual .app-shell { display: block; min-height: 0; }
  body.printing-portal-annual main { padding: 0; }
  body.printing-portal-annual #view-portal { display: block !important; }
  body.printing-portal-annual #view-portal > :not(#portalAuthenticated), body.printing-portal-annual .portal-heading, body.printing-portal-annual .portal-welcome, body.printing-portal-annual .portal-tabs, body.printing-portal-annual .portal-panel:not(#portalPanelAnual), body.printing-portal-annual #portalPanelAnual .portal-panel-title .portal-toolbar { display: none !important; }
  body.printing-portal-annual #portalAuthenticated, body.printing-portal-annual #portalPanelAnual { display: block !important; }
  body.printing-portal-annual #portalPanelAnual .annual-summary-panel { border: 0; box-shadow: none; }
  body.printing-portal-annual .portal-annual-print-header { display: grid; grid-template-columns: 150px 1fr 190px; align-items: center; gap: 22px; padding-bottom: 15px; margin-bottom: 14px; border-bottom: 3px solid #d52b1e; }
  body.printing-portal-annual .portal-annual-print-header img { max-width: 145px; max-height: 72px; object-fit: contain; }
  body.printing-portal-annual .print-report-title { text-align: center; }
  body.printing-portal-annual .print-report-title span { color: #697684; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
  body.printing-portal-annual .print-report-title h1 { margin: 5px 0 3px; color: #003b65; font-size: 20px; }
  body.printing-portal-annual .print-report-title p { margin: 0; color: #697684; font-size: 10px; }
  body.printing-portal-annual .annual-tax-table { width: 100%; min-width: 0; table-layout: fixed; }
  body.printing-portal-annual .annual-tax-table th, body.printing-portal-annual .annual-tax-table td { padding: 5px 4px; font-size: 7px; white-space: normal; }
  body.printing-calculation { background: #fff; color: #17232f; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.printing-calculation .sidebar, body.printing-calculation .topbar, body.printing-calculation .view, body.printing-calculation #toast { display: none !important; }
  body.printing-calculation .app-shell { display: block; min-height: 0; }
  body.printing-calculation main { padding: 0; }
  body.printing-calculation #view-calculo { display: block !important; }
  body.printing-calculation #view-calculo > .section-heading, body.printing-calculation .calculation-filter-panel, body.printing-calculation .horizontal-calculation-toolbar, body.printing-calculation .calculation-table th:last-child, body.printing-calculation .calculation-table td:last-child { display: none !important; }
  body.printing-calculation .horizontal-calculation-panel { border: 0; box-shadow: none; overflow: visible; }
  body.printing-calculation .print-report-header { display: grid; grid-template-columns: 150px 1fr 190px; align-items: center; gap: 22px; padding-bottom: 15px; margin-bottom: 14px; border-bottom: 3px solid #d52b1e; }
  body.printing-billing, body.printing-groups { background: #fff; color: #17232f; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.printing-billing .sidebar, body.printing-billing .topbar, body.printing-billing .view,
  body.printing-groups .sidebar, body.printing-groups .topbar, body.printing-groups .view { display: none !important; }
  body.printing-billing .app-shell, body.printing-groups .app-shell { display: block; }
  body.printing-billing main, body.printing-groups main { padding: 0; }
  body.printing-billing #view-facturacion, body.printing-groups #view-grupos { display: block !important; }
  body.printing-billing #view-facturacion .section-heading > div:last-child,
  body.printing-groups #view-grupos .section-heading > div:last-child,
  body.printing-groups #groupsGrid button { display: none !important; }
  body.printing-billing table th:last-child, body.printing-billing table td:last-child { display: none !important; }
  body.printing-calculation .print-eva-brand img { width: 140px; height: auto; }
  body.printing-calculation .print-report-title { text-align: center; }
  body.printing-calculation .print-report-title span { color: #697684; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
  body.printing-calculation .print-report-title h1 { margin: 5px 0 3px; color: #003b65; font-size: 20px; }
  body.printing-calculation .print-report-title p { margin: 0; color: #697684; font-size: 10px; }
  body.printing-calculation .print-nazar-brand { display: flex; align-items: center; justify-content: flex-end; }
  body.printing-calculation .print-nazar-brand img { display: block; width: 145px; height: 72px; object-fit: contain; object-position: center; }
  body.printing-calculation .table-wrap { overflow: visible; }
  body.printing-calculation .calculation-table { width: 100%; min-width: 0; table-layout: fixed; }
  body.printing-calculation .calculation-table tfoot { display: table-row-group; break-inside: avoid; page-break-inside: avoid; }
  body.printing-calculation .calculation-table tfoot tr { break-inside: avoid; page-break-inside: avoid; }
  body.printing-calculation .calculation-table th, body.printing-calculation .calculation-table td { position: static; padding: 5px 4px; font-size: 7px; white-space: normal; box-shadow: none; }
  body.printing-calculation .calculation-table th:first-child, body.printing-calculation .calculation-table td:first-child { width: 120px; min-width: 0; }
  body.printing-calculation .calculation-company small { font-size: 6px; }
  body.printing-calculation .table-number-input { width: 100%; padding: 0; border: 0; background: transparent; font-size: 7px; }
  body.printing-calculation .badge { padding: 2px 4px; font-size: 6px; }
  body.printing-f29 { background: #fff; color: #17232f; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.printing-f29 .sidebar, body.printing-f29 .topbar, body.printing-f29 .view, body.printing-f29 #toast { display: none !important; }
  body.printing-f29 .app-shell { display: block; min-height: 0; }
  body.printing-f29 main { padding: 0; }
  body.printing-f29 #view-f29-detail { display: block !important; }
  body.printing-f29 #view-f29-detail > .section-heading, body.printing-f29 .official-f29-warning, body.printing-f29 .f29-detail-actions, body.printing-f29 .rcv-breakdown-block { display: none !important; }
  body.printing-f29 .official-f29-sheet { overflow: visible; border: 0; box-shadow: none; }
  body.printing-f29 .official-f29-block { break-inside: avoid; margin: 8px 0; }
  body.printing-f29 .official-f29-expandable > summary span { display: none; }
  body.printing-f29 .official-f29-expandable > summary { padding: 6px 8px; }
  body.printing-f29 .table-wrap { overflow: visible; }
  body.printing-f29 .official-f29-table { width: 100%; min-width: 0; table-layout: fixed; }
  body.printing-f29 .official-f29-table th, body.printing-f29 .official-f29-table td { padding: 4px; font-size: 7px; }
  body.printing-f29 .official-f29-table input { min-width: 0; padding: 0; border: 0; background: transparent; }
  body.printing-f29 .official-f29-print-logo { display: flex; align-items: center; justify-content: center; padding: 7px 10px; border-left: 1px solid #91a2aa; }
  body.printing-f29 .official-f29-print-logo img { display: block; width: 92px; max-height: 58px; object-fit: contain; }
  body.printing-f29 .official-f29-print-footer { display: grid; justify-items: center; gap: 5px; margin-top: 18px; padding-top: 12px; border-top: 1px solid #9aa7ad; color: #52616a; text-align: center; }
  body.printing-f29 .official-f29-print-footer span, body.printing-f29 .official-f29-print-footer small { font-size: 8px; font-weight: 700; }
  body.printing-f29 .official-f29-print-footer img { display: block; width: 150px; height: 64px; object-fit: contain; object-position: center; }
  body.printing-f29 .print-empty-row, body.printing-f29 .print-empty-block, body.printing-f29 .print-empty-box { display: none !important; }
  body.printing-f29 .official-f29-payment:has(.print-empty-box:first-child):has(.print-empty-box:last-child) { display: none !important; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body.printing-portal-section { background: #fff; color: #17232f; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.printing-portal-section .sidebar, body.printing-portal-section .topbar, body.printing-portal-section .portal-heading, body.printing-portal-section .portal-welcome, body.printing-portal-section .portal-tabs, body.printing-portal-section #toast { display: none !important; }
  body.printing-portal-section .app-shell, body.printing-portal-section main, body.printing-portal-section #view-portal, body.printing-portal-section #portalAuthenticated, body.printing-portal-section .portal-panel.portal-print-panel, body.printing-portal-section .portal-print-target { display: block !important; }
  body.printing-portal-section main { padding: 0; }
  body.printing-portal-section .view, body.printing-portal-section .portal-panel { display: none !important; }
  body.printing-portal-section #view-portal, body.printing-portal-section .portal-panel.portal-print-panel { display: block !important; }
  body.printing-portal-section .portal-print-target { position: static !important; inset: auto !important; width: auto !important; margin: 0 !important; border: 0 !important; box-shadow: none !important; overflow: visible !important; }
  body.printing-portal-section .portal-print-target .portal-toolbar, body.printing-portal-section .portal-print-target .row-action, body.printing-portal-section .portal-print-target button { display: none !important; }
  body.printing-portal-section .portal-print-target .print-report-header { display: grid; grid-template-columns: 150px 1fr 190px; align-items: center; gap: 22px; padding-bottom: 15px; margin-bottom: 14px; border-bottom: 3px solid #d52b1e; }
  body.printing-portal-section .portal-print-target .print-eva-brand img { width: 140px; max-height: 72px; object-fit: contain; }
  body.printing-portal-section .portal-print-target .print-report-title { text-align: center; }
  body.printing-portal-section .portal-print-target .print-report-title span { color: #697684; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
  body.printing-portal-section .portal-print-target .print-report-title h1 { margin: 5px 0 3px; color: #003b65; font-size: 20px; }
  body.printing-portal-section .portal-print-target .print-report-title p { margin: 0; color: #697684; font-size: 10px; }
  body.printing-portal-section .portal-print-target .print-nazar-brand { display: flex; justify-content: flex-end; }
  body.printing-portal-section .portal-print-target .print-nazar-brand img { width: 145px; height: 72px; object-fit: contain; }
  body.printing-portal-section .table-wrap, body.printing-portal-section .sales-line-scroll { overflow: visible !important; }
  body.printing-portal-section table { width: 100% !important; min-width: 0 !important; }
  body.printing-portal-section th, body.printing-portal-section td { padding: 6px 5px !important; font-size: 8px !important; white-space: normal !important; }
  body.printing-portal-section .sales-line-svg { width: 100% !important; min-width: 0 !important; }
}
/* E-VA web authentication */
.auth-page { min-height: 100vh; background: linear-gradient(135deg, #edf4f8, #f8fafc); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; }
.auth-card { width: min(100%, 500px); padding: 36px; }
.auth-logo { display: block; width: 116px; max-height: 72px; object-fit: contain; margin: 0 0 22px; }
.auth-card h1 { margin: 4px 0 10px; color: #003b65; }
.auth-form { display: grid; gap: 16px; margin-top: 24px; }
.auth-form label { display: grid; gap: 7px; font-weight: 700; color: #17324a; }
.auth-form input { width: 100%; border: 1px solid #b8c8d4; border-radius: 8px; padding: 12px; font: inherit; }
.auth-form input:focus { outline: 3px solid rgba(0, 107, 166, .18); border-color: #006ba6; }
.credential-status { margin-top: 16px; padding: 12px 14px; border: 1px solid #bfd3df; border-radius: 8px; background: #eef6fa; color: #17324a; font-weight: 700; }
.rcv-capture-table { min-width: 1180px; }
.rcv-capture-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.rcv-capture-note { margin: 12px 14px 2px; padding: 10px 12px; border-left: 4px solid #d77a00; background: #fff8eb; color: #66420b; font-size: 11px; }
.official-f29-expandable { padding: 0; overflow: hidden; }
.official-f29-expandable > summary { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; cursor: pointer; list-style: none; color: #17324a; background: #dceff7; border-bottom: 1px solid #8daab8; }
.official-f29-expandable > summary::-webkit-details-marker { display: none; }
.official-f29-expandable > summary span { color: #4e6875; font-size: 10px; }
.extended-f29-table { min-width: 980px; }
.extended-f29-table th:nth-child(1), .extended-f29-table td:nth-child(1) { width: 54px; text-align: center; }
.extended-f29-table th:nth-child(3), .extended-f29-table td:nth-child(3) { width: 170px; }
.extended-f29-table th:nth-child(4), .extended-f29-table td:nth-child(4) { width: 290px; }
.official-ppm-fields { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)) auto; gap: 8px; align-items: end; }
.official-ppm-fields label { display: grid; gap: 3px; color: var(--muted); font-size: 9px; }
.f29-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.rcv-api-detail { margin-top: 12px; border: 1px solid #bfd3df; border-radius: 8px; background: #fff; }
.rcv-api-detail summary { cursor: pointer; padding: 12px 14px; color: #17324a; font-weight: 700; }
.rcv-api-detail pre { max-height: 360px; margin: 0; padding: 14px; overflow: auto; border-top: 1px solid #d9e5ec; background: #f7fafc; color: #1f2937; font: 12px/1.5 Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
html.server-state-loading body::before {
  content: "Cargando información segura desde el servidor…";
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #174ea6;
  background: rgba(255, 255, 255, 0.96);
  font: 700 18px/1.4 Arial, sans-serif;
}
.bulk-import-dialog { width: min(920px, calc(100vw - 32px)); }
.bulk-file-field { display: grid; gap: 8px; padding: 18px; border: 1px dashed #9eb4ca; border-radius: 10px; background: #f7faff; }
.bulk-file-field input { padding: 10px; background: #fff; border: 1px solid #c9d5e2; border-radius: 6px; }
.bulk-import-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.bulk-import-summary article { padding: 14px; border: 1px solid #dce5ee; border-radius: 10px; background: #fff; }
.bulk-import-summary span { display: block; color: #607084; font-size: 12px; }
.bulk-import-summary strong { display: block; margin-top: 4px; color: #12345b; font-size: 24px; }
.bulk-import-preview { max-height: 320px; overflow: auto; border: 1px solid #dce5ee; border-radius: 10px; }
.bulk-import-preview table { width: 100%; border-collapse: collapse; }
.bulk-import-preview th, .bulk-import-preview td { padding: 9px 10px; border-bottom: 1px solid #e7edf3; text-align: left; font-size: 13px; }
.bulk-import-preview th { position: sticky; top: 0; z-index: 1; background: #12345b; color: #fff; }
.bulk-import-preview tr.import-invalid { background: #fce8e6; }
.bulk-import-preview tr.import-valid { background: #e6f4ea; }
@media (max-width: 720px) { .bulk-import-summary { grid-template-columns: 1fr; } }
.billing-period-status { margin: .65rem 0 1rem; padding: .7rem .9rem; border-radius: .7rem; font-weight: 700; }
.billing-period-status.is-open { color: #166534; background: #dcfce7; border: 1px solid #86efac; }
.billing-period-status.is-closed { color: #1e3a8a; background: #dbeafe; border: 1px solid #93c5fd; }
.utm-parameters-panel { margin-top: 18px; }
.utm-parameters-panel .section-heading { align-items: flex-start; }
.utm-parameters-panel h3 { margin: 2px 0 6px; color: #12345b; }
.utm-parameters-panel p { max-width: 760px; margin: 0; color: var(--muted); }
.utm-manual-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 14px 0 18px; padding: 14px; border: 1px solid #dce5ee; border-radius: 10px; background: #f7faff; }
.utm-manual-form label { display: grid; gap: 6px; color: #17324a; font-weight: 700; }
.utm-manual-form input { min-width: 170px; padding: 10px; border: 1px solid #b8c8d4; border-radius: 8px; font: inherit; }
.capture-source-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 16px;
  padding: 12px 14px;
  border: 1px solid #dfe6ee;
  border-radius: 10px;
  background: #f7f9fc;
}

.capture-source-selector label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #cfd9e6;
  border-radius: 8px;
  background: #fff;
  color: #243142;
  font-weight: 650;
  cursor: pointer;
}

.capture-source-selector input {
  width: 17px;
  height: 17px;
  accent-color: #174ea6;
}
/* Revisión de conflictos: valores mediante textContent, sin insertar HTML de datos. */
.sync-conflict-controls { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.sync-conflict-controls button { font-size: 12px; padding: 6px 10px; }
.sync-conflict-dialog { width: min(1000px, 94vw); max-height: 88vh; overflow: auto; padding: 24px; border: 0; border-radius: 12px; }
.sync-conflict-dialog::backdrop { background: #16243399; }
.sync-conflict-dialog > button { margin: 6px; }
.sync-conflict-fields section { margin: 16px 0; padding: 12px; background: #f3f6fa; border-radius: 8px; }
.sync-conflict-fields h3 { overflow-wrap: anywhere; font-size: 14px; }
.sync-conflict-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sync-conflict-values pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; max-height: 180px; overflow: auto; }
@media (max-width: 600px) { .sync-conflict-values { grid-template-columns: 1fr; } }
