:root {
  --ink: #171016;
  --night: #0f0a0e;
  --ivory: #F2E8D8;
  --gold: #BE9A68;
  --rose: #e3a3b4;
  --serif: 'Bodoni Moda', serif;
  --line: rgba(190, 154, 104, .3);
}

body { margin: 0; background: var(--ink); color: var(--ivory); font-family: 'Instrument Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--ivory); }
input, textarea, button, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
@keyframes m23fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Shared ---------- */
.kicker { font-size: 10.5px; letter-spacing: .32em; color: var(--gold); }
.h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 34px; }
.h2-gap { margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 10px; letter-spacing: .24em; color: rgba(242, 232, 216, .7); }
.input-line { border: 0; border-bottom: 1px solid rgba(242, 232, 216, .5); background: transparent; padding: 8px 0; outline: none; min-height: 40px; min-width: 0; border-radius: 0; }
.input-line:focus, .input-area:focus { border-color: var(--gold); }
.input-lg { font-size: 18px; min-height: 46px; border-bottom-color: var(--ivory); }
.input-area { border: 1px solid rgba(242, 232, 216, .3); background: transparent; padding: 10px; outline: none; resize: vertical; border-radius: 0; }
.upper { text-transform: uppercase; }
.error { margin: 0; font-size: 13px; color: var(--rose); }
.hint { margin: 0; font-size: 12.5px; line-height: 1.6; color: rgba(242, 232, 216, .65); }
.fine { margin: 0; font-size: 11.5px; line-height: 1.6; color: rgba(242, 232, 216, .6); }
.btn-ivory { background: var(--ivory); color: var(--ink); border: 0; padding: 16px; font-size: 11.5px; font-weight: 600; letter-spacing: .26em; cursor: pointer; transition: background .3s; }
.btn-ivory:hover { background: var(--gold); }
.btn-ivory.btn-sm { padding: 14px 20px; min-height: 42px; font-size: 10.5px; letter-spacing: .22em; white-space: nowrap; }
.btn-outline { border: 1px solid rgba(242, 232, 216, .4); color: var(--ivory); padding: 12px 16px; font-size: 10.5px; letter-spacing: .22em; }
.btn-gold { background: var(--gold); color: var(--ink); border: 0; padding: 12px 16px; font-size: 10.5px; font-weight: 600; letter-spacing: .22em; cursor: pointer; transition: background .3s; }
.btn-gold:hover { background: var(--ivory); }
.btn-text { background: none; border: 0; padding: 12px 6px; font-size: 10.5px; letter-spacing: .22em; cursor: pointer; color: rgba(242, 232, 216, .7); }
.btn-text:hover { color: var(--gold); }

/* ---------- Lock ---------- */
.lock { min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lock-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; border: 1px solid rgba(190, 154, 104, .35); padding: clamp(28px, 5vw, 48px); animation: m23fade .6s both; }
.lock-card .field { gap: 8px; }
.lock-card .label { letter-spacing: .26em; font-size: 10.5px; color: rgba(242, 232, 216, .75); }
.lock-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 52px; line-height: .9; }
.lock-title em { color: var(--gold); }

