/* =========================================================
   REGISTRU – Design System v2
   Modern, accessible, UX-first
   ========================================================= */

/* ── 1. Design tokens ─────────────────────────────────── */
:root {
  /* Palette */
  --brand:         #16a34a;
  --brand-strong:  #15803d;
  --brand-subtle:  #dcfce7;
  --brand-muted:   rgba(22, 163, 74, 0.12);

  --warn:          #dc2626;
  --warn-subtle:   rgba(220, 38, 38, 0.08);
  --warn-muted:    rgba(220, 38, 38, 0.14);

  --amber:         #d97706;
  --amber-subtle:  rgba(217, 119, 6, 0.12);

  /* Surfaces */
  --bg:            #f0f4f8;
  --bg-accent:     #e8edf3;
  --panel:         rgba(255, 255, 255, 0.97);
  --panel-hover:   rgba(255, 255, 255, 1);

  /* Text */
  --text:          #0f1923;
  --text-secondary:#374151;
  --muted:         #64748b;
  --muted-light:   #94a3b8;

  /* Lines */
  --line:          rgba(15, 35, 60, 0.10);
  --line-strong:   rgba(15, 35, 60, 0.16);

  /* Elevation */
  --shadow-xs:     0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm:     0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-md:     0 2px 6px rgba(15, 23, 42, 0.07), 0 12px 32px rgba(15, 23, 42, 0.09);
  --shadow-lg:     0 4px 8px rgba(15, 23, 42, 0.06), 0 24px 64px rgba(15, 23, 42, 0.14);
  --shadow-brand:  0 2px 12px rgba(22, 163, 74, 0.30);

  /* Shape */
  --radius-xs:     6px;
  --radius-sm:     10px;
  --radius:        16px;
  --radius-lg:     22px;
  --radius-xl:     28px;
  --radius-full:   999px;

  /* Motion */
  --ease:          cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 120ms;
  --duration:      180ms;
  --duration-slow: 280ms;
}

/* ── 2. Reset & base ──────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100dvh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Inter", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(22,163,74,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 100%, rgba(59,130,246,0.05) 0%, transparent 55%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea, .upload-button {
  font: inherit;
  color: inherit;
}

h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
}

/* ── 3. Accessibility ─────────────────────────────────── */
.skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  transform: translateY(-200%);
  z-index: 1000;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  background: var(--brand-strong);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: transform var(--duration) var(--ease);
}
.skip-link:focus-visible {
  transform: translateY(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;
}

/* ── 4. Page shell ────────────────────────────────────── */
.page-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  height: 100dvh;
  padding: 10px 0;
}

/* ── 5. Auth screen ───────────────────────────────────── */
.auth-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(440px, 100%);
  padding: 40px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.auth-logo svg {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.auth-brand {
  display: grid;
  gap: 2px;
}

.auth-brand-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.auth-brand-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn-muted);
  background: var(--warn-subtle);
  color: #b91c1c;
  font-size: 0.9rem;
}

/* ── 6. Main layout ───────────────────────────────────── */
.layout {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

/* ── 7. Top strip / navigation bar ───────────────────── */
.panel,
.summary-card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 18px;
}

.compact-panel {
  padding: 10px 14px;
}

.top-strip {
  display: grid;
  gap: 8px;
}

.top-strip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

/* Navigation tabs */
.module-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px;
  background: var(--bg-accent);
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--line);
}

.module-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: calc(var(--radius) - 6px);
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 32px;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}

.module-tab svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--duration-fast);
}

.module-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.7);
}

.module-tab.active {
  background: #fff;
  color: var(--brand-strong);
  font-weight: 600;
  box-shadow: var(--shadow-xs), 0 0 0 1px rgba(22, 163, 74, 0.08);
}

.module-tab.active svg {
  stroke: var(--brand);
}

.session-box .icon-button.active {
  background: var(--brand-soft, #e6f4ea);
  color: var(--brand-strong, #14532d);
  border-color: rgba(22, 163, 74, 0.35);
}

.session-box .icon-button.active svg {
  stroke: var(--brand, #16a34a);
}

/* Session info */
.session-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.global-year-field {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-direction: row;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
}

.global-year-field select {
  min-width: 0;
  min-height: 30px;
}

.session-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: var(--bg-accent);
  font-weight: 500;
  color: var(--text-secondary);
}

.session-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;  flex-shrink: 0;
}

/* ── 8. Toolbar & filters ─────────────────────────────── */
.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.compact-toolbar {
  gap: 6px 10px;
}

.filter-toolbar {
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr)
                         minmax(120px, 0.6fr) minmax(130px, 0.7fr)
                         minmax(180px, 1fr)   minmax(240px, 1.25fr);
  align-items: end;
}

