:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --bg-deep: #ecefe9;
  --surface: #ffffff;
  --surface-2: #f7f8f4;
  --surface-3: #eef1ea;
  --ink: #151a17;
  --ink-soft: #2f3833;
  --muted: #69766f;
  --line: #dde4dd;
  --line-strong: #c9d3ca;
  --accent: #0a806f;
  --accent-strong: #075e54;
  --gold: #a9824b;
  --positive: #16845f;
  --negative: #bd463d;
  --warning: #c77a25;
  --info: #355f87;
  --shadow: 0 22px 55px rgba(22, 29, 25, 0.12);
  --shadow-soft: 0 10px 28px rgba(22, 29, 25, 0.07);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 247, 244, 0.98)),
    var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
}

::selection {
  background: rgba(10, 128, 111, 0.2);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(10, 128, 111, 0.12), rgba(184, 135, 70, 0.14)),
    var(--bg);
}

.auth-panel {
  width: min(430px, 100%);
  padding: 36px;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(222, 214, 200, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 12px 28px rgba(10, 128, 111, 0.22);
}

.auth-panel h1 {
  margin: 24px 0 5px;
  font-size: 30px;
  letter-spacing: 0;
}

.auth-panel p {
  margin: 0 0 24px;
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 128, 111, 0.15);
}

.auth-panel label + label {
  margin-top: 14px;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 15px;
  font-weight: 760;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.primary-button {
  background:
    linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 12px 24px rgba(10, 128, 111, 0.2);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(10, 128, 111, 0.26);
}

.ghost-button {
  background: #f1f3ef;
  color: var(--ink);
  border: 1px solid transparent;
}

.ghost-button:hover {
  background: #e7ebe4;
  border-color: var(--line-strong);
}

.danger-button {
  background: #fff0ed;
  color: var(--negative);
}

.icon-button {
  width: 40px;
  padding: 0;
  background: #f1ede4;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.auth-panel .primary-button {
  width: 100%;
  margin-top: 22px;
}

.form-message {
  min-height: 20px;
  margin-top: 14px !important;
  color: var(--negative) !important;
}

.modal-message {
  margin: 0 24px 14px !important;
  font-weight: 760;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 14px;
  background:
    linear-gradient(180deg, #111713 0%, #18211c 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #f5efe4;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 5px 28px;
  padding: 8px 5px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  letter-spacing: 0;
}

.sidebar-brand span {
  color: rgba(245, 239, 228, 0.62);
  font-size: 13px;
}

.main-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(245, 239, 228, 0.64);
  text-align: left;
  padding: 0 13px 0 28px;
  font-weight: 720;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: 99px;
  background: var(--gold);
  opacity: 0;
  transform: translateY(-50%);
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 253, 248, 0.12);
  color: #fffdf8;
}

.nav-item.active::before {
  opacity: 1;
}

.main-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 30px;
  background: rgba(251, 252, 249, 0.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(221, 228, 221, 0.92);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.compact-field {
  min-width: 150px;
}

.period-field {
  min-width: 170px;
}

.view {
  min-width: 0;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px 30px 48px;
}

.executive-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(480px, 0.88fr);
  gap: 16px;
  margin-bottom: 16px;
  padding: 20px;
  background:
    linear-gradient(135deg, #111713 0%, #1e2b25 58%, #3b3a2f 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: #fffdf8;
  box-shadow: var(--shadow);
}

.overview-copy {
  display: grid;
  align-content: center;
  gap: 9px;
}

.overview-copy h3 {
  margin: 0;
  font-size: clamp(26px, 2.2vw, 36px);
  line-height: 1.04;
  letter-spacing: 0;
}

.overview-copy p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 253, 248, 0.76);
  font-size: 14px;
  line-height: 1.5;
}

.premium-badge {
  width: fit-content;
  background: rgba(255, 253, 248, 0.12) !important;
  color: #f9ead2 !important;
}

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

.overview-metric {
  min-height: 108px;
  padding: 14px;
  background: rgba(255, 253, 248, 0.075);
  border: 1px solid rgba(255, 253, 248, 0.13);
  border-radius: var(--radius);
}

.overview-metric span,
.overview-metric small {
  display: block;
  color: rgba(255, 253, 248, 0.62);
  font-size: 12px;
  font-weight: 760;
}

