:root {
  --indigo: oklch(0.55 0.17 264);
  --indigo-soft: #e0e7ff;
  --indigo-text: #3730a3;
  --indigo-active: rgba(79, 70, 229, 0.25);
  --page-bg: oklch(0.97 0.004 250);
  --card-border: oklch(0.9 0.006 250);
  --navy: #0f172a;
  --navy-line: rgba(255, 255, 255, 0.08);
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --green: #10b981;
  --green-bg: #d1fae5;
  --green-soft: #ecfdf5;
  --green-line: #a7f3d0;
  --red: #ef4444;
  --red-bg: #fee2e2;
  --yellow: #f59e0b;
  --yellow-bg: #fef3c7;
  --yellow-soft: #fffbeb;
  --yellow-line: #fde68a;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 100px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
  --sidebar-width: 220px;
  --sidebar-collapsed: 64px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page-bg);
  color: var(--slate-700);
  font-family: "Public Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--indigo);
  text-decoration: none;
}

a:hover {
  color: var(--indigo-text);
}

svg {
  display: block;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--page-bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: rgba(255, 255, 255, 0.72);
}

.sidebar-brand {
  min-height: 72px;
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 0.5px solid var(--navy-line);
}

.sidebar-brand img {
  width: 158px;
  height: 32px;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  padding: 16px 12px;
}

.sidebar-link {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.52);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.84);
}

.sidebar-link.active {
  background: var(--indigo-active);
  color: #a5b4fc;
}

.sidebar-section {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.08);
}

.sidebar-section-title {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  color: rgba(255, 255, 255, 0.36);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-section.active .sidebar-section-title {
  color: rgba(255, 255, 255, 0.64);
}

.sidebar-subnav {
  display: grid;
  gap: 2px;
}

.sidebar-subnav .sidebar-link {
  min-height: 34px;
  padding-left: 34px;
}

.sidebar-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.sidebar-icon svg,
.mobile-menu-button svg,
.icon-button svg,
.delete-modal-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-label,
.user-email {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px 12px 16px;
  border-top: 0.5px solid var(--navy-line);
}

.user-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 8px;
  border-radius: 7px;
}

.user-strip-link {
  color: inherit;
  transition: background 150ms ease;
}

.user-strip-link:hover,
.user-strip-link:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
}

.avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--indigo);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.user-email {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.logout-form {
  margin: 0;
}

.logout-link {
  width: 100%;
  color: rgba(255, 255, 255, 0.42);
}

.language-form {
  display: grid;
  gap: 6px;
}

.language-form label {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.sidebar .language-form {
  padding: 0 8px;
}

.sidebar .language-form label {
  color: rgba(255, 255, 255, 0.38);
}

.sidebar .language-form select {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
}

.sidebar .language-form select option {
  background: var(--white);
  color: var(--slate-900);
}

.app-main {
  min-width: 0;
  min-height: 100vh;
}

.page {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px;
}

.mobile-menu-button {
  display: none;
}

.mobile-overlay {
  display: none;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0;
  color: var(--slate-900);
  line-height: 1.2;
}

h1 {
  font-size: 30px;
  font-weight: 800;
}

h2 {
  font-size: 19px;
  font-weight: 700;
}

.page-head p,
.panel p {
  margin: 5px 0 0;
  color: var(--slate-500);
}

.panel {
  margin-bottom: 28px;
  border: 0.5px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.panel:not(.form-grid):not(.form-stack):not(.totals-panel) {
  padding: 16px;
}

.panel-head,
.head-actions,
.form-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.autosave-status {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.autosave-status[data-state="saving"] {
  color: var(--indigo);
}

.autosave-status[data-state="saved"] {
  color: #047857;
}

.autosave-status[data-state="error"] {
  color: var(--red);
}

.guest-save-status {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.guest-save-status[data-state="saving"] {
  color: var(--indigo);
}

.guest-save-status[data-state="error"] {
  color: var(--red);
}

.panel-head {
  justify-content: space-between;
  margin: -2px -2px 12px;
  padding-bottom: 12px;
  border-bottom: 0.5px solid var(--slate-200);
}

.export-panel {
  display: block;
}

.export-panel h2 {
  font-size: 15px;
}

.export-panel-head p {
  max-width: 760px;
}

.export-scenario-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 12px;
}

.export-scenario {
  min-width: 0;
  padding: 14px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.export-scenario-primary {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.scenario-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.export-scenario h3 {
  margin: 0 0 6px;
  color: var(--slate-900);
  font-size: 18px;
  font-weight: 600;
}

.export-scenario p {
  margin: 0 0 12px;
  color: var(--slate-600);
}

.export-scenario-steps {
  margin: 0 0 12px 18px;
  padding: 0;
  color: var(--slate-700);
}

.export-scenario-steps li + li {
  margin-top: 5px;
}

.export-official-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.export-official-link-card {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 0.5px solid var(--green-line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  text-decoration: none;
}

.export-official-link-card strong {
  color: #047857;
  font-size: 13px;
  font-weight: 700;
}

.export-official-link-card span {
  color: var(--slate-600);
  font-size: 12px;
  line-height: 1.35;
}

.export-official-link-card:hover {
  border-color: #34d399;
  background: #ffffff;
}

.export-action-panel {
  display: flex;
  justify-content: flex-start;
  padding-top: 12px;
  border-top: 0.5px solid var(--green-line);
}

.success-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 0.5px solid var(--green);
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.success-button:hover {
  background: #059669;
  color: #fff;
}

.stateful-action {
  min-width: max-content;
  transition: opacity 150ms ease, background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.stateful-action[data-state="loading"],
.stateful-action[data-state="success"] {
  pointer-events: none;
}

.stateful-action[data-state="loading"]::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.stateful-action[data-state="success"]::before {
  content: "✓";
  font-weight: 800;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.export-support-list {
  display: grid;
  gap: 10px;
}

.export-support-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-top: 10px;
  border-top: 0.5px solid var(--slate-200);
}

.export-support-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.export-support-item strong {
  display: block;
  margin-bottom: 3px;
  color: var(--slate-900);
  font-size: 14px;
}

.export-support-item p {
  margin: 0;
  color: var(--slate-600);
  font-size: 13px;
}

.wizard-check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wizard-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.wizard-check-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.wizard-check-ok .wizard-check-icon {
  background: var(--green-bg);
  color: #047857;
}

.wizard-check-warning .wizard-check-icon {
  background: var(--yellow-bg);
  color: #b45309;
}

.wizard-model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.wizard-model-card {
  display: grid;
  gap: 14px;
}

.wizard-model-head,
.wizard-step-top,
.wizard-value-row,
.wizard-document-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.wizard-model-head p,
.wizard-step-top p,
.wizard-explanation p {
  margin: 4px 0 0;
}

.wizard-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--slate-100);
  appearance: none;
}

.wizard-progress::-webkit-progress-bar {
  border-radius: inherit;
  background: var(--slate-100);
}

.wizard-progress::-webkit-progress-value {
  border-radius: inherit;
  background: var(--indigo);
}

.wizard-progress::-moz-progress-bar {
  border-radius: inherit;
  background: var(--indigo);
}

.wizard-model-facts {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
}

.wizard-model-facts dt,
.wizard-kicker,
.wizard-value-row span,
.wizard-document-row small {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.wizard-model-facts dd {
  min-width: 0;
  margin: 0;
  color: var(--slate-700);
  overflow-wrap: anywhere;
}

.wizard-step-panel {
  display: grid;
  gap: 18px;
}

.wizard-step-meter {
  min-width: 180px;
  display: grid;
  gap: 8px;
  text-align: right;
}

.wizard-step-meter span {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 600;
}

.wizard-value-row {
  align-items: center;
  padding: 16px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.wizard-value-row strong {
  display: block;
  margin-top: 4px;
  color: var(--slate-900);
  font-size: 28px;
  font-weight: 600;
}

.wizard-explanation {
  padding-top: 2px;
}

.wizard-explanation h3,
.wizard-details summary {
  color: var(--slate-900);
  font-size: 14px;
  font-weight: 600;
}

.wizard-explanation h3 {
  margin: 0;
}

.wizard-details {
  padding: 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.wizard-details summary {
  cursor: pointer;
}

.wizard-details[open] summary {
  margin-bottom: 12px;
}

.aeat-guide-panel {
  display: grid;
  gap: 16px;
}

.aeat-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.aeat-guide-card {
  padding: 14px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.aeat-guide-card h3 {
  margin: 0 0 10px;
  color: var(--slate-900);
  font-size: 15px;
}

.aeat-link-list,
.aeat-checklist,
.aeat-step-list {
  margin: 0;
  padding-left: 18px;
  color: var(--slate-700);
  font-size: 13px;
  line-height: 1.55;
}

.aeat-link-list li,
.aeat-checklist li,
.aeat-step-list li {
  margin: 4px 0;
}

.aeat-link-list a {
  color: var(--indigo);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.aeat-guide-card .muted {
  margin: 10px 0 0;
  font-size: 12px;
}

.aeat-guide-details {
  background: var(--slate-50);
}

.wizard-detail-total td {
  border-top: 0.5px solid var(--slate-200);
  color: var(--slate-900);
  font-weight: 600;
}

.wizard-step-actions,
.wizard-submit-action {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.wizard-upload-form {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 14px 0;
}

.wizard-upload-form label {
  display: grid;
  gap: 6px;
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.wizard-document-list {
  display: grid;
  gap: 8px;
}

.wizard-document-row {
  padding: 10px 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.wizard-document-row strong,
.wizard-document-row span {
  display: block;
}

.wizard-document-row strong {
  color: var(--slate-900);
  font-weight: 600;
}

.wizard-document-row span {
  margin-top: 3px;
  color: var(--slate-600);
  overflow-wrap: anywhere;
}

.wizard-submitted {
  padding: 10px 12px;
  border: 0.5px solid #bbf7d0;
  border-radius: var(--radius-sm);
  background: #f0fdf4;
  color: #047857;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metrics div,
.totals-panel div {
  position: relative;
  padding: 16px;
  border: 0.5px solid var(--slate-200);
  border-radius: 10px;
  background: var(--slate-50);
}

.metric-icon {
  width: 28px;
  height: 28px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  float: right;
  border-radius: 8px;
  background: var(--indigo-soft);
  color: var(--indigo);
}

.metric-icon svg,
.button-icon svg,
.search-field svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metrics span:not(.metric-icon) {
  display: block;
  color: var(--slate-900);
  font-size: 22px;
  font-weight: 600;
}

.metrics small,
.totals-panel span {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 400;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.statistics-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.statistics-split {
  grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
}

.stat-type-list {
  display: grid;
  gap: 8px;
}

.stat-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--slate-100);
}

.stat-type-row:last-child {
  border-bottom: 0;
}

.stat-type-row strong {
  color: var(--slate-900);
  font-size: 18px;
  font-weight: 600;
}

button,
.primary,
.secondary,
.danger {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 0.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--slate-900);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.primary {
  border-color: var(--indigo);
  background: var(--indigo);
  color: #ffffff;
}

.primary:hover {
  background: #4338ca;
  color: #ffffff;
}

.secondary {
  background: transparent;
  color: var(--slate-700);
}

.secondary:hover {
  border-color: var(--slate-400);
  color: var(--slate-900);
}

.button-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.danger {
  border-color: var(--red);
  background: var(--red);
  color: #ffffff;
}

.danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--indigo);
}

.icon-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--slate-500);
}

.icon-button:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

.icon-button.danger-icon:hover {
  background: var(--red-bg);
  color: var(--red);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.inline-form {
  display: inline;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--slate-700);
  font: inherit;
  font-size: 14px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  accent-color: var(--indigo);
}

.form-stack p:has(input[type="checkbox"]),
.form-grid p:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-stack p:has(input[type="checkbox"]) label,
.form-grid p:has(input[type="checkbox"]) label {
  margin: 0;
}

.form-stack p:has(input[type="radio"]) ul,
.form-grid p:has(input[type="radio"]) ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.form-stack p:has(input[type="radio"]) li label,
.form-grid p:has(input[type="radio"]) li label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  accent-color: var(--indigo);
}

textarea {
  resize: vertical;
}

.textarea-compact {
  min-height: 36px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--slate-400);
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

select option.new-client-option {
  color: var(--indigo);
  font-weight: 600;
}

.form-grid,
.form-stack {
  padding: 18px;
}

.form-stack p,
.form-grid p {
  margin: 0 0 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: stretch;
}

.form-grid > p,
.form-stack > p,
.form-section-grid > p {
  display: flex;
  flex-direction: column;
}

.form-grid > p > input,
.form-grid > p > select,
.form-grid > p > textarea,
.form-stack > p > input,
.form-stack > p > select,
.form-stack > p > textarea,
.form-section-grid > p > input,
.form-section-grid > p > select,
.form-section-grid > p > textarea {
  flex: 1 1 auto;
}

.form-grid h2,
.form-grid .form-section,
.form-grid .form-actions,
.form-grid .errorlist {
  grid-column: 1 / -1;
}

.form-section {
  padding-bottom: 18px;
  border-bottom: 0.5px solid var(--slate-100);
}

.form-section:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}

.form-section h2 {
  margin: 0 0 14px;
  color: var(--slate-900);
  font-size: 15px;
  font-weight: 600;
}

.form-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: stretch;
}

.form-section-grid p {
  margin: 0;
}

.helptext {
  display: block;
  margin-top: 6px;
  color: var(--slate-500);
  font-size: 12px;
  line-height: 1.45;
}

.helptext.form-status-error {
  color: #b91c1c;
}

.helptext a {
  font-weight: 600;
}

.field-wide {
  grid-column: 1 / -1;
}

.modelo303-switch-row {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.modelo303-switch-main {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
}

.modelo303-switch-title {
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 600;
}

.modelo303-switch {
  flex: 0 0 auto;
}

.modelo303-switch-value {
  min-width: 28px;
  color: #047857;
  font-size: 13px;
  font-weight: 600;
}

.modelo303-switch-value[data-state="off"] {
  color: #b45309;
}

.manual-client-fields,
.no-iva-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: stretch;
}

.manual-client-fields[hidden],
.no-iva-fields[hidden],
.correction-reason-field[hidden],
.irpf-custom-wrap[hidden] {
  display: none !important;
}

.manual-client-fields p,
.no-iva-fields p {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.asset-spoiler {
  padding: 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.asset-spoiler summary {
  cursor: pointer;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 600;
}

.asset-spoiler[open] summary {
  margin-bottom: 12px;
}

.asset-spoiler-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
}

.asset-spoiler-grid p {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.guest-seller-panel {
  padding: 0;
}

.guest-details {
  padding: 18px;
}

.guest-details summary {
  cursor: pointer;
  color: var(--slate-900);
  font-size: 15px;
  font-weight: 600;
}

.guest-details[open] summary {
  margin-bottom: 16px;
}

.guest-email-gate {
  width: 100%;
  margin-top: 6px;
  padding: 14px;
  border: 0.5px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 320px) auto;
  gap: 12px;
  align-items: end;
}

.guest-email-gate[hidden] {
  display: none !important;
}

.guest-email-gate p {
  margin: 4px 0 0;
  color: var(--slate-600);
}

.guest-email-gate label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guest-email-gate button {
  min-height: 42px;
}

.field-with-reference {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.field-with-reference .field-main,
.field-with-reference .field-reference {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.field-with-reference .field-main > textarea,
.field-with-reference .field-reference > select {
  flex: 1 1 auto;
}

.irpf-control {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.irpf-control > select {
  flex: 1 1 auto;
}

.irpf-custom-wrap {
  flex: 0 0 140px;
  display: flex;
}

.irpf-custom-wrap input {
  height: 100%;
}

.form-grid label,
.form-stack label {
  display: block;
  margin-bottom: 6px;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 500;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid > p.without-iva-row {
  width: max-content;
  max-width: 100%;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  justify-self: start;
  gap: 8px;
}

.without-iva-row label,
.without-iva-row .tooltip-wrap {
  flex: 0 0 auto;
  white-space: nowrap;
}

.checkbox-field input {
  width: auto;
  min-height: 0;
  flex: 0 0 auto;
}

.checkbox-field label {
  margin: 0;
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tooltip-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 600;
}

.tooltip-bubble {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: min(340px, calc(100vw - 48px));
  max-width: min(340px, calc(100vw - 48px));
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--slate-900);
  color: #ffffff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  overflow-wrap: break-word;
  white-space: normal;
  transform: translateY(2px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.tooltip-wrap:hover .tooltip-bubble,
.tooltip-wrap:focus .tooltip-bubble,
.tooltip-wrap:focus-within .tooltip-bubble {
  opacity: 1;
  transform: translateY(0);
}

.required-field label::after {
  content: " *";
  color: var(--red);
}

.required-field input,
.required-field select,
.required-field textarea {
  border-left-color: var(--red);
  border-left-width: 3px;
}

.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.toolbar {
  margin-bottom: 16px;
  padding: 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--white);
}

.search-field {
  position: relative;
  min-width: min(100%, 280px);
  margin: 0;
}

.search-field span {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--slate-400);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  padding-left: 34px;
}

.toolbar input,
.toolbar select {
  max-width: 280px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.accounting-table-scroll {
  margin-top: 12px;
  max-height: 520px;
  overflow: auto;
  border: 0.5px solid var(--slate-100);
  border-radius: var(--radius-sm);
}

.accounting-summary-table {
  max-height: none;
}

.accounting-book-scroll {
  max-height: 560px;
}

.data-table th,
.data-table td {
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--slate-100);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table td {
  color: var(--slate-700);
  font-size: 14px;
}

.data-table tbody tr {
  transition: background 150ms ease;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.72);
}

.data-table tbody tr:hover {
  background: var(--slate-50);
}

.accounting-table-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ffffff;
  box-shadow: inset 0 -0.5px 0 var(--slate-200);
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}

.data-table tbody tr.clickable-row:focus {
  outline: 2px solid rgba(79, 70, 229, 0.35);
  outline-offset: -2px;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.break-anywhere {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.asset-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.asset-status.active {
  background: var(--green-bg);
  color: #065f46;
}

.data-table .actions {
  width: 1%;
  min-width: 104px;
  padding-top: 6px;
  padding-right: 14px;
  padding-bottom: 6px;
  padding-left: 8px;
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 150ms ease;
}

.data-table .actions-col {
  width: 104px;
  min-width: 104px;
}

.data-table tr:hover .actions,
.data-table tr:focus-within .actions {
  opacity: 1;
}

.invoice-table .actions,
.client-table .actions,
.asset-table .actions {
  opacity: 1;
}

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

.row-actions {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.row-actions a,
.row-actions button,
.row-actions form {
  flex: 0 0 auto;
}

.invoice-table .actions {
  min-width: 104px;
}

.client-table .actions {
  min-width: 48px;
}

.num {
  text-align: right !important;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-600);
  font-size: 11px;
  font-weight: 500;
}

.tax-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.tax-badge-warning {
  background: var(--yellow-bg);
  color: #92400e;
}

.status-draft {
  background: #f1f5f9;
  color: #475569;
}

.status-issued,
.status-sent {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-paid {
  background: var(--green-bg);
  color: #065f46;
}

.status-overdue {
  background: var(--yellow-bg);
  color: #92400e;
}

.status-cancelled,
.status-rectified {
  background: var(--red-bg);
  color: #991b1b;
}

tr.overdue-row {
  background: rgba(245, 158, 11, 0.08);
}

.messages {
  margin-bottom: 16px;
}

.message {
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius);
  background: #ffffff;
}

.message.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.message.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.message.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.inline-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 0.5px solid #bbf7d0;
  border-radius: var(--radius-sm);
  background: #f0fdf4;
  color: #15803d;
  box-shadow: var(--shadow);
}

.invoice-lines {
  display: grid;
  gap: 12px;
}

.line-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: #ffffff;
  transition: border-color 150ms ease, background 150ms ease, opacity 150ms ease;
}

.line-card:hover {
  border-color: var(--slate-300);
}

.line-card.line-card-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.18);
}

.line-card-top {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: start;
}

.line-description,
.line-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.line-description span,
.line-field span,
.line-card-total span {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.line-card textarea,
.line-card input {
  min-width: 0;
}

.line-unit-toggle {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 0.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--slate-700);
  font-size: 13px;
}

.line-unit-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
}

.line-unit-value {
  margin-top: 6px;
  color: var(--slate-500);
}

.line-unit-value.is-muted {
  border-color: var(--slate-300);
  background: #e5e7eb;
  color: var(--slate-400);
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.line-unit-value.is-muted:focus {
  outline: 0;
  border-color: var(--slate-300);
  box-shadow: none;
}

.line-description textarea {
  min-height: 54px;
  resize: vertical;
}

.line-card-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(76px, 120px));
  gap: 10px;
  align-items: end;
  justify-content: start;
}

.line-card-total {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.line-card-total strong {
  color: var(--slate-900);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.drag-handle {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--slate-400);
  cursor: grab;
}

.drag-handle:hover {
  background: var(--slate-100);
  color: var(--slate-700);
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
}

.line-card.is-dragging {
  background: var(--slate-100);
  opacity: 0.58;
}

.table-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
}

.totals-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.totals-panel strong {
  display: block;
  margin-top: 4px;
  color: var(--slate-900);
  font-size: 16px;
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 12px;
}

.facts dt {
  color: var(--slate-500);
  font-weight: 500;
}

.facts dd {
  margin: 0;
}

.hash {
  overflow-wrap: anywhere;
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.empty-state {
  margin: 0;
  color: var(--slate-500);
}

.asset-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.asset-cell img {
  width: 56px;
  height: 36px;
  object-fit: contain;
  border: 0.5px solid var(--slate-200);
  border-radius: 6px;
  background: #fff;
}

.errorlist {
  margin: 4px 0;
  padding-left: 18px;
  color: #b91c1c;
}

.profile-progress {
  padding: 16px;
}

.profile-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--slate-500);
  font-size: 12px;
}

.profile-progress-head strong {
  color: var(--slate-900);
  font-size: 13px;
  font-weight: 600;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--slate-100);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--indigo);
}

.profile-progress-meter {
  width: 100%;
  height: 8px;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--slate-100);
  appearance: none;
}

.profile-progress-meter::-webkit-progress-bar {
  border-radius: inherit;
  background: var(--slate-100);
}

.profile-progress-meter::-webkit-progress-value {
  border-radius: inherit;
  background: var(--indigo);
}

.profile-progress-meter::-moz-progress-bar {
  border-radius: inherit;
  background: var(--indigo);
}

.toggle-switch {
  width: 38px;
  height: 22px;
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-switch span {
  position: relative;
  width: 38px;
  height: 22px;
  display: block;
  box-sizing: border-box;
  border: 1px solid var(--slate-300);
  border-radius: 999px;
  background: var(--slate-100);
  transition: background 150ms ease, border-color 150ms ease;
}

.toggle-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--slate-500);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: background 150ms ease, transform 150ms ease;
}

.toggle-switch input:checked + span {
  border-color: #bfdbfe;
  background: #dbeafe;
}

.toggle-switch input:checked + span::after {
  background: var(--indigo);
  transform: translateX(16px);
}

.asset-toggle {
  vertical-align: middle;
}

.toggle-switch-row {
  min-height: 36px;
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 500;
}

.toggle-switch-row > span:first-child {
  white-space: nowrap;
}

.sequence-cards,
.asset-cards {
  display: grid;
  gap: 12px;
}

.sequence-card {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 160px) minmax(100px, 140px) auto auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.sequence-card label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sequence-card label > span:first-child,
.asset-card-body dt {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.sequence-default-field {
  align-self: end;
}

.asset-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.asset-card-preview {
  width: 72px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.asset-card-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.asset-card-body {
  min-width: 0;
}

.asset-card-body strong {
  display: block;
  margin-bottom: 8px;
  color: var(--slate-900);
  font-weight: 600;
}

.asset-card-body dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  margin: 0;
}

.asset-card-body dd {
  min-width: 0;
  margin: 0;
}

.asset-card-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.numbering-form {
  align-items: end;
}

.numbering-form .numbering-default-field {
  align-self: end;
  min-height: 36px;
  display: flex !important;
  align-items: center;
  margin-bottom: 14px;
}

.numbering-form .numbering-default-field .toggle-switch {
  flex: 0 0 auto;
}

.numbering-form .form-actions {
  align-self: end;
  min-height: 36px;
  margin-bottom: 14px;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
  background: #ffffff;
}

.auth-brand-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  padding: 56px;
  background: var(--indigo);
  color: #ffffff;
}

.auth-brand-panel img {
  width: 180px;
  height: auto;
}

.auth-brand-panel h1 {
  max-width: 520px;
  color: #ffffff;
  font-size: 30px;
  font-weight: 600;
}

.auth-brand-panel p {
  max-width: 520px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
}

.auth-benefits {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.86);
}

