/* Luna Mail. Top bar, one centered column for buyers, a wider workspace for the admin.
   Every color derives from --h (the palette hue), so the six themes swap with one variable. */
:root {
  --h: 336;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --bg: hsl(var(--h) 70% 97.5%);
  --surface: hsl(var(--h) 60% 100%);
  --surface-2: hsl(var(--h) 45% 95.5%);
  --fg: hsl(var(--h) 35% 14%);
  --muted: hsl(var(--h) 12% 40%);
  --line: hsl(var(--h) 30% 89%);
  --accent: hsl(var(--h) 80% 45%);
  --accent-ink: #fff;
  --accent-text: hsl(var(--h) 75% 36%);
  --accent-soft: hsl(var(--h) 92% 94%);
  --good: #14804f;
  --warn: #a85a00;
  --bad: #c0262d;
  --shadow: 0 1px 2px hsl(var(--h) 40% 30% / .06), 0 8px 24px hsl(var(--h) 40% 30% / .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: hsl(var(--h) 28% 8.5%);
    --surface: hsl(var(--h) 22% 12.5%);
    --surface-2: hsl(var(--h) 20% 16.5%);
    --fg: hsl(var(--h) 25% 94%);
    --muted: hsl(var(--h) 12% 68%);
    --line: hsl(var(--h) 16% 22%);
    --accent: hsl(var(--h) 88% 64%);
    --accent-ink: hsl(var(--h) 40% 10%);
    --accent-text: hsl(var(--h) 90% 76%);
    --accent-soft: hsl(var(--h) 38% 21%);
    --good: #4cd49a;
    --warn: #f0b050;
    --bad: #ff8a8f;
    --shadow: 0 1px 2px #0006, 0 8px 24px #0005;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: hsl(var(--h) 28% 8.5%);
  --surface: hsl(var(--h) 22% 12.5%);
  --surface-2: hsl(var(--h) 20% 16.5%);
  --fg: hsl(var(--h) 25% 94%);
  --muted: hsl(var(--h) 12% 68%);
  --line: hsl(var(--h) 16% 22%);
  --accent: hsl(var(--h) 88% 64%);
  --accent-ink: hsl(var(--h) 40% 10%);
  --accent-text: hsl(var(--h) 90% 76%);
  --accent-soft: hsl(var(--h) 38% 21%);
  --good: #4cd49a;
  --warn: #f0b050;
  --bad: #ff8a8f;
  --shadow: 0 1px 2px #0006, 0 8px 24px #0005;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  padding-block: 0 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background-image: radial-gradient(900px 380px at 85% -80px, hsl(var(--h) 90% 70% / .22), transparent 70%);
  background-repeat: no-repeat;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
p { margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; }
.narrow { max-width: 640px; margin: 0 auto; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-weight: 700; color: var(--muted); font-size: 14px; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.icon-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.swatch-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }

.theme-pop { position: relative; }
.theme-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 272px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sw { display: grid; gap: 6px; justify-items: center; padding: 10px 4px; background: var(--surface-2); border: 2px solid transparent; border-radius: 14px; font-size: 12px; font-weight: 700; }
.sw i { width: 26px; height: 26px; border-radius: 50%; display: block; }
.sw[aria-pressed="true"] { border-color: var(--accent); }

.ribbon { display: flex; gap: 8px; align-items: center; justify-content: center; text-align: center; background: var(--accent-soft); color: var(--accent-text); border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 500; margin-bottom: 20px; }

/* public */
.hero { padding-block: 28px 8px; text-align: left; }
.hero h1 { font-size: clamp(34px, 7vw, 56px); font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin-top: 14px; max-width: 46ch; color: var(--muted); font-size: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
.lookup { margin-top: 24px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 700; }
.input { width: 100%; min-width: 0; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); }
.input:focus { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.pin-input { font-family: var(--font-mono); font-size: 20px; letter-spacing: .35em; font-weight: 700; }
.row2 { display: grid; grid-template-columns: 1fr 190px; gap: 12px; }
.btn { border: 0; border-radius: 12px; padding: 13px 20px; font-weight: 700; background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { color: var(--bad); }
.btn.bad-solid { background: var(--bad); color: var(--surface); }
.demo-hint { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.error { color: var(--bad); font-weight: 500; font-size: 14px; min-height: 1px; }

.result { margin-top: 20px; display: grid; gap: 14px; }
.plan { display: grid; gap: 10px; }
.plan-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, var(--surface)); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.pill.off { color: var(--muted); background: var(--surface-2); }
.mail { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.mail.expired { opacity: .55; }
.mail-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.mail h3 { font-size: 16px; }
.mail small { color: var(--muted); }
.code { font-family: var(--font-mono); font-weight: 700; font-size: 26px; letter-spacing: .18em; color: var(--accent-text); margin-top: 4px; }
.mail-act { display: grid; gap: 6px; justify-items: end; }
.privacy { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.steps { margin-top: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step { padding: 16px; border-radius: 16px; border: 1px dashed var(--line); }
.step b { font-family: var(--font-display); display: block; margin-bottom: 4px; }
.step span { color: var(--muted); font-size: 14px; }

/* admin */
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 14px; padding-block: 8px 18px; }
.admin-head h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 13px; font-size: 13px; font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.chip b { background: var(--surface-2); border-radius: 99px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.add { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; margin-block: 16px; }
.add .btn[type=submit] { grid-column: 1 / -1; justify-self: start; }
.pin-row { display: flex; gap: 6px; }
.pin-row .input { font-family: var(--font-mono); letter-spacing: .15em; }
.table { display: grid; gap: 10px; margin-top: 14px; }
.trow { display: grid; grid-template-columns: 1fr 1.5fr 1.1fr .9fr .9fr 1.15fr auto; gap: 12px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.trow > * { min-width: 0; }
.thead { background: transparent; border: 0; padding-block: 0 2px; }
.thead span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cell-main { font-weight: 700; overflow-wrap: anywhere; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.row-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.remind { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--fg); font-size: 13.5px; }
.remind.bad { background: color-mix(in srgb, var(--bad) 11%, var(--surface)); }
.filter-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.rule { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rule:last-child { border-bottom: 0; }
.rule p { font-size: 13px; color: var(--muted); }
.switch { width: 46px; height: 28px; border-radius: 99px; border: 0; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px #0004; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.mails { display: grid; gap: 8px; }
.amail { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); align-items: center; }
.amail.hidden-mail { background: var(--surface-2); }
.amail .subj { font-weight: 700; overflow-wrap: anywhere; }
.amail .meta { font-size: 12.5px; color: var(--muted); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 700; font-size: 14px; z-index: 50; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.tabs { margin-top: 4px; }

.contact { margin-top: 20px; display: flex; gap: 14px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.contact-list { display: flex; gap: 8px; flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-block; }
.crow { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; }
textarea.input { resize: vertical; min-height: 84px; }
.seg.tabs { max-width: 100%; overflow-x: auto; }
@media (max-width: 560px) { .crow { grid-template-columns: 1fr; } }
.opts { display: grid; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input { margin-top: 4px; accent-color: var(--accent); }
.opt b { display: block; }
.opt small { color: var(--muted); font-size: 13px; }
.row3 { display: grid; grid-template-columns: 1fr 110px 1fr; gap: 12px; }
.stat { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.stat:last-child { border-bottom: 0; }
.stat b { font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .row3, #mb-form .row2 { grid-template-columns: 1fr !important; } }
@media (max-width: 920px) {
  .add { grid-template-columns: 1fr 1fr; }
  .add .btn { grid-column: 1 / -1; }
  .filter-grid { grid-template-columns: 1fr; }
  .thead { display: none; }
  .trow { grid-template-columns: 1fr 1fr; row-gap: 10px; }
  .trow > [data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  .trow .row-act { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .row2 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .add { grid-template-columns: 1fr; }
  .mail { grid-template-columns: auto 1fr; }
  .mail-act { grid-column: 1 / -1; justify-items: stretch; grid-template-columns: 1fr; }
  .code { font-size: 22px; letter-spacing: .14em; }
  .brand span.name { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* real-site additions */
body[data-mode="admin"] #view-public { display: none !important; }
.login { max-width: 420px; margin: 32px auto 0; display: grid; gap: 14px; }
.mb-list { display: grid; margin-top: 8px; }
.mbrow { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mbrow:last-child { border-bottom: 0; }
.mbrow > div { min-width: 0; }
.note { font-size: 13px; color: var(--muted); }
.msg { padding: 10px 12px; border-radius: 12px; font-size: 14px; background: var(--surface-2); overflow-wrap: anywhere; }
.msg.ok { background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.msg.bad { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.mail.old { opacity: .78; }
.mail-act a.btn, .mail-act button { text-align: center; }
.mail-act { align-content: center; }
.stack { display: grid; gap: 14px; }
input[type="file"].input { padding: 9px 12px; }


/* desktop table: six aligned columns, actions on their own line */
@media (min-width: 921px) {
  .trow { grid-template-columns: 1fr 1.7fr 1.1fr .95fr .95fr 1.1fr; }
  .trow .row-act { grid-column: 1 / -1; justify-content: flex-start; padding-top: 2px; }
}

textarea.input { font-family: var(--font-body); line-height: 1.45; }
.seg button { white-space: nowrap; }