.filter-field {
  min-width: 0;
}

.filter-field-date input,
.filter-field-type select,
.filter-field-search input {
  min-width: 0;
}

/* ── 9. Forms & labels ────────────────────────────────── */
label {
  display: grid;
  gap: 5px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
}

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

.wide, .search {
  grid-column: span 2;
}

.upload-field small {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  transition: border-color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease);
}

input:hover,
select:hover {
  border-color: rgba(22, 163, 74, 0.3);
}

input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
  background: #fff;
}

input::placeholder {
  color: var(--muted-light);
}

input[disabled],
select[disabled] {
  background: var(--bg-accent);
  color: var(--muted);
  cursor: not-allowed;
  border-color: var(--line);
}

/* Focus ring for buttons & other interactive elements */
button:focus-visible,
.upload-button:focus-visible,
.document-link:focus-visible,
.skip-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── 10. Buttons ──────────────────────────────────────── */
button {
  min-height: 36px;
  padding: 7px 18px;
  border: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  touch-action: manipulation;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition: transform var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease),
              opacity var(--duration-fast) var(--ease);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0) scale(0.98);
}

.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  box-shadow: var(--shadow-brand);
  font-weight: 600;
}

.primary:hover {
  box-shadow: 0 4px 20px rgba(22, 163, 74, 0.40);
}

.secondary {
  background: var(--panel);
  color: var(--text-secondary);
  border: 1.5px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
}

.secondary:hover {
  background: var(--bg-accent);
  border-color: rgba(22, 163, 74, 0.25);
}

.upload-button {
  min-height: 36px;
  padding: 7px 18px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition: transform var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease);
}

.upload-button:hover {
  transform: translateY(-1px);
}

.danger {
  background: var(--warn-subtle);
  color: var(--warn);
  border: 1.5px solid var(--warn-muted);
}

.danger:hover {
  background: rgba(220, 38, 38, 0.12);
}

/* ── 11. Actions row ──────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.compact-actions { gap: 6px; }

.top-strip-actions {
  justify-content: flex-start;
  align-self: stretch;
  row-gap: 6px;
  max-width: none;
}

.invoice-import-action {
  margin-left: auto;
}

.entry-form .actions {
  grid-column: 1 / -1;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  justify-content: flex-end;
}

/* ── 12. Report panel ─────────────────────────────────── */
.report-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-head-inline {
  margin-bottom: 10px;
}