.benefit-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 600;
}

.auth-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-language {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 140px;
}

.auth-shell {
  width: 100%;
  max-width: 380px;
}

.auth-flow-shell {
  max-width: 430px;
}

.auth-shell h1 {
  margin-bottom: 18px;
}

.auth-card-head {
  margin-bottom: 18px;
  text-align: center;
}

.auth-card-head h1 {
  margin: 0 0 8px;
}

.auth-card-head p {
  max-width: 360px;
  margin: 0 auto;
  color: var(--slate-500);
}

.auth-flow-illustration {
  width: 112px;
  height: 112px;
  display: block;
  margin: 0 auto 14px;
}

.auth-shell .panel {
  padding: 22px;
  box-shadow: var(--shadow);
}

.auth-flow-card > p {
  color: var(--slate-600);
}

.auth-shell .primary {
  width: 100%;
}

.auth-social-stack {
  display: grid;
  gap: 10px;
}

.auth-social-button {
  justify-content: center;
  width: 100%;
}

.auth-secondary-link {
  display: block;
  margin-top: 12px;
  color: var(--slate-500);
  text-align: center;
}

.guest-public-layout {
  min-height: 100vh;
  background: var(--slate-50);
}

.guest-public-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 0.5px solid var(--navy-line);
  background: var(--navy);
  color: rgba(255, 255, 255, 0.72);
}