/* ---------- Dashboard ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 48px) 80px; display: flex; flex-direction: column; gap: clamp(40px, 5vw, 64px); animation: m23fade .6s both; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.head-left { display: flex; flex-direction: column; gap: 10px; }
.head-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6vw, 72px); line-height: .9; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.stat { padding: 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.stat-label { font-size: 10px; letter-spacing: .26em; color: rgba(242, 232, 216, .7); }
.stat-value { font-family: var(--serif); font-size: 48px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; color: rgba(242, 232, 216, .6); }

.alloc { display: flex; flex-direction: column; gap: 8px; margin-top: calc(-1 * clamp(20px, 2.5vw, 32px)); }
.alloc-head { display: flex; justify-content: space-between; font-size: 10.5px; letter-spacing: .22em; color: rgba(242, 232, 216, .75); }
.alloc-track { height: 3px; background: rgba(242, 232, 216, .12); }
.alloc-bar { height: 100%; width: 0; background: var(--gold); transition: width .6s; }
.alloc-bar.over { background: var(--rose); }

.invites { display: flex; flex-direction: column; gap: 20px; }
.invites-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px; }
.filters { display: flex; flex-wrap: wrap; border: 1px solid rgba(190, 154, 104, .5); }
.filter { border: 0; padding: 10px 14px; font-size: 10px; letter-spacing: .2em; cursor: pointer; background: transparent; color: var(--ivory); }
.filter[aria-selected="true"] { background: var(--gold); color: var(--ink); }
.create { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 12px; align-items: end; background: var(--night); padding: 18px; border: 1px solid rgba(190, 154, 104, .2); }
@media (max-width: 640px) { .create { grid-template-columns: 1fr 1fr; } .create .field:first-child { grid-column: 1 / -1; } .create button { grid-column: 1 / -1; } }
.create-msg { margin: -8px 0 0; font-size: 12.5px; color: var(--gold); }
.create-msg.bad { color: var(--rose); }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 14px 10px; font-weight: 500; font-size: 10px; letter-spacing: .22em; color: rgba(242, 232, 216, .65); }
.table th.right { text-align: right; }
.table td { padding: 14px 10px; }
.table tbody tr { border-top: 1px solid rgba(190, 154, 104, .18); }
.table tbody tr.revoked { opacity: .55; }
.cell-name { font-family: var(--serif); font-size: 18px; }
.cell-code { font-size: 12px; letter-spacing: .1em; }
.cell-notes { max-width: 240px; font-size: 12.5px; line-height: 1.5; color: rgba(242, 232, 216, .75); }
.mini-stepper { display: flex; align-items: center; gap: 6px; }
.mini-stepper button { width: 28px; height: 28px; border: 1px solid rgba(242, 232, 216, .3); background: none; cursor: pointer; }
.mini-stepper button:hover { border-color: var(--gold); }
.mini-stepper span { min-width: 18px; text-align: center; }
.badge { font-size: 10px; letter-spacing: .2em; padding: 5px 9px; border: 1px solid currentColor; white-space: nowrap; }
.badge.yes { color: var(--gold); }
.badge.no { color: rgba(242, 232, 216, .55); }
.badge.maybe { color: var(--rose); }
.badge.pending { color: rgba(242, 232, 216, .85); }
.badge.revoked { color: rgba(242, 232, 216, .4); }
.row-actions { display: flex; gap: 14px; justify-content: flex-end; font-size: 10px; letter-spacing: .18em; white-space: nowrap; }
.row-actions button { background: none; border: 0; padding: 4px 0; cursor: pointer; }
.act-copy { color: var(--gold); }
.act-copy:hover { color: var(--ivory); }
.act-toggle { color: rgba(242, 232, 216, .8); }
.act-toggle:hover { color: var(--rose); }
.empty { margin: 0; padding: 40px 10px; text-align: center; font-family: var(--serif); font-style: italic; font-size: 22px; color: rgba(242, 232, 216, .6); }

.bottom { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: clamp(24px, 4vw, 48px); }
.settings, .messages { display: flex; flex-direction: column; gap: 18px; }
.save-row { display: flex; align-items: center; gap: 16px; }
.saved { font-size: 12px; color: var(--gold); }
.messages-list { display: flex; flex-direction: column; gap: 18px; }
.quote { margin: 0; border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.quote-text { font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.35; }
.quote-name { font-size: 10px; letter-spacing: .22em; color: var(--gold); }
.no-messages { margin: 0; font-family: var(--serif); font-style: italic; font-size: 20px; color: rgba(242, 232, 216, .55); }
.fine-rule { margin-top: auto; color: rgba(242, 232, 216, .55); border-top: 1px solid rgba(242, 232, 216, .15); padding-top: 14px; }

/* ---------- V2 ---------- */
code { font-size: .95em; color: var(--gold); }
.opt { opacity: .6; }
.h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 24px; }
.h3-gap { margin-top: 14px; }
.banner { border: 1px solid rgba(190, 154, 104, .5); padding: 14px 18px; font-size: 13px; line-height: 1.6; color: rgba(242, 232, 216, .85); margin-top: calc(-1 * clamp(20px, 2.5vw, 32px)); }
.banner strong { color: var(--gold); font-weight: 600; letter-spacing: .08em; }
.banner.test { border-color: var(--rose); }
.stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.stat-value { font-size: 42px; }
.toolbar { display: flex; gap: 12px; align-items: end; flex: 1; justify-content: flex-end; }
.search { width: min(100%, 360px); }
.filters { align-self: flex-start; }
.create-wrap { display: flex; flex-direction: column; gap: 10px; }
.create { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .6fr) auto; }
@media (max-width: 900px) { .create { grid-template-columns: 1fr 1fr; } .create .field:first-child { grid-column: 1 / -1; } .create button { grid-column: 1 / -1; } }
.import { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.btn-file { position: relative; cursor: pointer; display: inline-block; }
.btn-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.btn-file:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.table { min-width: 940px; }
.table tbody tr { cursor: pointer; transition: background .2s; }
.table tbody tr:hover { background: rgba(190, 154, 104, .06); }
.cell-contact { display: block; font-family: 'Instrument Sans', sans-serif; font-size: 11.5px; color: rgba(242, 232, 216, .6); margin-top: 4px; letter-spacing: .02em; }
.cell-sub { display: block; font-size: 11px; color: rgba(242, 232, 216, .55); margin-top: 6px; }
.badge.not_sent { color: rgba(242, 232, 216, .55); border-style: dashed; }
.badge.sent, .badge.marked_sent, .badge.delivery_delayed { color: var(--ivory); }
.badge.delivered { color: var(--gold); }
.badge.failed, .badge.bounced, .badge.complained { color: var(--rose); }
.row-actions button, .row-actions a { background: none; border: 0; padding: 4px 0; cursor: pointer; font: inherit; }
.btn-outline { background: transparent; cursor: pointer; font: inherit; font-size: 10.5px; letter-spacing: .22em; transition: border-color .3s, color .3s; }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-outline:disabled, .btn-ivory:disabled, .btn-gold:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger { background: transparent; border: 1px solid rgba(227, 163, 180, .55); color: var(--rose); padding: 12px 16px; font-size: 10.5px; letter-spacing: .22em; cursor: pointer; }
.btn-danger:hover { background: rgba(227, 163, 180, .1); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.sends { display: flex; flex-direction: column; gap: 16px; }
.sends-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 18px; }
.send-card { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; border: 1px solid rgba(190, 154, 104, .25); padding: 22px; background: var(--night); }
.send-card .field { width: 100%; }
.confirm { width: 100%; border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; font-size: 13px; line-height: 1.6; }
.confirm .names { color: rgba(242, 232, 216, .7); font-size: 12.5px; }
.confirm-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 18px; }
.toggle { display: flex; align-items: center; gap: 12px; font-size: 13.5px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--gold); }
input[type="datetime-local"] { color-scheme: dark; }
.side { display: flex; flex-direction: column; gap: 48px; }
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 520px; overflow-y: auto; border-top: 1px solid var(--line); }
.activity-list li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(190, 154, 104, .12); font-size: 12.5px; line-height: 1.5; }
.activity-list time { font-size: 10.5px; letter-spacing: .08em; color: rgba(242, 232, 216, .5); }
.activity-list .who { color: var(--gold); }