.overview-metric strong {
  display: block;
  margin: 12px 0 7px;
  color: #fffdf8;
  font-size: clamp(22px, 1.9vw, 30px);
  line-height: 1;
}

.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(520px, 0.9fr);
  gap: 16px;
  margin-bottom: 16px;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 248, 244, 0.94));
  border: 1px solid rgba(221, 228, 221, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 9px;
}

.hero-copy h3 {
  margin: 0;
  font-size: clamp(25px, 2.4vw, 36px);
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 640;
  line-height: 1.5;
}

.page-hero .premium-badge {
  background: rgba(10, 128, 111, 0.1) !important;
  color: var(--accent-strong) !important;
}

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

.page-hero .overview-metric {
  min-height: 112px;
  background: var(--surface);
  border-color: rgba(221, 228, 221, 0.92);
}

.page-hero .overview-metric span,
.page-hero .overview-metric small {
  color: var(--muted);
}

.page-hero .overview-metric strong {
  color: var(--ink);
  font-size: clamp(20px, 1.9vw, 28px);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.kpi {
  position: relative;
  min-height: 116px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(221, 228, 221, 0.96);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(22, 29, 25, 0.055);
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--gold);
  opacity: 0.45;
}

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

.kpi strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(21px, 1.7vw, 28px);
  line-height: 1.02;
  letter-spacing: 0;
}

.kpi small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.positive {
  color: var(--positive) !important;
}

.negative {
  color: var(--negative) !important;
}

.warning {
  color: var(--warning) !important;
}

.alert-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 13px 15px;
  background: #fff8ed;
  border: 1px solid #ecd8b8;
  border-left: 3px solid var(--warning);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.alert-band.negative {
  background: #fff3f0;
  border-color: #edc5bd;
  border-left-color: var(--negative);
}

.alert-band strong {
  color: var(--ink);
}

.alert-band span {
  color: var(--muted);
  font-weight: 740;
}

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

.insight-card {
  min-height: 92px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(221, 228, 221, 0.92);
  border-radius: var(--radius);
}

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

.insight-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.insight-card div {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.progress-track {
  display: block;
  height: 7px;
  background: #e4e8df;
  border-radius: 99px;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  background:
    linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: inherit;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(360px, 0.68fr);
  gap: 16px;
  margin-top: 16px;
}

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

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(221, 228, 221, 0.96);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
  box-shadow: 0 8px 24px rgba(22, 29, 25, 0.055);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.panel h3,
.section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 780;
  letter-spacing: 0;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: -5px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 18px;
  white-space: nowrap;
}

.chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--legend-color);
  box-shadow: 0 0 0 3px rgba(12, 128, 111, 0.08);
}

.chart {
  width: 100%;
  height: 300px;
  display: block;
}

.mix-list {
  display: grid;
  gap: 12px;
}

.mix-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 1fr);
  align-items: center;
  gap: 14px;
}

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

.mix-row strong {
  font-size: 13px;
  font-weight: 780;
}

.mix-row div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 640;
}

.mix-bar {
  height: 9px;
  background: #e5e9e1;
  border-radius: 99px;
  overflow: hidden;
}

.mix-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.mix-bar.positive span {
  background: var(--positive);
}

.mix-bar.negative span {
  background: var(--negative);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

th,
td {
  border-bottom: 1px solid #e7ece6;
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
}

th:first-child,
td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
  min-width: 220px;
}

thead th {
  background: #f3f5f0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f8faf6;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef1ea;
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}

.status-confirmé {
  background: #e3f4ec;
  color: var(--positive);
}

.status-prévu {
  background: #e7eef5;
  color: var(--info);
}

.status-prospection {
  background: #fff0dc;
  color: var(--warning);
}

.status-annulé {
  background: #fff0ed;
  color: var(--negative);
}

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

.search-field {
  max-width: 360px;
}

.items-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(180px, 0.75fr) minmax(160px, 0.65fr) auto minmax(150px, 0.55fr);
  gap: 12px;
  align-items: end;
  margin: 0 0 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(22, 29, 25, 0.045);
}

.toolbar-search input {
  min-width: 0;
}