.guest-public-brand {
  display: inline-flex;
  align-items: center;
}

.guest-public-brand img {
  width: 158px;
  height: 32px;
}

.guest-public-head .language-form {
  min-width: 140px;
}

.guest-public-head .language-form label {
  color: rgba(255, 255, 255, 0.38);
}

.guest-public-head .language-form select {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
}

.guest-public-head .language-form select option {
  background: var(--white);
  color: var(--slate-900);
}

.guest-public-page {
  max-width: 1180px;
  margin: 0 auto;
}

.auth-divider {
  position: relative;
  margin: 14px 0 12px;
  text-align: center;
  color: var(--slate-400);
  font-size: 12px;
}

.auth-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 0.5px solid var(--slate-200);
}

.auth-divider span {
  position: relative;
  padding: 0 10px;
  background: var(--white);
}

.auth-guest-cta {
  width: 100%;
  justify-content: center;
}

.auth-guest-hint {
  display: block;
  margin-top: 8px;
  color: var(--slate-500);
  text-align: center;
}

.onboarding-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.onboarding-banner h2 {
  margin-bottom: 4px;
}

.onboarding-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.onboarding-actions form {
  margin: 0;
}

.invoice-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.invoice-preview,
.invoice-inspector {
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.invoice-preview {
  min-height: calc(100vh - 56px);
  padding: 28px;
}

.invoice-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 26px;
  border-bottom: 0.5px solid var(--slate-200);
}

