:root {
  color-scheme: light dark;

  --bg: light-dark(#fafafa, #0b0c10);
  --surface: light-dark(#ffffff, #121318);
  --subtle: light-dark(#f4f4f5, #181920);
  --hover: light-dark(#f4f4f5, #1d1e26);
  --line: light-dark(#e4e4e7, #272832);
  --line-2: light-dark(#f0f0f2, #1e1f27);
  --line-strong: light-dark(#d4d4d8, #363743);
  --ink: light-dark(#09090b, #f4f4f5);
  --ink-2: light-dark(#52525b, #b4b4bd);
  --ink-3: light-dark(#71717a, #8e8e99);
  --ink-4: light-dark(#a1a1aa, #5c5c68);
  --glass: light-dark(rgb(255 255 255 / 0.92), rgb(18 19 24 / 0.88));

  --accent: light-dark(#1e3a8a, #4169e1);
  --accent-hover: light-dark(#172554, #3557c4);
  --accent-ink: light-dark(#1e3a8a, #a3b6f2);
  --accent-soft: light-dark(#eff6ff, rgb(65 105 225 / 0.18));
  --accent-ring: light-dark(rgb(30 58 138 / 0.22), rgb(65 105 225 / 0.45));
  --saffron: #fbbf24;
  --saffron-edge: #f59e0b;
  --saffron-soft: light-dark(#fef3c7, rgb(251 191 36 / 0.14));
  --saffron-ink: light-dark(#78350f, #fcd34d);

  --ok: light-dark(#059669, #10b981);
  --ok-ink: light-dark(#047857, #6ee7b7);
  --ok-soft: light-dark(#ecfdf5, rgb(16 185 129 / 0.14));
  --bad: light-dark(#dc2626, #ef4444);
  --bad-ink: light-dark(#b91c1c, #fca5a5);
  --bad-soft: light-dark(#fef2f2, rgb(239 68 68 / 0.14));
  --bad-line: light-dark(#fecaca, rgb(239 68 68 / 0.35));
  --warn: light-dark(#d97706, #f59e0b);
  --warn-ink: light-dark(#b45309, #fcd34d);
  --warn-soft: light-dark(#fffbeb, rgb(245 158 11 / 0.14));

  --r1: light-dark(#1e3a8a, #8aa4f0);
  --r2: light-dark(#0d9488, #2dd4bf);
  --r3: light-dark(#c2410c, #fb923c);
  --r4: light-dark(#be185d, #f472b6);
  --r5: light-dark(#0f766e, #34d399);
  --r6: light-dark(#0369a1, #38bdf8);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  --sh-xs: 0 1px 2px light-dark(rgb(24 24 27 / 0.05), rgb(0 0 0 / 0.4));
  --sh-sm: 0 1px 2px light-dark(rgb(24 24 27 / 0.04), rgb(0 0 0 / 0.35)), 0 1px 3px light-dark(rgb(24 24 27 / 0.06), rgb(0 0 0 / 0.4));
  --sh-md: 0 2px 4px -1px light-dark(rgb(24 24 27 / 0.05), rgb(0 0 0 / 0.4)), 0 6px 16px -4px light-dark(rgb(24 24 27 / 0.08), rgb(0 0 0 / 0.5));
  --sh-lg: 0 4px 12px -4px light-dark(rgb(24 24 27 / 0.08), rgb(0 0 0 / 0.5)), 0 20px 48px -12px light-dark(rgb(24 24 27 / 0.22), rgb(0 0 0 / 0.7));

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--line-strong) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 0.875rem/1.5 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #fde68a;
  color: var(--ink);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--ink-4);
}

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

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h2 {
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.011em;
}

h3 {
  font-size: 0.8125rem;
  font-weight: 600;
}

a {
  color: var(--accent-ink);
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover {
  text-decoration: underline;
}

strong {
  font-weight: 600;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

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

[hidden] {
  display: none !important;
}

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

.small {
  font-size: 0.8125rem;
}
.muted {
  color: var(--ink-2);
}
.min0 {
  min-width: 0;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: min(60vh, 520px);
  padding: 24px;
  color: var(--ink-2);
  font-size: 0.875rem;
  text-align: center;
  animation: fade-in 0.2s ease 0.15s both;
}
.loading .spinner {
  width: 24px;
  height: 24px;
  border-width: 2.5px;
}
.loading.boot {
  min-height: 100vh;
  min-height: 100dvh;
}
.page-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: min(60vh, 520px);
  padding: 24px;
  text-align: center;
  animation: fade-in 0.2s ease both;
}
.page-state.boot {
  min-height: 100vh;
  min-height: 100dvh;
}
.page-state h2 {
  font-size: 1.125rem;
}
.page-state p {
  max-width: 44ch;
  color: var(--ink-2);
  font-size: 0.875rem;
}
.page-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.busy-note {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: pulse 1.6s ease-in-out infinite !important;
    border-color: transparent;
    background: var(--accent);
    opacity: 0.5;
  }
}
@keyframes pulse {
  50% {
    opacity: 0.15;
  }
}

.error-text {
  color: var(--bad-ink);
  font-size: 0.8125rem;
  font-weight: 500;
}
.error-text:empty {
  display: none;
}

/* Brand */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.015em;
  color: var(--ink);
}
a.brand:hover {
  text-decoration: none;
}
.brand-lg {
  font-size: 1.0625rem;
}

.logo-mark {
  display: grid;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  box-shadow: 0 1px 2px rgb(23 37 84 / 0.25);
  flex: none;
}
.brand-lg .logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.logo-mark svg {
  width: 100%;
  height: 100%;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--sh-xs);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
  user-select: none;
}
.btn:hover {
  background: var(--bg);
  border-color: var(--line-strong);
  text-decoration: none;
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn[aria-busy="true"] {
  cursor: progress;
  opacity: 0.75;
}
.btn[aria-busy="true"]::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn[aria-busy="true"] > .icon {
  display: none;
}
.btn .icon {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgb(23 37 84 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.14);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

.btn-danger {
  color: var(--bad-ink);
}
.btn-danger:hover {
  background: var(--bad-soft);
  border-color: var(--bad-line);
  color: var(--bad-ink);
}
.btn-ghost.btn-danger:hover {
  border-color: transparent;
}

.btn-destructive {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
  box-shadow: 0 1px 2px rgb(185 28 28 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.14);
}
.btn-destructive:hover {
  background: var(--bad-ink);
  border-color: var(--bad-ink);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 0.8125rem;
  border-radius: 7px;
}
.btn-icon {
  width: 36px;
  padding: 0;
}
.btn-sm.btn-icon {
  width: 30px;
}
.btn-block {
  width: 100%;
}

/* Forms */

label {
  display: grid;
  gap: 6px;
}

.label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
}

.input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  box-shadow: var(--sh-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder {
  color: var(--ink-3);
}
.input:hover {
  border-color: var(--line-strong);
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input[aria-invalid="true"] {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px rgb(220 38 38 / 0.15);
}
textarea.input {
  height: auto;
  padding: 9px 12px;
  resize: vertical;
  line-height: 1.5;
}
select.input {
  appearance: none;
  padding-right: 32px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  cursor: pointer;
}
input[type="file"].input {
  height: auto;
  padding: 7px;
  font-size: 0.8125rem;
}
input[type="file"].input::file-selector-button {
  margin-right: 10px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--subtle);
  color: var(--ink);
  font: 500 0.8125rem var(--sans);
  cursor: pointer;
}
.input-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 0.8125rem;
  border-radius: 7px;
}
select.input-sm {
  width: auto;
  padding-right: 30px;
}

.field-row {
  display: grid;
  gap: 14px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  line-height: 1.45;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
  cursor: pointer;
}
.check input {
  margin-top: 2px;
}

.code-input {
  height: 52px;
  font: 500 1.5rem/1 var(--mono);
  letter-spacing: 0.5em;
  text-align: center;
  padding-left: 0.5em;
}

.ts {
  min-height: 65px;
}

/* Avatars, pills, progress */

.av {
  --av: var(--accent);
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: light-dark(color-mix(in srgb, var(--av) 13%, #ffffff), color-mix(in srgb, var(--av) 28%, #121318));
  color: light-dark(color-mix(in srgb, var(--av) 82%, black), color-mix(in srgb, var(--av) 45%, white));
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  flex: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--av) 18%, transparent);
}
.av-sm {
  width: 22px;
  height: 22px;
  font-size: 0.625rem;
}
.av-lg {
  width: 36px;
  height: 36px;
  font-size: 0.8125rem;
}
.av[data-status="signed"]::after,
.av[data-status="current"]::after,
.av[data-status="declined"]::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--ok);
}
.av-lg[data-status]::after {
  width: 11px;
  height: 11px;
}
.av[data-status="current"]::after {
  background: var(--accent);
}
.av[data-status="declined"]::after {
  background: var(--bad);
}

.av-stack {
  display: inline-flex;
  align-items: center;
}
.av-stack > span:not(.sr-only) {
  display: inline-flex;
}
.av-stack > span + span .av,
.av-stack > .av-more {
  margin-left: -7px;
}
.av-stack .av {
  border: 2px solid var(--surface);
  width: 30px;
  height: 30px;
  box-shadow: none;
}
.av-more {
  --av: #71717a;
  border: 2px solid var(--surface);
  width: 30px;
  height: 30px;
  font-size: 0.65rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--subtle);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px rgb(24 24 27 / 0.06);
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.pill[data-state="draft"] {
  color: var(--ink-2);
}
.pill[data-state="draft"]::before {
  background: var(--ink-4);
}
.pill[data-state="sent"] {
  background: var(--saffron-soft);
  color: var(--saffron-ink);
  box-shadow: inset 0 0 0 1px rgb(245 158 11 / 0.28);
}
.pill[data-state="sent"]::before {
  background: var(--saffron-edge);
}
.pill[data-state="completed"] {
  background: var(--ok-soft);
  color: var(--ok-ink);
  box-shadow: inset 0 0 0 1px rgb(5 150 105 / 0.16);
}
.pill[data-state="declined"],
.pill[data-state="voided"] {
  background: var(--bad-soft);
  color: var(--bad-ink);
  box-shadow: inset 0 0 0 1px rgb(220 38 38 / 0.14);
}
.pill[data-state="expired"] {
  color: var(--ink-3);
}
.pill[data-state="expired"]::before {
  background: var(--ink-4);
}

.progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.progress .bar {
  position: relative;
  width: 64px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  flex: none;
}
.progress .bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 0%);
  border-radius: inherit;
  background: var(--saffron-edge);
  transition: width 0.5s var(--ease);
}
.progress[data-full="true"] .bar i {
  background: var(--ok);
}
.progress-label {
  font-size: 0.75rem;
  color: var(--ink-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* App shell */

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px 12px;
  background: var(--bg);
  border-right: 1px solid var(--line);
}
.sidebar .brand {
  padding: 6px 8px 18px;
}

.nav {
  display: grid;
  gap: 2px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-weight: 500;
  border: 1px solid transparent;
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover {
  background: rgb(24 24 27 / 0.04);
  color: var(--ink);
  text-decoration: none;
}
.nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--sh-sm);
}
.nav a[aria-current="page"] .icon {
  color: var(--accent);
}

.side-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 0 8px;
  border-top: 1px solid var(--line);
}
.side-foot .who {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  min-width: 0;
  padding: 36px clamp(16px, 4vw, 48px) 64px;
}
.main:focus {
  outline: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1120px;
  margin: 0 auto 24px;
}
.page-head .sub {
  margin-top: 4px;
  color: var(--ink-2);
}
.head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.content {
  max-width: 1120px;
  margin: 0 auto;
}
.content.narrow > * {
  max-width: 720px;
}

/* Sign in */

@font-face {
  font-family: "Mrs Saint Delafield";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/mrs-saint-delafield-latin.woff2") format("woff2");
}

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--surface);
}
.auth-main {
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  padding: 40px 24px 0;
}
.auth-card {
  align-self: center;
  width: min(380px, 100%);
}
.auth-head {
  display: grid;
  gap: 8px;
  margin-bottom: 28px;
}
.auth-head .brand {
  margin-bottom: 28px;
}
.auth-head h1 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}
.auth-head p {
  color: var(--ink-2);
}
.auth-body {
  display: grid;
  gap: 12px;
}
.auth-body .small.muted {
  color: var(--ink-3);
  line-height: 1.5;
}
.auth-foot {
  text-align: center;
  padding: 20px 16px 28px;
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.auth-art {
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 64px;
  overflow: hidden;
  margin: 12px 12px 12px 0;
  padding: 48px 40px;
  border-radius: 20px;
  background:
    radial-gradient(700px 420px at 80% 0%, rgb(29 78 216 / 0.45), transparent 70%),
    #0b1533;
  color: #f8fafc;
}
.art-stage {
  position: relative;
  width: min(420px, 100%);
  margin-top: 40px;
}
.art-prompt {
  position: absolute;
  top: -58px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 12px;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
  color: #e2e8f0;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}
.art-prompt .icon {
  width: 15px;
  height: 15px;
  color: var(--saffron);
}
.art-typed {
  clip-path: inset(0 100% 0 0);
}
.art-doc {
  display: grid;
  gap: 9px;
  padding: 28px 28px 24px;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 40px 80px -30px rgb(0 0 0 / 0.6), 0 2px 6px rgb(0 0 0 / 0.2);
  transform: rotate(-2deg);
}
.art-title {
  font: 600 1.0625rem/1.3 Georgia, "Times New Roman", serif;
}
.art-meta {
  margin-bottom: 6px;
  color: var(--ink-3);
  font-size: 0.75rem;
}
.art-line {
  display: block;
  width: var(--w);
  height: 6px;
  border-radius: 3px;
  background: #e4e4e7;
  transform-origin: left;
}
.art-sign {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
  margin-top: 18px;
}
.art-field {
  position: relative;
  display: grid;
  grid-template-rows: auto 44px;
  gap: 2px;
  padding: 8px 12px 6px;
  border: 1.5px solid var(--saffron-edge);
  border-radius: 8px;
  background: var(--saffron-soft);
  opacity: 0;
  transform: translateY(-16px) scale(0.94);
  transition: opacity 0.35s var(--ease), transform 0.6s var(--spring), border-style 0s;
}
.art-label {
  color: var(--ink-3);
  font-size: 0.6875rem;
  font-weight: 500;
}
.art-here,
.art-sig {
  grid-area: 2 / 1;
  align-self: center;
}
.art-here {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--saffron-ink);
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.art-here .icon {
  width: 16px;
  height: 16px;
}
.art-sig {
  color: #172554;
  font: 400 2.5rem/1 "Mrs Saint Delafield", cursive;
  clip-path: inset(0 100% 0 0);
}
.art-tick {
  position: absolute;
  top: -11px;
  right: -11px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--saffron);
  color: var(--saffron-ink);
  box-shadow: 0 0 0 3px #fff;
  transform: scale(0);
  transition: transform 0.2s var(--ease);
}
.art-tick .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}
.art-date {
  display: grid;
  gap: 4px;
  min-width: 92px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-size: 0.8125rem;
}
.art-date-v {
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.art-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.97);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 12px 30px -10px rgb(0 0 0 / 0.5);
  opacity: 0;
  transform: translateY(10px) scale(0.94);
  transition: opacity 0.3s var(--ease), transform 0.5s var(--spring);
}
.art-chip-a {
  top: -22px;
  right: -18px;
}
.art-chip-b {
  bottom: -24px;
  left: -22px;
}
.art-dot,
.art-av {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok-ink);
}
.art-dot-b {
  background: var(--accent-soft);
  color: var(--accent);
}
.art-av {
  background: var(--r1);
  color: #fff;
  font-size: 0.5625rem;
  font-weight: 700;
}
.art-dot .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.6;
}

.art-stage[data-step="1"] .art-prompt {
  opacity: 1;
  transform: translate(-50%, 0);
}
.art-stage[data-step="1"] .art-typed {
  animation: art-type 1.3s steps(36, end) 0.3s forwards;
}
.art-stage[data-step="1"] .art-line {
  animation: art-line 0.6s var(--ease) both;
  animation-delay: calc(var(--d) + 1.4s);
}
.art-stage:not([data-step="1"]) .art-field {
  opacity: 1;
  transform: none;
}
.art-stage[data-step="2"] .art-field {
  border-style: dashed;
}
.art-stage[data-step="2"] .art-here {
  opacity: 1;
}
.art-stage[data-step="3"] .art-sig,
.art-stage[data-step="4"] .art-sig {
  clip-path: inset(0 -10% 0 0);
  transition: clip-path 1.4s cubic-bezier(0.65, 0, 0.35, 1) 0.35s;
}
.art-stage[data-step="3"] .art-date-v,
.art-stage[data-step="4"] .art-date-v {
  opacity: 1;
  transition-delay: 1.4s;
}
.art-stage[data-step="4"] .art-date-v {
  transition-delay: 0s;
}
.art-stage[data-step="4"] .art-tick {
  transform: scale(1);
  transition: transform 0.5s var(--spring) 0.15s;
}
.art-stage[data-step="1"] [data-for="1"],
.art-stage[data-step="2"] [data-for="2"],
.art-stage[data-step="3"] [data-for="3"],
.art-stage[data-step="4"] [data-for="4"] {
  opacity: 1;
  transform: none;
  transition-delay: 0.5s;
}
.art-stage[data-step="4"] .art-chip-b[data-for="4"] {
  transition-delay: 0.8s;
}
.art-stage[data-step="3"] [data-for="3"] {
  transition-delay: 1.6s;
}

@keyframes art-type {
  to {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes art-line {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
}

.art-copy {
  display: grid;
  justify-items: center;
  gap: 28px;
  max-width: 420px;
  text-align: center;
}
.art-caps {
  display: grid;
}
.art-caps > div {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s var(--ease), transform 0.5s var(--ease);
}
.auth-art[data-step="1"] [data-cap="1"],
.auth-art[data-step="2"] [data-cap="2"],
.auth-art[data-step="3"] [data-cap="3"],
.auth-art[data-step="4"] [data-cap="4"] {
  opacity: 1;
  transform: none;
  transition-delay: 0.1s;
}
.art-caps h2 {
  margin-bottom: 10px;
  font-size: 1.625rem;
  letter-spacing: -0.025em;
}
.art-caps p {
  color: #a3b1cc;
  line-height: 1.55;
}
.art-steps {
  display: flex;
  gap: 8px;
}
.art-steps button {
  width: 44px;
  height: 20px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.art-steps i {
  position: relative;
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.18);
}
.art-steps i::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--saffron);
  transform: scaleX(0);
  transform-origin: left;
}
.art-steps [data-state="done"] i::after {
  transform: scaleX(1);
}
.art-steps [data-state="now"] i::after {
  animation: art-fill 3.6s linear forwards;
}
.art-steps button:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 2px;
  border-radius: 4px;
}
@keyframes art-fill {
  to {
    transform: scaleX(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .auth-art *,
  .auth-art *::after {
    animation: none !important;
    transition: none !important;
  }
  .art-typed,
  .art-sig {
    clip-path: none;
  }
  .art-steps [data-state="now"] i::after {
    transform: scaleX(1);
  }
}
@media (max-width: 900px) {
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-art {
    display: none;
  }
}

/* Segmented tabs */

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--subtle);
  box-shadow: inset 0 0 0 1px rgb(24 24 27 / 0.04);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg button:hover {
  color: var(--ink);
}
.seg button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(24 24 27 / 0.08), 0 0 0 1px rgb(24 24 27 / 0.06);
}
.seg .count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgb(24 24 27 / 0.06);
  color: var(--ink-2);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}
.seg button[aria-selected="true"] .count {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.seg-full {
  display: flex;
}
.seg-full button {
  flex: 1;
  justify-content: center;
}

/* Envelope list */

.list-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.list-head,
.env-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px 150px 96px 16px;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
}
.list-head {
  height: 38px;
  padding-left: 72px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 500;
}
.list-head span:last-child {
  grid-column: span 2;
}
.env-list {
  list-style: none;
  padding: 0;
}
.env-list li + li {
  border-top: 1px solid var(--line-2);
}
.env-row {
  grid-template-columns: 36px minmax(0, 1fr) 220px 150px 96px 16px;
  min-height: 68px;
  padding: 12px 20px;
  color: inherit;
  transition: background-color 0.12s;
}
.env-row:hover {
  background: var(--hover);
  text-decoration: none;
}
.env-row:hover .chev {
  color: var(--ink-2);
  transform: translateX(2px);
}
.env-row:focus-visible {
  outline-offset: -2px;
  border-radius: 0;
}
.env-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--subtle);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px rgb(24 24 27 / 0.05);
}
.env-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.env-title {
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.env-sub {
  font-size: 0.8125rem;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.env-signers {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.env-signers .progress .bar {
  width: 48px;
}
.env-time {
  font-size: 0.8125rem;
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chev {
  color: var(--ink-4);
  transition: transform 0.15s var(--ease), color 0.15s;
}

.list-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 48px 16px;
  color: var(--ink-3);
}
.list-empty .icon {
  width: 22px;
  height: 22px;
}

/* Empty states */

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}
.empty h2 {
  font-size: 1.0625rem;
  margin-top: 6px;
}
.empty p {
  max-width: 46ch;
  color: var(--ink-2);
  margin-bottom: 10px;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-md);
  color: var(--accent);
}
.empty-icon .icon {
  width: 22px;
  height: 22px;
}
.empty-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Upload */

.drop {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 320px;
  padding: 32px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.drop:hover {
  border-color: var(--ink-4);
}
.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.drop:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.drop-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh-md);
  color: var(--accent);
  transition: transform 0.3s var(--ease);
}
.drop.over .drop-icon,
.drop:hover .drop-icon {
  transform: translateY(-2px);
}
.drop-icon .icon {
  width: 22px;
  height: 22px;
}
.drop .big {
  font-size: 1rem;
  font-weight: 500;
}
.drop .link {
  color: var(--accent-ink);
}
.drop .spinner {
  width: 22px;
  height: 22px;
  margin-bottom: 8px;
}

/* Editor */

.editor {
  min-height: 100vh;
  background: var(--subtle);
}
.editor-section {
  padding: 18px 16px;
  border-bottom: 1px solid var(--line-2);
}
.editor-section h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: var(--ink);
}
.switch-label input {
  margin-top: 0;
}
.switch-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--ink-2);
}
.recips {
  list-style: none;
  padding: 0;
  margin-bottom: 10px;
  display: grid;
  gap: 6px;
}
.recips-empty {
  padding: 2px 0;
  color: var(--ink-3);
}
.recip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "sw who del" ". meta meta";
  gap: 6px 10px;
  align-items: center;
  padding: 10px 6px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.recip:hover {
  border-color: var(--line-strong);
}
.recip[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--rc) 55%, var(--surface));
  background: color-mix(in srgb, var(--rc) 4%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc) 12%, transparent);
}
.recip:focus-visible {
  outline-offset: 1px;
  border-radius: 10px;
}
.recip .sw {
  grid-area: sw;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--rc);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06);
}
.recip .who {
  grid-area: who;
  min-width: 0;
  display: grid;
  line-height: 1.3;
}
.recip .who strong {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recip .who span {
  font-size: 0.75rem;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recip [data-del] {
  grid-area: del;
  width: 28px;
  height: 28px;
  align-self: start;
}
.recip .meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.recip .meta .small {
  font-size: 0.75rem;
}
.recip .meta .btn {
  height: 24px;
  padding: 0 6px;
  font-size: 0.75rem;
  margin-left: auto;
}
.recip .meta .icon {
  width: 13px;
  height: 13px;
}
.recip select {
  appearance: none;
  height: 24px;
  padding: 0 22px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--subtle) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 5px center / 13px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
}
.suggest {
  position: relative;
}
.suggest-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--sh-lg);
  max-height: 264px;
  overflow-y: auto;
  animation: pop-in 0.16s var(--ease-out);
}
.suggest-list li {
  display: grid;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  line-height: 1.35;
  cursor: pointer;
}
.suggest-list li strong {
  font-weight: 500;
}
.suggest-list li span {
  font-size: 0.75rem;
  color: var(--ink-3);
}
.suggest-list li[aria-selected="true"],
.suggest-list li:hover {
  background: var(--subtle);
}
.add-group-select {
  margin-top: 8px;
  color: var(--ink-2);
}
.palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.palette button {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--sh-xs);
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.palette button:hover {
  border-color: color-mix(in srgb, var(--rc, var(--accent)) 45%, var(--surface));
  background: color-mix(in srgb, var(--rc, var(--accent)) 4%, var(--surface));
}
.palette button:active {
  transform: scale(0.98);
}
.palette button[aria-pressed="true"] {
  border-color: var(--rc, var(--accent));
  background: color-mix(in srgb, var(--rc, var(--accent)) 8%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc, var(--accent)) 16%, transparent);
}
.palette button .icon {
  color: var(--rc, var(--accent));
}
.hint {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--ink-3);
  line-height: 1.5;
}
.options {
  gap: 14px;
}
.options .check {
  line-height: 1.4;
}
.inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.expiry {
  width: 72px;
  font-variant-numeric: tabular-nums;
}
.save-state {
  font-size: 0.75rem;
  color: var(--ink-3);
  text-align: center;
}
.editor-main {
  min-width: 0;
  padding: 28px clamp(12px, 3vw, 40px) 80px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 16px;
  background: var(--subtle);
}
.issues {
  width: 100%;
  max-width: 860px;
  padding: 12px 16px;
  border: 1px solid var(--bad-line);
  border-radius: 10px;
  background: var(--bad-soft);
  color: var(--bad-ink);
  font-size: 0.875rem;
}

.pages {
  display: grid;
  gap: 20px;
  width: 100%;
  max-width: 860px;
}
.page {
  position: relative;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgb(24 24 27 / 0.06), var(--sh-md);
  overflow: hidden;
}
.page canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.page .overlay {
  position: absolute;
  inset: 0;
}
.page-no {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgb(24 24 27 / 0.72);
  color: #fff;
  font: 500 0.6875rem/1 var(--mono);
  pointer-events: none;
}
.placing .page .overlay {
  cursor: crosshair;
}

.fbox {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border: 1.5px solid var(--rc);
  border-radius: 5px;
  background: color-mix(in srgb, var(--rc) 10%, rgb(255 255 255 / 0.7));
  color: color-mix(in srgb, var(--rc) 85%, black);
  font: 600 11px/1 var(--sans);
  cursor: grab;
  user-select: none;
  touch-action: none;
  overflow: hidden;
  white-space: nowrap;
  transition: box-shadow 0.15s;
}
.fbox .icon {
  width: 13px;
  height: 13px;
}
.fbox:active {
  cursor: grabbing;
}
.fbox:hover {
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--rc) 40%, transparent);
}
.fbox[aria-selected="true"] {
  background: color-mix(in srgb, var(--rc) 16%, rgb(255 255 255 / 0.7));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc) 22%, transparent);
}
.fbox:focus-visible {
  outline: 2px solid var(--rc);
  outline-offset: 2px;
}
.fbox .grip {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--rc);
  cursor: nwse-resize;
}
.fbox.ghost {
  pointer-events: none;
  opacity: 0.6;
  border-style: dashed;
}
.fbox.opt {
  border-style: dashed;
}
.fpop {
  position: absolute;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--sh-lg);
  font-size: 0.8125rem;
  white-space: nowrap;
  animation: pop-in 0.16s var(--ease-out);
}
.fpop label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  cursor: pointer;
}
.fpop-note {
  padding: 0 8px;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

/* Envelope detail */

.detail-head {
  align-items: flex-start;
}
.detail-title {
  min-width: 0;
  flex: 1 1 420px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-weight: 500;
}
.back-link:hover {
  color: var(--ink);
  text-decoration: none;
}
.back-link .icon {
  width: 14px;
  height: 14px;
}
.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.title-row h1 {
  min-width: 0;
  overflow-wrap: anywhere;
}
.detail-head .head-actions {
  padding-top: 30px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}
.stack {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-sm);
  padding: 20px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}
