/* ==========================================================================
   The Hive — honeycomb home + hive theming for the rest of Leo
   ========================================================================== */
:root {
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  --hive-bg: radial-gradient(120% 90% at 50% 30%, #fffaf0 0%, #f6ecd2 70%, #efe1bd 100%);
  --wax: #fff9e8;
  --wax-2: #fdf0cc;
  --wax-rim: #ead39a;
  --hive-cell: rgba(234, 211, 154, 0.16);
  --hive-line: rgba(197, 160, 40, 0.28);
  --honey-top: #ffd451;
  --honey-bot: #eba20c;
  --cell-ink: #3a2a05;
  --cell-ink-2: rgba(58, 42, 5, 0.62);
  --cell-shadow: rgba(110, 75, 0, 0.2);
  --glass: rgba(255, 250, 236, 0.84);
  --hex-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27.72' height='48'%3E%3Cpath d='M13.86 0 27.72 8v16L13.86 32 0 24V8zM13.86 32v16' fill='none' stroke='%23a8840f' stroke-opacity='.09'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --hive-bg: radial-gradient(120% 90% at 50% 30%, #241c0c 0%, #120e06 70%, #0a0803 100%);
    --wax: #2b2314;
    --wax-2: #3a2e15;
    --wax-rim: #6b5626;
    --hive-cell: rgba(107, 86, 38, 0.18);
    --hive-line: rgba(212, 175, 55, 0.22);
    --honey-top: #e9a91c;
    --honey-bot: #a96a00;
    --cell-ink: #fff3d1;
    --cell-ink-2: rgba(255, 243, 209, 0.66);
    --cell-shadow: rgba(0, 0, 0, 0.55);
    --glass: rgba(34, 28, 16, 0.86);
    --hex-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27.72' height='48'%3E%3Cpath d='M13.86 0 27.72 8v16L13.86 32 0 24V8zM13.86 32v16' fill='none' stroke='%23d4af37' stroke-opacity='.07'/%3E%3C/svg%3E");
  }
}

/* ---------- Hive theming across the app ---------- */
body { background-image: var(--hex-pattern); background-size: 41.58px 72px; background-attachment: fixed; }
.card.pad > h2::before, .card__head h2::before {
  content: ""; display: inline-block; width: 8px; height: 9px; margin-right: 7px;
  clip-path: var(--hex); background: var(--tint-fill); vertical-align: 0;
}
.who { display: flex; align-items: center; gap: 10px; }
.hexatar {
  flex: none; width: 32px; height: 37px; display: grid; place-items: center;
  clip-path: var(--hex); background: linear-gradient(var(--honey-top), var(--honey-bot));
  color: #3a2a05; font-size: 12px; font-weight: 700; letter-spacing: 0;
}
.toast:not(.toast--err):not(.toast--warn)::before {
  content: ""; display: inline-block; width: 10px; height: 11px; margin-right: 8px;
  clip-path: var(--hex); background: var(--tint-fill); vertical-align: -1px;
}
.btn--plain { background: transparent; color: var(--tint); }
.main:has(.hive) { max-width: none; }

/* ---------- Hive header + honey stats ---------- */
.hive-head { margin-bottom: 12px; }
.honey-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.hstat {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center;
  padding: 10px 14px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.hstat:active { transform: scale(0.98); }
.hstat i { grid-row: 1 / 3; width: 24px; height: 28px; clip-path: var(--hex); background: linear-gradient(var(--honey-top), var(--honey-bot)); }
.hstat i.is-filling { background: linear-gradient(to top, var(--honey-bot) 38%, var(--wax-rim) 38%); }
.hstat i.is-due { background: var(--red); }
.hstat i.is-quote { background: repeating-linear-gradient(45deg, var(--honey-bot) 0 4px, var(--wax-rim) 4px 7px); }
.hstat b { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hstat span { font-size: 12px; color: var(--label-2); }
.hstat.is-alert b { color: var(--red-text); }

/* ---------- The comb ---------- */
.hive {
  position: relative; height: max(440px, calc(100vh - 250px));
  border-radius: 22px; overflow: hidden; background: var(--hive-bg);
  perspective: 1500px; perspective-origin: 50% 30%;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; outline: none;
  box-shadow: inset 0 0 0 0.5px var(--sep);
}
.hive.is-dragging { cursor: grabbing; }
.hive__stage { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }
.hive__stage.is-gliding { transition: transform 0.75s cubic-bezier(0.22, 0.8, 0.2, 1); }

.cell {
  position: absolute; left: -49px; top: -56.5px; width: 98px; height: 113px;
  padding: 0; border: 0; background: none; cursor: pointer; font-family: var(--ios); color: var(--cell-ink);
  transform: translate3d(var(--x), var(--y), var(--z, 0px));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.35s, opacity 0.3s;
  filter: drop-shadow(0 6px 7px var(--cell-shadow));
}
.cell:hover, .cell:focus-visible, .cell.is-selected { --z: 28px; filter: drop-shadow(0 20px 18px var(--cell-shadow)); z-index: 2; }
.cell:focus-visible { outline: none; }
.cell:focus-visible .cell__rim, .cell.is-selected .cell__rim { background: var(--tint) !important; animation: none !important; opacity: 1 !important; }
.cell__rim, .cell__core { position: absolute; clip-path: var(--hex); }
.cell__rim { inset: 0; background: var(--wax-rim); }
.cell__core { inset: 3px; background: var(--wax); overflow: hidden; }
.cell__honey {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--h) * 100%);
  background: linear-gradient(180deg, var(--honey-top), var(--honey-bot));
  transition: height 1s cubic-bezier(0.3, 0.7, 0.3, 1);
}
.cell__honey::before {
  content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 10px;
  background: radial-gradient(circle at 8px 10px, var(--honey-top) 7px, transparent 7.5px) 0 0 / 16px 10px repeat-x;
  animation: honey-wave 3.6s linear infinite;
}
.cell__honey::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.32) 45%, transparent 60%); }
@keyframes honey-wave { to { background-position-x: 16px; } }

