/* ==========================================================================
   RentLedger — quiet ledger design system
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4f2ec;
  --paper-2: #eeebe2;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --surface-3: #f3f1e9;
  --ink: #17211e;
  --ink-2: #394641;
  --muted: #6c7872;
  --muted-2: #8d968f;
  --line: #e4e1d7;
  --line-2: #d5d1c3;
  --pine: #1d5c4f;
  --pine-700: #164a3f;
  --pine-900: #0d2c26;
  --pine-tint: #e6efeb;
  --copper: #b8763b;
  --copper-tint: #f6eadc;
  --green: #2c7a58;
  --green-tint: #e4f1ea;
  --red: #b4472f;
  --red-tint: #f8e7e1;
  --amber: #a56a1c;
  --amber-tint: #f8eedb;
  --blue: #35618f;
  --blue-tint: #e8eff7;
  --shadow-sm: 0 1px 2px rgba(23, 33, 30, 0.05);
  --shadow-md: 0 10px 30px rgba(23, 33, 30, 0.08);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 252px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

img, svg {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

::selection {
  background: var(--copper-tint);
  color: var(--ink);
}

.icon {
  flex: none;
}

.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;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 14px;
  color: #dfe9e3;
  background:
    radial-gradient(circle at 18% 8%, rgba(184, 118, 59, 0.16), transparent 38%),
    linear-gradient(180deg, #143f36 0%, #0c2a24 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 18px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f0d9c1;
}

.brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-company {
  margin-top: 3px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(223, 233, 227, 0.55);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.nav-group {
  margin-top: 18px;
}

.nav-group:first-child {
  margin-top: 10px;
}

.nav-label {
  padding: 0 10px 6px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(223, 233, 227, 0.42);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: 8px;
  color: rgba(233, 240, 236, 0.76);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}

.nav-link .icon {
  opacity: 0.72;
}

.nav-link.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--copper);
}

.nav-link.is-active .icon {
  opacity: 1;
  color: #f0d9c1;
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
}

.sidebar-foot {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 6px;
  border-radius: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--copper-tint);
  color: #7a4a20;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.user-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 10px;
  text-transform: capitalize;
  color: rgba(223, 233, 227, 0.5);
}

.user-chip form {
  margin: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar .icon-btn {
  color: rgba(233, 240, 236, 0.62);
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(13, 44, 38, 0.42);
  backdrop-filter: blur(2px);
}

.frame {
  min-height: 100vh;
  margin-left: var(--sidebar);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 30px;
  background: rgba(244, 242, 236, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.menu-btn {
  display: none;
}

.topbar-brand {
  display: none;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-date {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.topbar-sep {
  width: 1px;
  height: 14px;
  background: var(--line-2);
}

.topbar-context {
  font-size: 11.5px;
  color: var(--muted-2);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 30px 32px 60px;
}

.app-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px 22px;
  font-size: 11px;
  color: var(--muted-2);
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   Typography and page header
   -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.eyebrow {
  margin-bottom: 7px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--copper);
}

.page-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(27px, 3vw, 36px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
  color: var(--ink);
}

.page-sub {
  margin-top: 7px;
  max-width: 660px;
  font-size: 13.5px;
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.section-sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.text-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--pine);
  white-space: nowrap;
}

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

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.strong {
  font-weight: 600;
}

.nowrap {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
  box-shadow: 0 1px 2px rgba(13, 44, 38, 0.18);
}

.btn-primary:hover {
  background: var(--pine-700);
  border-color: var(--pine-700);
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink-2);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--muted-2);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--ink);
}

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

.btn-danger:hover {
  background: #973824;
  border-color: #973824;
  color: #fff;
}

.btn-outline-danger {
  background: transparent;
  border-color: rgba(180, 71, 47, 0.35);
  color: var(--red);
}

.btn-outline-danger:hover {
  background: var(--red-tint);
  border-color: var(--red);
  color: var(--red);
}

.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-lg {
  height: 44px;
  padding: 0 18px;
  font-size: 13.5px;
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Badges and tones
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-green { background: var(--green-tint); color: var(--green); }
.badge-red { background: var(--red-tint); color: var(--red); }
.badge-amber { background: var(--amber-tint); color: var(--amber); }
.badge-blue { background: var(--blue-tint); color: var(--blue); }
.badge-neutral { background: var(--surface-3); color: var(--muted); }
.badge-pine { background: var(--pine-tint); color: var(--pine); }
.badge-copper { background: var(--copper-tint); color: #8a5524; }

.tone-blue { background: var(--blue-tint); color: var(--blue); }
.tone-green { background: var(--green-tint); color: var(--green); }
.tone-red { background: var(--red-tint); color: var(--red); }
.tone-amber { background: var(--amber-tint); color: var(--amber); }
.tone-pine { background: var(--pine-tint); color: var(--pine); }
.tone-copper { background: var(--copper-tint); color: #8a5524; }
.tone-neutral { background: var(--surface-3); color: var(--muted); }

/* --------------------------------------------------------------------------
   Cards and layout helpers
   -------------------------------------------------------------------------- */