.panel-note {
  padding: 14px 0 0;
}

.signers {
  list-style: none;
  padding: 0;
  margin: 0 -20px;
}
.signers li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
}
.signers li + li {
  border-top: 1px solid var(--line-2);
}
.signers .who {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 1.35;
}
.signers .who strong {
  font-weight: 500;
}
.signers .who span {
  font-size: 0.8125rem;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sstat {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}
.sstat[data-status="signed"] {
  color: var(--ok-ink);
}
.sstat[data-status="current"] {
  color: var(--accent-ink);
}
.sstat[data-status="declined"] {
  color: var(--bad-ink);
}

.timeline {
  list-style: none;
  padding: 0;
  position: relative;
}
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 18px;
}
.timeline li:last-child {
  padding-bottom: 0;
}
.timeline li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 9.5px;
  top: 16px;
  bottom: -2px;
  width: 1px;
  background: var(--line);
}
.tl-dot {
  width: 9px;
  height: 9px;
  margin: 5px 0 0 5.5px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1.5px var(--ink-4);
}
.timeline li[data-type="signed"] .tl-dot,
.timeline li[data-type="completed"] .tl-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}
.timeline li[data-type="sent"] .tl-dot,
.timeline li[data-type="consented"] .tl-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.timeline li[data-type="declined"] .tl-dot,
.timeline li[data-type="voided"] .tl-dot {
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}
.timeline li[data-type="expired"] .tl-dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}
.tl-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.tl-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.tl-line strong {
  font-weight: 500;
}
.tl-line time {
  font-size: 0.75rem;
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tl-meta {
  font-size: 0.8125rem;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.hash {
  display: block;
  margin-top: 2px;
  font-size: 0.6875rem;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.details h2 {
  margin-bottom: 14px;
}
.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 16px;
  margin-bottom: 18px;
  font-size: 0.8125rem;
}
.facts dt {
  color: var(--ink-3);
}
.facts dd {
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.facts .hash-dd {
  font-size: 0.6875rem;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: center;
}
.details .btn {
  margin-bottom: 14px;
}
.details > .small {
  color: var(--ink-3);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* Contacts */

.split {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.side-list {
  display: grid;
  gap: 2px;
}
.side-list button {
  appearance: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.side-list button:hover {
  background: rgb(24 24 27 / 0.04);
  color: var(--ink);
}
.side-list button[aria-pressed="true"] {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--sh-sm);
}
.side-list .add-group {
  justify-content: flex-start;
  margin-top: 6px;
  color: var(--accent-ink);
}
.side-list .add-group:hover {
  color: var(--accent-hover);
  background: var(--accent-soft);
}
.side-list .n {
  color: var(--ink-3);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar .grow {
  flex: 1 1 240px;
}
.search {
  position: relative;
  display: block;
}
.search .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.search .input {
  padding-left: 34px;
}
.bulkbar {
  padding: 8px 8px 8px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: var(--accent-soft);
  animation: pop-in 0.18s var(--ease-out);
}
.bulkbar strong {
  color: var(--accent-ink);
  margin-right: 4px;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-sm);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th {
  height: 38px;
  padding: 0 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-3);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  height: 52px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr {
  transition: background-color 0.12s;
}
tbody tr:hover {
  background: var(--hover);
}
tbody tr:has(input:checked) {
  background: var(--accent-soft);
}
.check-cell {
  width: 44px;
  padding-right: 0;
}
.person {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.person strong {
  font-weight: 500;
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  background: var(--subtle);
  box-shadow: inset 0 0 0 1px rgb(24 24 27 / 0.06);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.table-empty {
  height: auto;
  padding: 32px 14px;
  text-align: center;
}

/* Dialogs */

dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-lg);
}
dialog::backdrop {
  background: rgb(9 9 11 / 0.4);
  backdrop-filter: blur(2px);
}
dialog[open] {
  animation: dialog-in 0.26s var(--ease);
}
dialog[open]::backdrop {
  animation: fade-in 0.2s ease-out;
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
.dialog-body {
  display: grid;
  gap: 14px;
  padding: 24px 24px 20px;
}
.dialog-body h2 {
  font-size: 1.0625rem;
}
.dialog-body .seg {
  margin-bottom: 0;
}
.dialog-body h2 + p {
  margin-top: -6px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  border-radius: 0 0 14px 14px;
}
.dialog-actions.stacked {
  flex-direction: column-reverse;
  align-items: stretch;
}
.dialog-actions.stacked .btn {
  height: 44px;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: 10px;
  background: #18181b;
  border: 1px solid light-dark(transparent, #34343c);
  color: #fafafa;
  font-size: 0.875rem;
  box-shadow: var(--sh-lg);
  transform: translateX(-50%);
  animation: toast-in 0.32s var(--ease);
}
.toast.err {
  background: var(--bad-ink);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.97);
  }
}

/* Signing page */

.sign-body {
  background: var(--bg);
  font-size: 0.9375rem;
}

.s-head {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgb(250 250 250 / 0.78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgb(228 228 231 / 0.8);
}
.s-head-in {
  max-width: 900px;
  height: 56px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.s-secure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-xs);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ok-ink);
  white-space: nowrap;
}
.s-secure .icon {
  width: 13px;
  height: 13px;
}
.s-domain {
  padding-left: 7px;
  margin-left: 1px;
  border-left: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.6875rem;
}

.s-intro {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 0;
}
.s-from {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--ink-2);
  min-width: 0;
}
.s-from > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.s-from strong {
  color: var(--ink);
  font-weight: 500;
}
.s-intro h1 {
  margin-top: 8px;
  font-size: 1.375rem;
  overflow-wrap: anywhere;
}

.s-steps {
  list-style: none;
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 16px 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.s-steps li {
  display: grid;
  gap: 7px;
}
.seg-bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.seg-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.s-steps li[data-status="done"] .seg-bar::after,
.s-steps li[data-status="current"] .seg-bar::after {
  transform: scaleX(1);
}
.s-steps li[data-status="current"] .seg-bar::after {
  animation: seg-fill 0.7s var(--ease);
}
@keyframes seg-fill {
  from {
    transform: scaleX(0);
  }
}
.seg-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-3);
}
.s-steps li[data-status="done"] .seg-label {
  color: var(--ink-2);
}
.s-steps li[data-status="current"] .seg-label {
  color: var(--ink);
  font-weight: 600;
}

.s-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}
.s-main:has(.s-bar) {
  padding-bottom: 104px;
}
.s-card {
  display: grid;
  gap: 16px;
  max-width: 520px;
  margin: 0 auto;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--sh-md);
}
.s-card h2 {
  font-size: 1.125rem;
}
.s-card > .muted {
  margin-top: -8px;
}
.s-card .btn-primary {
  height: 44px;
  font-size: 0.9375rem;
}
.s-notice {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--ink-2);
  line-height: 1.55;
}
.s-notice p:first-child {
  color: var(--ink);
}
.s-notice ul {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}
.s-notice li::marker {
  color: var(--ink-4);
}
.s-card .check {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s, background-color 0.15s;
}
.s-card .check:has(input:checked) {
  border-color: #bfdbfe;
  background: var(--accent-soft);
}
.s-card .check input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.s-result {
  justify-items: center;
  text-align: center;
  padding: 40px 28px;
}
.s-result h2 {
  font-size: 1.25rem;
}
.s-result p {
  max-width: 40ch;
}
.result-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin-bottom: 4px;
  animation: result-in 0.5s var(--ease);
}
.result-icon .icon {
  width: 24px;
  height: 24px;
  stroke-width: 2.25;
}
.result-icon[data-tone="good"] {
  background: var(--ok-soft);
  color: var(--ok);
  box-shadow: 0 0 0 6px rgb(236 253 245 / 0.6), inset 0 0 0 1px rgb(5 150 105 / 0.18);
}
.result-icon[data-tone="bad"] {
  background: var(--bad-soft);
  color: var(--bad);
  box-shadow: 0 0 0 6px rgb(254 242 242 / 0.6), inset 0 0 0 1px rgb(220 38 38 / 0.16);
}
.result-icon[data-tone="warn"] {
  background: var(--warn-soft);
  color: var(--warn-ink);
  box-shadow: 0 0 0 6px rgb(255 251 235 / 0.6), inset 0 0 0 1px rgb(217 119 6 / 0.18);
}
@keyframes result-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

