:root {
  --gold: #966f31;
  --gold-dark: #775725;
  --gold-soft: #f3eadc;
  --arpea-green: #063d32;
  --arpea-green-soft: #e8f2ee;
  --ink: #3c3c3b;
  --muted: #73716d;
  --paper: #ffffff;
  --field: #f8f7f4;
  --bg: #f4f2ed;
  --line: #ded9cf;
  --danger: #a63838;
  --danger-bg: #fff0f0;
  --success: #337a4d;
  --success-bg: #eef7f1;
  --blue: #1f5f95;
  --shadow: 0 18px 44px rgba(39, 37, 32, .08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, #fbfaf7 0, var(--bg) 260px);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  background: rgba(251, 250, 247, .92);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand {
  display: grid;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.brand img {
  width: 168px;
  height: auto;
}

.nav {
  display: grid;
  gap: 4px;
  margin: 30px 0;
}

.nav a {
  display: block;
  min-height: 40px;
  padding: 11px 12px;
  border-radius: 7px;
  color: #514f49;
  text-decoration: none;
  font-weight: 700;
}

.nav a:hover,
.nav a.active {
  background: var(--arpea-green-soft);
  color: var(--arpea-green);
}

.sidebar-panel,
.panel,
.kpi {
  background: var(--paper);
  border: 1px solid rgba(222, 217, 207, .9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar-panel {
  padding: 14px;
  box-shadow: none;
}

.sidebar-panel p,
.note,
.empty,
small {
  color: var(--muted);
}

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #58554f;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfc8bd;
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 10px 11px;
  min-height: 40px;
}

textarea {
  resize: vertical;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "title"
    "period";
  align-items: start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 4px 0;
}

.topbar > div:first-child {
  grid-area: title;
}

.session-card {
  margin-top: auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .76);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.session-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.session-card strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.session-card em {
  display: inline-flex;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--arpea-green-soft);
  color: var(--arpea-green);
  padding: 3px 8px;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
}

.session-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--arpea-green);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 0;
}

.link-button:hover {
  text-decoration: underline;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--arpea-green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.2;
  color: #6d6a64;
  font-weight: 800;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  margin-bottom: 14px;
  font-size: 16px;
}