.cell__label {
  position: relative; z-index: 1; height: 100%; padding: 0 11px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center;
}
.cell__label small { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cell-ink-2); }
.cell__label b {
  font-size: 12.5px; font-weight: 700; line-height: 1.15; max-width: 74px; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cell__label em { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--cell-ink-2); font-variant-numeric: tabular-nums; }

/* Queen */
.cell--queen { --z: 10px; filter: drop-shadow(0 0 22px rgba(212, 175, 55, 0.55)); }
.cell--queen:hover, .cell--queen.is-selected { --z: 34px; }
.cell--queen .cell__rim { background: linear-gradient(140deg, #fbe08a, #b8860b 60%, #f2cd5c); }
.cell--queen .cell__core { inset: 4px; background: radial-gradient(circle at 50% 32%, #2e2614, #100d06 75%); }
.cell--queen .cell__label b { color: #f7d774; font-size: 13px; }
.cell--queen .cell__label small { color: rgba(255, 243, 209, 0.6); }
.cell__bee { width: 40px; height: auto; margin-bottom: 1px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45)); }

/* Families */
.cell--client .cell__rim { background: var(--tint-fill); }
.cell--client .cell__core { background: var(--wax-2); }
.cell--client .cell__label b { font-size: 13.5px; }
.cell.is-overdue .cell__rim { background: var(--red); animation: due-pulse 1.8s ease-in-out infinite; }
@keyframes due-pulse { 50% { opacity: 0.45; } }
.cell--invoice .cell__rim { background: var(--honey-bot); }
.cell--quote.is-draft .cell__rim { background: var(--label-3); }
.cell--quote.is-sent .cell__rim { background: repeating-linear-gradient(45deg, var(--honey-bot) 0 6px, var(--wax-rim) 6px 10px); }
.cell--quote.is-accepted .cell__rim { background: var(--honey-bot); }
.cell--quote.is-declined { opacity: 0.4; filter: grayscale(1); }
.cell.is-sealed .cell__core::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.22) 0 2px, transparent 2px 9px), rgba(255, 236, 190, 0.28);
}

/* Empty cells */
.cell--family, .cell--grow { filter: none; }
.cell--family .cell__rim { background: var(--wax-rim); opacity: 0.5; }
.cell--family .cell__core { background: var(--wax); opacity: 0.85; }
.cell--grow .cell__rim { background: var(--hive-line); }
.cell--grow .cell__core { background: var(--hive-cell); }
.cell--family .cell__label b, .cell--grow .cell__label b { font-size: 24px; font-weight: 300; color: var(--tint); opacity: 0; transition: opacity 0.2s; -webkit-line-clamp: 1; }
.cell--grow .cell__label em { opacity: 0; color: var(--tint); transition: opacity 0.2s; }
.cell--family:hover .cell__label b, .cell--grow:hover .cell__label *, .cell--family:focus-visible .cell__label b, .cell--grow:focus-visible .cell__label * { opacity: 1; }
.cell--grow:hover .cell__rim { background: var(--tint-fill); }
.cell--grow.is-near .cell__label b, .cell--grow.is-near .cell__label em { opacity: 0.85; }
.cell--grow.is-near .cell__rim { background: rgba(201, 162, 39, 0.55); animation: near-glow 2.6s ease-in-out infinite; }
@keyframes near-glow { 50% { opacity: 0.45; } }

/* Family name tags float above each cluster */
.hive__tag {
  position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap;
  transform: translate3d(var(--x), var(--y), 4px) translateX(-50%);
  padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--cell-ink); background: var(--glass); box-shadow: 0 2px 10px var(--cell-shadow);
}

/* Flat view: no tilt, softer lift */
.hive.is-flat .cell:hover, .hive.is-flat .cell.is-selected { --z: 0px; transform: translate3d(var(--x), var(--y), 0) scale(1.07); }

