/* ==========================================================================
   Design tokens
   A quiet, dense, financial-software palette: mostly ink/slate/white, with
   a single brand accent (purple, carried over from the invoice template
   for continuity) reserved for the active nav indicator, primary actions,
   links and focus rings — not smeared across every badge and gradient.
   ========================================================================== */
:root {
  /* Brand accent - used sparingly (primary CTA, active states, focus) */
  --purple: #6d3f96;
  --purple-dark: #56316f;
  --orange: #f58220;

  /* Text */
  --ink: #171b21;
  --ink-soft: #3a4250;
  --muted: #6b7385;
  --faint: #97a0af;

  /* Surfaces */
  --panel: #ffffff;
  --soft: #f7f8fa;
  --sunken: #f1f3f6;
  --app-bg: #f4f5f7;

  /* Borders */
  --line: #e4e7ec;
  --line-strong: #d3d8e0;

  /* Semantic */
  --success: #0f7938;
  --success-bg: #eafbf1;
  --warn: #b42318;
  --warn-bg: #fef3f2;
  --amber: #a15c07;
  --amber-bg: #fdf3e2;
  --info: #2952a3;
  --info-bg: #eef2fb;
  --mint: #f1fcf5;

  /* Radius - deliberately restrained, not "bubbly" */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  /* Shadow - a single quiet elevation, used sparingly (menus, modals) */
  --shadow-sm: 0 1px 2px rgba(23, 27, 33, 0.06);
  --shadow: 0 4px 16px rgba(23, 27, 33, 0.08), 0 1px 2px rgba(23, 27, 33, 0.04);

  /* Motion - fast and functional, never decorative */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --fast: 120ms;

  /* Type scale */
  --text-xs: 11.5px;
  --text-sm: 12.5px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 21px;
  --text-2xl: 26px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--app-bg);
  font-family: -apple-system, "Segoe UI", system-ui, Inter, Arial, Helvetica, sans-serif;
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Financial figures always get tabular numerals, so amounts and dates align
   in a column instead of jittering left/right per-digit-width. */
.num,
.stat strong,
td.num,
th.num,
.amount,
.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  background: #fff;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