.toolbar-summary {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.toolbar-summary span {
  font-weight: 720;
  text-transform: uppercase;
}

.toolbar-summary strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.1;
}

.toolbar-summary small {
  font-size: 11px;
}

.list-panel {
  padding: 16px;
}

.actions-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.list-table-wrap {
  max-height: min(72vh, 840px);
  overflow: auto;
}

.list-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 4;
}

.items-table th:first-child,
.items-table td:first-child {
  min-width: 330px;
}

.items-table th:last-child,
.items-table td:last-child {
  width: 96px;
  text-align: right;
}

.item-main,
.item-main strong,
.item-main small {
  display: block;
}

.item-main strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 740;
}

.item-main small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f0f3ee;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.invoice-toolbar {
  grid-template-columns: minmax(280px, 1.2fr) minmax(150px, 0.48fr) auto auto minmax(150px, 0.5fr);
}

.payment-toolbar {
  grid-template-columns: minmax(280px, 1.2fr) minmax(150px, 0.48fr) auto minmax(150px, 0.5fr);
}

.expense-report-toolbar {
  grid-template-columns: minmax(280px, 1.2fr) minmax(150px, 0.48fr) auto minmax(150px, 0.5fr);
}

.expense-reports-table th:first-child,
.expense-reports-table td:first-child {
  min-width: 260px;
}

.expense-reports-table th:nth-child(4),
.expense-reports-table td:nth-child(4) {
  min-width: 140px;
}

.muted-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.payments-table th:first-child,
.payments-table td:first-child {
  min-width: 150px;
}

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

.payments-table th:nth-child(3),
.payments-table td:nth-child(3) {
  min-width: 150px;
}

.payments-table tr.is-late-payment td:first-child {
  box-shadow: inset 3px 0 0 var(--negative);
}

.payment-status.is-negative {
  font-weight: 850;
}

.invoices-table th:first-child,
.invoices-table td:first-child {
  min-width: 190px;
}

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

.invoice-note {
  max-width: 280px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.invoice-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 780;
  white-space: nowrap;
}

.invoice-status.is-open {
  background: #edf1ea;
  color: var(--ink-soft);
}

.invoice-status.is-warning,
.invoice-status.is-partial {
  background: #fff0dc;
  color: var(--warning);
}

.invoice-status.is-paid {
  background: #e3f4ec;
  color: var(--positive);
}

.invoice-status.is-negative {
  background: #fff0ed;
  color: var(--negative);
}

.invoice-status.is-muted,
.invoice-status.is-incomplete {
  background: #f1f3f0;
  color: var(--muted);
}

.invoice-calendar-panel {
  margin-top: 0;
}

.invoice-calendar-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: -5px 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.invoice-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.invoice-calendar-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.invoice-calendar-legend i.is-issue {
  background: var(--warning);
}

.invoice-calendar-legend i.is-payment {
  background: var(--positive);
}

.invoice-calendar-legend i.is-incomplete {
  background: var(--muted);
}

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

.invoice-month-card {
  min-height: 260px;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.invoice-month-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.invoice-month-head strong,
.invoice-month-head small {
  display: block;
}

.invoice-month-head strong {
  font-size: 15px;
  font-weight: 820;
}

.invoice-month-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 640;
}

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

.invoice-month-totals span {
  padding: 10px;
  background: var(--surface);
  border: 1px solid #e7ece6;
  border-radius: 8px;
}

.invoice-month-totals strong,
.invoice-month-totals small {
  display: block;
}

.invoice-month-totals strong {
  font-size: 13px;
  font-weight: 820;
}

.invoice-month-totals small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.invoice-event-list {
  display: grid;
  gap: 8px;
}

.invoice-event {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 9px;
  border: 1px solid #e2e8e2;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.invoice-event:hover {
  border-color: rgba(10, 128, 111, 0.24);
  background: #f7fbf8;
}

.invoice-event-date {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #edf1ea;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.invoice-event.is-issue .invoice-event-date {
  background: #fff0dc;
  color: var(--warning);
}

.invoice-event.is-payment .invoice-event-date {
  background: #e3f4ec;
  color: var(--positive);
}

.invoice-event.is-incomplete .invoice-event-date {
  background: #f1f3f0;
  color: var(--muted);
}

.invoice-event-copy {
  min-width: 0;
}