/* ---------- Leo the bee ---------- */
.hive__leo {
  position: absolute; left: 50%; top: 40%; width: 46px; height: auto; z-index: 5; pointer-events: none;
  transition: left 1.1s cubic-bezier(0.45, 0.05, 0.3, 1), top 1.1s cubic-bezier(0.45, 0.05, 0.3, 1);
  animation: leo-bob 1.7s ease-in-out infinite;
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.3));
}
.hive__leo.is-left { scale: -1 1; }
.hive__leo.is-happy { animation: leo-loop 1s cubic-bezier(0.3, 0.7, 0.3, 1); }
@keyframes leo-bob { 50% { transform: translateY(-7px) rotate(-5deg); } }
@keyframes leo-loop { 40% { transform: translateY(-30px) rotate(-200deg) scale(1.2); } 100% { transform: rotate(-360deg); } }
.spark {
  position: absolute; width: 11px; height: 12px; z-index: 6; pointer-events: none;
  clip-path: var(--hex); background: linear-gradient(var(--honey-top), var(--honey-bot));
  animation: spark 1.25s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes spark {
  from { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  70% { opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 40px)) rotate(var(--r)) scale(1); opacity: 0; }
}

/* ---------- Tools + legend ---------- */
.hive__tools { position: absolute; left: 12px; top: 12px; display: grid; gap: 6px; z-index: 4; }
.hive__tools .icon-btn {
  width: 38px; height: 38px; font-size: 17px; color: var(--label);
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px var(--cell-shadow);
}
.hive__legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 4; list-style: none;
  display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; max-width: calc(100% - 24px);
  border-radius: 12px; font-size: 12px; color: var(--cell-ink-2);
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.hive__legend li { display: flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 12px; height: 14px; clip-path: var(--hex); }
.lg--honey { background: linear-gradient(var(--honey-top), var(--honey-bot)); }
.lg--filling { background: linear-gradient(to top, var(--honey-bot) 35%, var(--wax-rim) 35%); }
.lg--wax { background: repeating-linear-gradient(60deg, var(--wax) 0 2px, var(--wax-rim) 2px 5px); }
.lg--due { background: var(--red); }

/* ---------- Honey-glass panel (a sibling of .hive: perspective there would trap position:fixed) ---------- */
.hive-wrap { position: relative; overflow: hidden; border-radius: 22px; }   /* clips the parked panel so the page never scrolls sideways */