.s-foot {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px 40px;
  display: grid;
  gap: 6px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ink-3);
}
.s-foot strong {
  color: var(--ink-2);
  font-weight: 500;
}
.s-main:has(.s-bar) + .s-foot {
  padding-bottom: 120px;
}

.s-doc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.s-pages {
  max-width: none;
}

.sfield {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 4px;
  border: 1.5px solid var(--saffron-edge);
  border-radius: 5px;
  background: rgb(254 243 199 / 0.92);
  color: var(--saffron-ink);
  font: 600 var(--fs, 12px) / 1 var(--sans);
  overflow: hidden;
  white-space: nowrap;
  animation: beckon 2.2s var(--ease-out) 0.5s 2;
  transition: background-color 0.2s, border-color 0.2s;
}
input.sfield {
  font-weight: 500;
  color: var(--ink);
  padding: 0 6px;
  justify-content: flex-start;
  cursor: text;
}
input.sfield::placeholder {
  color: var(--saffron-ink);
  opacity: 0.75;
}
input.sfield:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
  background: #fff;
}
.sfield.opt {
  border-style: dashed;
}
.sfield.done {
  border-color: var(--ok);
  background: rgb(236 253 245 / 0.7);
  color: var(--ink);
  animation: none;
}
@keyframes beckon {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgb(245 158 11 / 0);
  }
  40% {
    box-shadow: 0 0 0 5px rgb(245 158 11 / 0.3);
  }
}
.ssig {
  cursor: pointer;
}
.ssig:hover {
  background: rgb(253 230 138 / 0.95);
}
.ssig.done:hover {
  background: rgb(209 250 229 / 0.8);
}
.ssig .icon {
  width: 1.1em;
  height: 1.1em;
}
.ssig img {
  max-width: 100%;
  max-height: 100%;
}
.sig-typed {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 500;
  font-size: 1.3em;
  line-height: 1;
  letter-spacing: -0.01em;
  color: #1e1b4b;
}
.scheck {
  cursor: pointer;
}
.scheck input {
  width: 78%;
  height: 78%;
  accent-color: var(--ok);
}
.sdate {
  font-weight: 500;
  color: var(--ink);
  border-style: dotted;
  border-color: var(--ink-4);
  background: rgb(255 255 255 / 0.7);
  animation: none;
  font-variant-numeric: tabular-nums;
}