button:hover {
  border-color: #b7bfcb;
  background: var(--soft);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

button:active {
  transform: translateY(0.5px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button:disabled:hover {
  border-color: var(--line-strong);
  background: #fff;
}

button.primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
  font-weight: 600;
}

button.primary:hover {
  background: var(--purple-dark);
  border-color: var(--purple-dark);
}

button.danger {
  color: var(--warn);
}

button.danger:hover {
  border-color: #f3b7ae;
  background: var(--warn-bg);
}

button.icon {
  width: 38px;
  padding: 0;
}

button.subtle {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

button.subtle:hover {
  background: var(--sunken);
  color: var(--ink-soft);
}

a.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  background: #fff;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

a.button-link:hover {
  border-color: #b7bfcb;
  background: var(--soft);
}

a.button-link.whatsapp-btn {
  background: #1fa855;
  border-color: #1fa855;
  color: #fff;
  font-weight: 600;
}

a.button-link.whatsapp-btn:hover {
  background: #178a45;
  border-color: #178a45;
}

a.button-link.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.reminder-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.reminder-actions button,
.reminder-actions a.button-link {
  flex: 0 0 auto;
}

@media screen and (max-width: 900px) {
  .reminder-actions {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .reminder-actions button,
  .reminder-actions a.button-link {
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
  font-size: var(--text-base);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(109, 63, 150, 0.13);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ==========================================================================
   App shell
   ========================================================================== */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: #14181f;
  color: #fff;
  padding: 18px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 4px 22px;
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--purple);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Grouped navigation - sections with a quiet uppercase label, matching the
   Overview / Sales / Expenses / Reports / AI / Settings / Trash IA. app.js
   still emits plain .nav > button elements; .nav-group is just a wrapper
   with an optional label rendered around them.

   .nav is a grid container with flex:1, so it's handed whatever leftover
   vertical space exists in the sidebar's flex column beyond what the nav
   groups actually need. CSS Grid's default align-content ("normal",
   which resolves to stretch here) distributes that leftover space
   EQUALLY across every implicit row - i.e. every .nav-group gets the same
   extra pixels regardless of how much content it holds. A one-button
   group like "Overview" ends up with most of its added height as blank
   space below its button, while a five-button group like "Sales" barely
   shows it - the same absolute stretch reads as a wildly disproportionate
   gap after the shortest group. align-content: start packs every row at
   its own natural height instead, so any true leftover space collects
   once at the bottom of the list, not silently inside each group. */
.nav {
  display: grid;
  align-content: start;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.nav-group + .nav-group {
  margin-top: 14px;
}

.nav-group-label {
  padding: 0 10px;
  margin-bottom: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6b7385;
}

.nav button {
  position: relative;
  width: 100%;
  justify-content: flex-start;
  min-height: 36px;
  color: #aab2c0;
  background: transparent;
  border-color: transparent;
  border-radius: var(--radius-sm);
  text-align: left;
  font-weight: 500;
  font-size: var(--text-sm);
  padding: 7px 10px;
}

.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav button.active {
  color: #fff;
  background: rgba(109, 63, 150, 0.3);
  font-weight: 600;
}

.nav button.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 6px;
  bottom: 6px;
  width: 2.5px;
  border-radius: 3px;
  background: var(--orange);
}

.search-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  margin-bottom: 14px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: #8790a0;
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
}

.search-trigger:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #cfd4dd;
}

.search-trigger kbd {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  color: #7b8494;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 2px 5px;
}

.user-menu {
  position: relative;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 5px 7px;
}

.user-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
}

.user-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.user-menu-label {
  display: grid;
  gap: 1px;
  min-width: 0;
  line-height: 1.3;
}

.user-menu-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.user-menu-label small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #8790a0;
  font-size: 11px;
  font-weight: 500;
}

.user-menu-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  background: #1c212b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 5px;
  box-shadow: var(--shadow);
  z-index: 5;
}

.user-menu.open .user-menu-dropdown {
  display: grid;
  gap: 1px;
}

.user-menu-item {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #d3d8e0;
  text-align: left;
  font-weight: 500;
  font-size: var(--text-sm);
}

.user-menu-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.user-menu-item.danger {
  color: #f0a89e;
}

.user-menu-item.danger:hover {
  color: #fff;
  background: rgba(180, 35, 24, 0.35);
}

.mobile-bar {
  display: none;
}

.nav-overlay {
  display: none;
}

.main {
  min-width: 0;
  padding: 24px 28px 40px;
}

.topbar,
.section-head,
.row-actions,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 18px;
  align-items: flex-start;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 3px;
  font-size: var(--text-2xl);
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--ink);
}

h2 {
  font-size: var(--text-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted);
  font-size: var(--text-sm);
}

.grid {
  display: grid;
  gap: 14px;
}

.two-column {
  grid-template-columns: 340px minmax(0, 1fr);
}

.invoice-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payment-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.invoice-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.invoice-filters input[type="search"] {
  flex: 1;
  min-width: 220px;
}

.invoice-filters input[type="month"] {
  width: auto;
  min-width: 150px;
}

.section-head input[type="checkbox"],
td input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: var(--purple);
  cursor: pointer;
}

th input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--purple);
  cursor: pointer;
}

/* ==========================================================================
   Stat cards - quiet, dense, no rainbow top-borders. Label, figure, and an
   optional one-line trend/context note underneath.
   ========================================================================== */