.seller-lockup h1 {
  max-width: 620px;
  font-size: 22px;
  font-weight: 600;
}

.seller-lockup p {
  margin: 4px 0 0;
  color: var(--slate-500);
}

.document-number {
  min-width: 180px;
  text-align: right;
}

.document-number span {
  display: block;
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.document-number strong {
  display: block;
  margin-top: 5px;
  color: var(--slate-900);
  font-size: 18px;
}

.invoice-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  margin: 28px 0;
}

.invoice-summary h2,
.invoice-lines-preview th {
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.invoice-summary p {
  margin: 3px 0;
  color: var(--slate-500);
}

.summary-name {
  color: var(--slate-700) !important;
  font-size: 21px;
  font-weight: 600 !important;
}

.summary-total {
  min-width: 230px;
  text-align: right;
}

.summary-total strong {
  display: block;
  margin-top: 6px;
  color: var(--slate-900);
  font-size: 32px;
  font-weight: 600;
}

.invoice-lines-preview {
  border-top: 0.5px solid var(--slate-200);
  border-bottom: 0.5px solid var(--slate-200);
}

.invoice-lines-preview table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-lines-preview th,
.invoice-lines-preview td {
  padding: 16px 2px;
  border-bottom: 0.5px solid var(--slate-100);
}

.invoice-lines-preview tbody tr:last-child td {
  border-bottom: 0;
}

.invoice-lines-preview td span {
  display: block;
  margin-top: 4px;
  color: var(--slate-500);
  font-size: 12px;
}

.invoice-preview-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 28px;
  align-items: end;
  padding-top: 28px;
}