/* Full screen: native :fullscreen, or .is-full where the browser won't allow it (iPhone) */
.hive-wrap:fullscreen, .hive-wrap.is-full { background: var(--bg); border-radius: 0; }
.hive-wrap.is-full { position: fixed; inset: 0; z-index: 60; }
.hive-wrap:fullscreen .hive, .hive-wrap.is-full .hive { height: 100vh; height: 100dvh; border-radius: 0; margin: 0; box-shadow: none; }
.hive-wrap:fullscreen .hive__tools, .hive-wrap.is-full .hive__tools { top: max(12px, env(safe-area-inset-top)); }
body.hive-full { overflow: hidden; }
[data-full][aria-pressed="true"] { background: var(--tint-fill) !important; color: var(--on-tint) !important; }
.hive__panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 360px; z-index: 7;
  padding: 22px 18px 18px; overflow-y: auto; cursor: default; touch-action: pan-y; user-select: text; -webkit-user-select: text;
  border-radius: 20px; background: var(--glass); color: var(--label);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 24px 60px var(--cell-shadow), inset 0 0 0 0.5px rgba(255, 255, 255, 0.35);
  transform: translateX(calc(100% + 24px)); visibility: hidden;
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0.45s;
}
.hive.has-panel + .hive__panel { transform: none; visibility: visible; transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1); }
.hive__close { position: absolute; right: 14px; top: 14px; }
.hp__tag { font-size: 13px; font-weight: 600; color: var(--tint); margin-bottom: 2px; padding-right: 36px; }
.hp__title { font-size: 26px; letter-spacing: -0.02em; margin-bottom: 4px; padding-right: 30px; word-break: break-word; }
.hp__state { font-size: 15px; color: var(--label-2); }
.hp__amount { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.hp__meter { height: 12px; margin: 14px 0 4px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.hp__meter span { display: block; height: 100%; width: calc(var(--h) * 100%); border-radius: inherit; background: linear-gradient(90deg, var(--honey-bot), var(--honey-top)); transition: width 0.8s; }
.hp__pct { font-size: 12px; color: var(--label-2); }
.hp__list { margin: 12px 0; padding: 0 14px; border-radius: 12px; background: var(--card); }
.hp__list > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 15px; box-shadow: inset 0 -0.5px 0 var(--sep); }
.hp__list > div:last-child { box-shadow: none; }
.hp__list dt { color: var(--label-2); }
.hp__list dd { font-weight: 600; text-align: right; }
.hp__label { font-size: 13px; color: var(--label-2); margin: 4px 0 6px; }
.hp__stages { display: flex; width: 100%; }
.hp__stages .chip { flex: 1; padding: 6px 2px; font-size: 12px; }
.hp__actions { display: grid; gap: 8px; margin-top: 16px; }
.hp__actions .btn { width: 100%; min-height: 44px; border-radius: 12px; }

@media (max-width: 1080px) {
  .honey-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .hive { height: max(420px, calc(100dvh - 330px)); border-radius: 18px; margin: 0 -4px; }
  .hive-head .actions { width: auto; }
  /* Phones: a bottom sheet pinned just above the tab bar */
  .hive__panel {
    position: fixed; top: auto; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 25;
    width: auto; max-height: 62vh; border-radius: 20px 20px 0 0;
    transform: translateY(calc(100% + 90px));
  }
  .hive__panel::before { content: ""; position: absolute; left: 50%; top: 7px; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); transform: translateX(-50%); }
  .has-panel .hive__legend { display: none; }
  .hive-wrap:fullscreen .hive__panel, .hive-wrap.is-full .hive__panel { bottom: 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .hive__legend { font-size: 11px; gap: 4px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .hive__leo { transition: none; }
  .cell__honey::before { animation: none; }
}

/* ==========================================================================
   Leo — TheVincis back office
   App chrome follows Apple's Human Interface Guidelines (system font, grouped
   inset lists, large titles, switches, segmented controls, sheets) with Vinci
   Gold as the tint. The PDF sheet at the bottom keeps the site's brand fonts.
   ========================================================================== */

:root {
  /* Brand constants (used by the PDF sheet — never themed) */
  --gold: #c5a028;
  --gold-fine: #d4af37;
  --gold-deep: #745b00;
  --muted: #7a7466;
  --display: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --sans: "Manrope", "Segoe UI", sans-serif;

  /* iOS system palette, light appearance */
  --ios: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter Tight", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --bg: #f2f2f7;               /* systemGroupedBackground */
  --card: #ffffff;             /* secondarySystemGroupedBackground */
  --card-2: #f2f2f7;           /* tertiary fill inside cards */
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.18);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --tint: #a8840f;             /* gold, darkened for text contrast */
  --tint-fill: #c9a227;        /* gold for filled controls */
  --on-tint: #1c1c1e;
  --tint-soft: rgba(201, 162, 39, 0.14);
  --green: #34c759;
  --green-text: #248a3d;
  --orange: #ff9500;
  --orange-text: #c93400;
  --red: #ff3b30;
  --red-text: #d70015;
  --blue-text: #0040dd;
  --chrome: rgba(249, 249, 249, 0.78);  /* translucent bars */
  --shadow: 0 0.5px 0 rgba(0, 0, 0, 0.04);
  --sheet-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
  --r-card: 12px;
  --r-ctl: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --card-2: #2c2c2e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.6);
    --label-3: rgba(235, 235, 245, 0.3);
    --sep: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.36);
    --tint: #e0bb4a;
    --tint-fill: #d4af37;
    --tint-soft: rgba(212, 175, 55, 0.18);
    --green-text: #30d158;
    --orange-text: #ff9f0a;
    --red-text: #ff453a;
    --blue-text: #64a8ff;
    --chrome: rgba(22, 22, 24, 0.78);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--ios);
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
img { display: block; max-width: 100%; }
svg { display: block; flex: none; }
code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.9em; background: var(--fill); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 34px; letter-spacing: -0.025em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }   /* Large Title */
h2 { font-size: 20px; letter-spacing: -0.015em; }                                                                     /* Title 3 */
.muted { color: var(--label-2); }
.pad { padding: 16px; }
.spacer { flex: 1; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--tint-soft); outline-offset: 1px; }

/* ---------- Boot + loading ---------- */
.boot, .loading { min-height: 60vh; display: grid; place-items: center; }
.boot { min-height: 100vh; }
.boot__bee, .loading img { width: 56px; height: auto; animation: hover 1.6s ease-in-out infinite; }
@keyframes hover { 50% { transform: translateY(-6px); } }