.stat,
.panel,
.login {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel,
.login {
  box-shadow: var(--shadow-sm);
}

.stat {
  padding: 16px 18px;
}

.stat > span:first-child {
  display: block;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.stat small {
  display: block;
  margin-top: 5px;
  font-size: var(--text-xs);
  color: var(--faint);
}

.stat small.attn {
  color: var(--warn);
  font-weight: 600;
}

/* Dashboard privacy toggle: a single button below the KPI row, not one
   per-card, so there is exactly one thing to press and no risk of cards
   getting out of sync with each other. Masking swaps text content only
   (see maskedAmount() in app.js) so this button's own presence/position
   never shifts the stat cards above it. */
.dashboard-mask-toggle {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.dashboard-mask-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: var(--text-xs);
  font-weight: 650;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.dashboard-mask-toggle button:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.dashboard-mask-toggle button svg {
  flex: none;
}

.panel {
  padding: 18px 20px;
}

.toast,
.notice {
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: var(--text-sm);
}

.toast {
  background: var(--success-bg);
  border: 1px solid #b7e6c9;
  color: #0c5c2a;
}

.notice {
  background: var(--amber-bg);
  border: 1px solid #f2d69f;
  color: #7a4405;
}

/* ==========================================================================
   Tables - compact rows, right-aligned amounts, subtle hover, quiet header.
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--sunken);
  text-align: left;
  vertical-align: middle;
  font-size: var(--text-base);
}

th {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding-top: 4px;
  padding-bottom: 10px;
}

th.num,
td.num {
  text-align: right;
}

tbody tr {
  transition: background-color var(--fast) var(--ease);
}

tbody tr:hover {
  background: var(--soft);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr.row-selected {
  background: rgba(109, 63, 150, 0.06);
}

/* ==========================================================================
   Status - subtle, text-led (never color-only), a small dot + label rather
   than a loud filled pill.
   ========================================================================== */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: capitalize;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex-shrink: 0;
}

.status.paid {
  background: var(--success-bg);
  border-color: #c3ecd2;
  color: var(--success);
}

.status.overdue {
  background: var(--warn-bg);
  border-color: #f6cac3;
  color: var(--warn);
}

.status.draft {
  background: var(--sunken);
  border-color: var(--line);
  color: var(--muted);
}

.status.sent,
.status.open {
  background: var(--info-bg);
  border-color: #cddaf3;
  color: var(--info);
}

.status.partial {
  background: var(--amber-bg);
  border-color: #f0deb0;
  color: var(--amber);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.line-grid {
  display: grid;
  grid-template-columns: 1fr 110px 130px 42px;
  gap: 10px;
  align-items: end;
}

.line-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
}

.line-card .line-grid {
  margin-top: 10px;
}

.inline-panel {
  margin-top: 10px;
  padding: 14px;
  border: 1px dashed var(--purple);
  border-radius: var(--radius-sm);
  background: #f9f6fb;
}

.inline-panel .form-grid {
  margin-bottom: 10px;
}

.inline-panel .muted:empty {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--app-bg);
}

.login {
  width: min(400px, 100%);
  padding: 32px 28px;
  text-align: center;
}

.login .imppress-logo {
  justify-content: center;
  display: flex;
  margin: 0 auto 18px;
}

.login h1 {
  margin: 0 0 6px;
  font-size: 20px;
}

.login .muted {
  margin: 0 0 22px;
}

.login form {
  display: grid;
  gap: 16px;
  text-align: left;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 62px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 8px;
}

.password-toggle:hover {
  background: rgba(109, 63, 150, 0.08);
}

.form-error {
  margin: 0;
  min-height: 18px;
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
}

.form-error:empty {
  display: none;
}

.login .muted#forgot-success {
  color: var(--success);
  font-weight: 600;
}

.login .muted:empty {
  display: none;
}

.link-button {
  width: 100%;
  margin-top: 18px;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-weight: 700;
  font-size: 13px;
}

.link-button:hover {
  background: rgba(109, 63, 150, 0.08);
}

.invoice-panel {
  padding: 18px;
  background: var(--soft);
}

.mobile-scroll-hint {
  display: none;
}