.preview-totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 18px;
  margin: 0;
}

.preview-totals dt {
  color: var(--slate-500);
  font-weight: 500;
  text-transform: uppercase;
}

.preview-totals dd {
  margin: 0;
  text-align: right;
  color: var(--slate-700);
  font-weight: 500;
}

.preview-totals dt:last-of-type,
.preview-totals dd:last-of-type {
  padding-top: 10px;
  border-top: 0.5px solid var(--slate-200);
  color: var(--slate-900);
  font-size: 18px;
  font-weight: 600;
}

.invoice-inspector {
  position: sticky;
  top: 24px;
  padding: 20px;
}

.inspector-section h2 {
  margin-bottom: 14px;
}

.inspector-facts {
  display: grid;
  grid-template-columns: minmax(120px, 0.75fr) minmax(0, 1fr);
  gap: 12px 16px;
  margin: 0 0 20px;
  padding-bottom: 20px;
  border-bottom: 0.5px solid var(--slate-200);
}

.inspector-facts dt {
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 500;
}

.inspector-facts dd {
  min-width: 0;
  margin: 0;
  color: var(--slate-900);
  text-align: right;
  font-weight: 500;
}

.inspector-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.inspector-actions form,
.inspector-actions a,
.inspector-actions button {
  width: 100%;
}

.quick-client-modal {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: none;
}

.quick-client-modal.open {
  display: block;
}

