/* ============================================================
   Offer Letter Generator — stylesheet
   Palette: near-black console, single MZOS orange accent,
   letter renders as white paper floating on the dark surface.
   ============================================================ */

:root {
  --ink-950: #07080a;
  --ink-900: #0b0d10;
  --ink-850: #101317;
  --ink-800: #14171c;
  --ink-750: #191d23;
  --line:      #262b33;
  --line-soft: #1c2027;

  --text:  #eef1f5;
  --muted: #98a1ad;
  --faint: #6b7480;

  --accent:      #e8650a;
  --accent-soft: rgba(232, 101, 10, 0.14);
  --accent-line: rgba(232, 101, 10, 0.42);

  --ok:   #35c08a;
  --warn: #e8b23a;
  --err:  #ef5d5d;
  --info: #5b8def;

  --paper: #ffffff;
  --paper-ink: #16181d;

  --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display:'Plus Jakarta Sans', var(--sans);
  --serif: 'Source Serif 4', 'Times New Roman', Georgia, serif;
  --mono:  'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ink-950);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.015em; }

a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--display); font-size: 14px; font-weight: 600;
  padding: 11px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, transform .08s ease, color .16s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #f5761d; }

.btn-outline { background: transparent; border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--accent-line); color: #fff; }

.btn-ghost { background: var(--ink-800); border-color: var(--line-soft); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line); }

.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: #f47070; }

.btn-sm { padding: 8px 13px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-size: 13.5px; font-weight: 500;
  text-decoration: none; border-bottom: 1px solid transparent;
}
.btn-link:hover { border-bottom-color: var(--accent-line); }
.btn-link:disabled { color: var(--faint); cursor: not-allowed; }
.btn-link.danger { color: var(--err); }
.btn-link.muted { color: var(--faint); }

/* ── Alerts + toast ──────────────────────────────────────── */

.alert {
  padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
  font-size: 13.5px; line-height: 1.45;
  border: 1px solid var(--line); background: var(--ink-800); color: var(--text);
}
.alert-err  { border-color: rgba(239, 93, 93, .45);  background: rgba(239, 93, 93, .10); }
.alert-ok   { border-color: rgba(53, 192, 138, .40); background: rgba(53, 192, 138, .10); }
.alert-warn { border-color: rgba(232, 178, 58, .40); background: rgba(232, 178, 58, .10); }

.flash-stack {
  max-width: 1440px; margin: 16px auto 0; padding: 0 24px;
  transition: opacity .4s ease;
}
.flash-stack.is-gone { opacity: 0; pointer-events: none; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 18px);
  background: var(--ink-750); color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 14px; opacity: 0; pointer-events: none; z-index: 90;
  transition: opacity .2s ease, transform .2s ease;
  max-width: min(420px, calc(100vw - 32px));
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast-ok  { border-left-color: var(--ok); }
.toast-err { border-left-color: var(--err); }

/* ── Fields ──────────────────────────────────────────────── */

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block; margin-bottom: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  font-family: var(--display); letter-spacing: .01em;
}
.field-label b { color: var(--accent); font-weight: 700; }

.field input, .field select, .field textarea,
.filter-bar input, .filter-bar select {
  width: 100%; padding: 11px 13px;
  background: var(--ink-900); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--sans); font-size: 14.5px;
  transition: border-color .15s ease, background .15s ease;
}
.field textarea { resize: vertical; min-height: 62px; }
.field input::placeholder, .field textarea::placeholder { color: #4e5661; }

.field input:hover, .field select:hover, .field textarea:hover { border-color: #333a44; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); background: var(--ink-850);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input.has-error, .field textarea.has-error, .field select.has-error {
  border-color: var(--err); box-shadow: 0 0 0 3px rgba(239, 93, 93, .14);
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2398a1ad' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
  padding-right: 34px;
}
.field input[type="date"] { min-height: 44px; }
.field input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }

.field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--faint); line-height: 1.45; }

.field-wrap { position: relative; display: block; }
.field-wrap input { padding-right: 74px; }
.field-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--ink-750); border: 1px solid var(--line); color: var(--muted);
  font-size: 12px; font-weight: 600; padding: 6px 11px;
  border-radius: 7px; cursor: pointer;
}
.field-toggle:hover { color: var(--text); border-color: var(--accent-line); }

/* ============================================================
   AUTH
   ============================================================ */

.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 8% -10%, rgba(232, 101, 10, .12), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(10, 36, 99, .30), transparent 62%),
    var(--ink-950);
}