.mobile-only-action,
.mobile-invoice-summary {
  display: none;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--purple);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus-visible {
  top: 12px;
}

.imppress-logo {
  margin-bottom: 14px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.imppress-logo span {
  color: var(--purple);
}

.imppress-logo strong {
  color: var(--orange);
}

.uploaded-logo {
  display: block;
  width: auto;
  max-width: 220px;
  max-height: 80px;
  object-fit: contain;
  margin-bottom: 14px;
}

.settings-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 4px;
}

.ai-chat-panel {
  display: flex;
  flex-direction: column;
  height: min(72vh, 640px);
}

.ai-chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
  margin-bottom: 14px;
}

.ai-message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--soft);
}

.ai-message p {
  margin: 2px 0 0;
  white-space: pre-wrap;
}

.ai-message-role {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ai-message-user {
  align-self: flex-end;
  background: rgba(109, 63, 150, 0.09);
}

.ai-message-assistant {
  align-self: flex-start;
}

/* Structured AI answer card - summary figure + breakdown + a direct action,
   rather than a wall of prose (the "financial copilot", not a chat toy). */
.ai-answer-card {
  align-self: flex-start;
  max-width: 92%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}

.ai-answer-figure {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.ai-answer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 10px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.ai-chat-form {
  display: flex;
  gap: 10px;
}

.ai-chat-form input {
  flex: 1;
}

.ai-confirm-card {
  border: 1px solid #f2d69f;
  background: var(--amber-bg);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.ai-confirm-card p {
  margin: 0 0 8px;
}

.ai-voice-listening {
  border-color: var(--warn);
  color: var(--warn);
  animation: ai-voice-pulse 1.1s ease-in-out infinite;
}

@keyframes ai-voice-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.25);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(180, 35, 24, 0.06);
  }
}

.ai-invoice-link {
  display: inline;
  min-height: auto;
  padding: 1px 4px;
  border: 0;
  background: rgba(109, 63, 150, 0.09);
  color: var(--purple);
  font: inherit;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}

.ai-invoice-link:hover {
  background: rgba(109, 63, 150, 0.16);
}

.logo-settings {
  display: grid;
  grid-template-columns: 240px 1fr auto;
  gap: 14px;
  align-items: end;
}