.invoice-event-copy strong,
.invoice-event-copy small {
  display: block;
}

.invoice-event-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-event-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 640;
}

.invoice-event-amount {
  color: var(--ink);
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
}

.invoice-undated {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.invoice-undated h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.compact-empty {
  padding: 16px;
  font-size: 12px;
}

.rhythm-cell {
  color: var(--muted);
  font-size: 12px;
}

.amount-cell {
  min-width: 150px;
  vertical-align: middle;
}

.amount-cell strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.row-share {
  display: block;
  height: 6px;
  background: #e5e9e1;
  border-radius: 999px;
  overflow: hidden;
}

.row-share span {
  display: block;
  height: 100%;
  background: currentColor;
  border-radius: inherit;
}

.compact-action {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.cashflow-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(22, 29, 25, 0.045);
}

.cashflow-toolbar strong,
.cashflow-toolbar small {
  display: block;
}

.cashflow-toolbar strong {
  font-size: 15px;
  font-weight: 780;
}

.cashflow-toolbar small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.cashflow-payment-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding: 6px 9px;
  color: var(--muted);
  background: rgba(247, 249, 246, 0.92);
  border: 1px solid rgba(210, 219, 210, 0.9);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 760;
}

.cashflow-payment-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cashflow-payment-legend i {
  width: 7px;
  height: 14px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 13%, transparent);
}

.cashflow-payment-legend .payment-state-paid {
  color: var(--positive);
}

.cashflow-payment-legend .payment-state-planned {
  color: #c98220;
}

.cashflow-payment-legend .payment-state-late {
  color: var(--negative);
}

.segmented-control {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: #edf1ea;
  border: 1px solid #dfe6df;
  border-radius: 8px;
}

.segmented-control button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 760;
}

.segmented-control button.active {
  background: var(--ink);
  color: white;
  box-shadow: 0 8px 18px rgba(21, 26, 23, 0.16);
}

details.cash-section {
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

details.cash-section summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  font-weight: 780;
  cursor: pointer;
}

.section-total {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.section-total small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 620;
}

details.cash-section summary::-webkit-details-marker {
  display: none;
}

.cash-table {
  min-width: 1220px;
}

.cashflow-wrap {
  max-height: min(68vh, 680px);
  overflow: auto;
}

.cashflow-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 4;
}

.cashflow-wrap th:first-child,
.cashflow-wrap td:first-child {
  min-width: 255px;
  background: var(--surface);
  box-shadow: 8px 0 16px rgba(22, 29, 25, 0.05);
}

.cashflow-wrap thead th:first-child {
  z-index: 6;
  background: #f3f5f0;
}

.cashflow-wrap th:last-child,
.cashflow-wrap td:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  min-width: 118px;
  background: var(--surface);
  box-shadow: -8px 0 16px rgba(22, 29, 25, 0.06);
  font-weight: 820;
}

.cashflow-wrap thead th:last-child {
  z-index: 6;
  background: #f3f5f0;
}

.cashflow-wrap .cash-group-row td {
  position: static;
  left: auto;
  right: auto;
  z-index: 2;
  min-width: 0;
  padding: 12px 14px;
  text-align: left;
  background: #f8faf6;
  border-top: 1px solid #dce5dd;
  border-bottom: 1px solid #dce5dd;
  box-shadow: none;
}

.cash-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cash-group-copy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cash-group-copy i {
  width: 9px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--group-color);
  box-shadow: 0 0 0 4px rgba(12, 128, 111, 0.07);
}

.cash-group-copy strong,
.cash-group-copy small,
.cash-group-total strong,
.cash-group-total small {
  display: block;
}

.cash-group-copy strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 820;
}

.cash-group-copy small,
.cash-group-total small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 640;
}

.cash-group-total {
  display: grid;
  justify-items: end;
  gap: 1px;
  flex: 0 0 auto;
  text-align: right;
}

.cash-group-total strong {
  font-size: 13px;
  font-weight: 840;
}

.cash-table .line-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cash-table .line-copy {
  display: grid;
  min-width: 0;
}

.cash-table .line-copy strong {
  max-width: 165px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cash-table .line-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 620;
}

.cash-table .edit-line {
  border: 1px solid rgba(10, 128, 111, 0.14);
  border-radius: 999px;
  background: #eef7f3;
  color: var(--accent);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 760;
}