.auth-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
  max-width: 1180px; margin: 0 auto; gap: 0;
}

.auth-aside { padding: 56px 52px; display: flex; flex-direction: column; justify-content: center; }

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 44px; }
.auth-brand strong { display: block; font-family: var(--display); font-size: 15px; letter-spacing: .02em; }
.auth-brand span   { display: block; font-size: 12.5px; color: var(--faint); }

.auth-mark {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  background: var(--accent); color: #fff; border-radius: 11px;
  font-family: var(--display); font-weight: 800; font-size: 17px;
}

.auth-headline {
  font-size: clamp(30px, 4vw, 42px); line-height: 1.1; margin: 0 0 16px; font-weight: 700;
}
.auth-headline em { color: var(--accent); font-style: normal; }

.auth-sub { color: var(--muted); font-size: 15px; max-width: 42ch; margin: 0 0 36px; }

.auth-steps { list-style: none; padding: 0; margin: 0 0 32px; }
.auth-steps li { display: flex; gap: 14px; padding: 0 0 22px; position: relative; }
.auth-steps li:not(:last-child)::before {
  content: ''; position: absolute; left: 6px; top: 18px; bottom: 4px;
  width: 1px; background: var(--line);
}
.step-dot {
  width: 13px; height: 13px; flex: none; margin-top: 5px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--ink-900); position: relative; z-index: 1;
}
.auth-steps .is-current .step-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-steps .is-done .step-dot { border-color: var(--ok); background: var(--ok); }
.auth-steps strong { display: block; font-family: var(--display); font-size: 14.5px; }
.auth-steps em { display: block; font-style: normal; font-size: 12.5px; color: var(--faint); }

.auth-facts { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line-soft); padding-top: 20px; }
.auth-facts li {
  font-size: 12.5px; color: var(--faint); padding-left: 18px; position: relative; margin-bottom: 7px;
}
.auth-facts li::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-line);
}

.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 32px; }

.auth-card {
  width: 100%; max-width: 400px;
  background: var(--ink-850); border: 1px solid var(--line);
  border-radius: 18px; padding: 34px 30px; box-shadow: var(--shadow);
}

.auth-eyebrow {
  margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--accent); font-family: var(--display);
}
.auth-title { margin: 0 0 8px; font-size: 25px; font-weight: 700; }
.auth-text  { margin: 0 0 26px; font-size: 14px; color: var(--muted); }

.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.auth-row .inline { display: inline; }

.auth-foot {
  margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--faint); text-align: center;
}

.otp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 20px; }
.otp-box {
  width: 100%; aspect-ratio: 3 / 4; text-align: center;
  font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--text);
  background: var(--ink-900); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.otp-box:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); background: var(--ink-850);
}

/* ============================================================
   APP SHELL
   ============================================================ */

.app-body {
  min-height: 100vh;
  background:
    radial-gradient(900px 480px at 88% -12%, rgba(232, 101, 10, .085), transparent 62%),
    var(--ink-950);
}

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 24px; border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 13, 16, .88); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 40;
}
.topbar-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.topbar-title { font-family: var(--display); font-weight: 700; font-size: 15px; }
.topbar-title em { font-style: normal; color: var(--faint); font-weight: 500; }

.topbar-nav { display: flex; gap: 4px; margin-left: 8px; }
.topbar-nav a {
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
  font-size: 14px; font-weight: 500; color: var(--muted);
}
.topbar-nav a:hover { color: var(--text); background: var(--ink-800); }
.topbar-nav a.is-active { color: var(--text); background: var(--ink-800); box-shadow: inset 0 -2px 0 var(--accent); }

.topbar-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent);
  font-family: var(--display); font-weight: 700; font-size: 14px;
}
.topbar-meta { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-meta strong { font-size: 13px; font-weight: 600; }
.topbar-meta em { font-style: normal; font-size: 11.5px; color: var(--faint); }

.page { max-width: 1440px; margin: 0 auto; padding: 28px 24px 60px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 24px;
}
.page-head h1 { margin: 4px 0 8px; font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; }
.page-sub { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 66ch; }

.eyebrow {
  margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--accent); font-family: var(--display);
}