.logo-preview {
  min-height: 86px;
  display: grid;
  align-content: center;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.hidden {
  display: none;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.template-card {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  background: #fff;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.template-card:hover {
  border-color: var(--purple);
}

.template-card input {
  position: absolute;
  top: 12px;
  right: 12px;
  margin: 0;
}

.template-card.selected {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(109, 63, 150, 0.16);
}

.template-swatch {
  height: 64px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border: 1px solid var(--line);
}

.template-swatch-classic {
  background: linear-gradient(135deg, #6d3f96 0 30%, #f6f4fb 30%);
}

.template-swatch-minimal {
  background: repeating-linear-gradient(180deg, #ffffff 0 14px, #e4e7ec 14px 15px);
}

.template-swatch-corporate {
  background: linear-gradient(180deg, #6d3f96 0 45%, #ffffff 45%);
}

.template-swatch-serif {
  background: #ffffff;
  border-top: 3px double #1f2933;
}

.template-swatch-compact {
  background:
    linear-gradient(180deg, #6d3f96 0 22%, transparent 22%),
    repeating-linear-gradient(180deg, #ffffff 0 12px, #e4e7ec 12px 13px);
}

.template-card-name {
  font-weight: 700;
  margin-bottom: 2px;
  font-size: var(--text-sm);
}

.template-card-desc {
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   Needs Attention - the dashboard's action-oriented panel. Each item is a
   clickable row that leads directly to the relevant view/filter.
   ========================================================================== */
.attention-panel {
  padding: 4px 0 8px;
}

.attention-list {
  display: grid;
  gap: 1px;
}

.attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.attention-item:hover {
  background: var(--soft);
}

.attention-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--warn);
}

.attention-dot.amber {
  background: var(--amber);
}

.attention-dot.info {
  background: var(--info);
}

.attention-text {
  flex: 1;
  min-width: 0;
  font-size: var(--text-base);
  font-weight: 500;
}

.attention-text strong {
  font-weight: 650;
}

.attention-chevron {
  flex-shrink: 0;
  color: var(--faint);
  font-size: 14px;
}

.attention-empty {
  padding: 18px 6px;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ==========================================================================
   Empty & loading states
   ========================================================================== */
.empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--faint);
  font-size: 20px;
}

.empty-state h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 650;
  color: var(--ink-soft);
}

.empty-state p {
  margin: 0;
  max-width: 340px;
  font-size: var(--text-sm);
}

.empty-state .primary {
  margin-top: 10px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--sunken);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: skeleton-sweep 1.3s var(--ease) infinite;
}

@keyframes skeleton-sweep {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
}

.skeleton-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.skeleton-stat {
  height: 78px;
}

.skeleton-row {
  height: 42px;
  margin-bottom: 6px;
}

/* ==========================================================================
   Command palette (Ctrl/Cmd+K) - a lightweight global search overlay.
   ========================================================================== */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  align-content: start;
  justify-items: center;
  padding-top: min(14vh, 120px);
  background: rgba(15, 18, 24, 0.5);
}

.cmdk {
  width: min(560px, calc(100vw - 32px));
  max-height: min(60vh, 480px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(15, 18, 24, 0.35);
  overflow: hidden;
}

.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px;
  border-bottom: 1px solid var(--line);
}

.cmdk-input-row svg {
  flex-shrink: 0;
  color: var(--faint);
}

.cmdk-input-row input {
  border: 0;
  min-height: 48px;
  padding: 0;
  font-size: var(--text-md);
}

.cmdk-input-row input:focus {
  box-shadow: none;
}

.cmdk-results {
  overflow-y: auto;
  padding: 6px;
}

.cmdk-group-label {
  padding: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: var(--text-base);
  cursor: pointer;
}

.cmdk-item strong {
  font-weight: 600;
}

.cmdk-item small {
  color: var(--muted);
  font-size: var(--text-sm);
}

.cmdk-item.active,
.cmdk-item:hover {
  background: var(--soft);
}

.cmdk-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

.cmdk-footer {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--faint);
}

.cmdk-footer kbd {
  font-family: inherit;
  font-weight: 700;
  background: var(--sunken);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 3px;
}

/* ==========================================================================
   Confirm dialog - accessible replacement for window.confirm(), used for
   every destructive action. Reuses .cmdk-overlay for the backdrop.
   ========================================================================== */
.confirm-overlay {
  align-content: center;
  padding-top: 0;
}

.confirm-dialog {
  width: min(400px, calc(100vw - 32px));
  padding: 22px 22px 20px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(15, 18, 24, 0.35);
}

.confirm-dialog h2 {
  margin-bottom: 6px;
}

.confirm-dialog .form-actions {
  justify-content: flex-end;
  gap: 8px;
}

/* Toast auto-dismiss fade */
.toast,
.notice {
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}

.toast-leaving {
  opacity: 0;
  transform: translateY(-4px);
}

/* ==========================================================================
   Searchable customer combobox - text input + filtered dropdown, used in
   invoice/quotation creation so picking a customer never leaves the page.
   ========================================================================== */
.combobox {
  position: relative;
}

.combobox-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px;
}

.combobox-group-label {
  padding: 6px 8px 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.combobox-option {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: var(--text-base);
  cursor: pointer;
}

.combobox-option strong {
  font-weight: 600;
}

.combobox-option small {
  color: var(--muted);
  font-size: var(--text-sm);
}

.combobox-option.active,
.combobox-option:hover {
  background: var(--soft);
}

.combobox-selected-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--soft);
}