.s-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px -16px rgb(24 24 27 / 0.2);
}
.s-bar-in {
  max-width: 868px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.s-bar-prog {
  min-width: 0;
}
.s-bar-prog .progress {
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 6px;
}
.s-bar-prog .progress-label {
  font-size: 0.8125rem;
  color: var(--ink);
  font-weight: 500;
}
.s-bar-prog .bar {
  width: 96px;
}
.s-bar-act {
  display: flex;
  gap: 6px;
  align-items: center;
}
.s-bar-act .btn-primary {
  height: 40px;
  padding: 0 16px;
}

.sig-preview {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 8px 16px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) no-repeat 16px calc(100% - 22px) / calc(100% - 32px) 1px,
    var(--bg);
  font-size: 1.6rem;
  overflow: hidden;
}
.pad {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  touch-action: none;
  cursor: crosshair;
}
.pad-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.initials-input {
  width: 120px;
}

.verify-card {
  max-width: 620px;
}
.verify-card h1 {
  font-size: 1.375rem;
}
.checklist {
  list-style: none;
  counter-reset: c;
  padding: 0;
  display: grid;
  gap: 12px;
}
.checklist li {
  counter-increment: c;
  position: relative;
  padding: 14px 16px 14px 52px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink-2);
  line-height: 1.55;
}
.checklist li::before {
  content: counter(c);
  position: absolute;
  left: 16px;
  top: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 600;
}
.checklist strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.875em;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.verify-foot {
  font-size: 0.875rem;
  color: var(--ink-2);
}

/* Responsive */