/* ---------- Guest dialog ---------- */
.dialog { width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 24px); border: 1px solid rgba(190, 154, 104, .45); background: var(--ink); color: var(--ivory); padding: clamp(20px, 4vw, 36px); }
.dialog::backdrop { background: rgba(10, 6, 9, .78); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 10px; right: 14px; }
.gd { display: flex; flex-direction: column; gap: 26px; }
.gd-section { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 18px; }
.gd-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 5vw, 42px); line-height: 1; padding-right: 90px; }
.gd-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gd-link { flex: 1; min-width: 0; font-size: 12px; color: rgba(242, 232, 216, .75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid rgba(242, 232, 216, .25); padding: 8px 0; }
.gd-wa { width: 100%; min-height: 220px; font-size: 13.5px; line-height: 1.55; }
.gd-history { list-style: none; margin: 0; padding: 0; font-size: 12.5px; line-height: 1.6; color: rgba(242, 232, 216, .8); }
.gd-history li { padding: 6px 0; border-bottom: 1px solid rgba(190, 154, 104, .1); }
.gd-msg { font-size: 12.5px; min-height: 1em; margin: 0; }
.gd-msg.bad { color: var(--rose); }
.gd-msg.ok { color: var(--gold); }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 14px; font-size: 13px; line-height: 1.5; }
.kv dt { font-size: 10px; letter-spacing: .22em; color: rgba(242, 232, 216, .6); padding-top: 3px; }
.kv dd { margin: 0; }
.gd-head { display: flex; flex-direction: column; gap: 14px; }
.gd-edit { display: flex; flex-direction: column; gap: 14px; }