.panel-head-inline h2 {
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.panel-head-inline p {
  margin-top: 4px;
  font-size: 0.92rem;
  color: var(--muted);
}

.report-heading {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0 0 10px;
}

.tax-report-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.tax-report-heading h3 {
  white-space: nowrap;
}

.tax-heading-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.tax-heading-left select {
  min-width: 0;
}

.tax-config-button {
  flex-shrink: 0;
}

.tax-config-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.report-heading h3,
.report-heading p {
  margin: 0;
}

.report-heading h3 {
  font-size: clamp(1.25rem, 2.4vw, 1.85rem);
  letter-spacing: 0.05em;
  font-weight: 800;
  color: var(--text);
}

.report-heading p {
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 600;
  color: var(--muted);
}

/* ── 13. Summary cards ────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.summary-grid-bottom { margin-top: 0; }

.summary-card {
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  border-radius: var(--radius-sm);
  transition: box-shadow var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}

.summary-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.summary-card > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-card strong {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.summary-card.accent {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-brand);
}

.summary-card.accent > span {
  color: rgba(255, 255, 255, 0.75);
}

.summary-card-warning {
  background: linear-gradient(135deg, rgba(251,146,60,0.14), rgba(248,113,113,0.10));
  border: 1px solid rgba(234, 88, 12, 0.20);
}

.summary-card-warning > span,
.summary-card-warning .summary-subvalue {
  color: #9a3412;
}

.summary-card-warning strong {
  color: #c2410c;
}

.summary-subvalue {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

/* ── Tax specific cards & grids ───────────────────────────── */
.tax-report-panel {
  display: block;
  overflow-y: auto;
  padding-bottom: 24px;
}

.tax-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.tax-report-panel table {
  min-width: 0;
}

.tax-report-panel th,
.tax-report-panel td {
  white-space: normal;
}

.tax-config-grid,
.tax-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.dashboard-group {
  margin-bottom: 20px;
}
.dashboard-group-heading {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.dashboard-group-heading h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-left: 8px;
  border-left: 3px solid var(--accent, #2563eb);
}
.dashboard-group .tax-summary-grid {
  margin-bottom: 0;
  grid-template-columns: repeat(auto-fill, minmax(200px, 240px));
}

.tax-card-incasari {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(22, 163, 74, 0.08));
  border: 1px solid rgba(22, 163, 74, 0.20);
}
.tax-card-incasari > span { color: #14532d; }
.tax-card-incasari strong { color: #15803d; }

.tax-card-plati {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(220, 38, 38, 0.14));
  border: 1px solid rgba(220, 38, 38, 0.35);
}
.tax-card-plati > span { color: #7f1d1d; }
.tax-card-plati strong { color: #dc2626; }

.tax-card-total-pay {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border: 1px solid #991b1b;
}
.tax-card-total-pay > span { color: #fecaca; }
.tax-card-total-pay strong { color: #ffffff; }

.tax-card-net-positive {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.10));
  border: 1px solid rgba(22, 163, 74, 0.25);
}
.tax-card-net-positive > span { color: #14532d; }
.tax-card-net-positive strong { color: #15803d; }

.tax-card-net-negative {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.10));
  border: 1px solid rgba(220, 38, 38, 0.25);
}
.tax-card-net-negative > span { color: #7f1d1d; }
.tax-card-net-negative strong { color: #dc2626; }

.tax-card-contrib {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.20);
}
.tax-card-contrib > span { color: #1e3a5f; }
.tax-card-contrib strong { color: #2563eb; }

.tax-card-total-tax {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(124, 58, 237, 0.10));
  border: 1px solid rgba(139, 92, 246, 0.25);
}
.tax-card-total-tax > span { color: #4c1d95; }
.tax-card-total-tax strong { color: #7c3aed; }

/* ── 14. Table ────────────────────────────────────────── */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  min-height: 0;
  position: relative;
  background: rgba(255,255,255,0.97);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
  background: transparent;
}

thead {
  background: var(--bg-accent);
}

th, td {
  padding: 9px 11px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.3;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.035em;
}

tbody tr {
  transition: background var(--duration-fast);
}

tbody tr:hover {
  background: rgba(22, 163, 74, 0.04);
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* Journal table */
.journal-table {
  border-collapse: separate;
  border-spacing: 0;
}

.journal-table thead th {
  text-align: center;
  font-size: 0.8rem;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-accent);
}

.journal-table thead tr:first-child th {
  height: 44px;
  vertical-align: middle;
}

.journal-table thead th[rowspan="2"] {
  position: sticky;
  overflow: hidden;
}

.journal-table thead tr:nth-child(2) th {
  top: 44px;
  z-index: 3;
  background: var(--bg-accent);
  box-shadow: inset 0 -1px 0 var(--line);
}

.journal-table thead {
  position: relative;
  z-index: 4;
}

.journal-table thead th.header-divider-left::before {
  content: "";
  position: absolute;
  left: -1px; top: 50%; bottom: 0;
  border-left: 1px solid var(--line);
  pointer-events: none;
}

.journal-table tbody td {
  font-size: 0.88rem;
}

.journal-table tbody td:nth-child(6),
.journal-table tbody td:nth-child(7),
.journal-table tbody td:nth-child(8),
.journal-table tbody td:nth-child(9),
.journal-table tbody td:nth-child(10),
.expenses-total-cell,
.import-result-item strong {
  font-variant-numeric: tabular-nums;
}

.journal-table tbody tr.entry-row-uncollected td {
  background: rgba(220, 38, 38, 0.03);
}

.journal-table tbody tr.entry-row-uncollected:hover td {
  background: rgba(220, 38, 38, 0.06);
}

.journal-table tbody tr.entry-row-expense td {
  background: rgba(220, 38, 38, 0.07);
}

.journal-table tbody tr.entry-row-expense:hover td {
  background: rgba(220, 38, 38, 0.12);
}

.journal-table tbody td:nth-child(1),
.journal-table tbody td:nth-child(2),
.journal-table tbody td:nth-child(6),
.journal-table tbody td:nth-child(7),
.journal-table tbody td:nth-child(8),
.journal-table tbody td:nth-child(9),
.journal-table tbody td:nth-child(10) {
  white-space: nowrap;
}

.amount-negative {
  color: #dc2626;
}

.amount-positive {
  color: #15803d;
}

.access-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.access-status-success {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.access-status-failed {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.journal-table tbody tr.access-log-failed td,
.clients-table tbody tr.access-log-failed td {
  background: rgba(220, 38, 38, 0.05);
}

.access-log-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.access-log-filter {
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.access-log-filter:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.access-log-filter-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.access-log-filter-active:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #ffffff;
}

/* Clients table */
.clients-table {
  min-width: 1080px;
}

/* ── 15. Invoices view ────────────────────────────────── */
.invoices-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.access-logs-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.invoices-summary-grid {
  margin: 0 0 10px;
}

.invoices-table {
  width: 100%;
  min-width: 0;
}

.invoices-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-accent);
  white-space: nowrap;
  padding: 7px 9px;
}

.invoices-table tbody td:nth-child(4),
.invoices-table tbody td:nth-child(5),
.invoices-table tbody td:nth-child(6),
.invoices-table tbody td:nth-child(7) {
  font-variant-numeric: tabular-nums;
}

.invoice-client-cell,
.invoice-rate-cell {
  white-space: nowrap;
}

.invoices-table th,
.invoices-table td {
  white-space: nowrap;
}

.invoices-table td {
  padding: 6px 9px;
}

.invoice-value-cell {
  white-space: nowrap;
  text-align: right;
}

.invoice-currency-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--brand-muted);
  color: var(--brand-strong);
  vertical-align: middle;
}

.invoice-currency-symbol {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.invoice-currency-code {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.invoice-value-cell strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1;
}

.invoice-value-cell-open strong {
  color: #c2410c;
}

.invoice-subvalue-text {
  display: inline-flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 1px;
  margin-top: 0;
  font-size: 0.63rem;
  color: var(--text);
  font-weight: 500;
  width: 100%;
  line-height: 0.96;
  letter-spacing: -0.01em;
}

.invoice-token-text {
  font-size: 0.56rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0;
}

.invoice-inline-rate {
  display: block;
  margin-top: 4px;
  font-size: 0.58rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.15;
}

/* Status pills */
.invoice-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  min-width: 100px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.invoice-status-pill.is-open {
  background: rgba(234, 88, 12, 0.10);
  color: #c2410c;
}

.invoice-status-pill.is-collected {
  background: rgba(22, 163, 74, 0.12);
  color: var(--brand-strong);
}

.invoice-status-toggle {
  border: 0;
}

.invoice-status-toggle.is-open {
  background: rgba(234, 88, 12, 0.10);
  color: #c2410c;
}

.invoice-status-toggle.is-open:hover {
  background: rgba(234, 88, 12, 0.18);
}

.invoice-status-toggle.is-collected {
  background: rgba(22, 163, 74, 0.12);
  color: var(--brand-strong);
}

.invoice-status-toggle.is-collected:hover {
  background: rgba(22, 163, 74, 0.20);
}

.invoice-status-cell {
  text-align: center;
  white-space: nowrap;
}

.invoice-status-date {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── 16. Profile view ─────────────────────────────────── */
.profile-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
}

.profile-grid > .profile-card:first-child {
  grid-column: 1;
}

.profile-grid > .profile-card:last-child {
  grid-column: 2;
}

.profile-card {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-accent);
}

.profile-card h3 {
  margin: 0 0 16px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.profile-address-field  { grid-column: 1 / -1; }
.profile-display-name-field { grid-column: 1 / span 1; }
.profile-business-name-field { grid-column: 2 / -1; }
.profile-caen-field     { grid-column: 1 / -1; }
.profile-registration-field { grid-column: 1 / span 2; }
.profile-company-field  { grid-column: 3 / span 1; }
.profile-vat-field      { grid-column: 4 / span 1; }
.profile-bank-field    { grid-column: 1 / span 2; }
.profile-iban-field    { grid-column: 3 / -1; }
.profile-email-field    { grid-column: 1 / span 2; }
.profile-phone-field    { grid-column: 3 / span 2; }

/* ── 17. Expenses view ────────────────────────────────── */
.expenses-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.expenses-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 8px;
}

.expenses-head h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.03em;
}

.expenses-head p {
  margin: 6px 0 0;
  max-width: 600px;
  color: var(--muted);
  font-size: 0.92rem;
}

.expenses-help-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
}

.expenses-help-link:hover {
  text-decoration: underline;
}

.expense-upload-button {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1f2329;
  border: 0;
  box-shadow: 0 2px 10px rgba(245,158,11,0.28);
  font-weight: 600;
}

.expense-upload-button:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  box-shadow: 0 4px 14px rgba(245,158,11,0.38);
}

.expenses-summary-grid {
  margin-bottom: 8px;
}

.expenses-card {
  min-height: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.97);
  overflow: auto;
}

.expenses-table {
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}

.expenses-table thead {
  background: transparent;
}

.expenses-table th,
.expenses-table td {
  border-right: 0;
  border-bottom: 0;
  padding: 18px 22px;
  color: var(--text);
}

.expenses-table th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
}