.combobox-selected-chip strong {
  display: block;
  font-size: var(--text-base);
}

.combobox-selected-chip small {
  color: var(--muted);
}

/* ==========================================================================
   Invoice form v2 - sections separated by quiet dividers, not nested
   cards; a persistent summary rail keeps totals visible while scrolling.
   ========================================================================== */
.form-section + .form-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.form-section-title {
  margin-bottom: 12px;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-hint {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--faint);
  font-weight: 500;
}

.field-error {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--warn);
  font-weight: 600;
}

input.invalid,
select.invalid,
textarea.invalid {
  border-color: var(--warn);
}

.invoice-form-layout {
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
}

.summary-rail {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 10px;
}

.summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: var(--text-base);
}

.summary-row.total {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 17px;
  font-weight: 650;
}

.summary-row .num {
  font-weight: 600;
}

.line-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 96px 96px 32px;
  gap: 8px;
  align-items: start;
  padding: 8px 0;
}

.line-item-row + .line-item-row {
  border-top: 1px solid var(--sunken);
}

.line-item-row input,
.line-item-row select {
  min-height: 36px;
  font-size: var(--text-sm);
}

.line-item-amount {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: var(--text-sm);
  font-weight: 600;
}

.line-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 96px 96px 32px;
  gap: 8px;
  padding-bottom: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.line-item-head span:nth-child(2),
.line-item-head span:nth-child(3),
.line-item-head span:nth-child(4) {
  text-align: right;
}

.action-hierarchy {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-hierarchy .secondary-actions {
  position: relative;
}

.action-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 170px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px;
  z-index: 15;
}

.action-menu.open {
  display: grid;
  gap: 1px;
}

.action-menu button {
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
}

.action-menu button:hover {
  background: var(--soft);
}

@media screen and (max-width: 1450px) {
  .invoice-layout {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    background: #14181f;
    color: #fff;
  }

  .mobile-bar .brand {
    margin: 0;
    font-size: 16px;
    color: #fff;
  }

  .mobile-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-search-trigger {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-color: rgba(255, 255, 255, 0.24);
    background: transparent;
    color: #fff;
  }

  .menu-toggle {
    display: grid;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 11px;
    border-color: rgba(255, 255, 255, 0.24);
    background: transparent;
  }

  .menu-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: #fff;
  }

  .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(80vw, 296px);
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    overflow-y: auto;
  }

  .sidebar .brand {
    display: none;
  }

  .shell.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 24px 0 48px rgba(15, 23, 42, 0.35);
  }

  .shell.nav-open .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(15, 23, 42, 0.5);
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 16px 14px 36px;
  }

  .topbar,
  .section-head,
  .row-actions {
    flex-wrap: wrap;
  }

  .invoice-filters {
    flex-wrap: wrap;
  }

  .invoice-filters input[type="search"],
  .invoice-filters input[type="month"] {
    width: 100%;
    min-width: 0;
  }

  .stats,
  .form-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .line-grid,
  .logo-settings,
  .invoice-form-layout {
    grid-template-columns: 1fr;
  }

  .summary-rail {
    position: static;
  }

  .line-item-head {
    display: none;
  }

  .line-item-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
  }

  .line-item-row + .line-item-row {
    border-top: 1px solid var(--line);
  }

  .line-item-amount {
    justify-content: space-between;
  }

  .line-item-amount::before {
    content: "Amount";
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
  }

  .action-hierarchy {
    width: 100%;
  }

  .action-hierarchy button,
  .action-hierarchy .secondary-actions {
    flex: 1;
  }

  .action-hierarchy .secondary-actions button {
    width: 100%;
  }

  .action-menu {
    left: 0;
    right: 0;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar > div:last-child {
    width: 100%;
  }

  .topbar > div:last-child:empty {
    display: none;
  }

  .topbar button,
  .topbar a.button-link {
    width: 100%;
  }

  .section-head h2 {
    font-size: 15px;
  }

  .stat {
    padding: 14px;
  }

  .stat strong {
    font-size: 19px;
  }
}