@media (max-width: 1100px) {
  .list-head,
  .env-row {
    grid-template-columns: 36px minmax(0, 1fr) 190px 140px 16px;
  }
  .list-head {
    grid-template-columns: minmax(0, 1fr) 190px 140px 16px;
  }
  .env-time,
  .list-head span:last-child {
    display: none;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    z-index: 30;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgb(250 250 250 / 0.85);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
  }
  .sidebar .brand {
    padding: 0 4px;
  }
  .brand > span:last-child {
    display: inline;
  }
  .nav {
    display: flex;
    gap: 2px;
    margin-left: auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav a {
    padding: 0 10px;
  }
  .side-foot {
    margin: 0;
    padding: 0;
    border: 0;
    gap: 4px;
  }
  .side-foot .who,
  .side-foot .av {
    display: none;
  }
  .main {
    padding-top: 24px;
  }
  .page-head {
    align-items: center;
  }
  .page-head h1 {
    font-size: 1.3125rem;
  }

  .list-head {
    display: none;
  }
  .env-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "main status" "signers signers";
    gap: 10px 12px;
    padding: 14px 16px;
  }
  .env-icon,
  .env-row .chev {
    display: none;
  }
  .env-main {
    grid-area: main;
  }
  .env-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .env-status {
    grid-area: status;
    align-self: start;
  }
  .env-signers {
    grid-area: signers;
  }
  .env-status .pill-text {
    display: none;
  }
  .env-status .pill::after {
    content: attr(data-short);
  }

  .split {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .side-list {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    scrollbar-width: none;
  }
  .side-list button {
    width: auto;
    white-space: nowrap;
  }
  .side-list .add-group {
    margin-top: 0;
  }


  .detail-head .head-actions {
    padding-top: 0;
  }
}

@media (max-width: 640px) {
  .seg {
    display: flex;
  }
  dialog.sheet {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  dialog.sheet[open] {
    animation: sheet-in 0.38s var(--ease);
  }
  dialog.sheet .dialog-body {
    position: relative;
    padding-top: 28px;
  }
  dialog.sheet .dialog-body::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 999px;
    background: var(--line-strong);
  }
  dialog.sheet .dialog-actions {
    border-radius: 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  dialog.sheet .dialog-actions:not(.stacked) .btn {
    flex: 1;
    height: 44px;
  }
  @keyframes sheet-in {
    from {
      transform: translateY(100%);
    }
  }
}

@media (max-width: 480px) {
  .main {
    padding-left: 12px;
    padding-right: 12px;
  }
  .page-head .btn-primary {
    width: 100%;
  }
  .page-head > div:first-child {
    flex: 1 1 100%;
  }
  .s-card {
    padding: 22px 18px;
  }
  .s-result {
    padding: 32px 18px;
  }
  .s-intro h1 {
    font-size: 1.25rem;
  }
  .s-domain {
    display: none;
  }
  .s-bar {
    padding-left: 12px;
    padding-right: 12px;
  }
  .s-bar-prog .bar {
    width: 72px;
  }
  .s-bar-act .btn-primary {
    padding: 0 12px;
  }
}

@media (max-width: 640px) {
  .nav a {
    flex: none;
    padding: 0 9px;
  }
  .nav a > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .sidebar .brand > span:last-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Document editor */

.docedit {
  width: 100%;
  max-width: 860px;
}

.doc-editor {
  display: grid;
  gap: 12px;
}

.doc-toolbar {
  position: sticky;
  top: 12px;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-md);
  backdrop-filter: saturate(1.4) blur(10px);
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tool-group.end {
  margin-left: auto;
}

.tool-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.tool {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.tool:hover {
  background: var(--hover);
  color: var(--ink);
}

.tool[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.tool[disabled] {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}

.tool.danger:hover {
  background: var(--bad-soft);
  color: var(--bad-ink);
}

.de-status {
  min-width: 96px;
  padding: 0 6px;
  color: var(--ink-3);
  font-size: 0.75rem;
  text-align: right;
  white-space: nowrap;
}

.de-hint {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.prop-bar,
.numbers-pop {
  position: sticky;
  top: calc(var(--bar-h, 0px) + 76px);
  z-index: 11;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-sm);
  animation: pop-in 0.18s var(--ease, ease-out);
}

.numbers-pop {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  gap: 12px;
  padding: 14px;
}

.prop-bar select.input-sm {
  width: auto;
}

.prop-bar .grow {
  flex: 1;
}

.prop-num {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-3);
}

.prop-num .input {
  width: 64px;
}

.prop-range,
.prop-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.prop-range input {
  width: 110px;
  accent-color: var(--accent);
}

.prop-range output {
  min-width: 28px;
  font: 500 0.75rem/1 var(--mono);
  color: var(--ink-3);
}

.swatch {
  width: 30px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.swatch-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.swatch-btn span {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15);
}

.swatch-btn[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.de-pages .page.blank {
  background: #fff;
}

.ov-layer,
.hit-layer {
  position: absolute;
  inset: 0;
}

.hit-layer {
  z-index: 2;
}

.ov-layer {
  z-index: 3;
  pointer-events: none;
}

.ov-layer > * {
  pointer-events: auto;
}

.ov-cover,
.ov-pnum {
  position: absolute;
  pointer-events: none !important;
}

.ov-pnum {
  color: #404040;
  font-family: Helvetica, Arial, sans-serif;
  white-space: nowrap;
}

.ov {
  position: absolute;
  cursor: move;
  touch-action: none;
  user-select: none;
}

.ov-text {
  padding: 0;
  line-height: 1.2;
  white-space: pre;
  outline: 1px dashed transparent;
  outline-offset: 2px;
}

.ov-text:hover {
  outline-color: rgb(30 58 138 / 0.45);
}

.ov-text.editing {
  cursor: text;
  user-select: text;
  outline: 2px solid var(--accent);
  background: rgb(255 255 255 / 0.6);
}

.ov-box {
  outline: 1px dashed transparent;
}

.ov-box:hover {
  outline-color: rgb(30 58 138 / 0.6);
}

.ov[aria-selected="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ov-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.ov-grip {
  position: absolute;
  right: -6px;
  bottom: -6px;
  display: none;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 50%;
  cursor: nwse-resize;
}

.ov[aria-selected="true"] .ov-grip {
  display: block;
}

.ov-ghost {
  position: absolute;
  border: 1.5px dashed var(--accent);
  background: rgb(30 58 138 / 0.08);
  pointer-events: none;
}

.doc-editor[data-tool="addText"] .page,
.doc-editor[data-tool="cover"] .page {
  cursor: crosshair;
}

.hit {
  position: absolute;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  cursor: text;
}

.hit:hover,
.hit:focus-visible {
  background: rgb(30 58 138 / 0.12);
  box-shadow: 0 0 0 1px rgb(30 58 138 / 0.5);
}

.organizer {
  display: grid;
  gap: 16px;
}

.org-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.org-bar .grow {
  flex: 1;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.thumb {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-xs);
  cursor: grab;
  transition: box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
}

.thumb:hover {
  border-color: var(--line-strong);
  box-shadow: var(--sh-sm);
}

.thumb.dragging {
  opacity: 0.4;
}

.thumb.drop-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.thumb-page {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  background: var(--subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.thumb-page canvas {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
}

.thumb-page canvas.blank {
  width: auto;
  height: 92%;
}


.thumb-label {
  min-width: 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


@media (max-width: 820px) {
  .doc-toolbar {
    top: 64px;
  }

  .prop-bar,
  .numbers-pop {
    top: calc(var(--bar-h, 0px) + 76px);
  }

  .tool-group.end {
    margin-left: 0;
  }
}

.prop-bar .btn.warn {
  border-color: var(--warn);
  color: var(--warn-ink);
  background: var(--warn-soft);
}

.order-toggle {
  color: var(--ink-2);
}

.doc-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.doc-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 500 0.8125rem/1.2 var(--sans);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--sh-xs);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.doc-tool .icon {
  color: var(--accent);
}

.doc-tool:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.doc-tool[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
  color: var(--accent-ink);
}

.doc-tool:focus-within {
  box-shadow: var(--focus);
}

.doc-history {
  display: flex;
  align-items: center;
  gap: 2px;
}

.doc-history .de-status {
  margin-left: auto;
  min-width: 0;
}

.assign-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.assign-row:empty {
  display: none;
}

.assign-label {
  width: 100%;
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 500;
}

.assign-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: 500 0.8125rem/1 var(--sans);
  cursor: pointer;
}

.assign-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rc, var(--ink-4));
}

.assign-chip[aria-pressed="true"] {
  border-color: var(--rc, var(--ink-3));
  background: color-mix(in srgb, var(--rc, var(--ink-3)) 9%, var(--surface));
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--rc, var(--ink-3));
}

.fpop-assign {
  height: 28px;
  max-width: 160px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 500 0.8125rem/1 var(--sans);
}

.canvas-banner {
  position: sticky;
  top: 12px;
  z-index: 13;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 860px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--rc, var(--accent)) 30%, var(--surface));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--rc, var(--accent)) 7%, var(--surface));
  color: var(--ink-2);
  font-size: 0.875rem;
  box-shadow: var(--sh-sm);
}

.canvas-banner strong {
  color: var(--ink);
  font-weight: 600;
}

.canvas-banner:empty {
  display: none;
}

.banner-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--rc, var(--accent));
  color: #fff;
}

.banner-icon .icon {
  width: 16px;
  height: 16px;
}



#send.ready {
  box-shadow: 0 0 0 3px var(--accent-ring), var(--sh-sm);
}

.recip-acts {
  grid-area: del;
  display: flex;
  gap: 2px;
}

.recip-acts [data-edit],
.recip-acts [data-del] {
  width: 28px;
  height: 28px;
  color: var(--ink-3);
}

.recip-acts .icon {
  width: 15px;
  height: 15px;
}

.recip.editing {
  display: block;
  cursor: default;
  border-color: var(--rc);
  box-shadow: 0 0 0 1px var(--rc);
}

.recip-edit {
  display: grid;
  gap: 10px;
}

.recip-edit .label {
  margin-bottom: 4px;
  font-size: 0.75rem;
}

.recip-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.person-btn {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.person-btn:hover strong {
  color: var(--accent);
}

th.row-act,
td.row-act {
  width: 48px;
  text-align: right;
}

td.row-act .btn {
  opacity: 0;
  color: var(--ink-3);
}

tr:hover td.row-act .btn,
td.row-act .btn:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  td.row-act .btn {
    opacity: 1;
  }
}

.source-list {
  display: grid;
  gap: 6px;
}

.source-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.source-opt:hover {
  background: var(--hover);
}

.source-opt:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.source-opt input {
  margin: 0;
  accent-color: var(--accent);
}

/* Templates */