.money-input {
  width: 82px;
  min-height: 32px;
  padding: 6px 7px;
  text-align: right;
  background: var(--surface);
}

.money-input.zero-cell,
td.zero-cell {
  color: #a8b3ad;
}

.money-input.zero-cell {
  background: #fbfcfa;
  border-color: #edf2ed;
}

.money-input.revenue-cell {
  border-color: rgba(22, 132, 95, 0.24);
  background: #fbfffd;
}

.money-input.expense-cell {
  border-color: rgba(189, 70, 61, 0.24);
  background: #fffdfc;
}

.money-input[readonly] {
  cursor: default;
}

.readonly-money-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7f8f4;
  font-weight: 760;
}

.readonly-money-cell.expense-cell {
  color: var(--negative);
}

.readonly-money-cell.zero-cell {
  color: var(--muted);
}

.money-input.payment-status-field,
.readonly-money-cell.payment-status-field,
.money-input.invoice-status-field,
.readonly-money-cell.invoice-status-field {
  --payment-status-color: var(--positive);
  --payment-status-border: rgba(22, 132, 95, 0.34);
  --payment-status-bg: rgba(22, 132, 95, 0.045);
  --payment-status-focus: rgba(22, 132, 95, 0.13);
  border-color: var(--payment-status-border);
  background:
    linear-gradient(90deg, var(--payment-status-bg) 0 12px, rgba(255, 255, 255, 0.9) 12px),
    #fff;
  box-shadow:
    inset 3px 0 0 var(--payment-status-color),
    0 1px 2px rgba(22, 29, 25, 0.035);
  color: var(--ink);
  font-weight: 780;
}

.money-input.payment-status-field:focus,
.money-input.invoice-status-field:focus {
  border-color: var(--payment-status-color);
  box-shadow:
    inset 3px 0 0 var(--payment-status-color),
    0 0 0 3px var(--payment-status-focus);
}

.payment-status-field.paystate-paid {
  --payment-status-color: var(--positive);
  --payment-status-border: rgba(22, 132, 95, 0.34);
  --payment-status-bg: rgba(22, 132, 95, 0.045);
  --payment-status-focus: rgba(22, 132, 95, 0.13);
}

.payment-status-field.paystate-planned {
  --payment-status-color: #c98220;
  --payment-status-border: rgba(201, 130, 32, 0.32);
  --payment-status-bg: rgba(201, 130, 32, 0.045);
  --payment-status-focus: rgba(201, 130, 32, 0.13);
}

.payment-status-field.paystate-late {
  --payment-status-color: var(--negative);
  --payment-status-border: rgba(189, 70, 61, 0.34);
  --payment-status-bg: rgba(189, 70, 61, 0.045);
  --payment-status-focus: rgba(189, 70, 61, 0.13);
}

.invoice-status-field.invstate-paid {
  --payment-status-color: var(--positive);
  --payment-status-border: rgba(22, 132, 95, 0.34);
  --payment-status-bg: rgba(22, 132, 95, 0.045);
  --payment-status-focus: rgba(22, 132, 95, 0.13);
}

.invoice-status-field.invstate-open {
  --payment-status-color: #c98220;
  --payment-status-border: rgba(201, 130, 32, 0.32);
  --payment-status-bg: rgba(201, 130, 32, 0.045);
  --payment-status-focus: rgba(201, 130, 32, 0.13);
}

.invoice-status-field.invstate-risk {
  --payment-status-color: var(--negative);
  --payment-status-border: rgba(189, 70, 61, 0.34);
  --payment-status-bg: rgba(189, 70, 61, 0.045);
  --payment-status-focus: rgba(189, 70, 61, 0.13);
}

.invoice-status-field.invstate-muted {
  --payment-status-color: #87928c;
  --payment-status-border: rgba(105, 116, 111, 0.26);
  --payment-status-bg: rgba(105, 116, 111, 0.045);
  --payment-status-focus: rgba(105, 116, 111, 0.12);
}

.cashflow-wrap tbody tr:focus-within {
  background: #f4faf7;
}

.total-row {
  background: #f3f5f0;
  font-weight: 780;
}

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