/* ---------- Buttons (iOS: filled / tinted / plain) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 16px;
  border: 0; border-radius: 999px;
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer; white-space: nowrap;
  transition: opacity 0.15s, background 0.15s, transform 0.1s;
}
.btn:active { opacity: 0.6; }
.btn:disabled { opacity: 0.4; cursor: progress; }
.btn--gold { background: var(--tint-fill); color: var(--on-tint); }
.btn--ghost { background: var(--fill); color: var(--tint); }
.btn--danger { background: var(--red); color: #fff; }
.btn--danger-ghost { background: transparent; color: var(--red-text); padding-left: 4px; padding-right: 4px; }
.btn--sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; min-height: 50px; border-radius: 14px; font-size: 17px; }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 0; border-radius: 999px; background: var(--fill); color: var(--label-2); cursor: pointer; font-size: 12px; }
.icon-btn:active { opacity: 0.6; }

/* ---------- Fields: inset grouped rows ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field__label { font-size: 13px; font-weight: 400; color: var(--label-2); padding-left: 2px; }
.field__hint { font-size: 12px; color: var(--label-2); padding-left: 2px; }
input:not([type=checkbox]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--card-2); border: 0; border-radius: var(--r-ctl);
  font-size: 17px; color: var(--label);
  transition: box-shadow 0.15s, background 0.15s;
}
.card input:not([type=checkbox]), .card select, .card textarea, .modal input:not([type=checkbox]), .modal select, .modal textarea { background: var(--fill); }
input::placeholder, textarea::placeholder { color: var(--label-3); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 1.5 9 4.5M3 7.5 6 10.5 9 7.5' fill='none' stroke='%238e8e93' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { resize: vertical; line-height: 1.35; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--tint-soft); }
input[type=date] { -webkit-appearance: none; }

/* Checkboxes render as iOS switches; label left, switch right */
.check {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 17px; cursor: pointer; flex-direction: row-reverse;
  min-height: 44px;
}
.check input, input[type=checkbox] {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 51px; height: 31px; border-radius: 999px;
  background: var(--fill-2); position: relative; cursor: pointer;
  transition: background 0.25s ease;
}
.check input::after, input[type=checkbox]::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.4, 1);
}
.check input:checked, input[type=checkbox]:checked { background: var(--green); }
.check input:checked::after, input[type=checkbox]:checked::after { transform: translateX(20px); }
.inline { display: flex; gap: 8px; align-items: center; }
.inline select { flex: 1; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth__card { width: min(380px, 100%); text-align: center; }
.auth__bee { width: 84px; height: auto; margin: 0 auto 10px; filter: drop-shadow(0 8px 20px rgba(201, 162, 39, 0.35)); }
.auth__word { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 22px; }
.auth__card h1 { font-size: 22px; justify-content: center; margin-bottom: 8px; }
.auth__card > p { margin-bottom: 16px; font-size: 15px; }
.auth__form { display: flex; flex-direction: column; gap: 12px; text-align: left; margin-top: 4px; }
.auth__form .field input { background: var(--card); min-height: 50px; border-radius: 12px; }
.auth__error { min-height: 1.2em; color: var(--red-text); font-size: 13px; text-align: center; }
.auth__qr { width: 200px; height: 200px; margin: 4px auto 12px; border-radius: 16px; padding: 10px; background: #fff; }
.auth__secret { font-size: 13px; margin-bottom: 4px; }
.auth__secret summary { cursor: pointer; color: var(--tint); }
.auth__secret code { display: block; margin-top: 8px; padding: 10px; }
.code-input { font-size: 28px !important; letter-spacing: 0.35em; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Shell: translucent sidebar (iPad style) ---------- */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  background: var(--chrome);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 0.5px solid var(--sep);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 18px;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.side__brand img { width: 34px; height: auto; }
.side__brand span { font-weight: 800; font-size: 26px; letter-spacing: -0.03em; }
.side__toggle { display: none; }
.side__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side__nav a, .side__out {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 17px; font-weight: 400; color: var(--label);
  background: none; border: 0; cursor: pointer; width: 100%; text-align: left;
}
.side__nav svg { width: 22px; height: 22px; color: var(--tint); }
.side__nav a:hover { background: var(--fill); }
.side__nav a.is-active { background: var(--tint-fill); color: var(--on-tint); font-weight: 600; }
.side__nav a.is-active svg { color: var(--on-tint); }
.side__out { margin-top: auto; color: var(--red-text); }
.side__out svg { color: var(--red-text) !important; }
.tabbar { display: none; }
.main { padding: 28px clamp(16px, 3vw, 40px) 64px; max-width: 1180px; width: 100%; outline: none; }

/* ---------- Page furniture ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.eyebrow { font-size: 15px; font-weight: 400; color: var(--tint); margin-bottom: 2px; display: flex; align-items: center; gap: 2px; }
.eyebrow a::before { content: "‹ "; font-size: 1.3em; line-height: 0; }
.eyebrow a { color: var(--tint); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border-radius: var(--r-card); margin-bottom: 22px; overflow: hidden; box-shadow: var(--shadow); }
.card.pad > h2, .card > .card__head h2 { font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; color: var(--label-2); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 8px; }
.card.pad > h2 + .muted { margin-top: 6px; font-size: 13px; }
.stack > .card { margin-bottom: 22px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.cols > .card { margin-bottom: 0; }
.cols + .card { margin-top: 22px; }
.empty { padding: 44px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.savebar { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 45%); display: flex; justify-content: flex-end; z-index: 2; }
.danger-zone { margin-top: 4px; }

/* Stats — iOS widgets */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 16px;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.stat:active { transform: scale(0.98); }
.stat span { font-size: 13px; font-weight: 600; color: var(--label-2); }
.stat b { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stat small { color: var(--label-2); font-size: 13px; }
.stat--alert b { color: var(--red-text); }

/* Segmented control + search */
.chips { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.segmented { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--fill); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.chip {
  padding: 6px 14px; border: 0; border-radius: 7px; background: transparent;
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--label);
  transition: background 0.2s, box-shadow 0.2s;
}
.chip.is-on { background: var(--card); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04); }
@media (prefers-color-scheme: dark) { .chip.is-on { background: #636366; } }
.search {
  margin-left: auto; max-width: 300px; min-height: 36px !important; padding: 7px 12px 7px 32px !important;
  border-radius: 10px !important; font-size: 17px !important; background: var(--fill) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5' fill='none' stroke='%238e8e93' stroke-width='1.8'/%3E%3Cpath d='m11 11 3.5 3.5' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: 10px center !important;
}

/* Tables read as inset grouped lists */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; font-weight: 400; color: var(--label-2); padding: 10px 16px 6px; white-space: nowrap; }
.table td { padding: 12px 16px; vertical-align: middle; font-size: 15px; box-shadow: inset 0 -0.5px 0 var(--sep); }
.table td:first-child { box-shadow: inset 16px 0 0 var(--card), inset 0 -0.5px 0 var(--sep); }
.table tr:last-child td { box-shadow: none; }
.table tbody tr[data-href], .table tbody tr.clickable { cursor: pointer; }
.table tbody tr:active td { background: var(--fill); }
.table tr.is-muted { opacity: 0.45; }
.table td a { color: inherit; }
.table td:last-child { position: relative; padding-right: 34px; }
.table tbody tr[data-href] td:last-child::after, .table tbody tr.clickable td:last-child::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px;
  border: solid var(--label-3); border-width: 2px 2px 0 0; transform: translateY(-50%) rotate(45deg);
}
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { display: block; color: var(--label-2); font-size: 13px; }

/* Status pills */
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--fill); color: var(--label-2); white-space: nowrap; letter-spacing: 0; vertical-align: middle; }
h1 .pill { font-size: 13px; padding: 4px 10px; }
.pill--sent, .pill--quoted { background: var(--tint-soft); color: var(--tint); }
.pill--accepted, .pill--paid, .pill--delivered { background: rgba(52, 199, 89, 0.15); color: var(--green-text); }
.pill--active { background: rgba(0, 122, 255, 0.12); color: var(--blue-text); }
.pill--unpaid { background: rgba(255, 149, 0, 0.15); color: var(--orange-text); }
.pill--overdue, .pill--declined { background: rgba(255, 59, 48, 0.13); color: var(--red-text); }

/* Client detail */
.info { display: grid; grid-template-columns: 120px 1fr; padding: 0 16px 6px; }
.info dt, .info dd { padding: 11px 0; box-shadow: inset 0 -0.5px 0 var(--sep); }
.info dt { color: var(--label-2); }
.info dd { text-align: right; }
.info dt:last-of-type, .info dd:last-of-type { box-shadow: none; }
.plist { list-style: none; }
.plist__item { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; text-align: left; padding: 11px 16px; background: none; border: 0; box-shadow: inset 16px 0 0 var(--card), inset 0 -0.5px 0 var(--sep); cursor: pointer; font-size: 15px; }
.plist li:last-child .plist__item { box-shadow: none; }
.plist__item:active { background: var(--fill); }
.plist__item .muted { grid-column: 1; font-size: 13px; }
.plist__item .pill { grid-row: 1 / 3; grid-column: 2; align-self: center; }

/* ---------- Editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.editor__side { position: sticky; top: 20px; display: grid; gap: 10px; }
.editor__side .card { margin-bottom: 0; }
.item {
  display: grid; grid-template-columns: minmax(0, 1fr) 72px 110px 110px 30px;
  gap: 10px; align-items: start; padding: 12px 16px; box-shadow: inset 16px 0 0 var(--card), inset 0 -0.5px 0 var(--sep);
}
.item.has-sac { grid-template-columns: minmax(0, 1fr) 90px 72px 110px 110px 30px; }
.item--head { padding-top: 4px; padding-bottom: 6px; font-size: 13px; color: var(--label-2); }
.item__desc { display: grid; gap: 6px; }
.item__desc input { font-weight: 600; }
.item__desc textarea { min-height: 36px; font-size: 15px; color: var(--label-2); }
.item__amt { padding-top: 12px; font-weight: 600; font-size: 15px; }
.item .icon-btn { margin-top: 7px; }
.items__add { display: flex; gap: 10px; align-items: center; padding: 12px 16px 14px; }
.items__add select { flex: 1; color: var(--tint); font-weight: 500; }

.totals { display: grid; gap: 10px; }
.totals__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 17px; }
.totals__row input { width: 120px; min-height: 36px; text-align: right; }
.totals__row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.totals .check { font-size: 17px; }
.totals__grand { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; margin: 6px -4px 0; border-radius: 14px; background: var(--label); color: var(--card); }
.totals__grand span { font-size: 13px; font-weight: 600; color: var(--gold-fine); text-transform: uppercase; letter-spacing: 0.04em; }
.totals__grand b { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.totals__words { font-size: 13px; color: var(--label-2); }

/* ---------- Sheets (dialogs) ---------- */
.modal {
  margin: auto; width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px);
  border: 0; border-radius: 14px; padding: 0; background: var(--bg); color: var(--label);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  animation: sheet-pop 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal--sm { width: min(300px, calc(100% - 48px)); background: var(--card); text-align: center; }   /* iOS alert */
.modal::backdrop { background: rgba(0, 0, 0, 0.35); animation: fade 0.25s ease; }
.modal__form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal__head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 16px 10px; }
.modal__head h2 { grid-column: 2; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.modal__head .icon-btn { grid-column: 3; justify-self: end; }
.modal__body { padding: 4px 16px 18px; overflow-y: auto; }
.modal__body > .grid { background: var(--card); border-radius: var(--r-card); padding: 14px; margin-top: 6px; }
.modal--sm .modal__body { padding: 20px 16px 16px; font-size: 15px; }
.modal__foot { display: flex; gap: 8px; align-items: center; padding: 10px 16px 16px; }
.modal--sm .modal__foot { padding: 0; gap: 0; box-shadow: inset 0 0.5px 0 var(--sep); }
.modal--sm .modal__foot .spacer { display: none; }
.modal--sm .modal__foot .btn { flex: 1; border-radius: 0; min-height: 44px; background: transparent; font-size: 17px; font-weight: 400; color: var(--tint); }
.modal--sm .modal__foot .btn + .btn { box-shadow: inset 0.5px 0 0 var(--sep); font-weight: 600; }
.modal--sm .modal__foot .btn--danger { color: var(--red-text); }
@keyframes sheet-pop { from { opacity: 0; transform: scale(0.96) translateY(10px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Toasts — iOS banner ---------- */
.toasts { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(380px, calc(100% - 24px)); }
.toast {
  padding: 12px 16px; border-radius: 16px; font-size: 15px; font-weight: 500; text-align: center;
  background: var(--chrome); color: var(--label);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), inset 0 0 0 0.5px var(--sep);
  animation: toast-in 0.35s cubic-bezier(0.32, 0.72, 0, 1); transition: opacity 0.4s, transform 0.4s;
}
.toast--err { color: var(--red-text); }
.toast--warn { color: var(--orange-text); }
.toast.is-out { opacity: 0; transform: translateY(-12px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor { grid-template-columns: 1fr; }
  .editor__side { position: static; }
}
@media (max-width: 820px) {
  /* iPhone: compact nav bar on top, tab bar at the bottom */
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .side {
    position: sticky; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between;
    padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); gap: 0; z-index: 20;
    border-right: 0; border-bottom: 0.5px solid var(--sep);
  }
  .side__brand { padding: 2px 0; }
  .side__brand img { width: 28px; }
  .side__brand span { font-size: 20px; }
  .side__toggle { display: inline-grid; width: 34px; height: 34px; font-size: 15px; color: var(--tint); }
  .side__nav { display: none; flex-basis: 100%; padding: 10px 0 6px; }
  .nav-open .side__nav { display: flex; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 4px calc(4px + env(safe-area-inset-bottom));
    background: var(--chrome); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--sep);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 500; color: #8e8e93; padding: 2px 0; }
  .tabbar svg { width: 26px; height: 26px; }
  .tabbar a.is-active { color: var(--tint); }
  .main { padding: 14px 16px 40px; }
  h1 { font-size: 30px; }
  .cols, .grid { grid-template-columns: 1fr; }
  .search { margin-left: 0; max-width: none; flex-basis: 100%; }
  .segmented { flex-basis: 100%; }
  .chip { flex: 1; }

  /* Lists: each table row becomes a two-line cell */
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tr { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; padding: 10px 34px 10px 16px; position: relative; box-shadow: inset 16px 0 0 var(--card), inset 0 -0.5px 0 var(--sep); }
  .table tr:last-child { box-shadow: none; }
  .table td { display: block; padding: 0; box-shadow: none !important; font-size: 13px; color: var(--label-2); grid-column: 1; }
  .table td:first-child { font-size: 17px; color: var(--label); grid-column: 1; }
  .table td.num { grid-column: 2; grid-row: 1; font-size: 15px; color: var(--label); }
  .table td:last-child { grid-column: 2; grid-row: 2; justify-self: end; padding-right: 0; position: static; }
  .table tbody tr[data-href] td:last-child::after, .table tbody tr.clickable td:last-child::after { right: 14px; }

  .item, .item.has-sac { grid-template-columns: 1fr 1fr 30px; }
  .item__desc { grid-column: 1 / 3; grid-row: 1; }
  .item--head { display: none; }
  .item [data-k=sac] { grid-column: 1 / -1; }
  .item__amt { grid-column: 1 / 3; text-align: left !important; padding-top: 0; }
  .item .icon-btn { grid-row: 1; grid-column: 3; justify-self: end; }
  .items__add { flex-wrap: wrap; }

  /* Dialogs become bottom sheets */
  .modal:not(.modal--sm) {
    width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0;
    border-radius: 14px 14px 0 0; box-shadow: var(--sheet-shadow);
    animation: sheet-up 0.42s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .modal:not(.modal--sm) .modal__form { max-height: 92vh; }
  .modal:not(.modal--sm) .modal__head::before { content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); transform: translateX(-50%); }
  .modal__foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat b { font-size: 22px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* ==========================================================================
   PDF sheet — A4 (210 × 297 mm), rendered off-screen and captured by html2pdf
   ========================================================================== */
.sheet-stage { position: fixed; left: -10000px; top: 0; pointer-events: none; }
.sheet {
  width: 210mm; min-height: 296mm; padding: 12mm 15mm 0;
  background: #fff; color: #1a1a1a;
  font-family: var(--sans); font-size: 9.6pt; line-height: 1.5;
  display: flex; flex-direction: column;
}
.sheet h4 { font-family: var(--sans); font-size: 7.2pt; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 5px; }
.sheet__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; }
.sheet__brand { display: flex; align-items: center; gap: 4mm; }
.sheet__brand img { width: 19mm; height: auto; }
.sheet__word { font-family: var(--display); font-size: 21pt; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.sheet__word em { font-style: normal; color: var(--gold); }
.sheet__tag { font-size: 8pt; color: var(--muted); margin-top: 3px; }
.sheet__title { text-align: right; }
.sheet__title h1 { display: block; font-family: var(--display); font-size: 24pt; font-weight: 300; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1; color: #1a1a1a; }
.sheet__no { margin-top: 6px; font-weight: 800; font-size: 10.5pt; color: var(--gold-deep); letter-spacing: 0.04em; }
.sheet__rule { height: 2px; margin: 6mm 0 5mm; background: linear-gradient(90deg, var(--gold-deep), var(--gold-fine) 40%, rgba(212, 175, 55, 0.15)); }
.sheet__parties { display: grid; grid-template-columns: 1fr 1fr 48mm; gap: 7mm; margin-bottom: 6mm; }
.sheet__party { font-family: var(--display); font-weight: 700; font-size: 11pt; margin-bottom: 2px; }
.sheet__parties p { color: #3c3a35; }
.sheet__dates { background: #faf7ee; border-radius: 3mm; padding: 4mm; display: grid; gap: 3mm; align-content: start; }
.sheet__dates div { display: flex; flex-direction: column; }
.sheet__dates span { font-size: 7pt; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.sheet__dates b { font-size: 10pt; }

.sheet__items { width: 100%; border-collapse: collapse; margin-bottom: 5mm; }
.sheet__items th { font-size: 7pt; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; text-align: left; color: #fff; background: #1a1a1a; padding: 3mm 3mm; }
.sheet__items th:first-child { border-radius: 2mm 0 0 2mm; }
.sheet__items th:last-child { border-radius: 0 2mm 2mm 0; }
.sheet__items td { padding: 2.6mm 3mm; border-bottom: 1px solid #ece8dd; vertical-align: top; }
.sheet__items .c-num { width: 9mm; color: var(--muted); }
.sheet__items .c-desc b { display: block; font-weight: 700; }
.sheet__items .c-desc span { display: block; color: #6d675b; font-size: 8.4pt; margin-top: 1px; }
.sheet__items .c-sac { width: 18mm; }
.sheet__items .c-qty { width: 18mm; text-align: center; }
.sheet__items .c-qty small { color: var(--muted); }
.sheet__items .c-amt { width: 30mm; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet__items th.c-qty { text-align: center; }
.sheet__items th.c-amt { text-align: right; }

.sheet__sum { display: grid; grid-template-columns: 1fr 74mm; gap: 8mm; align-items: start; margin-bottom: 5mm; }
.sheet__words { font-style: italic; color: #3c3a35; padding-top: 2mm; }
.sheet__words span { display: block; font-style: normal; font-size: 7pt; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 3px; }
.sheet__totals > div { display: flex; justify-content: space-between; padding: 1.1mm 3mm; font-variant-numeric: tabular-nums; }
.sheet__totals > div span:first-child { color: #55524a; }
.sheet__grand { margin-top: 2mm; padding: 3.6mm 4mm !important; background: #1a1a1a; border-radius: 2.5mm; color: #fff; align-items: baseline; }
.sheet__grand span:first-child { color: var(--gold-fine) !important; font-size: 7.6pt; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.sheet__grand span:last-child { font-family: var(--display); font-size: 15pt; font-weight: 700; }

.sheet__pay { display: flex; justify-content: space-between; gap: 8mm; padding: 4mm 5mm; border: 1px solid #ece3c4; background: #fffcf2; border-radius: 3mm; margin-bottom: 5mm; }
.sheet__pay dl { display: grid; grid-template-columns: 26mm 1fr; gap: 1mm 4mm; }
.sheet__pay dt { color: var(--muted); }
.sheet__pay dd { font-weight: 700; }
.sheet__qr { text-align: center; }
.sheet__qr img { width: 22mm; height: 22mm; image-rendering: pixelated; }
.sheet__qr figcaption { font-size: 7pt; color: var(--muted); margin-top: 1mm; }

.sheet__note { margin-bottom: 4mm; }
.sheet__note p { color: #3c3a35; }
.sheet__foot {
  margin-top: auto; margin-left: -15mm; margin-right: -15mm;
  display: flex; justify-content: space-between; gap: 6mm;
  padding: 4.5mm 15mm; background: #1a1a1a; color: rgba(255, 255, 255, 0.75); font-size: 8pt;
  border-top: 2px solid var(--gold);
}
.sheet__foot span:first-child { color: var(--gold-fine); font-weight: 700; }