.tpl-hero {
  max-width: 760px;
  margin: 8px auto 40px;
  text-align: center;
}
.tpl-hero h1 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}
.tpl-hero .sub {
  margin: 6px auto 20px;
  max-width: 56ch;
}
.tpl-describe {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-md);
  padding: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tpl-describe:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), var(--sh-md);
}
.tpl-describe textarea.input {
  border: 0;
  box-shadow: none;
  resize: none;
  font-size: 0.9375rem;
  padding: 10px 12px;
}
.tpl-describe-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 4px 12px;
}
.tpl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tpl-hero .tpl-chips {
  justify-content: center;
  margin-top: 14px;
}
.chip-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.8125rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.chip-btn:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
}
.tpl-section {
  margin-top: 32px;
}
.tpl-section h2 {
  font-size: 1rem;
  margin-bottom: 12px;
}
.tpl-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tpl-section-head h2,
.tpl-section-head .seg {
  margin-bottom: 0;
}
.tpl-region {
  width: auto;
  margin-left: auto;
}
.tpl-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.tpl-card {
  display: grid;
  gap: 6px;
  height: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-xs);
  color: var(--ink);
  align-content: start;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.2s var(--ease-out);
}
.tpl-card:hover {
  text-decoration: none;
  border-color: var(--line-strong);
  box-shadow: var(--sh-md);
}
.tpl-card:active {
  transform: scale(0.99);
}
.tpl-card-blank {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}
.tpl-card .env-icon {
  margin-bottom: 4px;
}
.tpl-card-title {
  font-weight: 600;
  font-size: 0.9375rem;
}
.tpl-card-sum {
  color: var(--ink-2);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.tpl-card-cat {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 0.75rem;
}
.tpl-mine {
  position: relative;
}
.tpl-del {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
  transition: opacity 0.15s;
}
.tpl-mine:hover .tpl-del,
.tpl-del:focus-visible {
  opacity: 1;
}
.tpl-note {
  margin-top: 20px;
}

.tpl-head {
  max-width: 1320px;
  margin: 0 auto 16px;
}
.tpl-tabs .count:empty {
  display: none;
}
.tpl-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.tpl-title-wrap {
  flex: 1;
  min-width: 240px;
  display: block;
}
.tpl-where {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tpl-where select {
  width: auto;
}
.tpl-where input {
  width: 190px;
  max-width: 100%;
}
.tpl-title {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  padding: 2px 8px;
  margin-left: -9px;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
  transition: border-color 0.15s, background-color 0.15s;
}
.tpl-title:hover {
  border-color: var(--line);
}
.tpl-title:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.tpl-title::placeholder {
  color: var(--ink-4);
}

.tpl-layout {
  --tpl-h: calc(100dvh - 190px);
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  gap: 20px;
  align-items: start;
}
.tpl-side {
  order: 2;
  position: sticky;
  top: 16px;
  height: var(--tpl-h);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.tpl-tabs {
  margin: 10px 10px 0;
}
.tpl-tabs .icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}
.tpl-pane {
  flex: 1;
  min-height: 0;
}
.tpl-pane[hidden] {
  display: none;
}
.tpl-pane-scroll {
  overflow-y: auto;
  padding: 16px;
}
.tpl-pane-chat {
  display: flex;
  flex-direction: column;
}

.cg-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  margin: 0;
  padding: 20px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}
.cg-msg {
  animation: tpl-in 0.25s var(--ease-out);
  font-size: 0.875rem;
  line-height: 1.6;
}
@keyframes tpl-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.cg-user {
  display: flex;
  justify-content: flex-end;
}
.cg-bubble {
  max-width: 85%;
  padding: 9px 14px;
  border-radius: 18px;
  background: var(--subtle);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cg-ai {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
}
.cg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgb(30 58 138 / 0.12);
}
.cg-avatar .icon {
  width: 15px;
  height: 15px;
}
.cg-avatar.is-busy .icon {
  animation: cg-spin 1.6s linear infinite;
}
@keyframes cg-spin {
  to {
    transform: rotate(360deg);
  }
}
.cg-body {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding-top: 3px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.cg-ai.is-error .cg-body > p {
  color: var(--bad-ink);
}
.cg-shimmer {
  width: fit-content;
  color: transparent;
  background: linear-gradient(90deg, var(--ink-3) 0%, var(--ink-3) 35%, var(--ink) 50%, var(--ink-3) 65%, var(--ink-3) 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: cg-shimmer 1.8s linear infinite;
}
@keyframes cg-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}
.cg-change {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--sh-xs);
}
.cg-change.is-undone {
  opacity: 0.6;
}
.cg-change-icon {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ok-soft);
  color: var(--ok-ink);
}
.cg-change-icon .icon {
  width: 15px;
  height: 15px;
}
.cg-change-text {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 1.35;
}
.cg-change-text strong {
  font-size: 0.8125rem;
  font-weight: 600;
}
.cg-change-text span {
  font-size: 0.75rem;
  color: var(--ink-3);
}
.cg-issues {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.cg-issue {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 10px 10px 12px;
}
.cg-issue + .cg-issue {
  border-top: 1px solid var(--line-2);
}
.cg-issue strong {
  font-size: 0.8125rem;
  font-weight: 600;
}
.cg-issue p {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.cg-issue.is-done strong,
.cg-issue.is-done p {
  color: var(--ink-4);
}
.cg-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--ink-4);
}
.cg-sev-high .cg-dot {
  background: var(--bad);
}
.cg-sev-medium .cg-dot {
  background: var(--warn);
}
.cg-fixed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--ok-ink);
  padding-top: 3px;
}
.cg-fixed .icon {
  width: 14px;
  height: 14px;
}
.cg-fixall {
  justify-self: start;
}
.cg-empty {
  margin: auto 0;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 6px;
  padding: 12px 4px;
}
.cg-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 6px;
}
.cg-empty h3 {
  font-size: 1.0625rem;
  font-weight: 600;
}
.cg-empty p {
  max-width: 34ch;
}
.cg-starters {
  margin-top: 14px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cg-starter {
  appearance: none;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.8125rem;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.cg-starter:hover {
  border-color: var(--line-strong);
  background: var(--subtle);
  color: var(--ink);
}

.cg-dock {
  padding: 8px 14px 10px;
  display: grid;
  gap: 8px;
}
.cg-dock .tpl-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -14px;
  padding: 0 14px;
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 40px), transparent);
}
.cg-dock .tpl-chips:empty {
  display: none;
}
.cg-dock .chip-btn {
  white-space: nowrap;
  flex: none;
}
.cg-composer {
  display: grid;
  gap: 2px;
  padding: 10px 10px 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--sh-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cg-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), var(--sh-md);
}
.cg-composer textarea {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink);
  max-height: 200px;
  padding: 2px 0;
}
.cg-composer textarea::placeholder {
  color: var(--ink-3);
}
.cg-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -2px -2px 4px -6px;
}
.cg-mode[hidden] {
  display: none;
}
.cg-mode span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 500;
}
.cg-mode .icon {
  width: 13px;
  height: 13px;
}
.cg-mode-x {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.cg-mode-x:hover {
  background: var(--subtle);
}
.cg-mode-x .icon {
  width: 14px;
  height: 14px;
}
.cg-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cg-menu-wrap {
  position: relative;
}
.cg-tool {
  appearance: none;
  width: 32px;
  height: 32px;
  margin-left: -4px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.2s var(--ease-out);
}
.cg-tool:hover {
  background: var(--subtle);
  color: var(--ink);
}
.cg-tool[aria-expanded="true"] .icon {
  transform: rotate(45deg);
}
.cg-tool .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s var(--ease-out);
}
.cg-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: -4px;
  width: 280px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--sh-lg);
  display: grid;
  gap: 2px;
  z-index: 20;
  transform-origin: bottom left;
  animation: cg-pop 0.16s var(--ease-out);
}
.cg-menu[hidden] {
  display: none;
}
@keyframes cg-pop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(4px);
  }
}
.cg-menu button {
  appearance: none;
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.cg-menu button:hover,
.cg-menu button:focus-visible {
  background: var(--subtle);
}
.cg-menu button .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--ink-2);
}
.cg-menu strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
}
.cg-menu span span {
  font-size: 0.75rem;
  color: var(--ink-3);
}
.cg-hint {
  margin-left: auto;
  font-size: 0.6875rem;
  color: var(--ink-4);
  font-family: var(--mono);
}
.cg-send {
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s var(--ease-out);
}
.cg-send:hover {
  background: var(--accent-hover);
}
.cg-send:active {
  transform: scale(0.94);
}
.cg-send .icon {
  width: 17px;
  height: 17px;
  stroke-width: 2.4;
}
.cg-send.is-stop {
  background: light-dark(var(--ink), #3f3f46);
}
.cg-stop {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--surface);
}
.cg-note {
  text-align: center;
  font-size: 0.6875rem;
  color: var(--ink-4);
}

.tpl-progress-row {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}
.tpl-meter {
  display: block;
  height: 4px;
  border-radius: 4px;
  background: var(--line-2);
  overflow: hidden;
}
.tpl-meter span {
  display: block;
  height: 100%;
  background: var(--ok);
  border-radius: 4px;
  transition: width 0.4s var(--ease-out);
}
.tpl-fields {
  display: grid;
  gap: 12px;
}
.tpl-field {
  min-width: 0;
}
.tpl-flash .input {
  animation: tpl-flash 2.4s var(--ease-out);
}
@keyframes tpl-flash {
  0%,
  30% {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
    background: var(--accent-soft);
  }
}
.tpl-signers {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.tpl-signer {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.tpl-signer-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.tpl-signer-name {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tpl-me {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--ink-2);
  cursor: pointer;
  justify-self: start;
}
.tpl-empty-pane {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 40px 12px;
  color: var(--ink-2);
}
.tpl-empty-pane > .icon {
  width: 28px;
  height: 28px;
  color: var(--ink-3);
}

.tpl-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}
.tpl-doc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tpl-doc-bar .seg {
  margin-bottom: 0;
}
.tpl-paper {
  position: relative;
  height: calc(var(--tpl-h) - 46px);
  min-height: 474px;
  overflow-y: auto;
  padding: 48px 56px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-sm);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--ink);
}
.tpl-paper h1 {
  font-size: 1.375rem;
  margin: 0 0 16px;
}
.tpl-paper h2 {
  font-size: 0.9375rem;
  margin: 22px 0 6px;
}
.tpl-paper p {
  margin: 0 0 8px;
}
.tpl-paper ul {
  margin: 0 0 8px;
  padding-left: 20px;
}
.tpl-changed {
  border-radius: 4px;
  animation: tpl-changed 6s var(--ease-out) forwards;
}
@keyframes tpl-changed {
  0%,
  50% {
    background: var(--ok-soft);
    box-shadow: -8px 0 0 var(--ok-soft), 8px 0 0 var(--ok-soft), inset 3px 0 0 var(--ok);
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}
.tpl-cursor {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 1px;
  background: var(--accent);
  animation: tpl-blink 1s steps(2) infinite;
}
@keyframes tpl-blink {
  50% {
    opacity: 0;
  }
}
.tpl-paper-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  height: 100%;
  gap: 4px;
  color: var(--ink-2);
  font-family: var(--sans);
  text-align: center;
}
.tpl-paper-empty .icon {
  width: 32px;
  height: 32px;
  color: var(--ink-4);
  margin-bottom: 8px;
}
.tpl-blank,
.tpl-val {
  cursor: pointer;
  border-radius: 4px;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.tpl-blank {
  padding: 0 4px;
  background: var(--warn-soft);
  color: var(--warn-ink);
  box-shadow: inset 0 -1px 0 var(--warn);
}
.tpl-val {
  padding: 0 2px;
  background: var(--accent-soft);
}
.tpl-blank:hover,
.tpl-val:hover,
.tpl-hot {
  box-shadow: 0 0 0 2px var(--accent);
}
.tpl-text-wrap {
  display: grid;
  gap: 8px;
}
.tpl-text-wrap[hidden] {
  display: none;
}
.tpl-text {
  height: calc(var(--tpl-h) - 80px);
  min-height: 440px;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

@media (max-width: 1100px) {
  .tpl-layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  }
  .tpl-paper {
    padding: 32px;
  }
}
@media (max-width: 900px) {
  .tpl-layout {
    grid-template-columns: 1fr;
  }
  .tpl-side {
    order: 0;
    position: static;
    height: 70vh;
  }
  .tpl-paper,
  .tpl-text {
    height: auto;
    min-height: 60vh;
    padding: 24px 20px;
  }
  .tpl-hero h1 {
    font-size: 1.375rem;
  }
  .tpl-describe-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .tpl-del {
    opacity: 1;
  }
  .cg-starters {
    grid-template-columns: 1fr;
  }
  .cg-hint {
    visibility: hidden;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cg-msg,
  .tpl-changed,
  .tpl-flash .input,
  .tpl-cursor,
  .cg-shimmer,
  .cg-avatar.is-busy .icon,
  .cg-menu {
    animation: none;
  }
}

.legal-note {
  margin-top: 10px;
  text-align: center;
}

.made-with {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.btn-google {
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
}

.btn-google:hover {
  background: var(--hover);
  text-decoration: none;
}

.g-mark {
  width: 18px;
  height: 18px;
  flex: none;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Billing */

.bill {
  display: grid;
  gap: 20px;
}
.badge-test {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn-ink);
  font-size: 0.75rem;
  font-weight: 500;
}
.bill-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.875rem;
}
.bill-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
}
.bill-now {
  display: grid;
  gap: 6px;
  align-content: start;
  justify-items: start;
}
.bill-plan-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}
.bill-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0;
}
.bill-pill .icon {
  width: 14px;
  height: 14px;
}
.bill-pill.ok {
  background: var(--ok-soft);
  color: var(--ok-ink);
}
.bill-pill.warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
}
.bill-status {
  color: var(--ink-2);
  margin-bottom: 6px;
}
.bill-limits {
  display: grid;
  gap: 6px;
  width: 100%;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.bill-limits li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.bill-usage {
  display: grid;
  gap: 14px;
  align-content: start;
}
.meter {
  display: grid;
  gap: 6px;
}
.meter-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
}
.meter-num {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.meter-num strong {
  color: var(--ink);
}
.meter-bar {
  display: block;
  height: 6px;
  border-radius: 6px;
  background: var(--line-2);
  overflow: hidden;
}
.meter-bar > span {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: var(--accent);
  transition: width 0.4s var(--ease-out);
}
.meter-bar.is-near > span {
  background: var(--warn);
}
.bill-toggle-row {
  display: flex;
  justify-content: center;
}
.bill-toggle-row .seg {
  margin-bottom: 0;
}
.save-tag {
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok-ink);
  font-size: 0.6875rem;
  font-weight: 600;
}
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.plan-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--sh-sm);
}
.plan-card.is-popular {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--sh-sm);
}
.plan-card.is-current {
  background: var(--subtle);
}
.plan-badge {
  position: absolute;
  top: -11px;
  left: 22px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
}
.plan-card h3 {
  font-size: 1.0625rem;
  font-weight: 650;
}
.plan-tag {
  min-height: 2.6em;
}
.plan-price {
  margin-top: 4px;
}
.plan-price strong {
  font-size: 1.875rem;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.plan-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.plan-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.plan-list .icon {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  color: var(--ok);
}
.plan-soon-h {
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-3);
}
.plan-list.soon li {
  color: var(--ink-3);
}
.plan-list.soon li::before {
  content: "";
  width: 6px;
  height: 6px;
  margin: 6px 5px 0;
  flex: none;
  border-radius: 50%;
  background: var(--line-strong);
}
.locked {
  color: var(--ink-3);
}
.plan-chip {
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.6875rem;
  font-weight: 600;
}
.cg-upgrade {
  justify-self: start;
}
@media (max-width: 900px) {
  .plan-grid,
  .bill-summary {
    grid-template-columns: 1fr;
  }
}