.quick-client-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.quick-client-card {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  overflow: auto;
  padding: 18px;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.quick-client-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.quick-client-head h2 {
  font-size: 18px;
}

.quick-client-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.quick-client-grid p {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.quick-client-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.delete-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.delete-modal.open {
  display: flex;
}

.delete-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.delete-modal-card {
  position: relative;
  width: min(100%, 420px);
  padding: 24px;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.delete-modal-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 999px;
  background: var(--red-bg);
  color: var(--red);
}

.delete-modal-icon svg {
  width: 24px;
  height: 24px;
}

.delete-modal-card h2 {
  font-size: 16px;
  font-weight: 600;
}

.delete-modal-card p {
  margin: 8px 0 0;
  color: var(--slate-500);
}

.delete-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 1180px) {
  .invoice-workspace {
    grid-template-columns: 1fr;
  }

  .invoice-inspector {
    position: static;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .app-shell {
    grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
  }

  .sidebar-brand {
    padding: 18px 16px;
  }

  .sidebar-brand img {
    width: 32px;
    max-width: 32px;
    object-fit: cover;
    object-position: left center;
  }

  .sidebar-label,
  .user-email,
  .sidebar .language-form label,
  .sidebar .language-form select {
    display: none;
  }

  .sidebar-link {
    justify-content: center;
    padding: 8px;
  }

  .sidebar-section-title {
    justify-content: center;
    padding: 8px;
  }

  .sidebar-subnav .sidebar-link {
    padding: 8px;
  }

  .user-strip {
    justify-content: center;
    padding: 0;
  }
}

@media (max-width: 820px) {
  .metrics,
  .split,
  .form-grid,
  .form-section-grid,
  .field-with-reference,
  .manual-client-fields,
  .no-iva-fields,
  .asset-spoiler-grid,
  .quick-client-grid,
  .aeat-guide-grid,
  .wizard-model-grid,
  .wizard-upload-form,
  .compact,
  .totals-panel,
  .invoice-preview-foot,
  .invoice-summary {
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .toolbar select {
    max-width: none;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .export-scenario-grid {
    grid-template-columns: 1fr;
  }

  .export-official-links {
    grid-template-columns: 1fr;
  }

  .export-support-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .export-support-item a,
  .success-button,
  .export-scenario > .secondary {
    width: 100%;
  }

  .autosave-status {
    width: 100%;
    margin-left: 0;
  }

  .guest-email-gate {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .onboarding-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .onboarding-actions,
  .onboarding-actions .primary,
  .onboarding-actions form,
  .onboarding-actions button {
    width: 100%;
  }

  .guest-public-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .guest-public-head .language-form {
    width: 100%;
  }

  .wizard-model-head,
  .wizard-step-top,
  .wizard-value-row,
  .wizard-document-row {
    flex-direction: column;
    align-items: stretch;
  }

  .wizard-model-facts {
    grid-template-columns: 1fr;
  }

  .wizard-step-meter {
    min-width: 0;
    text-align: left;
  }

  .wizard-copy-button,
  .wizard-step-actions button,
  .wizard-submit-action button,
  .wizard-upload-form button {
    width: 100%;
  }

  .wizard-step-actions {
    flex-direction: column-reverse;
  }
}

@media (max-width: 767px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 60;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    background: rgba(15, 23, 42, 0.45);
  }

  .app-shell.sidebar-open .mobile-overlay {
    display: block;
  }

  .mobile-menu-button {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: flex-start;
    padding: 0 16px;
    border: 0;
    border-bottom: 0.5px solid var(--slate-200);
    border-radius: 0;
    background: #ffffff;
    color: var(--slate-700);
  }

  .mobile-menu-button svg {
    width: 22px;
    height: 22px;
  }

  .page {
    padding: 16px;
  }

  h1 {
    font-size: 26px;
  }

  .accounting-table-scroll {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-brand-panel {
    min-height: auto;
    padding: 32px 24px;
  }

  .auth-content {
    padding: 64px 16px 24px;
  }

  .auth-language {
    top: 14px;
    right: 16px;
  }

  .line-card {
    padding: 12px;
  }

  .line-card-top {
    grid-template-columns: 28px minmax(0, 1fr) 32px;
    gap: 8px;
  }

  .line-card-fields {
    grid-template-columns: repeat(3, minmax(76px, 108px));
    justify-content: start;
    gap: 10px 8px;
  }

  .line-unit {
    display: none;
  }

  .line-quantity {
    order: 1;
  }

  .line-price {
    order: 2;
  }

  .line-iva {
    order: 3;
  }

  .line-discount {
    grid-column: auto;
    order: 4;
  }

  .line-card input,
  .line-card textarea {
    padding-right: 8px;
    padding-left: 8px;
  }

  .line-card-total {
    justify-content: space-between;
  }

  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table th,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody {
    display: grid;
    gap: 10px;
  }

  .responsive-table tr {
    padding: 12px;
    border: 0.5px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: #ffffff;
  }

  .responsive-table tr:hover {
    background: #ffffff;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
    gap: 8px;
    padding: 6px 0;
    border-bottom: 0;
    text-align: left !important;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .responsive-table tbody th {
    padding: 6px 0;
    border-bottom: 0;
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-align: left;
    white-space: normal;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 500;
  }

  .responsive-table td[data-label=""] {
    grid-template-columns: 1fr;
  }

  .responsive-table td[data-label=""]::before {
    display: none;
  }

  .responsive-table .actions {
    min-width: 0;
    padding: 6px 0;
    opacity: 1;
  }

  .responsive-table .row-actions {
    justify-content: flex-start;
  }

  .compact-responsive-table td {
    grid-template-columns: minmax(76px, 30%) minmax(0, 1fr);
  }

  .sequence-card,
  .asset-card {
    grid-template-columns: 1fr;
  }

  .sequence-card {
    align-items: stretch;
  }

  .sequence-default-field {
    justify-content: space-between;
  }

  .asset-card-actions {
    justify-content: flex-start;
  }

  .invoice-preview {
    min-height: 0;
    padding: 18px;
  }

  .invoice-preview-head {
    flex-direction: column;
  }

  .document-number,
  .summary-total,
  .inspector-facts dd {
    min-width: 0;
    text-align: left;
  }

  .invoice-lines-preview table,
  .invoice-lines-preview thead,
  .invoice-lines-preview tbody,
  .invoice-lines-preview tr,
  .invoice-lines-preview td {
    display: block;
    width: 100%;
  }

  .invoice-lines-preview thead {
    display: none;
  }

  .invoice-lines-preview tbody {
    display: grid;
    gap: 10px;
    padding: 12px 0;
  }

  .invoice-lines-preview tr {
    padding: 10px 0;
    border-bottom: 0.5px solid var(--slate-100);
  }

  .invoice-lines-preview td {
    display: grid;
    grid-template-columns: minmax(86px, 32%) minmax(0, 1fr);
    gap: 8px;
    padding: 4px 0;
    border-bottom: 0;
    text-align: left !important;
    overflow-wrap: anywhere;
  }

  .invoice-lines-preview td::before {
    content: attr(data-label);
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 500;
  }

  .inspector-facts {
    grid-template-columns: 1fr;
  }
}

.accounting-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.warning-count-badge,
.warning-panel-count {
  min-width: 26px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--yellow-bg);
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
}

.warning-count-badge:hover {
  background: #fde68a;
  color: #78350f;
}

.accounting-filter > label {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  color: var(--slate-500);
  font-size: 12px;
}

.accounting-filter > label input,
.accounting-filter > label select {
  min-width: 150px;
}

.accounting-filter .accounting-credit-toggle {
  min-width: 240px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  color: var(--slate-500);
  font-size: 12px;
}

.accounting-filter .accounting-credit-toggle .toggle-switch-row {
  min-height: 38px;
  align-self: flex-start;
}

.dashboard-tax-filter.accounting-filter .accounting-credit-toggle .toggle-switch-row {
  min-height: 22px;
}

.accounting-filter .accounting-credit-toggle .accounting-filter-label {
  line-height: 1.2;
}

.accounting-filter > select,
.accounting-filter > button {
  align-self: end;
}

.accounting-filter > select,
.accounting-filter > label input,
.accounting-filter > label select,
.accounting-filter > button {
  min-height: 38px;
}

.accounting-tone-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 18px;
}

.tone-legend-item {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--slate-600);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tone-legend-item i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate-400);
}

.tone-pay {
  border-color: var(--yellow-line);
  background: var(--yellow-soft);
}

.tone-pay i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #d97706;
  transform: rotate(45deg);
}

.tone-credit {
  border-color: var(--green-line);
  background: var(--green-soft);
}

.tone-credit i {
  background: #059669;
}

.metrics-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0 !important;
}