.expenses-table tbody tr + tr td {
  border-top: 1px solid rgba(15, 35, 60, 0.05);
}

.expenses-table .expense-supplier {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.expenses-total-column,
.expenses-total-cell {
  text-align: right;
}

.expenses-table th.expenses-total-column {
  text-align: right;
}

.expenses-total-cell {
  font-weight: 700;
  white-space: nowrap;
}

.expenses-amount-cell {
  font-weight: 400;
}

.expenses-total-cell span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

/* ── 18. Row actions / icon buttons ──────────────────── */
.actions-column {
  width: 72px;
  min-width: 72px;
}

.row-actions {
  white-space: nowrap;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.icon-button {
  min-height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1.5px solid var(--line-strong);
  color: var(--brand);
  font-size: 0.9rem;
  line-height: 1;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast),
              border-color var(--duration-fast),
              transform var(--duration-fast) var(--ease);
}

.icon-button + .icon-button {
  margin-left: 4px;
}

.icon-button svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover {
  background: var(--brand-muted);
  border-color: rgba(22, 163, 74, 0.25);
  transform: translateY(0);
}

.icon-button.is-active {
  background: rgba(22, 163, 74, 0.15);
  border-color: rgba(22, 163, 74, 0.30);
  color: var(--brand-strong);
}

.link-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--brand);
  margin-right: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