.brand-custom img { display: block; height: 28px; max-width: 180px; object-fit: contain; }
.brand-custom span { font-weight: 650; }

.team { display: grid; gap: 20px; }
.member-list { list-style: none; margin: 0 0 16px; padding: 0; }
.member-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line, #e4e4e7); }
.member-list li:last-child { border-bottom: 0; }
.member-list li.is-pending { opacity: 0.7; }
.member-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.member-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-form { display: flex; gap: 8px; margin-bottom: 8px; }
.invite-form .input { flex: 1; min-width: 0; }

.brand-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 12px; }
.brand-form { display: grid; gap: 14px; align-content: start; }
.brand-form label { display: grid; gap: 6px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] { width: 40px; height: 36px; padding: 2px; border: 1px solid var(--line, #e4e4e7); border-radius: 8px; background: none; }
.color-row .input { width: 110px; font-family: "Geist Mono", ui-monospace, monospace; }
.logo-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.logo-box { display: grid; place-items: center; width: 140px; height: 52px; border: 1px dashed var(--line, #e4e4e7); border-radius: 8px; background: #fff; }
.logo-box img { max-width: 124px; max-height: 40px; object-fit: contain; }
.brand-preview { background: var(--subtle); border-radius: 12px; padding: 16px; align-self: start; }
.bp-mail { display: grid; gap: 10px; }
.bp-head img { height: 26px; max-width: 160px; object-fit: contain; display: block; }
.bp-card { background: #fff; border-radius: 10px; border-top: 4px solid; padding: 16px; display: grid; gap: 8px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.06); color: #111; }
.bp-btn { justify-self: start; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }

.lh-list { list-style: none; margin: 12px 0 16px; padding: 0; }
.lh-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lh-item:last-child { border-bottom: 0; }
.lh-thumb { flex: none; width: 54px; aspect-ratio: 210 / 297; border: 1px solid var(--line); border-radius: 4px; background: #fff; overflow: hidden; box-shadow: var(--sh-sm); }
.lh-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.lh-thumb img:not([src]) { visibility: hidden; }
.lh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; flex: 1; }
.lh-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-meta .small { flex-basis: 100%; }
.lh-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }
.lh-empty { margin: 12px 0 16px; padding: 20px; border: 1px dashed var(--line); border-radius: 10px; text-align: center; }
.lh-add { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }

dialog.lh-dialog { width: min(760px, calc(100vw - 32px)); }
.lh-pages { display: flex; gap: 20px; justify-content: center; }
.lh-page { margin: 0; display: grid; gap: 8px; justify-items: center; flex: 1; max-width: min(340px, 44vh); }
.lh-sheet { position: relative; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; touch-action: none; user-select: none; box-shadow: var(--sh-sm); }
.lh-sheet img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lh-shade { position: absolute; left: 0; right: 0; background: rgb(30 58 138 / 0.08); pointer-events: none; }
.lh-shade-top { top: 0; }
.lh-shade-bottom { bottom: 0; }
.lh-body { position: absolute; left: 10.8%; right: 10.8%; display: grid; align-content: start; gap: 7px; padding-top: 10px; overflow: hidden; pointer-events: none; }
.lh-body i { display: block; height: 4px; border-radius: 2px; background: rgb(17 17 17 / 0.12); }
.lh-body i:nth-child(1) { width: 55%; height: 7px; background: rgb(17 17 17 / 0.22); }
.lh-body i:nth-child(4) { width: 80%; }
.lh-line { position: absolute; left: 0; right: 0; height: 14px; margin: -7px 0; cursor: ns-resize; outline: none; }
.lh-line::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; border-top: 2px dashed var(--accent); }
.lh-line span { position: absolute; right: 6px; top: -4px; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; line-height: 1.5; }
.lh-line[data-edge="bottom"] span { top: auto; bottom: -4px; }
.lh-line:focus-visible::before { border-top-style: solid; }
@media (max-width: 720px) {
  .lh-item { flex-wrap: wrap; }
  .lh-actions { flex-basis: 100%; justify-content: flex-start; }
  .lh-pages { flex-direction: column; align-items: center; }
}

.tpl-lh { margin-left: auto; }
.tpl-lh select { max-width: 260px; }
.tpl-paper.has-lh { background-color: #fff; color: #111; background-repeat: no-repeat; background-size: 100% auto; background-attachment: local; }

.bulk-dialog textarea { font-family: "Geist Mono", ui-monospace, monospace; font-size: 13px; resize: vertical; }
.bulk-dialog label { display: grid; gap: 6px; margin-top: 12px; }

@media (max-width: 720px) {
  .brand-grid { grid-template-columns: 1fr; }
}

.profile-form { display: grid; gap: 14px; }
.profile-form label { display: grid; gap: 6px; }
.profile-section { margin: 10px 0 0; font-size: 14px; font-weight: 650; }
.profile-section:first-child { margin-top: 0; }
.profile-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; }
.tpl-profile-note { margin: 0 0 12px; }

.hint { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px; border-radius: 50%; background: var(--accent-soft, #eff6ff); color: var(--accent-ink, #1e3a8a); font-size: 11px; font-weight: 700; line-height: 1; cursor: help; vertical-align: 1px; }
.hint::after { content: attr(data-hint); position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 30; width: max-content; max-width: 260px; padding: 8px 10px; border-radius: 8px; background: #18181b; color: #fafafa; font-size: 12px; font-weight: 450; line-height: 1.45; text-align: left; white-space: normal; box-shadow: 0 6px 20px rgb(0 0 0 / 0.18); opacity: 0; transform: translate(-50%, 4px); pointer-events: none; transition: opacity 120ms ease, transform 120ms ease; }
.hint:hover::after, .hint:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.hint:focus-visible { outline: 2px solid var(--accent-ring, rgb(30 58 138 / 0.22)); outline-offset: 2px; }
.tpl-side .hint::after { left: 0; transform: translate(-12px, 4px); }
.tpl-side .hint:hover::after, .tpl-side .hint:focus-visible::after { transform: translate(-12px, 0); }
@media (prefers-reduced-motion: reduce) { .hint::after { transition: none; } }
.logo-row .btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }


/* Prepare: top bar */

.ebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  background: var(--glass);
  border-bottom: 1px solid var(--line);
}

.ebar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 8px 16px;
}

.ebar-row[hidden] {
  display: none;
}

.ebar-tools {
  min-height: 48px;
  padding-top: 6px;
  padding-bottom: 6px;
  border-top: 1px solid var(--line-2);
}

.ebar-grow {
  flex: 1;
}

.ebar-title {
  width: auto;
  field-sizing: content;
  min-width: 12ch;
  max-width: min(520px, 40vw);
  height: 32px;
  padding: 0 8px;
  border-color: transparent;
  box-shadow: none;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
}

.ebar-title:hover {
  border-color: var(--line);
}

.ebar-title:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.ebar .btn {
  height: 34px;
  padding: 0 12px;
  gap: 6px;
  font-size: 0.875rem;
}

.ebar .btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 0.8125rem;
}

.ebar .btn .icon {
  width: 15px;
  height: 15px;
}

.ebar .btn-sm .icon {
  width: 14px;
  height: 14px;
}

.ebar-label {
  margin-right: 2px;
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.ebar-sep {
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--line);
}

.ebar .save-state {
  font-size: 0.75rem;
  white-space: nowrap;
}

.pchips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.pchips:empty {
  display: none;
}

.pchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 500 0.8125rem/1 var(--sans);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.pchip:hover {
  border-color: var(--line-strong);
}

.pchip[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--rc) 60%, var(--surface));
  background: color-mix(in srgb, var(--rc) 6%, var(--surface));
}

.pchip .sw {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rc);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
}

.pchip.cc .sw {
  background: var(--subtle);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.pchip-note {
  color: var(--ink-3);
  font-size: 0.75rem;
}

.ebar .add-row {
  display: flex;
  gap: 4px;
}

.ebar .add-row .suggest {
  width: 220px;
}

.ebar .add-row .input,
.ebar .add-group-select {
  height: 32px;
  font-size: 0.8125rem;
}

.ebar .add-group-select {
  width: auto;
  margin: 0;
}

.pop-panel {
  position: fixed;
  inset: calc(var(--bar-h, 112px) + 8px) 16px auto auto;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - var(--bar-h, 112px) - 24px);
  margin: 0;
  padding: 18px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-lg);
}

#people-pop {
  inset: calc(var(--bar-h, 112px) + 8px) auto auto 16px;
}

.pop-panel:popover-open {
  display: grid;
  gap: 16px;
  animation: pop-in 0.18s var(--ease);
}

.pop-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.pop-panel .options .check,
.pop-panel .options .inline-field {
  font-size: 0.9375rem;
}