.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.card-body {
  padding: 20px;
}

.card-body-flush {
  padding: 0;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

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

.split-main {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr);
  gap: 20px;
  align-items: start;
}

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

.kpi {
  position: relative;
  padding: 17px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.kpi::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--line);
}

.kpi.tone-pine-line::after { background: var(--pine); }
.kpi.tone-red-line::after { background: var(--red); }
.kpi.tone-green-line::after { background: var(--green); }
.kpi.tone-copper-line::after { background: var(--copper); }

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

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.kpi-value {
  margin-top: 11px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(23px, 2.2vw, 30px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.kpi-meta {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 12.8px;
}

.table-invoices {
  min-width: 980px;
}

.table th {
  padding: 9px 16px;
  text-align: left;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: #fbfaf7;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table .strong {
  font-weight: 600;
}

.table .sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.table .row-title {
  font-weight: 600;
  color: var(--ink);
}

.table .row-title:hover {
  color: var(--pine);
  text-decoration: none;
}

.table .actions {
  text-align: right;
  white-space: nowrap;
}
.table .actions .text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.table tfoot td {
  padding: 12px 16px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
  font-weight: 600;
}

.table-compact td {
  padding: 9px 12px;
}

.table-compact th {
  padding: 8px 12px;
}

.table-negative {
  color: var(--red);
}

.row-link {
  color: var(--ink);
  font-weight: 600;
}

.row-link:hover {
  color: var(--pine);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

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

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

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

.field label,
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.field label .req {
  color: var(--copper);
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.textarea {
  height: auto;
  min-height: 100px;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c7872' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--muted-2);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(29, 92, 79, 0.12);
}

.input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
}

.hint {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

.error-text {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--red);
}

.money-wrap {
  position: relative;
}

.money-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.money-wrap .input {
  padding-left: 34px;
  font-variant-numeric: tabular-nums;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12.8px;
  color: var(--ink-2);
}

.check input[type='checkbox'],
.check input[type='radio'] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--pine);
  flex: none;
}

.check-copy {
  min-width: 0;
}

.check-title {
  font-weight: 600;
  color: var(--ink);
}

.check-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.form-section {
  padding-top: 20px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.form-section:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.form-section-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.form-section-sub {
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--muted);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.form-actions-split {
  justify-content: space-between;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group .input {
  flex: 1;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.checkbox-grid .check {
  padding: 7px 8px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.checkbox-grid .check:hover {
  border-color: var(--muted-2);
}

.tenant-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.tenant-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.tenant-option:hover {
  border-color: var(--muted-2);
}

.tenant-option input {
  margin-top: 3px;
  accent-color: var(--pine);
}

/* --------------------------------------------------------------------------
   Flash messages
   -------------------------------------------------------------------------- */

.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12.8px;
}

.flash .icon {
  margin-top: 1px;
}

.flash-success {
  background: var(--green-tint);
  border-color: rgba(44, 122, 88, 0.2);
  color: #1e5c41;
}

.flash-error {
  background: var(--red-tint);
  border-color: rgba(180, 71, 47, 0.22);
  color: #8c3422;
}

.flash-info {
  background: var(--blue-tint);
  border-color: rgba(53, 97, 143, 0.2);
  color: #2a4e73;
}

.flash-close {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.6;
}

.flash-close:hover {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Empty states, lists and detail grids
   -------------------------------------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 42px 24px;
}

.empty-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
}

.empty-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
}

.empty-text {
  max-width: 380px;
  margin: 5px 0 14px;
  font-size: 12.5px;
  color: var(--muted);
}

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

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

.detail-item {
  min-width: 0;
}

.detail-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.detail-value {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink);
  overflow-wrap: break-word;
}

.detail-value.large {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.list {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.list-item:first-child {
  padding-top: 0;
}

.list-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
}

.list-main {
  flex: 1;
  min-width: 0;
}

.list-title {
  font-size: 12.8px;
  font-weight: 600;
  color: var(--ink);
}

.list-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.list-meta {
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.attention-list .list-item {
  align-items: center;
}

.attention-list .list-title a {
  color: inherit;
}

.attention-list .list-title a:hover {
  color: var(--pine);
}

/* --------------------------------------------------------------------------
   Tabs, pagination, misc
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  padding: 10px 13px;
  border-bottom: 2px solid transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
  text-decoration: none;
}

.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--pine);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--muted);
}

.pagination-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.page-btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.page-current {
  font-weight: 600;
  color: var(--ink-2);
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-bar .field {
  min-width: 150px;
}

.filter-bar .field-grow {
  flex: 1;
  min-width: 220px;
}

.filter-bar .input,
.filter-bar .select {
  height: 36px;
  font-size: 12.5px;
}

.search-input {
  position: relative;
}

.search-input .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

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

.pill-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.pill:hover {
  border-color: var(--muted-2);
  color: var(--ink);
  text-decoration: none;
}

.pill.is-active {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
}

.chart-wrap {
  position: relative;
  height: 280px;
  padding: 12px 16px 16px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 5px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

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

.stat-row .label {
  color: var(--muted);
}

.stat-row .value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(165, 106, 28, 0.25);
  border-radius: 11px;
  background: var(--amber-tint);
  color: #7d5117;
  font-size: 12.5px;
}

.banner .icon {
  margin-top: 1px;
}

.banner strong {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Line item editor
   -------------------------------------------------------------------------- */

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

.line-table th {
  padding: 8px 8px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.line-table td {
  padding: 7px 8px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.line-table .input {
  height: 36px;
  font-size: 12.5px;
}

.line-table .line-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.line-table .line-actions {
  width: 36px;
  text-align: right;
}

.line-table .icon-btn {
  color: var(--muted);
}

.line-table .icon-btn:hover {
  background: var(--red-tint);
  color: var(--red);
}

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

.line-total-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.line-total-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Invoice / document cards
   -------------------------------------------------------------------------- */

.doc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px 28px;
}

.doc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.doc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--pine);
  color: #f0d9c1;
}

.doc-brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
}

.doc-brand-sub {
  font-size: 11px;
  color: var(--muted);
}

.doc-number {
  text-align: right;
}

.doc-number .label {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.doc-number .value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
}

.doc-meta-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 20px;
  padding: 20px 0;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.doc-table th {
  padding: 9px 10px;
  text-align: left;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line-2);
}

