/* Compa (project COMPANION) — quiet concierge. One light world, warm paper, bottle-green ink for action. */

@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/fraunces-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/fraunces-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/fraunces-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 400; font-display: swap; src: url("/static/fonts/fraunces-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-latin-600-normal.woff2") format("woff2"); }

:root {
  --paper: #f4f1ea;
  --paper-2: #ebe7de;
  --ink: #1b1a17;
  --ink-2: #5f5a50;
  --ink-3: #8c867a;
  --rule: #d9d3c6;
  --green: #1e4d45;
  --green-2: #16403a;
  --green-tint: #e2ebe7;
  --amber: #8a5a12;
  --amber-tint: #f4e9d2;
  --red: #8f2d28;
  --red-tint: #f3dcda;
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --shadow: 0 8px 24px -12px rgba(27, 26, 23, 0.28);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "cv11", "ss01";
  min-height: 100dvh;
}
::selection { background: var(--green-tint); color: var(--green-2); }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green-2); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; }

/* layout ------------------------------------------------------------ */
.wrap { width: min(100% - 40px, 760px); margin: 0 auto; }
.wrap-wide { width: min(100% - 40px, 1120px); margin: 0 auto; }
.stack > * + * { margin-top: var(--gap, 16px); }
.cluster { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* wordmark ------------------------------------------------------------ */
.brand { display: inline-flex; align-items: baseline; gap: 8px; color: var(--ink); text-decoration: none; }
.brand .name { font-family: var(--display); font-weight: 500; font-size: 1.25rem; letter-spacing: 0.01em; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); transform: translateY(-1px); }

/* landing ------------------------------------------------------------- */
.hero { padding: clamp(72px, 16vh, 160px) 0 clamp(48px, 10vh, 120px); }
.hero h1 { font-size: clamp(2.6rem, 7vw, 5.2rem); line-height: 1.02; font-weight: 500; }
.hero h1 em { font-style: italic; font-weight: 400; color: var(--green); }
.hero .lede { font-size: clamp(1.1rem, 2.2vw, 1.35rem); color: var(--ink-2); max-width: 36ch; margin-top: 28px; line-height: 1.45; }
.hero .note { margin-top: 44px; color: var(--ink-3); font-size: 0.95rem; }
.examples { border-top: 1px solid var(--rule); padding: 40px 0 72px; }
.examples h2 { font-size: 1.1rem; font-weight: 500; color: var(--ink-2); margin-bottom: 20px; }
.examples ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px 40px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .examples ul { grid-template-columns: 1fr 1fr; } }
.examples li { font-family: var(--display); font-size: 1.15rem; line-height: 1.35; color: var(--ink); }
.examples li::before { content: "“"; color: var(--green); }
.examples li::after { content: "”"; color: var(--green); }
footer { padding: 28px 0 44px; color: var(--ink-3); font-size: 0.85rem; border-top: 1px solid var(--rule); }

/* invite -------------------------------------------------------------- */
.invite { padding: clamp(56px, 14vh, 140px) 0; }
.invite h1 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.08; }
.invite .lede { margin-top: 20px; color: var(--ink-2); font-size: 1.1rem; max-width: 40ch; }
.actions { margin-top: 36px; display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 500 1rem/1 var(--body); padding: 16px 22px; border-radius: var(--radius);
  background: var(--green); color: #fff; text-decoration: none; border: 1px solid var(--green);
  box-shadow: var(--shadow); transition: transform 180ms cubic-bezier(.2,.8,.2,1), background 180ms;
}
.btn:hover { background: var(--green-2); color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: transparent; color: var(--green); box-shadow: none; }
.btn.secondary:hover { background: var(--green-tint); }
.btn.small { padding: 9px 14px; font-size: 0.875rem; box-shadow: none; }
.btn.ghost { background: transparent; border-color: var(--rule); color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--rule); color: var(--red); box-shadow: none; }
.btn.danger:hover { background: var(--red-tint); }
.btn svg { width: 18px; height: 18px; }
.state { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; background: var(--paper-2); color: var(--ink-2); }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.state.open::before, .state.live::before { background: var(--green); }
.state.open, .state.live { background: var(--green-tint); color: var(--green-2); }
.state.expired::before, .state.blocked::before { background: var(--amber); }
.state.expired, .state.blocked { background: var(--amber-tint); color: var(--amber); }
.state.revoked::before, .state.failed::before { background: var(--red); }
.state.revoked, .state.failed { background: var(--red-tint); color: var(--red); }
.state.redeemed::before { background: var(--ink-2); }
.steps { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--rule); color: var(--ink-2); max-width: 44ch; }
.steps p + p { margin-top: 10px; }

/* admin --------------------------------------------------------------- */
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 0.95rem; }
.admin-nav a:hover { background: var(--paper-2); color: var(--ink); }
.admin-nav a.active { background: var(--ink); color: var(--paper); }
.admin-main { padding: 28px 0 64px; }
.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title h1 { font-size: 1.8rem; }
.section { margin-top: 36px; }
.section h2 { font-size: 1.15rem; margin-bottom: 12px; color: var(--ink); }

.status-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.status-list li { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); align-items: center; }
.status-list .k { color: var(--ink-2); font-size: 0.95rem; }
.status-list .v { font-size: 0.95rem; }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 28px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 16px 0; }
.figure { padding: 8px 0; }
.figure .label { color: var(--ink-2); font-size: 0.85rem; }
.figure .value { font-family: var(--display); font-size: 1.7rem; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.figure .cmp { color: var(--ink-3); font-size: 0.8rem; margin-top: 2px; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
table.data th { text-align: left; font-weight: 500; color: var(--ink-2); padding: 10px 10px 10px 0; border-bottom: 1px solid var(--rule); font-size: 0.85rem; white-space: nowrap; }
table.data td { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .mono { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); word-break: break-all; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { display: inline; }

form.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input[type="text"], input[type="password"], input[type="number"] {
  font: 400 1rem var(--body); padding: 11px 13px; border-radius: 8px; border: 1px solid var(--rule); background: #fff; color: var(--ink); min-width: 0;
  caret-color: var(--green);
}
input::placeholder { color: var(--ink-3); }
input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-tint); }
.login { padding: clamp(60px, 18vh, 160px) 0; max-width: 380px; }
.login h1 { font-size: 1.9rem; margin-bottom: 20px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.alert { padding: 12px 14px; border-radius: 8px; background: var(--red-tint); color: var(--red); font-size: 0.925rem; }
.hint { margin: 14px 0 0; color: var(--ink-3); font-size: 0.85rem; line-height: 1.5; max-width: 72ch; }
.empty { padding: 36px 0; color: var(--ink-3); text-align: center; border: 1px dashed var(--rule); border-radius: var(--radius); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; opacity: 0; transition: all 220ms cubic-bezier(.2,.8,.2,1); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
pre.evt { margin: 4px 0 0; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-3); white-space: pre-wrap; }

@media (max-width: 640px) {
  .admin-top { flex-direction: column; align-items: flex-start; gap: 10px; }
  .status-list li { grid-template-columns: 1fr; gap: 2px; }
  table.data { display: block; }
  table.data thead { display: none; }
  table.data tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  table.data td { display: block; border: 0; padding: 3px 0; }
  table.data td.num { text-align: left; }
  table.data td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