.pop-panel .recips {
  margin: 0;
}

.canvas-banner {
  top: calc(var(--bar-h, 0px) + 12px);
  gap: 10px;
  padding: 8px 8px 8px 10px;
  border-color: color-mix(in srgb, var(--rc, var(--accent)) 22%, var(--line));
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.875rem;
  box-shadow: var(--sh-sm);
}

.canvas-banner .banner-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.canvas-banner .banner-icon .icon {
  width: 15px;
  height: 15px;
}

.canvas-banner .banner-text {
  flex: 1;
  min-width: 0;
}

.canvas-banner .btn {
  flex: none;
  height: 32px;
  padding: 0 12px;
  font-size: 0.8125rem;
}

.canvas-banner .btn .icon {
  width: 14px;
  height: 14px;
}

.canvas-banner[data-kind="ready"] {
  --rc: var(--ok);
}

@media (max-width: 820px) {
  .ebar-row {
    padding: 6px 12px;
  }

  .ebar .save-state,
  .ebar-label,
  .ebar .lbl,
  .tbtn span,
  .ebar-row:first-child .ebar-grow,
  #box-btn .icon:last-child {
    display: none;
  }

  .ebar-title {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }

  .ebar .lbl-short {
    display: inline;
  }

  .ebar .btn-icon {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .tbtn {
    width: 32px;
    padding: 0;
    justify-content: center;
  }

  .ebar-sep {
    margin: 0 2px;
  }

  .ebar .add-row {
    flex: 1 1 100%;
  }

  .ebar .add-row .suggest {
    flex: 1;
    width: auto;
  }

  .canvas-banner {
    flex-wrap: wrap;
  }

  .canvas-banner .banner-text {
    flex: 1 1 calc(100% - 44px);
  }

  .canvas-banner .btn {
    width: 100%;
    justify-content: center;
  }

  #people-pop,
  .pop-panel {
    inset: calc(var(--bar-h, 112px) + 8px) 16px auto 16px;
    width: auto;
  }
}

.ebar .add-row[hidden],
.ebar .btn[hidden] {
  display: none;
}

#box-btn .icon:last-child {
  width: 14px;
  height: 14px;
  margin-left: 2px;
  color: var(--ink-3);
}


.page.drop-page {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-ring), var(--sh-md);
}

.lbl-short {
  display: none;
}

.tbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--subtle);
}

.tbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-2);
  font: 500 0.8125rem/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.tbtn .icon {
  width: 14px;
  height: 14px;
}

.tbtn:hover:not(:disabled) {
  background: var(--surface);
  color: var(--ink);
}

.tbtn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent-ink);
  box-shadow: var(--sh-xs), 0 0 0 1px var(--accent-ring);
}

.tbtn:disabled {
  opacity: 0.4;
  cursor: default;
}

.tbtn:focus-visible,
.tbtn:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.tbtn-icon {
  width: 28px;
  padding: 0;
  justify-content: center;
}

.tbar-sep {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: var(--line-strong);
}

.thumb-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.thumb-label strong {
  color: var(--ink);
  font-weight: 600;
}

.thumb-menu {
  flex: none;
  gap: 4px;
}

.thumb-menu .icon {
  width: 14px;
  height: 14px;
}

.org-bar strong {
  margin-right: 4px;
  font-size: 0.9375rem;
}

.org-menu {
  position: fixed;
  inset: auto;
  width: 220px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-lg);
}

.org-menu:popover-open {
  display: grid;
  animation: pop-in 0.16s var(--ease);
}

.org-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  font: 500 0.875rem/1.2 var(--sans);
  text-align: left;
  cursor: pointer;
}

.org-menu button .icon {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--ink-3);
}

.org-menu button:hover:not(:disabled),
.org-menu button:focus-visible {
  background: var(--hover);
  outline: none;
}

.org-menu button:disabled {
  color: var(--ink-4);
  cursor: default;
}

.org-menu button.danger,
.org-menu button.danger .icon {
  color: var(--bad-ink);
}

.org-menu button.danger:hover:not(:disabled) {
  background: var(--bad-soft);
}

.org-menu hr {
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--line-2);
}

.box-menu {
  width: 272px;
}

.box-menu #palette {
  display: grid;
}

.box-menu button {
  align-items: flex-start;
  padding: 8px 10px;
}

.box-menu button .icon {
  margin-top: 1px;
  color: var(--accent);
}

.box-menu button span {
  display: grid;
  gap: 2px;
}

.box-menu button strong {
  font-weight: 600;
}

.box-menu button small {
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 400;
}

@media (max-width: 820px) {
  .tbtn {
    width: 32px;
    padding: 0;
    justify-content: center;
  }

  .tbtn span {
    display: none;
  }
}

/* Review and send */

.send-dlg {
  width: min(520px, calc(100vw - 32px));
}

.send-dlg .dialog-body {
  gap: 20px;
}

.review-block {
  display: grid;
  gap: 8px;
}

.review-head {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-weight: 500;
}

.review-people {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.review-people li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.review-people li + li {
  border-top: 1px solid var(--line-2);
}

.review-people .sw {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--rc);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
}

.review-people .who {
  display: grid;
  min-width: 0;
  line-height: 1.35;
}

.review-people .who strong {
  font-size: 0.875rem;
  font-weight: 600;
}

.review-people .who span,
.review-people .role {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-opts {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.review-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
}

.review-opt[hidden] {
  display: none;
}

.review-opt + .review-opt {
  border-top: 1px solid var(--line-2);
}

.review-opt input[type="checkbox"] {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.review-opt > span:first-of-type {
  display: grid;
  flex: 1;
  gap: 2px;
}

.review-opt strong {
  font-size: 0.875rem;
  font-weight: 600;
}

.review-opt small {
  color: var(--ink-3);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.review-opt.locked {
  cursor: default;
}

.review-expiry {
  align-items: center;
  cursor: default;
}

.expiry-field {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.send-dlg .dialog-actions {
  align-items: center;
}

.review-bulk {
  margin-right: auto;
  color: var(--ink-2);
}

.send-dlg[open] {
  display: flex;
  max-height: calc(100dvh - 32px);
}

.send-dlg form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.send-dlg .dialog-body {
  overflow-y: auto;
}

@media (max-width: 520px) {
  .send-dlg .dialog-actions {
    flex-wrap: wrap;
  }

  .send-dlg .dialog-actions .btn:not(.review-bulk) {
    flex: 1;
    justify-content: center;
  }

  .review-bulk {
    order: 3;
    width: 100%;
    margin: 0;
    justify-content: center;
  }
}

.canvas-banner[data-kind="sign"] {
  border-color: color-mix(in srgb, var(--saffron-edge) 40%, var(--line));
}

.canvas-banner[data-kind="sign"] .banner-icon {
  background: var(--saffron);
  color: var(--saffron-ink);
}

.link-check {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin: 16px 0 12px;
}
.link-check .input {
  font-family: var(--mono);
  font-size: 0.875rem;
}
.link-result {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  line-height: 1.55;
  color: var(--ink-2);
}
.link-result strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}
.link-result p {
  margin: 6px 0 0;
}
.link-result .mono {
  overflow-wrap: anywhere;
}
.link-result[data-tone="ok"] {
  border-color: var(--ok);
  background: var(--ok-soft);
}
.link-result[data-tone="ok"] strong {
  color: var(--ok-ink);
}
.link-result[data-tone="bad"] {
  border-color: var(--bad);
  background: var(--bad-soft);
}
.link-result[data-tone="bad"] strong {
  color: var(--bad-ink);
}
.link-result[data-tone="warn"] {
  border-color: var(--warn);
  background: var(--warn-soft);
}
.link-result[data-tone="warn"] strong {
  color: var(--warn-ink);
}
.verify-sub {
  font-size: 1rem;
  margin: 28px 0 12px;
}
@media (max-width: 520px) {
  .link-check {
    grid-template-columns: 1fr;
  }
}

/* Theme toggle */

.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .tt-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .tt-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .tt-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .tt-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .tt-moon {
    display: none;
  }
}

.auth-main {
  position: relative;
}

.auth-theme {
  position: absolute;
  top: 16px;
  right: 16px;
}

.page,
.thumb-page,
.bp-card,
.art-doc,
.art-chip,
.fpop {
  color-scheme: light;
  color: var(--ink);
}

.mail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mail-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.mail-list li:first-child { border-top: 0; }
.mail-who { font-weight: 500; overflow-wrap: anywhere; }
.mail-status { justify-self: end; grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; }
.mail-detail { grid-column: 1 / -1; overflow-wrap: anywhere; }
[data-tone="bad"].mail-status, .panel-head [data-tone="bad"] { color: var(--bad-ink); }
[data-tone="warn"].mail-status { color: var(--warn-ink); }
[data-tone="good"].mail-status { color: var(--ok-ink); }

fieldset.slot { border: 0; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
fieldset.slot legend { padding: 0; margin-bottom: 6px; }
button.tpl-card { font: inherit; text-align: left; width: 100%; cursor: pointer; }

.resend-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.resend-row p { flex-basis: 100%; margin: 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.link-btn:disabled { color: inherit; opacity: 0.7; text-decoration: none; cursor: default; }

.seal-fp { overflow-wrap: anywhere; font-size: 12.5px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); }

.s-card code.hash { white-space: normal; overflow-wrap: anywhere; word-break: break-all; }

.s-docs {
  max-width: 900px;
  margin-bottom: 20px;
}
.s-reqs,
.s-files,
.rdoc-list,
.doc-reviews,
.doc-files {
  list-style: none;
  margin: 0;
  padding: 0;
}
.s-reqs {
  display: grid;
  gap: 10px;
}
.s-req {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.s-req[data-done="yes"] {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
}
.s-req-head,
.doc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.s-req-reason {
  color: var(--bad-ink);
}
.s-files {
  display: grid;
  gap: 4px;
}
.s-files li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.s-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.s-req-act,
.doc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.s-docs-send {
  margin-top: 16px;
}
.rdocs {
  display: grid;
  gap: 12px;
}
.rdoc-signer {
  display: grid;
  gap: 6px;
  justify-items: start;
}
.rdoc-who {
  font-weight: 600;
}
.rdoc-list {
  display: grid;
  gap: 4px;
  width: 100%;
}
.rdoc-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rdoc-label {
  flex: 1;
  min-width: 0;
}
.doc-reviews {
  display: grid;
  gap: 14px;
}
.doc-reviews > li {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.doc-reviews > li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.doc-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.doc-files a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.doc-status[data-tone="good"],
.panel-note[data-tone="good"] {
  color: var(--ok-ink);
}
.doc-status[data-tone="warn"],
.panel-note[data-tone="warn"] {
  color: var(--warn-ink);
}
.doc-status[data-tone="bad"] {
  color: var(--bad-ink);
}
.panel-head [data-tone="warn"] {
  color: var(--warn-ink);
}