.dashboard-tax-panel {
  display: grid;
  gap: 14px;
}

.dashboard-tax-panel .panel-head {
  margin-bottom: 0;
}

.dashboard-tax-panel .toolbar {
  margin-bottom: 0;
}

.dashboard-tax-filter.accounting-filter .accounting-credit-toggle {
  min-height: 38px;
}

.dashboard-tax-grid {
  margin-top: 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 0.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.metric-card span:not(.metric-tone-icon) {
  display: block;
  color: var(--slate-500);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  color: var(--slate-900);
  font-size: 22px;
  line-height: 1.2;
  white-space: nowrap;
}

.metric-tone-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--slate-400);
}

.metric-card-pay {
  border-color: var(--yellow-line);
  background: var(--yellow-soft);
}

.metric-card-pay .metric-tone-icon {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #d97706;
  transform: rotate(45deg);
}

.metric-card-credit {
  border-color: var(--green-line);
  background: var(--green-soft);
}

.metric-card-credit .metric-tone-icon {
  background: #059669;
}

.tax-balance-panel {
  background: #f8fafc;
}

.tax-balance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.tax-balance-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.tax-balance-card span {
  display: block;
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tax-balance-card strong {
  display: block;
  color: var(--slate-900);
  font-size: 22px;
  line-height: 1.2;
}

.tax-balance-card p {
  margin: 0;
  color: var(--slate-600);
  font-size: 13px;
}

.tax-balance-table {
  margin-top: 16px;
}

.tax-total-row th,
.tax-total-row td {
  padding-top: 14px;
  padding-bottom: 14px;
  color: var(--slate-900);
  font-size: 17px;
  font-weight: 800;
}

.tax-total-row th {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}

.tax-total-row td {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.tax-total-pay th,
.tax-total-pay td {
  background: var(--yellow-soft);
  border-color: var(--yellow-line);
}

.tax-total-credit th,
.tax-total-credit td {
  background: var(--green-soft);
  border-color: var(--green-line);
}

.tax-total-neutral th,
.tax-total-neutral td {
  background: var(--slate-50);
}

.accounting-warning-panel {
  scroll-margin-top: 18px;
}

.accounting-warning-panel.has-warnings {
  border-color: #fecaca;
  background: #fff7ed;
}

.warning-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.warning-panel-head > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.warning-panel-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: #fed7aa;
  color: #9a3412;
  font-size: 15px;
  font-weight: 800;
}

.warning-toggle {
  margin-top: 12px;
}

@media (max-width: 900px) {
  .metrics-grid,
  .tax-balance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .metrics-grid,
  .tax-balance-grid {
    grid-template-columns: 1fr;
  }

  .metric-card strong {
    white-space: normal;
  }
}

.warning-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #92400e;
}

.status-pending,
.status-needs_review {
  background: #fff7ed;
  color: #c2410c;
}

.status-accepted {
  background: #ecfdf5;
  color: #047857;
}

.status-rejected {
  background: #fef2f2;
  color: #b91c1c;
}
