:root {
  --bg: #eef0f3; --panel: #fff; --side: #e4e7ec; --line: #d3d8df; --ink: #16202c; --muted: #536070;
  --accent: #1f4fa3; --accent-ink: #163b7d; --ok: #1b6a41; --err: #a3261f; --err-bg: #fbeceb; --warn: #8a5300;
  --r: 6px; --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); accent-color: var(--accent); }
body { margin: 0; min-height: 100vh; }
::selection { background: #c9d8f2; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-underline-offset: 3px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); padding: 2px 6px; border-radius: 4px; overflow-wrap: anywhere; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input:not([type=color]):not([type=file]), select, textarea {
  width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px;
}
input:hover, select:hover, textarea:hover { border-color: #a9b2bf; }
input[type=color] { width: 48px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
input[type=file] { font-size: .85rem; max-width: 100%; }
textarea { font: 1rem/1.6 var(--serif); resize: vertical; }
::placeholder { color: #7a8594; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; margin: 4px 0 0; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 16px; border-radius: var(--r);
  font: 600 .9rem var(--sans); cursor: pointer; text-decoration: none; border: 1px solid transparent; transition: background-color .15s, border-color .15s; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.line { background: #fff; color: var(--accent); border-color: #b4c3de; }
.btn.line:hover { border-color: var(--accent); }
.btn.quiet { background: none; color: var(--muted); padding: 0 8px; }
.btn.quiet:hover { color: var(--ink); background: rgba(0,0,0,.05); }
.btn.small { min-height: 30px; font-size: .8rem; }
.btn.danger-btn { background: #fff; color: var(--err); border-color: #e2b3b0; }
.btn.danger-btn:hover { background: var(--err-bg); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.mark { font-weight: 700; color: var(--ink); text-decoration: none; }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flash { margin: 16px 24px 0; padding: 10px 14px; border-radius: var(--r); background: #e6f2eb; color: var(--ok); border: 1px solid #b9dcc7; }
.flash-error { background: var(--err-bg); color: var(--err); border-color: #e9c1be; }

.start { max-width: 34rem; margin: 10vh auto 0; padding: 0 20px 40px; }
.lede { color: var(--muted); max-width: 65ch; margin: 0 0 1.25rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.start form .btn { margin-top: 12px; width: 100%; }
.note { margin-bottom: 12px; }
.start > .hint { margin-top: 16px; }
.terms { max-width: 40rem; margin-top: 6vh; }
.terms section { padding: 18px 0; }
.terms section p { margin: 0; max-width: 65ch; }
.terms h2 { margin-bottom: .35rem; }
.price { font-size: 1.15rem; margin: .25rem 0 .5rem; }
.price strong { font-size: 2rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.desk { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 59px); }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 28px; min-width: 0; }
.side > *, .brand > * { min-width: 0; }
.side h2 { display: flex; justify-content: space-between; align-items: baseline; font-size: .95rem; }
.count { color: var(--muted); font-weight: 400; font-size: .8rem; font-variant-numeric: tabular-nums; }
.clients { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 2px; }
.clients a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--r); color: var(--ink); text-decoration: none; }
.clients a:hover { background: rgba(255,255,255,.6); }
.clients a[aria-current] { background: var(--panel); box-shadow: 0 1px 3px rgba(22,32,44,.12); font-weight: 600; }
.state { color: var(--muted); font-weight: 400; white-space: nowrap; }
.state.is-ready { color: var(--accent); }
.state.is-blocked { color: var(--err); }
.state.is-sent { color: var(--ok); }
.brand { display: grid; gap: 10px; }
.brand h2 { margin: 0; }
.brand label { margin: 0 0 4px; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.logo-now { max-height: 48px; min-height: 24px; object-fit: contain; max-width: 100%; justify-self: start; background: #fff; padding: 4px; border-radius: 4px; }
.brand .btn { justify-self: start; }

.work { padding: 28px 32px 60px; max-width: 1180px; }
.head { margin-bottom: 8px; }
.meta { color: var(--muted); margin: 0; }
section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 24px; margin: 0 0 16px; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.steps { margin: 0 0 20px; padding-left: 1.4rem; display: grid; gap: 10px; max-width: 72ch; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.copy { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; max-width: 760px; }
.grid .end { align-self: end; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.inline label { margin: 0; }
.inline select { width: auto; }
.inline .hint { margin: 0; flex: 1 1 260px; }
.blocked { background: var(--err-bg); color: var(--err); border: 1px solid #e9c1be; border-radius: var(--r); padding: 10px 14px; max-width: 72ch; }
.nums { border-collapse: collapse; margin: 0 0 20px; font-variant-numeric: tabular-nums; }
.nums th, .nums td { padding: 6px 18px 6px 0; text-align: right; border-bottom: 1px solid var(--line); }
.nums th[scope=row], .nums thead th:first-child { text-align: left; font-weight: 400; }
.nums thead th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-bottom: 12px; }
.letter textarea { min-height: 420px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.preview { margin: 0; display: flex; flex-direction: column; }
.preview figcaption { display: flex; justify-content: space-between; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.preview figcaption a { font-weight: 400; }
.preview iframe { flex: 1; min-height: 480px; width: 100%; border: 1px solid var(--line); border-radius: var(--r); background: #e9ebee; }
.danger { margin-top: 28px; color: var(--muted); }
.danger summary { cursor: pointer; width: fit-content; }
.danger p { max-width: 65ch; }

@media (max-width: 960px) { .compose { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .top { padding: 10px 16px; }
  .flash { margin: 12px 16px 0; }
  .desk { grid-template-columns: minmax(0, 1fr); }
  /* phones: each log entry stacks (when and month, result, details) instead of scrolling sideways */
  .deliveries thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .deliveries tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .deliveries td { border: 0; padding: 0; }
  .deliveries td:last-child { grid-column: 1 / -1; color: var(--muted); }
  .side { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; gap: 20px; }
  .work { padding: 20px 16px 48px; }
  .grid { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 10px; }
  .who span { max-width: 40vw; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.scroll { overflow-x: auto; }
.deliveries { width: 100%; }
.deliveries th, .deliveries td { text-align: left; vertical-align: top; }
.deliveries td:first-child { white-space: nowrap; }