.period-toolbar {
  grid-area: period;
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(200px, .9fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 10px 28px rgba(35, 35, 34, .06);
}

.period-toolbar .button {
  min-width: 150px;
}

.client-display {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.client-display strong {
  font-size: 16px;
  color: var(--ink, #20201f);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-display .client-rfc {
  font-size: 12px;
  color: #85817a;
  letter-spacing: .04em;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.status-strip > div {
  background: var(--arpea-green);
  color: #fff;
  border-radius: 8px;
  padding: 13px 14px;
}

.status-strip .label {
  display: block;
  color: #d9d5cd;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-head {
  margin: 6px 0 16px;
}

.button-row,
.report-actions,
.upload-row,
.timer-row,
.manual-time-row,
.favor-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.favor-controls label {
  min-width: 220px;
}

.favor-editor {
  align-items: start;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  margin-bottom: 14px;
}

.favor-fields {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
}

.favor-editor .button {
  margin-top: 18px;
}

.favor-kpi p {
  font-size: 18px;
  font-weight: 900;
  color: var(--arpea-green);
}

.excel-sheet-grid,
.asset-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.excel-sheet-grid .inline-check,
.asset-controls {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.asset-controls {
  grid-template-columns: minmax(240px, 1.4fr) minmax(220px, 1fr) auto;
  align-items: end;
  margin-bottom: 12px;
}

.inline-check {
  display: inline-flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.inline-check input {
  width: auto;
  min-height: 0;
}

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 900;
  white-space: nowrap;
}

.button.primary {
  background: var(--arpea-green);
  color: #fff;
}

.button.primary:hover {
  background: #052f27;
}

.button.secondary {
  background: #fff;
  border-color: #cfc8bd;
  color: var(--ink);
}

.button.dark {
  background: var(--arpea-green);
  color: #fff;
}

.button.warn {
  background: var(--danger);
  color: #fff;
}

.button.tiny {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}

.nav a[hidden],
.role-hidden {
  display: none !important;
}

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

.home-grid,
.generated-reports {
  display: grid;
  gap: 12px;
}

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

.home-card,
.generated-report {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.home-card {
  display: grid;
  gap: 8px;
  min-height: 160px;
  padding: 16px;
  color: var(--ink);
  text-decoration: none;
}

.home-card:hover {
  border-color: var(--arpea-green);
  background: #f8fbf9;
}

.home-card span,
.generated-report span {
  color: var(--arpea-green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.home-card strong {
  font-size: 24px;
  line-height: 1.05;
}

.home-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.generated-report {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
}

.generated-report strong,
.generated-report small {
  display: block;
}

.generated-report small {
  margin-top: 3px;
  color: var(--muted);
}

.kpi {
  padding: 16px;
}

.kpi.principal {
  border-top: 4px solid var(--arpea-green);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 28px;
  line-height: 1;
}

.dashboard-grid,
.review-grid,
.import-grid,
.clients-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 14px;
}

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

.panel {
  min-width: 0;
  padding: 16px;
  margin-bottom: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 6px;
  background: var(--arpea-green-soft);
  color: var(--arpea-green);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.badge.neutral {
  background: #ece9e2;
  color: #5f5a50;
}

.badge.success {
  background: var(--success-bg);
  color: var(--success);
}

.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.workflow {
  display: grid;
  gap: 8px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fdfcf9;
}

.workflow-step.optional {
  background: #fbfaf7;
}

.workflow-step .marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ded9cf;
  color: #5f5a50;
  font-size: 12px;
  font-weight: 900;
}

.workflow-step.done .marker {
  background: var(--success);
  color: #fff;
}

.workflow-step.current {
  border-color: var(--arpea-green);
  background: #f4faf7;
}

.workflow-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.step-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eee9df;
  color: #5f5a50;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.step-chip.success {
  background: var(--success-bg);
  color: var(--success);
}

.risk-list,
.review-list {
  display: grid;
  gap: 10px;
}

.risk-item,
.review-item,
.client-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 12px;
}

.risk-item.alta,
.review-item.alta {
  border-color: #e0a6a6;
  background: var(--danger-bg);
}

.risk-item.media,
.review-item.media {
  border-color: #ead7b8;
  background: #fff8ea;
}

.risk-item h4,
.review-item h4,
.client-card h4 {
  margin: 0 0 5px;
  font-size: 14px;
}

.risk-item p,
.review-item p,
.client-card p {
  margin: 0;
  color: #625f59;
  line-height: 1.45;
}

.review-item footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.review-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.review-issues {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.review-issue {
  display: grid;
  gap: 2px;
  padding: 8px 0 0;
  border-top: 1px solid rgba(100, 88, 64, .18);
}

.review-issue:first-child {
  padding-top: 0;
  border-top: 0;
}

.review-issue strong {
  font-size: 13px;
}

.review-issue span {
  color: #625f59;
  line-height: 1.4;
}

.review-classification {
  min-width: min(100%, 220px);
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid var(--arpea-green);
  background: var(--arpea-green);
  color: #fff;
  padding: 10px 14px;
  font-weight: 900;
}

.secondary-picker {
  background: #fff;
  color: var(--arpea-green);
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.csf-form {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 10px;
  margin: 14px 0;
}

.user-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

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

.context-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e3d9ca;
  border-radius: 8px;
  background: #fbfaf6;
}

.context-suggestion div {
  display: grid;
  gap: 3px;
}

.context-suggestion strong {
  color: var(--arpea-green);
}

.context-suggestion span {
  color: var(--muted);
  line-height: 1.4;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.compact-table {
  margin-top: 14px;
}

.compact-table table {
  min-width: 620px;
}

.client-name-cell {
  min-width: 260px;
}

.status-select {
  min-width: 124px;
  padding: 6px 8px;
  min-height: 32px;
}

.freshness {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  background: #ece9e2;
  color: #5f5a50;
}

.freshness.ok {
  background: var(--success-bg);
  color: var(--success);
}

.freshness.warn {
  background: #fff8ea;
  color: var(--gold-dark);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: var(--arpea-green);
  color: #fff;
  text-align: left;
  padding: 9px;
}

td {
  border-bottom: 1px solid #ebe7df;
  padding: 9px;
  vertical-align: top;
}

.right {
  text-align: right;
}

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

.client-lock {
  border: 1px dashed #b8b0a3;
  border-radius: 8px;
  padding: 30px;
  background: #fff;
  text-align: center;
}

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

.client-summary {
  padding: 18px;
  background: #fff8ea;
  border: 1px solid #ead7b8;
  border-radius: 8px;
  line-height: 1.6;
}

#whatsappOutput {
  min-height: 260px;
  background: #fffdf8;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.cfdi-dialog {
  width: min(1280px, calc(100vw - 32px));
  max-height: min(880px, calc(100vh - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #fbfaf7;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(20, 30, 25, .24);
}

.cfdi-dialog::backdrop {
  background: rgba(9, 25, 21, .36);
  backdrop-filter: blur(5px);
}

.auth-dialog {
  width: min(620px, calc(100vw - 32px));
}

.login-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.login-user-list {
  display: grid;
  gap: 8px;
}

.login-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.login-user-card strong,
.login-user-card span {
  display: block;
}

.login-user-card span {
  color: var(--muted);
  font-size: 12px;
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: rgba(251, 250, 247, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

#cfdiDialogBody {
  padding: 18px;
  overflow: auto;
}

.invoice-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.invoice-doc-label {
  display: block;
  margin-bottom: 5px;
  color: var(--arpea-green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.invoice-preview header,
.invoice-parties,
.invoice-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.invoice-preview header {
  align-items: start;
  border-bottom: 3px solid var(--arpea-green);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.invoice-preview h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.invoice-stamp {
  justify-self: end;
  text-align: right;
  max-width: 360px;
}

.invoice-stamp strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.invoice-stamp span,
.invoice-parties span,
.invoice-totals span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.invoice-parties {
  margin-bottom: 16px;
}

.invoice-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.invoice-document {
  min-width: 0;
}

.invoice-alert {
  border: 1px solid #ead7b8;
  background: #fff8ea;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  color: var(--gold-dark);
}

.invoice-validation-card {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 10px;
  border: 1px solid #d8d0c2;
  border-radius: 8px;
  background: #fbfaf7;
  padding: 12px;
}

.validation-rail-head {
  border-radius: 7px;
  padding: 12px;
  background: var(--success-bg);
  color: var(--success);
}

.validation-rail-head.warn {
  background: #fff8ea;
  color: var(--gold-dark);
}

.validation-rail-head.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.validation-rail-head span,
.validation-rail-head strong,
.validation-rail-head small {
  display: block;
}

.validation-rail-head span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.validation-rail-head strong {
  margin-top: 4px;
  font-size: 22px;
  line-height: 1;
}

.validation-rail-head small {
  margin-top: 7px;
  color: inherit;
  opacity: .82;
  font-weight: 800;
}

.validation-pill-list {
  display: grid;
  gap: 7px;
}

.validation-pill {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid #e6ded1;
  border-radius: 7px;
  background: #fff;
  padding: 9px;
}

.validation-dot {
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border-radius: 50%;
  background: #8a8478;
}

.validation-pill.ok .validation-dot {
  background: var(--success);
}

.validation-pill.warn .validation-dot {
  background: var(--gold);
}

.validation-pill.danger .validation-dot {
  background: var(--danger);
}

.validation-pill strong,
.validation-pill small {
  display: block;
}

.validation-pill strong {
  font-size: 12px;
}

.validation-pill small {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
}

.validation-details {
  border-top: 1px solid #e6ded1;
  padding-top: 8px;
}

.validation-details summary {
  cursor: pointer;
  color: var(--arpea-green);
  font-weight: 900;
}

.validation-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 10px;
}

.validation-field {
  border: 1px solid #e6ded1;
  border-radius: 7px;
  background: #fff;
  padding: 8px 9px;
}

.validation-check,
.client-context-strip {
  border: 1px solid #e6ded1;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.validation-field span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.validation-field strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.validation-field.ok,
.validation-check.ok {
  background: #f5fbf7;
}

.validation-field.warn,
.validation-check.warn {
  background: #fff8ea;
}

.validation-field.danger,
.validation-check.danger {
  background: #fff4ef;
}

.client-context-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  background: #f7f5f0;
}

.client-context-strip span,
.client-context-strip small {
  line-height: 1.45;
}

.validation-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.validation-check strong,
.validation-check span {
  display: block;
}

.validation-check strong {
  font-size: 13px;
}

.validation-check span {
  margin-top: 4px;
  color: #514f49;
  line-height: 1.45;
}

.invoice-tax-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e8dfd1;
  border-radius: 8px;
  background: #fbfaf7;
}

.invoice-tax-card > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.invoice-tax-card span,
.invoice-tax-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.invoice-tax-card strong {
  color: var(--arpea-green);
  text-align: right;
}

.invoice-tax-card p {
  color: var(--muted);
  line-height: 1.5;
}

.invoice-tax-table {
  margin-top: 10px;
}

.invoice-tax-table th {
  background: #efe9dd;
  color: var(--ink);
}

.invoice-tax-table td {
  font-size: 13px;
}

.invoice-tax-alerts {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.invoice-tax-alert {
  border: 1px solid #d9c8a6;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffaf0;
  color: var(--gold-dark);
}

.invoice-tax-alert.needs-review {
  border-color: #c46d4d;
  background: #fff4ef;
  color: #78351f;
}

.invoice-tax-alert strong,
.invoice-tax-alert span {
  display: block;
}

.invoice-tax-alert span {
  margin-top: 3px;
  line-height: 1.45;
}

.invoice-totals {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
}

.invoice-totals div {
  background: #f7f5f0;
  border-radius: 8px;
  padding: 12px;
}

.xml-assist {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.xml-assist span {
  color: var(--muted);
  font-weight: 700;
}

.xml-code {
  margin: 0;
  padding: 18px;
  max-height: 620px;
  overflow: auto;
  border-radius: 8px;
  background: #101816;
  color: #e8eee9;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.xml-tag {
  color: #7dd3b0;
  font-weight: 800;
}

.xml-attr {
  color: #f0c36a;
}

.xml-value {
  color: #f5f2df;
}

.xml-comment {
  color: #93a39b;
}

mark {
  background: #fff2a8;
  color: #191919;
  border-radius: 3px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .period-toolbar,
  .status-strip,
  .kpi-grid,
  .home-grid,
  .dashboard-grid,
  .review-grid,
  .import-grid,
  .clients-grid,
  .client-grid {
    grid-template-columns: 1fr 1fr;
  }

  .invoice-visual-grid {
    grid-template-columns: 1fr;
  }

  .invoice-validation-card {
    position: static;
  }

  .validation-pill-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .section-head,
  .panel-head {
    display: grid;
  }

  .topbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "session"
      "period";
  }

  .session-card {
    justify-self: stretch;
  }

  .period-toolbar,
  .status-strip,
  .kpi-grid,
  .home-grid,
  .dashboard-grid,
  .review-grid,
  .import-grid,
  .clients-grid,
  .client-grid,
  .nav,
  .csf-form,
  .user-form,
  .admin-form {
    grid-template-columns: 1fr;
  }

  .wide-field,
  .admin-actions {
    grid-column: auto;
  }

  .admin-actions {
    display: grid;
  }

  .button,
  .file-picker {
    width: 100%;
  }

  .xml-assist,
  .invoice-visual-grid,
  .invoice-preview header,
  .invoice-parties,
  .invoice-totals,
  .validation-pill-list,
  .validation-checks {
    grid-template-columns: 1fr;
  }

  .invoice-tax-card > div {
    display: grid;
  }

  .invoice-tax-card strong {
    text-align: left;
  }

  .invoice-stamp {
    justify-self: start;
    text-align: left;
  }
}

.tool-details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .5);
}

.tool-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #6d6a64;
}

.tool-details[open] summary {
  margin-bottom: 10px;
}

.next-step-hero {
  grid-column: 1 / -1;
  display: grid;
  gap: 22px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.flow-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.flow-dot {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--field);
  border: 1px solid var(--line);
  font-size: 12px;
}

.flow-step.done {
  color: var(--success);
}

.flow-step.done .flow-dot {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.flow-step.current {
  color: var(--arpea-green);
}

.flow-step.current .flow-dot {
  background: var(--arpea-green);
  border-color: var(--arpea-green);
  color: #fff;
}

.next-action h3 {
  margin: 4px 0 6px;
  font-size: 22px;
}

.next-action .button {
  margin-top: 14px;
}

.kpi-hint {
  display: block;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fdf6e7;
  border: 1px solid #ecd9ae;
  color: #7a5b1e;
  font-size: 11.5px;
  line-height: 1.45;
}

.workflow-strip {
  gap: 4px 18px;
}

.workflow-strip .flow-step {
  font-size: 12px;
}

.workflow-strip .flow-dot {
  width: 22px;
  height: 22px;
  font-size: 11px;
}

.flow-step.optional {
  opacity: .55;
}

.workflow-current-note {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.kpi-hint[hidden] {
  display: none;
}


.sheet-empty-mark {
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--field);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}


.panel-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