@media screen and (max-width: 700px) {
  .table-wrap {
    overflow-x: visible;
  }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px 14px;
    background: #fff;
  }

  .table-wrap tr:last-child {
    margin-bottom: 0;
  }

  .table-wrap td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--sunken);
    text-align: right;
  }

  .table-wrap td:last-child {
    border-bottom: 0;
  }

  .table-wrap td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    flex-shrink: 0;
    margin-right: auto;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
  }

  .table-wrap td.row-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    padding-top: 10px;
  }

  .table-wrap td.row-actions button,
  .table-wrap td.row-actions a.button-link {
    width: 100%;
    white-space: normal;
    text-align: center;
  }

  /* The on-screen invoice/quotation preview (client/invoice/, untouched) is
     itself a fluid, full-width component with no minimum width, so on a
     narrow viewport it was shrinking to fit the phone-width column it was
     given: its own item table (which has a real min-width and its own
     internal overflow-x wrapper, by design) would hit that floor almost
     immediately and clip to 2-3 columns with no visible affordance to
     scroll. Root cause was here, not in client/invoice/ - this container
     never gave the document a floor to render at a readable size.
     Fix: give the mounted document a floor so it always renders at a
     comfortable, fully-legible size, and let *this* wrapper (ours,
     application UI) scroll horizontally to reveal it - never the page.
     The printable/PDF output is untouched: this is a screen-only rule and
     the document's own markup/props/print CSS are not modified.

     The floor is 900px - not an arbitrary "readable enough" compromise,
     but exactly the document's own declared max-w-[900px] (ClassicPurple.
     jsx and every other template use the same figure). An earlier pass at
     this fix used 620px, a value picked to just clear the item table's
     own min-w-[480px] rather than derived from the document's real
     intended size. Below 900px, the item table's fixed-width columns
     (colgroup: 40/auto/64/112/160px) leave the flexible description
     column far less room than it has on desktop - at 620px it's ~164px
     wide (3-4 line wraps for a normal description), at the document's own
     900px it's ~444px, the same room desktop gives it. Different
     available width for the same fixed columns is exactly what made the
     mobile render look like a squeezed-down desktop page rather than the
     same document desktop shows, just scrolled. Matching the document's
     own max-width removes that mismatch entirely: mobile and desktop now
     lay out every column identically, mobile just needs more horizontal
     scroll to see all of it on a narrower screen. */
  .invoice-panel {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .invoice-panel > * {
    min-width: 900px;
  }

  /* Subtle edge fade hinting there's more to see off-screen - fades away
     itself once the user actually scrolls, so it never lingers as noise. */
  .invoice-panel::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 22px;
    background: linear-gradient(to right, transparent, rgba(20, 20, 30, 0.07));
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .invoice-panel.scrolled::after {
    opacity: 0;
  }

  .mobile-scroll-hint {
    display: block;
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    transition: opacity 0.2s ease;
  }

  .mobile-scroll-hint.scrolled {
    opacity: 0;
  }

  /* Phase 3.1 refinement: on mobile, Edit + Record Payment lead (Print
     moves into More); a compact Total/Paid/Balance/Due strip sits above
     the preview so the numbers that matter are visible without scrolling
     the document itself. Desktop keeps its original row untouched - these
     two classes only ever render on one side of this breakpoint. */
  .desktop-only-action {
    display: none;
  }

  .mobile-only-action {
    display: block;
  }

  #back-invoices::before {
    content: "← ";
  }

  .mobile-invoice-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin-bottom: 14px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  .mobile-invoice-summary > div {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    background: #fff;
  }

  .mobile-invoice-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .mobile-invoice-summary strong {
    font-size: 15px;
  }

  /* The Payments panel's Total/Already paid/Balance due row was still the
     original desktop 3-up grid, squeezed to ~93px-wide cards on a phone -
     narrow enough that "Already paid" and "Balance due" wrapped to two
     lines while "Total" stayed on one, an inconsistent, cramped result.
     Reflow to 2x2 (adding Due date as the 4th cell, hidden on desktop via
     .mobile-only-action) so every card gets roughly double the width and
     its label fits on one line. */
  .payment-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .payment-summary-grid .stat {
    padding: 14px 16px !important;
  }

  .payment-summary-grid .stat > span:first-child {
    white-space: nowrap;
  }

  /* client/invoice/'s Footer (phone / email / website) uses Tailwind's
     sm: breakpoint (640px) to go from a stacked column to one row - a
     genuinely reasonable default, but it's a *viewport* media query, not
     a container query, so it never fires on a real phone even though our
     own min-width fix above renders the document itself at 900px: the
     footer can't tell it has the room. Reflow it to one row ourselves,
     from outside the component (nothing in client/invoice/ is edited),
     scoped to this screen-only breakpoint so print (its own separate
     @media print cascade) and desktop (already correct via Tailwind) are
     both untouched. */
  #invoice-react-mount .grid.grid-cols-1.sm\:grid-cols-3,
  #quotation-react-mount .grid.grid-cols-1.sm\:grid-cols-3 {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 4px;
  }

  #invoice-react-mount .grid.grid-cols-1.sm\:grid-cols-3 > span:not(:last-child)::after,
  #quotation-react-mount .grid.grid-cols-1.sm\:grid-cols-3 > span:not(:last-child)::after {
    content: "•";
    margin: 0 10px;
    color: var(--faint);
  }

  /* Same root cause as the footer fix above, found in two more places on a
     careful re-audit: the Bill To / Invoice Details cards and the top
     header row both also use Tailwind's viewport-gated sm: breakpoint to
     go from stacked to side-by-side. Because the document is always
     rendered at its own 900px width in here (see .invoice-panel > * above),
     the sm: state is what actually matches this canvas - grid-cols-1 was
     never meant to apply to a 900px-wide row, and letting it apply here is
     exactly what stretched each single-column card to the full content
     width, spreading a short label and its short value far apart (the
     value ends up scrolled almost entirely
     out of view, reading as "clipped"). Force every sm:-gated rule inside
     this canvas to its sm: (wide) state, the same way the footer already
     is - nothing in client/invoice/ is touched, and desktop/print are
     unaffected since they're outside this max-width:700px, screen-only
     block. */
  #invoice-react-mount .grid.grid-cols-1.sm\:grid-cols-2,
  #quotation-react-mount .grid.grid-cols-1.sm\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #invoice-react-mount .flex.flex-col.gap-6.sm\:flex-row,
  #quotation-react-mount .flex.flex-col.gap-6.sm\:flex-row {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  #invoice-react-mount .flex.flex-col.items-start.gap-3.sm\:items-end,
  #quotation-react-mount .flex.flex-col.items-start.gap-3.sm\:items-end {
    align-items: flex-end;
  }

  #invoice-react-mount .flex.flex-col.gap-1.sm\:items-end,
  #quotation-react-mount .flex.flex-col.gap-1.sm\:items-end {
    align-items: flex-end;
    text-align: right;
  }
}

/* ==========================================================================
   Print - UNCHANGED from the pre-redesign version. This governs printing
   from the app shell (hides sidebar/topbar/toast); the invoice's own print
   layout lives separately in client/invoice/index.css and is untouched.
   Do not modify anything below this line as part of a UI redesign.
   ========================================================================== */
@page {
  size: A4;
  margin: 0;
}

@media print {
  html,
  body {
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 0;
  }

  body {
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sidebar,
  .topbar,
  .no-print,
  .toast {
    display: none;
  }

  .shell {
    display: block;
    min-height: 0;
  }

  .main,
  .panel,
  .invoice-panel {
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: 0;
    background: #fff;
  }
}
