/* Secret Santa — "Retro Postcard" theme */
:root {
  --fir: #22361E;
  --fir-2: #2F4A2C;
  --fir-3: #1A2A17;
  --paper: #F1E6CD;
  --paper-2: #F8F0DC;
  --paper-3: #FBF5E6;
  --line: #C9B48A;
  --rule: #D8C59C;
  --gold: #C9A24A;
  --gold-l: #E2C77A;
  --red: #A82024;
  --red-d: #7E1519;
  --red-dd: #5E1013;
  --ink: #3B2A1E;
  --ink-2: #6A5440;
  --ink-3: #5A4632;
  --tag: #E8CF95;
  --tag-b: #8A6A2E;
  --post: #6F8798;
  --ok: #2F6B3A;

  --f-display: 'Yeseva One', Georgia, serif;
  --f-body: 'Lora', Georgia, serif;
  --f-script: 'Marck Script', 'Segoe Script', cursive;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--fir);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--red); }
a:hover { color: var(--red-d); }
:focus-visible { outline: 3px solid var(--gold-l); outline-offset: 2px; }

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

/* ---------- top bar */
.topbar {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 12px;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-name { font-family: var(--f-script); font-size: 28px; color: var(--gold-l); line-height: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; color: var(--paper); font-size: 15px; }
.link-btn {
  background: none; border: 1px solid var(--gold); color: var(--gold-l);
  min-height: 40px; padding: 0 14px; border-radius: 20px; cursor: pointer;
}
.link-btn:hover { background: rgba(226, 199, 122, 0.12); }

.page { max-width: 1200px; margin: 0 auto; padding: 0 12px 28px; }

/* ---------- postcard frames */
.postcard {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--gold);
  border-radius: 6px;
  padding: 24px 20px;
  box-shadow:
    inset 0 0 0 6px var(--paper),
    inset 0 0 0 7px var(--red),
    inset 0 0 48px rgba(122, 84, 34, 0.28),
    0 8px 24px rgba(0, 0, 0, 0.28);
}
.postcard-back {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px 18px;
  box-shadow: inset 0 0 40px rgba(122, 84, 34, 0.15), 0 6px 18px rgba(0, 0, 0, 0.25);
}
.corner { position: absolute; width: 30px; height: 30px; pointer-events: none; }
.corner.tl { top: 14px; left: 14px; }
.corner.tr { top: 14px; right: 14px; transform: scaleX(-1); }
.corner.bl { bottom: 14px; left: 14px; transform: scaleY(-1); }
.corner.br { bottom: 14px; right: 14px; transform: scale(-1, -1); }

.kicker { font-family: var(--f-script); font-size: 22px; color: var(--fir-2); line-height: 1.2; }
.title {
  margin: 0; font-family: var(--f-display); font-weight: 400;
  font-size: clamp(28px, 6vw, 44px); line-height: 1.08; color: var(--red);
}
.h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 24px; line-height: 1.15; color: var(--red); }
.label-caps {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}
.muted { color: var(--ink-2); }
.italic { font-style: italic; }
.center { text-align: center; }
.divider { display: block; margin: 4px auto; }
.script { font-family: var(--f-script); }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 4px; cursor: pointer;
  text-decoration: none; transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-red {
  border: 2px solid var(--gold);
  background: var(--red);
  color: var(--paper-2);
  font-family: var(--f-display); font-size: 18px;
  box-shadow: inset 0 0 0 3px var(--red), inset 0 0 0 4px var(--gold-l), 0 3px 0 var(--red-dd);
}
.btn-red:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost {
  border: 1.5px solid var(--tag-b); background: transparent; color: var(--ink);
  font-weight: 600; font-size: 15px;
}
.btn-ghost:hover:not(:disabled) { background: rgba(138, 106, 46, 0.1); }
.btn-small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-danger { border-color: var(--red); color: var(--red); }

