: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);
}

* { 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); }

.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 { min-height: 106px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
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); }
.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: hidden; border: 1px solid #91a2aa; border-radius: 4px; color: #182126; background: #fff; box-shadow: var(--shadow); }
.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); }
.calculation-table { min-width: 1760px; }
.calculation-table th { white-space: normal; line-height: 1.25; }
.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: 3; background: #f8fafc; }
.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 select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
.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; }
.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 .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-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-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; }
.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; }
.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); }
.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-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); }
.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); }
.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: 88px 1fr; }
  .sidebar { padding-inline: 12px; }
  .brand { width: 64px; height: 52px; justify-content: flex-start; margin-inline: auto; padding: 6px; }
  .brand-logo { width: 150px; max-width: none; flex: none; }
  .brand div, .nav-item, .sidebar-note div { font-size: 0; }
  .nav-item { text-align: center; }
  .nav-item::first-letter { font-size: 13px; }
  .sidebar-note { justify-content: center; }
  .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-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 .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-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 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; }
}
/* 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;
}