.counter {
  text-align: right; padding: 14px 20px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-850);
}
.counter-num { display: block; font-family: var(--mono); font-size: 26px; font-weight: 700; }
.counter-label { font-size: 11.5px; color: var(--faint); letter-spacing: .04em; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 14px;
  background: var(--ink-850); border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.toolbar-left { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-note { font-size: 12px; color: var(--faint); }

/* Style switcher */
.style-switch {
  padding: 14px 16px; margin-bottom: 20px;
  background: var(--ink-850); border: 1px solid var(--line-soft); border-radius: var(--radius);
  display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; align-items: center;
}
.style-switch-label {
  font-family: var(--display); font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.style-options {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  background: var(--ink-900); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 4px;
}
.style-option {
  padding: 9px 12px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--muted);
  font-family: var(--display); font-size: 13.5px; font-weight: 600;
  transition: background .16s ease, color .16s ease;
}
.style-option:hover { color: var(--text); }
.style-option.is-active { background: var(--ink-750); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.style-desc { grid-column: 2; margin: 0; font-size: 12px; color: var(--faint); }

/* ── Workspace ───────────────────────────────────────────── */

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); gap: 20px; align-items: start; }

.form-column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card {
  background: var(--ink-850); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 20px; margin: 0;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 15.5px; font-weight: 700; margin: 0 0 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line-soft);
}
.card-icon {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  border-radius: 8px; background: var(--accent-soft); color: var(--accent);
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}

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

.breakdown {
  background: var(--ink-900); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 6px 14px; margin: 4px 0 16px;
}
.breakdown-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px; color: var(--muted);
}
.breakdown-row:last-child { border-bottom: 0; }
.breakdown-row b { font-family: var(--mono); font-size: 14px; color: var(--text); font-weight: 500; }
.breakdown-row.is-total { border-top: 1px solid var(--line); margin-top: 2px; }
.breakdown-row.is-total span { color: var(--text); font-weight: 600; }
.breakdown-row.is-total b { color: var(--accent); font-weight: 700; }

/* ── Preview ─────────────────────────────────────────────── */

.preview-column { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.preview-panel {
  background: var(--ink-850); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
}
.preview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
}
.preview-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.preview-actions { display: flex; gap: 8px; }