.doc-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
}

.doc-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.doc-totals {
  width: 290px;
  margin-left: auto;
  padding-top: 14px;
}

.doc-totals .row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 0;
  font-size: 12.5px;
}

.doc-totals .row.grand {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
}

.doc-footer {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
}

.stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border: 2px solid currentColor;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: rotate(-3deg);
}

.stamp-paid { color: var(--green); }
.stamp-void { color: var(--red); }

/* --------------------------------------------------------------------------
   Auth
   -------------------------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
}

.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px 48px;
  color: #eaf1ec;
  background:
    radial-gradient(circle at 20% 15%, rgba(184, 118, 59, 0.22), transparent 42%),
    radial-gradient(circle at 85% 85%, rgba(255, 255, 255, 0.06), transparent 45%),
    linear-gradient(160deg, #164a3f 0%, #0b2822 100%);
  overflow: hidden;
}

.auth-aside::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 70% 40%, #000 0%, transparent 72%);
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand .brand-mark {
  width: 42px;
  height: 42px;
}

.auth-brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: #fff;
}

.auth-headline {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 40px 0;
}

.auth-headline h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: #fbf8f1;
}

.auth-headline p {
  margin-top: 18px;
  max-width: 380px;
  font-size: 13.5px;
  line-height: 1.7;
  color: rgba(234, 241, 236, 0.68);
}

.auth-points {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 380px;
}

.auth-point {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: rgba(234, 241, 236, 0.8);
}

.auth-point .icon {
  color: #d9b48c;
  margin-top: 1px;
}

.auth-foot {
  position: relative;
  z-index: 1;
  font-size: 11px;
  color: rgba(234, 241, 236, 0.4);
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  background: var(--paper);
}

.auth-card {
  width: min(400px, 100%);
}

.auth-card-wide {
  width: min(560px, 100%);
}

.auth-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.auth-sub {
  margin: 6px 0 24px;
  font-size: 13px;
  color: var(--muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.auth-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid rgba(180, 71, 47, 0.22);
  border-radius: 8px;
  background: var(--red-tint);
  color: #8c3422;
  font-size: 12.5px;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.auth-section-label {
  margin: 6px 0 -2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

.print-body {
  background: #e9e6dd;
  color: #111;
}

.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #ddd8cc;
  backdrop-filter: blur(8px);
}

.print-toolbar-left,
.print-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.print-toolbar-label {
  font-size: 11px;
  color: #6c7872;
}

.sheet {
  width: min(820px, 100%);
  margin: 26px auto 60px;
  padding: 44px 48px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(23, 33, 30, 0.14);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #17211e;
}

.sheet-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.sheet-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #1d5c4f;
  color: #f0d9c1;
}

.sheet-company {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
}

.sheet-company-sub {
  font-size: 10.5px;
  color: #6c7872;
  line-height: 1.5;
}

.sheet-doc {
  text-align: right;
}

.sheet-doc-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8d968f;
}

.sheet-doc-number {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
}

.sheet-title {
  margin: 26px 0 4px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sheet-subtitle {
  font-size: 11px;
  color: #6c7872;
}

.sheet-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 22px;
  padding: 22px 0;
}

.sheet-label {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #8d968f;
  margin-bottom: 4px;
}

.sheet-value {
  font-size: 11.5px;
  line-height: 1.55;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.sheet-table th {
  padding: 8px 8px;
  text-align: left;
  font-size: 8px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #6c7872;
  border-bottom: 1px solid #cfcabd;
}

.sheet-table td {
  padding: 9px 8px;
  border-bottom: 1px solid #e6e2d7;
  vertical-align: top;
}

.sheet-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sheet-table tfoot td {
  padding: 9px 8px;
  border-top: 1px solid #cfcabd;
  border-bottom: 0;
  font-weight: 600;
}

.sheet-totals {
  width: 270px;
  margin-left: auto;
  padding-top: 14px;
}

.sheet-totals .row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 0;
  font-size: 11px;
}

.sheet-totals .row.grand {
  margin-top: 6px;
  padding-top: 9px;
  border-top: 1.5px solid #17211e;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
}

.sheet-note {
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px solid #e6e2d7;
  font-size: 9.5px;
  line-height: 1.7;
  color: #6c7872;
}

.sheet-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 50px;
}

.signature-line {
  padding-top: 34px;
  border-bottom: 1px solid #17211e;
  font-size: 9.5px;
  color: #6c7872;
}

.signature-label {
  margin-top: 6px;
  font-size: 9px;
  color: #8d968f;
}

.clause {
  margin-top: 16px;
  font-size: 10.5px;
  line-height: 1.65;
}

.clause-heading {
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  margin-bottom: 3px;
}

.clause-body {
  white-space: pre-line;
  color: #333;
}

.statement-summary {
  display: flex;
  justify-content: flex-end;
  gap: 26px;
  padding: 14px 0;
}

.statement-summary .item {
  text-align: right;
}

.statement-summary .label {
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8d968f;
}

.statement-summary .value {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@page {
  size: A4;
  margin: 14mm;
}
@media print {
  body,
  body.print-body {
    background: #fff;
  }

  .print-toolbar,
  .no-print {
    display: none !important;
  }

  .sheet {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }
  .sheet-head {
    gap: 18px;
  }
  .sheet-brand {
    flex: 1;
    min-width: 0;
  }
  .sheet-doc {
    flex: none;
  }
  .sheet-company {
    font-size: 18px;
  }
  .sheet-doc-number {
    font-size: 21px;
    white-space: nowrap;
  }

  .table th {
    background: #f6f4ee !important;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-main {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: 20px 0 50px rgba(13, 44, 38, 0.2);
  }

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

  .sidebar-scrim.is-visible {
    display: block;
  }

  .frame {
    margin-left: 0;
  }

  .menu-btn {
    display: inline-flex;
    color: var(--ink-2);
  }

  .topbar-brand {
    display: inline-block;
  }

  .content {
    padding: 24px 20px 50px;
  }

  .topbar {
    padding: 0 18px;
  }

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

  .auth-aside {
    display: none;
  }

  .auth-main {
    min-height: 100vh;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .page-actions {
    width: 100%;
  }

  .tabs {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 2px;
  }

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

  .form-grid,
  .form-grid-3,
  .checkbox-grid,
  .tenant-picker {
    grid-template-columns: 1fr;
  }

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

  .topbar-right .btn-secondary {
    display: none;
  }

  .doc-meta-grid,
  .sheet-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .doc-card {
    padding: 20px;
  }

  .doc-totals {
    width: 100%;
  }

  .app-foot {
    flex-direction: column;
    padding: 14px 20px 20px;
  }

  .filter-bar .field {
    min-width: 100%;
  }

  .sheet {
    padding: 28px 22px;
  }

  .statement-summary {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 520px) {
  .topbar-date,
  .topbar-sep,
  .topbar-context {
    display: none;
  }

  .btn {
    padding: 0 11px;
  }

  .page-title {
    font-size: 27px;
  }

  .table th,
  .table td {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* --------------------------------------------------------------------------
   Component supplement — notices, dialogs, reports, invoice editor
   -------------------------------------------------------------------------- */