.document-link {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.document-link:hover {
  color: var(--brand-strong);
}

.danger-text {
  color: var(--warn);
}

.icon-button.danger-text:hover {
  background: var(--warn-subtle);
  border-color: var(--warn-muted);
}

/* Download button */
.download-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.download-icon-button svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.expense-file-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.document-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
}

.expense-preview-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-full);
  border: 1.5px solid rgba(22, 163, 74, 0.20);
  background: var(--brand-muted);
  color: var(--brand);
  box-shadow: none;
}

.expense-preview-button:hover {
  background: rgba(22, 163, 74, 0.18);
  transform: translateY(0);
}

.expense-preview-button svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── 19. Empty state ──────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 48px 28px !important;
  font-size: 0.9rem;
  background: transparent !important;
}

/* ── 20. Modals ───────────────────────────────────────── */
@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 35, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  overscroll-behavior: contain;
  padding: 24px;
  z-index: 100;
  animation: backdrop-in var(--duration) var(--ease);
}

.modal-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 30px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--duration-slow) var(--ease-spring);
}

.modal-card-compact {
  width: min(680px, 100%);
}

.modal-card-pdf {
  width: min(1120px, 100%);
  padding-bottom: 18px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.modal-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-download-link {
  width: 32px;
  height: 32px;
}

.modal-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--radius-full);
  background: var(--bg-accent);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 1.1rem;
  line-height: 1;
}