.sheet-scroll {
  max-height: min(70vh, 880px); overflow-y: auto; padding: 20px;
  background: repeating-linear-gradient(45deg, #0a0c0f 0 12px, #0c0e12 12px 24px);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.sheet-scroll::-webkit-scrollbar { width: 8px; }
.sheet-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.preview-foot {
  display: flex; gap: 10px; padding: 14px 16px;
  border-top: 1px solid var(--line-soft); flex-wrap: wrap;
}
.preview-foot .btn { flex: 1 1 130px; }

/* ── The letter itself (paper) ───────────────────────────── */

.sheet {
  background: var(--paper); color: var(--paper-ink);
  padding: 40px 42px; border-radius: 4px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .55);
  font-family: var(--serif); font-size: 14px; line-height: 1.68;
}
.sheet p { margin: 0 0 12px; text-align: justify; }

.sheet-letterhead { text-align: center; padding-bottom: 12px; border-bottom: 2px solid var(--paper-ink); }
.sheet-letterhead h1 { margin: 0 0 6px; font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: .01em; }
.sheet-address { margin: 0; font-size: 11.5px; color: #5c6169; line-height: 1.45; }

.sheet-title {
  margin: 22px 0; text-align: center; font-family: var(--serif);
  font-size: 15px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; text-decoration: underline; text-underline-offset: 5px;
}

.sheet-meta {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 12.5px; color: #4b5058; margin-bottom: 18px; flex-wrap: wrap;
}

.sheet-to { margin-bottom: 18px; }
.to-label { display: block; font-weight: 700; margin-bottom: 3px; }
.to-name { font-weight: 700; }
.to-line { font-size: 12.5px; color: #4b5058; }

.sheet-subject { margin-bottom: 16px !important; text-align: left !important; }
.sheet-greeting { margin-bottom: 14px !important; text-align: left !important; }

.sheet-subhead { font-weight: 700; margin: 18px 0 8px !important; text-align: left !important; }

.sheet-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 12.5px; }
.sheet-table td { border: 1px solid #b9bec6; padding: 7px 10px; }
.sheet-table .amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; width: 26%; }
.sheet-table .pm { text-align: right; white-space: nowrap; color: #6a707a; font-size: 11px; width: 26%; }
.sheet-table .total td { background: #f1f2f4; font-weight: 700; }

.sheet-benefits { font-size: 12px !important; color: #4b5058; }

.sheet-sign { margin-top: 30px; }
.sign-for { margin-bottom: 0 !important; text-align: left !important; }
.sign-line { width: 200px; border-top: 1px solid #2c2f36; margin: 42px 0 6px; }
.sign-name { margin: 0 !important; font-weight: 700; }
.sign-role { margin: 0 !important; font-size: 12px; color: #5c6169; }

.sheet-accept { margin-top: 26px; padding-top: 14px; border-top: 1px dashed #b9bec6; }
.accept-title { font-weight: 700; margin-bottom: 6px !important; text-align: left !important; }
.accept-text { font-size: 12px !important; color: #4b5058; }
.accept-lines { display: flex; gap: 8%; margin-top: 34px; }
.accept-lines span {
  flex: 1; border-top: 1px solid #2c2f36; padding-top: 4px;
  font-size: 11px; color: #5c6169;
}

/* Style variants */
.sheet-modern {
  font-family: var(--sans); font-size: 13.5px;
}
.sheet-modern .sheet-letterhead { text-align: left; border-bottom: 3px solid var(--accent); }
.sheet-modern .sheet-letterhead h1 { font-family: var(--display); font-size: 19px; letter-spacing: -.01em; }
.sheet-modern .sheet-address { text-align: left; }
.sheet-modern .sheet-title {
  text-align: left; text-decoration: none; font-family: var(--display);
  color: var(--accent); letter-spacing: .16em; font-size: 12px; margin: 20px 0 16px;
}
.sheet-modern .sheet-table td { border: 0; border-bottom: 1px solid #e3e5e9; }
.sheet-modern .sheet-table .total td { background: transparent; border-bottom: 2px solid var(--paper-ink); }
.sheet-modern p { text-align: left; }

.sheet-minimal { font-family: var(--sans); font-size: 13.5px; padding: 46px 44px; }
.sheet-minimal .sheet-letterhead { border-bottom: 1px solid #dfe1e5; }
.sheet-minimal .sheet-letterhead h1 { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: .12em; }
.sheet-minimal .sheet-title {
  text-decoration: none; font-family: var(--display); font-weight: 600;
  font-size: 11.5px; letter-spacing: .2em; color: #6a707a;
}
.sheet-minimal .sheet-table td { border: 0; border-bottom: 1px solid #eceef1; padding: 8px 0; }
.sheet-minimal .sheet-table .total td { background: transparent; border-bottom: 0; border-top: 1px solid var(--paper-ink); }
.sheet-minimal p { text-align: left; }

/* ── Recently saved ──────────────────────────────────────── */

.recent {
  background: var(--ink-850); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 18px;
}
.recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.recent-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.recent-empty { margin: 0; font-size: 13.5px; color: var(--faint); }

.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.recent-list li:last-child { border-bottom: 0; }
.recent-main { min-width: 0; }
.recent-main strong { display: block; font-size: 14px; }
.recent-main span { display: block; font-size: 12.5px; color: var(--muted); }
.recent-main em { display: block; font-style: normal; font-size: 11.5px; color: var(--faint); font-family: var(--mono); }
.recent-side { display: flex; align-items: center; gap: 12px; flex: none; }

/* ── Pills ───────────────────────────────────────────────── */

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; font-family: var(--display);
  border: 1px solid var(--line); color: var(--muted); background: var(--ink-800);
  white-space: nowrap;
}
.pill-issued   { color: var(--info); border-color: rgba(91, 141, 239, .4); background: rgba(91, 141, 239, .1); }
.pill-accepted { color: var(--ok);   border-color: rgba(53, 192, 138, .4); background: rgba(53, 192, 138, .1); }
.pill-declined { color: var(--err);  border-color: rgba(239, 93, 93, .4);  background: rgba(239, 93, 93, .1); }

/* ── Stats / filters / table ─────────────────────────────── */

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--ink-850); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat b { display: block; font-family: var(--mono); font-size: 22px; font-weight: 700; }
.stat span { font-size: 12px; color: var(--faint); }

.filter-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--ink-850); border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.field-flush { margin-bottom: 0; }
.filter-bar .field-flush:first-of-type { flex: 1 1 280px; }
.filter-bar .field-flush + .field-flush { flex: 0 1 170px; }

.filter-tabs { display: flex; gap: 4px; margin-left: auto; background: var(--ink-900); padding: 4px; border-radius: var(--radius-sm); }
.filter-tabs a {
  padding: 7px 14px; border-radius: 7px; text-decoration: none;
  font-size: 13px; font-weight: 600; color: var(--muted); font-family: var(--display);
}
.filter-tabs a.is-active { background: var(--ink-750); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

.table-wrap {
  background: var(--ink-850); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 12px 16px; font-family: var(--display);
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); border-bottom: 1px solid var(--line);
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .14s ease, opacity .3s ease, transform .3s ease; }
.data-table tbody tr:hover { background: var(--ink-800); }
.data-table tbody tr.is-leaving { opacity: 0; transform: translateX(14px); }
.data-table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.data-table .right { text-align: right; }
.cell-sub { display: block; font-size: 11.5px; color: var(--faint); font-family: var(--sans); margin-top: 2px; }
.row-actions { display: inline-flex; gap: 14px; justify-content: flex-end; }

.empty {
  text-align: center; padding: 56px 24px;
  background: var(--ink-850); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty h2 { margin: 0 0 8px; font-size: 19px; }
.empty p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }
.pager-btn {
  padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  text-decoration: none; font-size: 13.5px; color: var(--text); font-weight: 500;
}
.pager-btn:hover { border-color: var(--accent-line); }
.pager-btn.is-disabled { opacity: .4; pointer-events: none; }
.pager-info { font-size: 13px; color: var(--faint); }

/* ── Modal ───────────────────────────────────────────────── */

.modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(4, 5, 7, .74); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px;
}
.modal[hidden] { display: none; }
.modal-box {
  width: 100%; max-width: 420px; background: var(--ink-850);
  border: 1px solid var(--line); border-radius: 16px; padding: 26px; box-shadow: var(--shadow);
}
.modal-box h3 { margin: 0 0 8px; font-size: 19px; }
.modal-box p { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Footer ──────────────────────────────────────────────── */

.app-foot {
  max-width: 1440px; margin: 0 auto; padding: 22px 24px 40px;
  border-top: 1px solid var(--line-soft);
}
.app-foot p { margin: 0; font-size: 12.5px; color: var(--faint); }
.app-foot strong { color: var(--muted); }
.app-foot-meta { margin-top: 4px !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-column { position: static; }
  .sheet-scroll { max-height: none; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { padding: 40px 26px 8px; }
  .auth-headline { font-size: 28px; }
  .auth-steps { margin-bottom: 20px; }
  .auth-facts { display: none; }
  .auth-main { padding: 24px 20px 48px; }

  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .filter-tabs { margin-left: 0; width: 100%; }
  .filter-tabs a { flex: 1; text-align: center; }
}

@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .page { padding: 20px 16px 48px; }
  .flash-stack { padding: 0 16px; }

  .topbar { gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
  .topbar-nav { order: 3; width: 100%; margin-left: 0; }
  .topbar-nav a { flex: 1; text-align: center; }
  .topbar-meta { display: none; }

  .page-head { flex-direction: column; align-items: flex-start; }
  .counter { text-align: left; width: 100%; }

  .style-switch { grid-template-columns: 1fr; }
  .style-desc { grid-column: 1; }

  .grid { grid-template-columns: 1fr; }
  .grid .span-2 { grid-column: span 1; }

  .card { padding: 16px; }
  .sheet { padding: 26px 22px; font-size: 13px; }
  .sheet-scroll { padding: 12px; }
  .preview-foot .btn { flex: 1 1 100%; }

  /* Table → stacked cards */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .data-table td { border: 0; padding: 6px 16px; }
  .data-table td::before {
    content: attr(data-label); display: block;
    font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint);
    margin-bottom: 2px; font-family: var(--display);
  }
  .data-table .right { text-align: left; }
  .row-actions { justify-content: flex-start; }

  .otp-grid { gap: 6px; }
  .otp-box { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   PRINT — only the letter goes on paper
   ============================================================ */

@media print {
  @page { size: A4; margin: 16mm; }

  body { background: #fff !important; }
  .topbar, .flash-stack, .page-head, .toolbar, .style-switch,
  .form-column, .preview-head, .preview-foot, .recent,
  .app-foot, .toast, .modal { display: none !important; }

  .page { padding: 0; max-width: none; }
  .workspace { display: block; }
  .preview-column, .preview-panel { position: static; border: 0; background: none; }
  .sheet-scroll { max-height: none; overflow: visible; padding: 0; background: none; }

  .sheet {
    box-shadow: none; border-radius: 0; padding: 0;
    font-size: 11.5pt; color: #000; line-height: 1.6;
  }
  .sheet-table { page-break-inside: avoid; }
  .sheet-sign, .sheet-accept { page-break-inside: avoid; }
}