.badge-xs {
  height: 18px;
  padding: 0 6px;
  font-size: 9.5px;
}
.title-link {
  color: inherit;
}
.title-link:hover {
  color: var(--pine);
  text-decoration: none;
}
.grid-2-wide {
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
}
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.notice svg {
  flex: none;
}
.notice-info {
  background: var(--blue-tint);
  border-color: #cfdeee;
  color: #274a6e;
}
.notice-amber {
  background: var(--amber-tint);
  border-color: #ead6b3;
  color: #7c5116;
}
.notice-danger {
  background: var(--red-tint);
  border-color: #eccdc2;
  color: #8a3524;
}
.notice-muted {
  background: var(--surface-3);
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.check-inline {
  width: auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--pine);
}
.tabs-page {
  margin-bottom: 18px;
}
.filter-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}
.form-actions-sticky {
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin-top: 16px;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 -8px 24px -18px rgba(23, 33, 30, 0.35);
  backdrop-filter: blur(8px);
}
.dialog {
  width: min(480px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 30px 70px -30px rgba(23, 33, 30, 0.45);
  color: var(--ink);
}
.dialog::backdrop {
  background: rgba(13, 44, 38, 0.42);
  backdrop-filter: blur(2px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.dialog-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
}
.dialog-body {
  padding: 18px 20px;
}
.dialog-body .field + .field {
  margin-top: 12px;
}
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.report-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.report-card:hover {
  border-color: var(--line-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.report-card > svg {
  color: var(--muted-2);
  flex: none;
}
.report-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  flex: none;
}
.report-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.report-title {
  font-weight: 600;
  font-size: 13.5px;
}
.report-text {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}
.plain-list {
  margin: 8px 0 0;
  padding-left: 18px;
  list-style: disc;
}
.plain-list li {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}
.chart-box {
  position: relative;
  height: 250px;
}
.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}
.legend-invoiced {
  background: #d8e4de;
}
.legend-collected {
  background: var(--pine);
}
.invoice-total-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 0;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.invoice-total-row strong {
  color: var(--ink);
  font-weight: 600;
}
.invoice-total-row-grand {
  margin-top: 4px;
  padding-top: 11px;
  border-top: 1.5px solid var(--ink);
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  color: var(--ink);
}
.email-preview {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.email-preview pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
}
.preview-meta {
  padding-bottom: 4px;
}
.code-block {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  word-break: break-all;
  color: var(--ink-2);
}
.file-input {
  padding: 8px;
  background: var(--surface-2);
}
.print-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 20px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 18px;
}
.print-eyebrow {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.print-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.print-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.6;
}
.print-brand {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--pine);
  text-align: right;
}
.statement-foot {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--muted-2);
}
.statement-opening td {
  background: var(--surface-2);
}
.line-table td {
  padding-top: 7px;
  padding-bottom: 7px;
}
.line-table .input {
  height: 34px;
  font-size: 12.5px;
}
.line-amount {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
@media (max-width: 980px) {
  .grid-2-wide {
    grid-template-columns: 1fr;
  }
  .check-grid {
    grid-template-columns: 1fr;
  }
  .filter-bar-right {
    width: 100%;
    margin-left: 0;
  }
}