.modal-close:hover {
  background: var(--warn-subtle);
  color: var(--warn);
  border-color: var(--warn-muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.pdf-preview-frame {
  width: 100%;
  height: min(78vh, 920px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.pdf-preview-loading {
  height: min(78vh, 920px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-accent);
  color: var(--muted);
}

.pdf-preview-loading .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(21, 128, 61, 0.20);
  border-top-color: #15803d;
  border-radius: 50%;
  animation: pdf-spin 0.8s linear infinite;
}

.pdf-preview-loading p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

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

/* ── 21. Import result ────────────────────────────────── */
.import-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.import-result-item {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-accent);
}

.import-result-item span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.import-result-item strong {
  display: block;
  margin-top: 8px;
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.import-result-item-warn {
  border-color: rgba(220, 38, 38, 0.22);
  background: rgba(254, 242, 242, 0.9);
}

.import-result-item-warn span {
  color: #b91c1c;
}

.import-result-item-warn strong {
  color: var(--warn);
}

.import-result-errors {
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-accent);
}

.import-result-errors h4 {
  margin: 0 0 10px;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.import-result-errors ul {
  margin: 0;
  padding-left: 20px;
}

.import-result-errors li + li {
  margin-top: 6px;
}

/* ── 22. Form errors ──────────────────────────────────── */
.form-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn-muted);
  background: var(--warn-subtle);
  color: #b91c1c;
  font-size: 0.88rem;
}

.form-note {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.form-note strong {
  color: var(--text);
  font-weight: 600;
}

/* ── 23. Module transitions ───────────────────────────── */
.module-fade-enter-active,
.module-fade-leave-active {
  transition: opacity var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}

.module-fade-enter-from {
  opacity: 0;
  transform: translateY(10px);
}

.module-fade-leave-to {
  opacity: 0;
  transform: translateY(-4px);
}

/* ── 24. Clients panel ────────────────────────────────── */
.clients-panel .table-wrap {
  margin-top: 6px;
}

/* ── 25. Responsive – 1080px ──────────────────────────── */
@media (max-width: 1080px) {
  .tax-sections-grid {
    grid-template-columns: 1fr;
  }

  body {
    overflow: auto;
  }

  .page-shell {
    height: auto;
    min-height: 100dvh;
    padding-bottom: 12px;
  }

  .layout {
    height: auto;
    min-height: calc(100dvh - 16px);
    grid-template-rows: auto auto;
  }

  .report-panel,
  .expenses-panel,
  .profile-panel {
    min-height: auto;
  }

  .summary-grid,
  .entry-form,
  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .top-strip {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .top-strip-actions {
    justify-content: flex-start;
  }

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

  .session-box {
    width: 100%;
    justify-content: space-between;
  }

  .expenses-head {
    flex-direction: column;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-grid > .profile-card:first-child,
  .profile-grid > .profile-card:last-child {
    grid-column: auto;
  }

  .profile-card .entry-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-display-name-field,
  .profile-business-name-field,
  .profile-caen-field,
  .profile-registration-field,
  .profile-company-field,
  .profile-vat-field,
  .profile-email-field,
  .profile-phone-field,
  .profile-address-field,
  .profile-bank-field,
  .profile-iban-field {
    grid-column: auto;
  }

  .profile-business-name-field,
  .profile-caen-field,
  .profile-address-field,
  .profile-bank-field,
  .profile-iban-field {
    grid-column: 1 / -1;
  }

  .profile-email-field,
  .profile-phone-field {
    grid-column: span 1;
  }
}

/* ── 26. Responsive – 960px / touch ──────────────────── */
@media (max-width: 960px), (hover: none) and (pointer: coarse) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .page-shell {
    width: min(100% - 20px, 100%);
    height: auto;
    min-height: 100dvh;
    padding-top: 6px;
    padding-bottom: 14px;
  }

  .summary-grid,
  .entry-form,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .wide,
  .search,
  .filter-field-search {
    grid-column: span 1;
  }

  .panel,
  .modal-card {
    padding: 16px;
  }

  .compact-panel {
    padding: 12px;
  }

  .top-strip-head,
  .session-box {
    gap: 10px;
  }

  .module-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    padding: 4px;
  }

  .module-tab {
    justify-content: center;
    text-align: center;
  }

  .module-tab,
  .top-strip-actions > button,
  .top-strip-actions > label,
  .session-box > button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .session-box {
    flex-direction: column;
    align-items: stretch;
  }

  .top-strip-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-strip-actions > * {
    width: 100%;
  }

  .report-heading {
    gap: 2px;
    margin-bottom: 10px;
  }

  .report-heading h3 {
    font-size: 1rem;
    text-align: center;
    line-height: 1.2;
  }

  .report-heading p {
    font-size: 0.92rem;
  }

  .summary-card {
    padding: 12px 14px;
  }

  .table-wrap {
    border-radius: var(--radius-sm);
    -webkit-overflow-scrolling: touch;
  }

  table,
  .clients-table {
    min-width: 760px;
  }

  .journal-table {
    min-width: 760px;
  }

  .journal-table th,
  .journal-table td {
    padding: 7px 8px;
  }

  .journal-table thead th {
    padding: 7px 8px;
    font-size: 0.78rem;
  }

  .journal-table tbody td {
    font-size: 0.86rem;
  }

  .journal-table th:nth-child(1),
  .journal-table td:nth-child(1) { min-width: 54px; }

  .journal-table th:nth-child(2),
  .journal-table td:nth-child(2) { min-width: 90px; }

  .journal-table th:nth-child(3),
  .journal-table td:nth-child(3) { min-width: 108px; max-width: 108px; }

  .journal-table th:nth-child(4),
  .journal-table td:nth-child(4) { min-width: 102px; max-width: 102px; }

  .journal-table th:nth-child(5),
  .journal-table td:nth-child(5) { min-width: 180px; }

  .journal-table th:nth-child(6),
  .journal-table th:nth-child(7),
  .journal-table th:nth-child(8),
  .journal-table th:nth-child(9),
  .journal-table td:nth-child(6),
  .journal-table td:nth-child(7),
  .journal-table td:nth-child(8),
  .journal-table td:nth-child(9) { min-width: 84px; }

  .journal-table th:nth-child(10),
  .journal-table td:nth-child(10) { min-width: 96px; }

  .actions-column {
    width: 58px;
    min-width: 58px;
  }

  .row-actions {
    padding-left: 2px;
    padding-right: 2px;
  }

  .icon-button {
    min-width: 26px;
    min-height: 26px;
    font-size: 0.82rem;
  }

  .icon-button + .icon-button {
    margin-left: 2px;
  }

  .journal-table td:nth-child(3),
  .journal-table td:nth-child(4) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .journal-table td:nth-child(3) .document-link {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }

  .expenses-card {
    overflow: visible;
    border: 0;
    background: transparent;
  }

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

  .expenses-table thead {
    display: none;
  }

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

  .expenses-table tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.98);
    padding: 14px 16px;
  }

  .expenses-table tbody tr + tr td {
    border-top: 0;
  }

  .expenses-table td {
    padding: 0;
    border: 0;
  }

  .expenses-table td + td {
    margin-top: 10px;
  }

  .expenses-table td::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .expenses-table tbody td:nth-child(1)::before { content: "Furnizor"; }
  .expenses-table tbody td:nth-child(2)::before { content: "Data achizitie"; }
  .expenses-table tbody td:nth-child(3)::before { content: "Categorie"; }
  .expenses-table tbody td:nth-child(4)::before { content: "Total fara TVA"; }
  .expenses-table tbody td:nth-child(5)::before { content: "TVA"; }
  .expenses-table tbody td:nth-child(6)::before { content: "Total"; }

  .expense-supplier {
    justify-content: space-between;
  }

  .expenses-total-cell {
    text-align: left;
  }

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

  .responsive-card-table {
    min-width: 0;
  }

  .responsive-card-table thead {
    display: none;
  }

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

  .responsive-card-table tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.98);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
  }

  .responsive-card-table tbody tr.entry-row-uncollected {
    background: rgba(220, 38, 38, 0.03);
  }

  .responsive-card-table tbody tr.entry-row-uncollected:hover {
    background: rgba(220, 38, 38, 0.06);
  }

  .responsive-card-table tbody tr.entry-row-expense {
    background: rgba(220, 38, 38, 0.07);
  }

  .responsive-card-table tbody tr.entry-row-expense:hover {
    background: rgba(220, 38, 38, 0.12);
  }

  .responsive-card-table tbody tr + tr td {
    border-top: 0;
  }

  .responsive-card-table td {
    padding: 0;
    border: 0;
    background: transparent !important;
    box-shadow: none;
    text-align: left;
    min-width: 0;
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .responsive-card-table td + td {
    margin-top: 10px;
  }

  .responsive-card-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .responsive-card-table td.empty-state::before {
    display: none;
  }

  .responsive-card-table .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .responsive-card-table .row-actions .icon-button + .icon-button {
    margin-left: 0;
  }

  .responsive-card-table .document-inline-actions {
    flex-wrap: wrap;
  }

  .responsive-card-table .document-link {
    white-space: normal;
  }

  .responsive-card-table .invoice-value-cell strong,
  .responsive-card-table .expense-supplier > span:first-child,
  .responsive-card-table tbody td:first-child {
    font-weight: 600;
  }

  .profile-card .entry-form {
    grid-template-columns: 1fr;
  }

  .profile-display-name-field,
  .profile-business-name-field,
  .profile-caen-field,
  .profile-registration-field,
  .profile-company-field,
  .profile-vat-field,
  .profile-email-field,
  .profile-phone-field,
  .profile-address-field,
  .profile-bank-field,
  .profile-iban-field,
  .profile-card .actions {
    grid-column: 1 / -1;
  }

  .modal-backdrop {
    padding: 12px;
    align-items: end;
  }

  .modal-head {
    flex-direction: column;
  }

  .modal-card {
    width: 100%;
    max-height: min(88dvh, 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .auth-card {
    padding: 24px;
    border-radius: var(--radius-xl);
  }

  .actions {
    gap: 8px;
  }

  .actions button,
  .actions .upload-button {
    width: 100%;
    justify-content: center;
  }

  .import-result-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── 27. Responsive – 540px ───────────────────────────── */
@media (max-width: 540px) {
  .page-shell {
    width: calc(100% - 12px);
  }

  .module-switch {
    grid-template-columns: 1fr;
  }

  .module-tab-label {
    display: none;
  }

  .module-tab {
    justify-content: center;
  }

  .summary-grid,
  .import-result-grid {
    grid-template-columns: 1fr;
  }

  th, td {
    padding: 7px 8px;
  }

  .journal-table thead th,
  .journal-table tbody td {
    font-size: 0.82rem;
  }

  .journal-table {
    min-width: 680px;
  }

  .journal-table th:nth-child(3),
  .journal-table td:nth-child(3) { min-width: 96px; max-width: 96px; }

  .journal-table th:nth-child(4),
  .journal-table td:nth-child(4) { min-width: 90px; max-width: 90px; }

  .journal-table th:nth-child(5),
  .journal-table td:nth-child(5) { min-width: 160px; }

  .journal-table th:nth-child(6),
  .journal-table th:nth-child(7),
  .journal-table th:nth-child(8),
  .journal-table th:nth-child(9),
  .journal-table td:nth-child(6),
  .journal-table td:nth-child(7),
  .journal-table td:nth-child(8),
  .journal-table td:nth-child(9),
  .journal-table th:nth-child(10),
  .journal-table td:nth-child(10) { min-width: 76px; }

  .actions-column { width: 52px; min-width: 52px; }

  .icon-button { min-width: 24px; min-height: 24px; font-size: 0.78rem; }

  .panel-head-inline h2,
  .expenses-head h2 {
    font-size: 1.45rem;
  }

  .auth-card,
  .profile-card,
  .modal-card,
  .panel {
    border-radius: var(--radius);
  }
}

/* ── 28. Print ────────────────────────────────────────── */
@media print {
  body {
    background: #fff;
    overflow: auto;
    height: auto;
  }

  .compact-panel,
  .toolbar,
  .action-row,
  .row-actions,
  .actions-column,
  .modal-backdrop {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    padding: 0;
    height: auto;
  }

  .panel,
  .summary-card {
    box-shadow: none;
    border: 1px solid #ccc;
    backdrop-filter: none;
    background: #fff;
  }

  .panel {
    padding: 12px;
    border: 0;
  }

  .table-wrap {
    overflow: visible;
    border: 1px solid #000;
    border-radius: 0;
  }

  .journal-table {
    min-width: 0;
    font-size: 12px;
  }

  .journal-table th,
  .journal-table td {
    border: 1px solid #000;
    padding: 8px 6px;
  }

  .summary-grid {
    margin-bottom: 12px;
  }
}

/* ===== Documents module ===== */
.documents-panel {
  display: block;
  overflow-y: auto;
  padding-bottom: 24px;
}

.documents-tree {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  padding: 12px;
  margin-bottom: 16px;
}

.documents-tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

.documents-tree-row-clickable {
  cursor: pointer;
}

.documents-tree-row-clickable:hover {
  background: var(--bg-accent);
}

.documents-tree-folder-row {
  transition: background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}

.documents-tree-folder-row:hover {
  background: var(--brand-muted);
  border-color: var(--brand);
}

.documents-tree-folder-row:hover .documents-tree-icon {
  color: var(--brand-strong);
}

.documents-tree-folder-row:hover .documents-tree-label {
  color: var(--brand-strong);
}

.documents-tree-year-row {
  font-size: 1.02rem;
}

.documents-tree-type-row {
  font-weight: 600;
}

.documents-tree-month-row {
  padding-left: 4px;
}

.documents-tree-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.documents-tree-arrow-open {
  transform: rotate(90deg);
}

.documents-tree-arrow-spacer {
  visibility: hidden;
}

.documents-tree-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--brand-strong);
}

.documents-tree-icon-year,
.documents-tree-icon-month {
  color: var(--text-muted);
}

.documents-tree-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documents-year-title {
  font-weight: 700;
}

.documents-type-title {
  color: var(--brand-strong);
}

.documents-month-title {
  font-size: 0.9rem;
}

.documents-tree-children {
  margin: 2px 0 4px 14px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.documents-tree-branch {
  margin: 2px 0;
}

.documents-folder-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.documents-month-empty-state {
  border: 1px solid var(--warn-muted);
  background: var(--warn-subtle);
  border-radius: var(--radius-sm);
}

.documents-files {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.documents-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-accent);
  margin-bottom: 6px;
}

.documents-file-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 500;
}

.documents-file-meta {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.documents-file-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.documents-empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
}

.icon-button.danger-icon-button {
  color: var(--warn);
}

.icon-button.danger-icon-button:hover {
  background: var(--warn-subtle);
  border-color: var(--warn-muted);
}

.documents-file-count {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .documents-file {
    flex-wrap: wrap;
  }

  .documents-tree-children {
    margin-left: 8px;
    padding-left: 4px;
  }
}