/* ---------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input {
  min-height: 48px; padding: 10px 14px; border-radius: 4px;
  border: 1.5px solid var(--line); background: var(--paper-3); color: var(--ink);
  font-size: 16px;
}
.input:focus { border-color: var(--tag-b); outline: none; box-shadow: 0 0 0 3px rgba(201, 162, 74, .35); }
.form { display: flex; flex-direction: column; gap: 14px; }
.error {
  min-height: 0; color: var(--red); font-size: 14px; font-weight: 600;
}
.error:empty { display: none; }
.notice {
  padding: 10px 14px; border-radius: 4px; background: rgba(47, 107, 58, .1);
  border: 1px solid rgba(47, 107, 58, .35); color: var(--ok); font-size: 14px;
}
.toggle { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--red); flex: none; }

/* ---------- lined paper / letters */
.lined {
  background-image: repeating-linear-gradient(transparent 0, transparent 33px, var(--rule) 33px, var(--rule) 34px);
  font-family: var(--f-script); font-size: 23px; line-height: 34px; color: var(--ink);
}
.letter-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
textarea.lined {
  width: 100%; min-height: 272px; border: none; outline: none; resize: vertical; padding: 0;
  background-color: transparent;
}
textarea.lined::placeholder { color: #8A7358; }

.address { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.address span { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.address .script { font-size: 20px; color: var(--ink); }

/* ---------- stamp & postmark */
.stamp-wrap { position: relative; width: 66px; height: 78px; flex: none; }
.stamp {
  position: absolute; inset: 0; padding: 4px;
  background: var(--paper-3); border: 2px dashed var(--line);
}
.stamp-inner {
  width: 100%; height: 100%; background: var(--red);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--paper); font-size: 9px; letter-spacing: .08em;
}
.postmark {
  position: absolute; left: -36px; top: 34px; width: 54px; height: 54px; border-radius: 50%;
  border: 2px solid var(--post); color: var(--post); opacity: .85; transform: rotate(-14deg);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 8px; line-height: 1.2; letter-spacing: .04em;
}

/* ---------- gift tag */
.gift-tag {
  position: relative; display: inline-flex; flex-direction: column; justify-content: center;
  width: 200px; height: 118px; padding-left: 22px; transform: rotate(-4deg);
  background: var(--tag); border: 2px solid var(--tag-b); border-radius: 12px 60px 60px 12px;
  box-shadow: inset 0 0 0 5px var(--tag), inset 0 0 0 6px #A88845, 0 5px 10px rgba(34, 54, 30, .35);
}
.gift-tag::after {
  content: ''; position: absolute; right: 20px; top: 50%; margin-top: -10px;
  width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 2px solid var(--tag-b);
}
.gift-tag .tag-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #5C4520; }
.gift-tag .tag-num { font-family: var(--f-display); font-size: 54px; line-height: 1; color: var(--red); }
.gift-tag .tag-note { font-family: var(--f-script); font-size: 17px; color: var(--ink); }
.gift-tag.small { width: 132px; height: 92px; padding-left: 14px; }
.gift-tag.small .tag-num { font-size: 38px; }
.gift-tag.small .tag-note { display: none; }

/* ---------- auth page */
.auth-grid { display: grid; gap: 20px; align-items: stretch; }
.auth-front { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 36px 24px; }
.auth-front p { margin: 0; max-width: 360px; color: var(--ink-3); }
.steps-list { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.steps-list li { display: flex; gap: 10px; align-items: baseline; color: var(--ink-3); font-size: 15px; }
.steps-list b { font-family: var(--f-display); font-weight: 400; color: var(--red); font-size: 18px; min-width: 22px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button {
  min-height: 46px; border: none; background: transparent; cursor: pointer; font-weight: 600; color: var(--ink-2);
}
.seg button[aria-selected="true"] { background: var(--red); color: var(--paper-2); }

/* ---------- participant tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.tab {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 64px; padding: 10px 14px; text-align: left; cursor: pointer;
  border: 1.5px solid rgba(226, 199, 122, .45); border-radius: 6px 6px 0 0;
  background: var(--fir-2); color: var(--paper);
}
.tab .tab-title { font-family: var(--f-display); font-size: 17px; line-height: 1.15; }
.tab .tab-sub { font-size: 12.5px; color: #C8D3BE; }
.tab[aria-selected="true"] {
  background: var(--paper); color: var(--red); border-color: var(--gold);
  box-shadow: inset 0 3px 0 var(--red);
}
.tab[aria-selected="true"] .tab-sub { color: var(--ink-2); }
.tab.ready:not([aria-selected="true"]) { border-color: var(--gold-l); box-shadow: 0 0 0 2px rgba(226, 199, 122, .35); }
.tab.ready .tab-sub { color: var(--gold-l); font-weight: 600; }
.tab.ready[aria-selected="true"] .tab-sub { color: var(--ok); }
.seal {
  position: absolute; top: -9px; right: -6px; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #D23A35, var(--red) 55%, var(--red-d));
  border: 2px solid var(--red-dd); box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
  display: flex; align-items: center; justify-content: center;
}
.seal.pulse { animation: sealPulse 1.6s ease-in-out infinite; }
@keyframes sealPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 4px rgba(0,0,0,.35), 0 0 0 0 rgba(226, 199, 122, .7); }
  50% { transform: scale(1.08); box-shadow: 0 2px 4px rgba(0,0,0,.35), 0 0 0 8px rgba(226, 199, 122, 0); }
}
@media (prefers-reduced-motion: reduce) { .seal.pulse { animation: none; } }

.panel { display: flex; flex-direction: column; gap: 16px; }
.write-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.write-head .address { flex: 1; }
.counter { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-style: italic; color: var(--ink-2); }
.status-sent { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 600; font-size: 15px; }

.placeholder { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 34px 18px; }
.placeholder p { margin: 0; max-width: 420px; color: var(--ink-3); }

.santa-grid { display: grid; gap: 16px; }
.santa-front { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.santa-back-cols { display: grid; gap: 16px; }
.santa-meta { display: flex; flex-direction: column; gap: 14px; }

/* ---------- admin */
.admin-grid { display: grid; gap: 18px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.add-row { display: flex; gap: 8px; }
.add-row .input { flex: 1; min-width: 0; }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.plist li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.plist li:first-child { border-top: none; }
.p-name { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.p-status { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.p-status.done { color: var(--ok); font-weight: 600; }
.p-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.p-link {
  grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-2); background: var(--paper-3);
  border: 1px dashed var(--line); padding: 6px 10px; border-radius: 4px; overflow-wrap: anywhere;
  font-family: ui-monospace, Menlo, monospace;
}
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px; padding: 10px; text-align: center; }
.stat b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 30px; color: var(--red); line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
table.pairs { width: 100%; border-collapse: collapse; font-size: 15px; }
table.pairs th, table.pairs td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.pairs th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.empty { padding: 18px 0 6px; text-align: center; color: var(--ink-2); font-style: italic; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--fir-3); color: var(--paper); border: 1px solid var(--gold);
  padding: 10px 18px; border-radius: 4px; font-size: 15px; z-index: 50; max-width: calc(100% - 32px);
}

.foot { text-align: center; color: #AFBFA6; font-size: 13px; padding: 18px 12px 26px; }
.foot .script { color: var(--gold-l); font-size: 20px; }

/* ---------- larger screens */
@media (min-width: 720px) {
  .topbar { padding: 20px 28px; }
  .page { padding: 0 28px 36px; }
  .postcard { padding: 36px 40px; }
  .postcard-back { padding: 26px 30px; }
  .tabs { max-width: 560px; }
  .admin-grid { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); align-items: start; }
}
@media (min-width: 900px) {
  .auth-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); max-width: 1000px; margin: 12px auto 0; }
  .santa-grid { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); align-items: stretch; }
  .santa-back-cols { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 32px; }
  .santa-back-cols .letter-col { border-right: 1px solid var(--line); padding-right: 32px; }
  .write-card { max-width: 820px; }
  .gift-tag { width: 250px; height: 140px; padding-left: 28px; }
  .gift-tag .tag-num { font-size: 64px; }
}

/* ---------- print: only the gift tag */
@media print {
  body { background: #fff; }
  body * { visibility: hidden; }
  .print-tag, .print-tag * { visibility: visible; }
  .print-tag { position: absolute; left: 40px; top: 40px; transform: none; }
}

/* ---------- fixes: small screens */
.admin-grid > *, .santa-grid > *, .auth-grid > * { min-width: 0; }
.input { width: 100%; min-width: 0; }
.write-head .stamp-wrap { margin-left: 38px; }
.gift-tag { padding-right: 46px; }
.gift-tag .tag-note { white-space: nowrap; font-size: 16px; }
.locked-note { margin: 0; font-size: 14px; font-style: italic; color: var(--ink-2); }
@media (max-width: 719px) {
  .plist li { grid-template-columns: minmax(0, 1fr); }
  .p-actions { justify-content: flex-start; }
}
@media (max-width: 480px) {
  #orgName { display: none; }
  .brand-name { font-size: 25px; }
}
.gift-tag { width: auto; min-width: 200px; }
@media (min-width: 900px) { .gift-tag { min-width: 250px; } }

/* ---------- printable gift label with a vintage postcard */
.print-card {
  position: relative; width: 100%; max-width: 330px; margin: 8px auto 26px;
  display: flex; flex-direction: column; align-items: center;
}
.pc-photo {
  margin: 0; width: 100%; aspect-ratio: 3 / 4; background: #FBF7EC;
  padding: 10px 10px 12px; transform: rotate(1.5deg);
  border: 1px solid #D9CBA8; box-shadow: 0 6px 16px rgba(34, 54, 30, .35);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.pc-photo img#pcImg { width: 100%; height: 100%; object-fit: contain; background: #EFE4C8; }
.pc-fallback {
  width: 100%; height: 100%; background: var(--paper-2); border: 1px dashed var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.pc-fallback .script { font-size: 28px; color: var(--red); }
.pc-tag.gift-tag {
  position: absolute; right: -12px; bottom: 34px; min-width: 0; width: 168px; height: 96px;
  padding-left: 14px; padding-right: 40px; transform: rotate(-7deg);
}
.pc-tag .tag-num { font-size: 40px; }
.pc-tag .tag-note { font-size: 14px; }
.pc-tag.gift-tag::after { right: 14px; width: 14px; height: 14px; margin-top: -8px; }
.pc-credit { margin: 10px 0 0; font-size: 11.5px; line-height: 1.35; color: var(--ink-2); font-style: italic; text-align: center; max-width: 320px; }
.pc-credit a { color: var(--ink-2); }
.pc-controls { display: flex; align-items: center; justify-content: center; gap: 10px; }
.pc-arrow { min-width: 44px; min-height: 44px; font-size: 22px; line-height: 1; padding: 0; }
.pc-counter { font-size: 14px; color: var(--ink-2); min-width: 130px; text-align: center; }
@media (min-width: 900px) {
  .pc-tag.gift-tag { width: 188px; height: 104px; }
  .pc-tag .tag-num { font-size: 46px; }
}

@media print {
  @page { size: A6 portrait; margin: 6mm; }
  .print-card, .print-card * { visibility: visible; }
  .print-card { position: absolute; left: 0; top: 0; width: 100mm; max-width: none; margin: 0; }
  .pc-photo { transform: none; box-shadow: none; }
  .pc-photo img#pcImg { background: none; }
  .pc-tag.gift-tag { box-shadow: inset 0 0 0 5px var(--tag), inset 0 0 0 6px #A88845; }
  .pc-credit { font-size: 7pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.pc-stage { position: relative; width: 100%; }
.pc-tag.gift-tag { bottom: -22px; right: -14px; }
.print-card .pc-credit { margin-top: 34px; }
@media print {
  .print-card { position: fixed; left: 0; top: 0; }
  .print-card .pc-credit { margin-top: 30px; }
}

/* ---------- owner page */
.owner-grid { display: grid; gap: 18px; }
.owner-grid > * { min-width: 0; }
.owner-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg button[aria-checked="true"] { background: var(--red); color: var(--paper-2); }
.seg-3 button { font-size: 14px; padding: 0 6px; }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: .04em; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--tag); color: #5C4520; border: 1px solid var(--tag-b); vertical-align: middle;
}
.badge-red { background: #F3DADA; color: var(--red-d); border-color: var(--red); }
select.input { appearance: auto; }

.chart { margin: 0; }
.chart-title { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.chart-total { font-weight: 400; font-size: 12.5px; color: var(--ink-2); }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-bar { fill: var(--red); }
.chart-axis { stroke: var(--tag-b); stroke-width: 1; }
.chart-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-tick { font-size: 11px; fill: var(--ink-2); font-family: var(--f-body); }
.chart-hit { fill: transparent; cursor: default; outline: none; }
.chart-hit.on, .chart-hit:focus-visible { fill: rgba(168, 32, 36, .08); }
.chart-tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--fir-3); color: var(--paper); border: 1px solid var(--gold);
  padding: 6px 10px; border-radius: 4px; font-size: 13px; white-space: nowrap;
}
.chart-table summary { cursor: pointer; font-size: 14px; color: var(--ink-2); min-height: 32px; display: flex; align-items: center; }

@media (min-width: 720px) {
  .owner-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .owner-grid { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); align-items: start; }
}

/* ---------- language switch */
.lang-switch { display: inline-flex; border: 1px solid var(--gold); border-radius: 20px; overflow: hidden; flex: none; }
.lang-switch button {
  min-width: 40px; min-height: 36px; padding: 0 10px; border: none; background: transparent;
  color: var(--gold-l); font: 600 13px var(--f-body); letter-spacing: .04em; cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--gold-l); color: var(--fir); }
.lang-switch button:hover:not([aria-pressed="true"]) { background: rgba(226, 199, 122, .12); }

/* =========================================================
   Design consistency pass
   ========================================================= */
:root { --page-max: 1200px; }
body.narrow { --page-max: 1000px; }
.topbar, .page { max-width: var(--page-max); }

/* top bar: brand never wraps, actions wrap as a group */
.topbar { flex-wrap: wrap; row-gap: 10px; }
.brand { white-space: nowrap; }
.topbar-right { flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.link-btn { white-space: nowrap; min-height: 36px; font-size: 14px; display: inline-flex; align-items: center; text-decoration: none; }
#orgName, #hello { white-space: nowrap; }

/* login: same width as top bar, equal-height cards */
.auth-grid { max-width: none; margin: 0; }

/* stat tiles: same height, labels fit */
.stat { display: flex; flex-direction: column; justify-content: center; min-height: 84px; padding: 10px 6px; }
.stat span { font-size: 12.5px; line-height: 1.3; overflow-wrap: anywhere; }

/* participant rows */
.p-actions .btn-small { min-height: 40px; }

/* address lines: underline only the line, not the inner text */
.address span { border-bottom: none; padding-bottom: 0; }
.address > span { border-bottom: 1px solid var(--line); padding-bottom: 4px; }

/* postmark: overlaps the stamp's corner, not its label */
.postmark { left: -40px; top: 46px; }

/* postcard on the gift label: frame follows the card's own shape */
.pc-photo { aspect-ratio: auto; min-height: 200px; display: block; }
.pc-photo img#pcImg { display: block; width: 100%; height: auto; max-height: 440px; object-fit: contain; }
.pc-fallback { min-height: 260px; }

/* participant: tabs sit on the card, both tabs use the same width */
.tabs { margin-bottom: -2px; position: relative; z-index: 1; max-width: 560px; }
.tab[aria-selected="true"] { border-bottom-color: var(--paper); }
.write-card { max-width: none; }
.santa-grid > .postcard-back.placeholder { justify-content: center; }

@media (max-width: 719px) {
  .topbar { padding: 12px 12px 10px; }
  .brand-name { font-size: 24px; }
  #orgName, #hello { display: none; }
  .link-btn { padding: 0 12px; }
  .auth-grid > section:last-child { order: -1; }   /* sign-in form first on phones */
  .p-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); width: 100%; }
  .p-actions > :first-child { grid-column: 1 / -1; }
  .stat { min-height: 76px; }
  .write-head { gap: 8px; }
  .address .script { font-size: 18px; }
}
.topbar-right { margin-left: auto; }
.postcard.ornate { padding-top: 34px; padding-bottom: 42px; }
@media (max-width: 719px) {
  .owner-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .postcard.ornate { padding-left: 22px; padding-right: 22px; }
}

/* ---------- fix: buttons never fall back to the browser's grey look */
button, select { -webkit-appearance: none; appearance: none; }
select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px;
}
.lang-switch { background: rgba(0, 0, 0, .12); }
.lang-switch button + button { border-left: 1px solid var(--gold); }

/* ---------- fix: two-column pages — both columns share the same top and bottom edge */
.admin-grid, .owner-grid { align-items: stretch; }
.admin-grid > .panel, .owner-grid > .panel { display: flex; flex-direction: column; }
.admin-grid > .panel > :last-child, .owner-grid > .panel > :last-child { flex: 1 1 auto; }
.admin-grid > .postcard { height: auto; }
/* fix: only our drawn arrow on dropdowns (the browser's own arrow stays off) */
select.input { -webkit-appearance: none; -moz-appearance: none; appearance: none; }
select.input::-ms-expand { display: none; }