.full-width {
  grid-column: 1 / -1;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(21, 26, 23, 0.48);
  backdrop-filter: blur(8px);
}

.modal {
  width: min(980px, 100%);
  max-height: min(92vh, 900px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-header h3 {
  margin: 0;
}

.modal-body {
  padding: 18px 20px;
  overflow: auto;
  background: #fbfcfa;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.modal-summary-card {
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.modal-summary-card span,
.modal-summary-card strong {
  display: block;
}

.modal-summary-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.modal-summary-card strong {
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.05;
}

.modal-form-shell {
  display: grid;
  gap: 14px;
}

.modal-section {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.modal-section-title {
  margin-bottom: 12px;
}

.modal-section-title h4 {
  margin: 0;
  font-size: 15px;
}

.modal-section-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-section-title .modal-payment-context {
  display: inline-flex;
  margin-top: 8px;
  padding: 7px 9px;
  color: var(--ink);
  background: #edf8f4;
  border: 1px solid #c7e9dd;
  border-radius: 10px;
  font-weight: 800;
}

.modal-link-context {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 10px;
  color: var(--ink);
  background: #f7fbf8;
  border: 1px solid #dce8df;
  border-radius: 10px;
}

.modal-link-context.is-empty {
  color: var(--muted);
  background: #fbfcfa;
}

.modal-link-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}

.modal-link-head strong,
.modal-link-head span,
.modal-link-more {
  display: block;
}

.modal-link-head strong {
  font-size: 12px;
}

.modal-link-head span,
.modal-link-more {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

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

.modal-linked-invoice {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.modal-linked-invoice > span,
.modal-linked-invoice small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
}

.modal-linked-invoice strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-link-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.invoice-link-summary span,
.invoice-link-row,
.invoice-link-suggestion {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invoice-link-summary strong,
.invoice-link-row strong,
.invoice-link-suggestions strong {
  font-size: 12px;
}

.invoice-link-summary small,
.invoice-link-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.invoice-link-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.invoice-link-form {
  display: grid;
  grid-template-columns: 1fr 160px 160px auto;
  gap: 10px;
  align-items: end;
}

.invoice-link-suggestions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.invoice-link-suggestion {
  width: 100%;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.invoice-link-suggestion:hover {
  border-color: #0d8a78;
}

.expense-report-lines-section {
  display: grid;
  gap: 12px;
}

.expense-report-lines {
  display: grid;
  gap: 10px;
}

.expense-report-line-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fbfcfa;
  border: 1px solid #dce8df;
  border-radius: var(--radius);
}

.expense-report-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.expense-report-line-head strong {
  font-size: 13px;
  font-weight: 820;
}

.expense-report-line-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(120px, 0.55fr) minmax(130px, 0.6fr) minmax(120px, 0.55fr);
  gap: 10px;
}

.expense-report-add-line {
  justify-self: start;
}

@media (max-width: 980px) {
  .invoice-link-form {
    grid-template-columns: 1fr;
  }

  .expense-report-line-grid {
    grid-template-columns: 1fr;
  }
}

.modal-fields {
  gap: 12px;
}

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

.modal-month-field {
  padding: 10px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.modal-month-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}

.modal-month-field input {
  min-height: 38px;
  margin-top: 5px;
  padding: 8px 9px;
  text-align: right;
}

.modal-revenue-month {
  display: grid;
  gap: 6px;
}

.modal-month-note {
  display: block;
  min-height: 14px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-paid-toggle {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.modal-paid-toggle input {
  width: 15px;
  min-height: 15px;
  margin: 0;
  accent-color: var(--positive);
}

.modal-paid-toggle em {
  font-style: normal;
}

.modal-month-field.is-zero {
  opacity: 0.72;
}

.modal-month-field.is-zero input {
  color: #9ba8a1;
  background: #fbfcfa;
  border-color: #e9eee9;
}

.modal-month-field.is-active {
  border-color: rgba(10, 128, 111, 0.22);
  background: #fbfffd;
}

.modal-month-field.is-linked {
  border-color: rgba(201, 130, 32, 0.24);
}

.modal-month-field.is-paid {
  border-color: rgba(22, 132, 95, 0.42);
  background:
    linear-gradient(90deg, rgba(22, 132, 95, 0.055), rgba(255, 255, 255, 0) 45%),
    #fbfffd;
}

.modal-month-field.is-paid .modal-month-note {
  color: var(--positive);
}

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

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
  margin-top: 16px;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 16px;
  margin-top: 16px;
}

.settings-primary,
.settings-actions-panel,
.admin-card,
.activity-card {
  min-height: 0;
}

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

.setting-field {
  padding: 12px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.setting-field > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 780;
}

.setting-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.setting-field input,
.setting-field textarea {
  margin-top: 2px;
  background: var(--surface);
}

.settings-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #f3f7f4;
  border: 1px solid #dce8df;
  border-radius: var(--radius);
}

.settings-save-bar span {
  color: var(--muted);
  font-size: 12px;
}

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

.export-action {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.export-action:hover {
  transform: translateY(-1px);
  border-color: rgba(10, 128, 111, 0.28);
  background: #f7fbf8;
  box-shadow: 0 10px 24px rgba(22, 29, 25, 0.07);
}

.export-action strong {
  font-size: 13px;
  font-weight: 800;
}

.export-action span {
  color: var(--muted);
  font-size: 12px;
}

.month-register-export {
  gap: 10px;
}

.month-register-export:hover {
  transform: none;
}

.month-register-export label {
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}

.month-register-export select {
  min-height: 38px;
  background: var(--surface);
}

.export-inline-button {
  width: max-content;
  min-height: 38px;
  padding: 0 14px;
  text-decoration: none;
}

.user-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.65fr);
  gap: 12px;
  margin-bottom: 14px;
}

.settings-table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.users-table th:first-child,
.users-table td:first-child {
  min-width: 260px;
}

.user-identity,
.user-identity strong,
.user-identity small {
  display: block;
}

.user-identity strong {
  font-weight: 760;
}

.user-identity small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.activity-table {
  max-height: 660px;
}

.activity-list {
  display: grid;
}

.activity-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid #e7ece6;
}

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

.activity-date {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.activity-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.activity-copy strong {
  font-size: 12px;
  font-weight: 780;
}

.activity-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: #eef1ea;
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
}

.activity-badge.positive {
  background: #e5f5ed;
  color: var(--positive);
}

.activity-badge.negative {
  background: #fff0ed;
  color: var(--negative);
}

.activity-badge.info {
  background: #e7eef5;
  color: var(--info);
}

.admin-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 800;
}

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

.compact-table th,
.compact-table td {
  white-space: normal;
  vertical-align: middle;
}

.role-select {
  min-width: 130px;
}

.mini-stat {
  padding: 15px;
  background: #f3f5f0;
  border: 1px solid #e1e7df;
  border-radius: var(--radius);
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 21px;
}

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

@media (max-width: 1280px) {
  .executive-overview,
  .page-hero {
    grid-template-columns: 1fr;
  }

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

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .nav-item {
    text-align: center;
    padding-left: 13px;
  }

  .nav-item::before,
  .nav-item.active::after {
    display: none;
  }

  .grid-2,
  .admin-grid,
  .settings-layout,
  .comparison-grid,
  .insight-grid,
  .compact-analytics,
  .items-toolbar,
  .invoice-calendar-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .topbar,
  .actions-row,
  .alert-band,
  .cashflow-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .segmented-control {
    width: 100%;
  }

  .cashflow-payment-legend {
    flex-wrap: wrap;
    margin-left: 0;
  }

  .segmented-control button {
    flex: 1;
  }

  .topbar-actions,
  .split-form,
  .modal-summary-grid,
  .modal-month-grid,
  .month-grid,
  .kpi-grid,
  .grid-2,
  .admin-grid,
  .settings-layout,
  .comparison-grid,
  .insight-grid,
  .compact-analytics,
  .items-toolbar,
  .invoice-calendar-grid,
  .settings-form-grid,
  .user-create-form,
  .overview-ledger,
  .hero-stats {
    grid-template-columns: 1fr;
    display: grid;
  }

  .view {
    padding: 18px;
  }

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

  .executive-overview,
  .page-hero {
    padding: 18px;
  }

  .mix-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .cash-group-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .cash-group-total {
    justify-items: start;
    text-align: left;
  }

  .settings-save-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .activity-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .modal {
    max-height: 96vh;
  }
}
