/* Organic Soul admin */
:root {
  --ivory: #F7F1E3; --bg: #F4EFE3; --paper: #FFFDF8; --emerald: #0B4A3A; --emerald-2: #093D30; --emerald-tint: #E8F1EC;
  --royal: #1C2B5A; --cherry: #9E1B32; --gold: #B08D57; --gold-soft: #D9C49E;
  --ink: #1F1B16; --ink-2: #5E564A; --ink-3: #8A8174; --line: #E4DBC8; --line-2: #D3C7AE;
  --ok: #1E6B45; --warn: #8A5A00; --radius: 8px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(31,27,22,.05), 0 2px 8px rgba(31,27,22,.04);
}
* { box-sizing: border-box; }
img { max-width: 100%; height: auto; }
body { margin: 0; font: 400 15px/1.55 'Jost', 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--emerald); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--royal); outline-offset: 2px; }
h1, h2, h3 { font-family: 'Cormorant Garamond', Georgia, serif; color: var(--emerald); font-weight: 600; margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 2.1rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.15rem; }
code { font-size: .85em; background: #F1EADB; padding: 1px 5px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); } .small { font-size: .85rem; } .tiny { font-size: .78rem; }

/* ── Shell ───────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--emerald); color: #EDE5D1; padding: 18px 0 30px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { display: flex; align-items: center; gap: 12px; padding: 0 20px 18px; border-bottom: 1px solid rgba(217,196,158,.25); color: #fff; text-decoration: none; }
.side .logo img { height: 48px; width: auto; }
.side .logo span { font: 600 1.15rem/1.1 'Cormorant Garamond', serif; }
.side h2 { font: 500 .68rem/1 'Jost', sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-soft); margin: 22px 20px 6px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: block; padding: 7px 20px 7px 17px; color: #E6DDC8; text-decoration: none; font-size: .92rem; border-left: 3px solid transparent; }
.side a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a[aria-current="page"] { border-left-color: var(--gold); background: rgba(255,255,255,.09); color: #fff; font-weight: 500; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 32px; border-bottom: 1px solid var(--line); background: var(--paper); flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.topbar .who { font-size: .9rem; color: var(--ink-2); }
.topbar .who a { color: var(--ink-2); }
.mode { display: inline-block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; padding: 3px 9px; border: 1px solid var(--royal); color: var(--royal); border-radius: 999px; }
.mode--live { border-color: var(--ok); color: var(--ok); }
.content { padding: 28px 32px 110px; max-width: 1320px; }
.topbar .menu-btn { display: none; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; display: none; }
  .side.open { display: block; }
  .topbar { padding: 10px 14px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 18px 14px 110px; }
}

/* ── Page header ─────────────────────────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .lede { margin: 6px 0 0; color: var(--ink-2); max-width: 720px; }
.crumbs { font-size: .85rem; margin-bottom: 6px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); text-decoration: none; } .crumbs a:hover { text-decoration: underline; }

/* ── Cards ───────────────────────────────────────────── */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: -2px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 1.35rem; }
.card-head p { margin: 4px 0 0; color: var(--ink-2); font-size: .88rem; }
.card--flush { padding: 0; overflow: hidden; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); border-top: 3px solid var(--emerald); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font: 600 1.85rem/1.1 'Jost', sans-serif; color: var(--ink); }
.stat .l { font-size: .82rem; color: var(--ink-2); margin-top: 4px; }
.stat--warn { border-top-color: var(--cherry); }

/* ── Editor layout: main column + sticky sidebar ─────── */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.editor > aside { position: sticky; top: 70px; }
.cols-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .editor, .cols-2 { grid-template-columns: 1fr; } .editor > aside { position: static; } }

/* ── Forms ───────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid > * { grid-column: span 12; }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-3 { grid-column: span 3; } .form-grid .span-4 { grid-column: span 4; } .form-grid .span-6 { grid-column: span 6; } .form-grid .span-8 { grid-column: span 8; }
@media (max-width: 760px) { .form-grid .span-2, .form-grid .span-3, .form-grid .span-4, .form-grid .span-6, .form-grid .span-8 { grid-column: span 12; } }
@media (min-width: 761px) and (max-width: 1100px) { .form-grid .span-2, .form-grid .span-3 { grid-column: span 6; } }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.field { margin: 0 0 14px; min-width: 0; }
.form-grid .field { margin: 0; }
label, .label { display: block; font-weight: 500; font-size: .84rem; color: var(--ink); margin-bottom: 6px; }
.req { color: var(--cherry); margin-left: 2px; }
.opt { color: var(--ink-3); font-weight: 400; font-size: .78rem; margin-left: 4px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  font: 400 .95rem/1.4 'Jost', sans-serif; border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235E564A' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center; }
select[multiple] { background-image: none; padding: 6px; min-height: 120px; }
input:hover, select:hover, textarea:hover { border-color: #BFB197; }
input:focus, select:focus, textarea:focus { border-color: var(--emerald); outline: none; box-shadow: 0 0 0 3px rgba(11,74,58,.14); }
input[disabled], select[disabled], textarea[disabled] { background: #F5F1E8; color: var(--ink-3); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--cherry); }
input[type=file] { font: inherit; font-size: .9rem; }
input[type=file]::file-selector-button { font: 500 .85rem 'Jost', sans-serif; padding: 8px 14px; margin-right: 12px; border: 1px solid var(--emerald); border-radius: var(--radius-sm); background: #fff; color: var(--emerald); cursor: pointer; }
.input-affix { display: flex; align-items: stretch; }
.input-affix span { display: flex; align-items: center; padding: 0 12px; background: #F1EADB; border: 1px solid var(--line-2); color: var(--ink-2); font-size: .9rem; white-space: nowrap; }
.input-affix span:first-child { border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-affix span:last-child { border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-affix input { border-radius: 0; } .input-affix span:first-child + input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-affix input:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.hint { font-size: .8rem; color: var(--ink-3); margin: 5px 0 0; }
.err { color: var(--cherry); font-size: .84rem; margin: 5px 0 0; }
.counter { float: right; font-size: .75rem; color: var(--ink-3); font-weight: 400; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .92rem; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--emerald); flex: none; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.savebar { position: fixed; left: 252px; right: 0; bottom: 0; z-index: 30; background: rgba(255,253,248,.97); border-top: 1px solid var(--line); padding: 12px 32px; display: flex; justify-content: space-between; align-items: center; gap: 12px; box-shadow: 0 -4px 14px rgba(31,27,22,.06); }
.savebar .note { color: var(--ink-2); font-size: .88rem; }
@media (max-width: 900px) { .savebar { left: 0; padding: 10px 14px; } }

/* ── Buttons ─────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 18px; border: 1px solid var(--emerald); background: var(--emerald); color: #fff;
  font: 500 .88rem 'Jost', sans-serif; text-decoration: none; cursor: pointer; border-radius: var(--radius-sm); transition: background .15s, color .15s; white-space: nowrap; }
.btn:hover { background: var(--emerald-2); color: #fff; }
.btn-ghost { background: #fff; color: var(--emerald); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--emerald-tint); color: var(--emerald); border-color: var(--emerald); }
.btn-primary { background: var(--cherry); border-color: var(--cherry); }
.btn-primary:hover { background: #86162A; }
.btn-danger { background: #fff; color: var(--cherry); border-color: #E3B8C0; }
.btn-danger:hover { background: var(--cherry); color: #fff; border-color: var(--cherry); }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-link { background: none; border: 0; color: var(--emerald); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.btn-link.danger { color: var(--cherry); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Tables ──────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; background: var(--paper); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font: 500 .72rem 'Jost', sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); background: #FAF6EC; }
tbody tr:hover td { background: #FCF9F2; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; background: var(--paper); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }
@media (max-width: 700px) {
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 12px; }
  table.stack td::before { content: attr(data-label); font-size: .72rem; text-transform: uppercase; color: var(--ink-2); }
}

/* ── Status & feedback ───────────────────────────────── */
.flash { padding: 12px 16px; margin-bottom: 18px; border-radius: var(--radius-sm); border: 1px solid; background: var(--paper); }
.flash--success { border-color: #B9D8C6; background: #EEF6F1; color: var(--ok); }
.flash--error { border-color: #E8BEC6; background: #FBEFF1; color: #7D1427; }
.alert { padding: 12px 16px; border: 1px solid #E8BEC6; border-radius: var(--radius-sm); background: #FBEFF1; color: #6B1022; margin-bottom: 16px; }
.alert ul, .okbox ul { margin: 6px 0 0; padding-left: 18px; }
.okbox { padding: 12px 16px; border: 1px solid #B9D8C6; border-radius: var(--radius-sm); background: #EEF6F1; color: var(--ok); margin-bottom: 16px; }
.infobox { padding: 12px 16px; border: 1px solid #C9D0E3; border-radius: var(--radius-sm); background: #F1F3F9; color: var(--royal); margin-bottom: 16px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font: 500 .72rem/1.5 'Jost', sans-serif; padding: 2px 10px; border-radius: 999px; background: #EFE9DC; color: var(--ink-2); white-space: nowrap; letter-spacing: .02em; vertical-align: middle; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill--published, .pill--paid, .pill--confirmed, .pill--delivered, .pill--active, .pill--subscribed, .pill--ok, .pill--sent, .pill--read, .pill--completed { background: #E3F0E8; color: var(--ok); }
.pill--draft, .pill--pending, .pill--pending_payment, .pill--new, .pill--enquiry_only, .pill--scheduled, .pill--sending { background: #E6EAF4; color: var(--royal); }
.pill--cancelled, .pill--expired, .pill--rejected, .pill--failed, .pill--review, .pill--refunded, .pill--warn, .pill--quarantined, .pill--inactive, .pill--paused { background: #F8E5E9; color: var(--cherry); }
.pill--shipped, .pill--in_progress, .pill--partially_refunded, .pill--payable, .pill--delivered_wa { background: #F6EDD8; color: var(--warn); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.filters .field { margin: 0; min-width: 170px; }
.pager { display: flex; gap: 8px; align-items: center; margin: 12px 0; font-size: .88rem; color: var(--ink-2); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.checklist li:last-child { border-bottom: 0; }
.checklist .mark { font-weight: 700; }
.checklist .yes .mark { color: var(--ok); } .checklist .no .mark { color: var(--cherry); }
.locked { background: #F6F1E6; border: 1px dashed var(--gold); padding: 16px 18px; border-radius: var(--radius); }
.locked dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--royal); margin-top: 12px; }
.locked dd { margin: 2px 0 0; font-family: 'Cormorant Garamond', serif; font-size: 1.15rem; }
details.box { border: 1px solid var(--line); background: var(--paper); padding: 0 18px; margin-bottom: 12px; border-radius: var(--radius); }
details.box > summary { cursor: pointer; padding: 14px 0; font-weight: 500; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::before { content: '▸'; color: var(--gold); transition: transform .15s; }
details.box[open] > summary::before { transform: rotate(90deg); }
details.box[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 16px; }
details.box > :last-child { margin-bottom: 16px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: .92rem; }
dl.kv dt { color: var(--ink-2); } dl.kv dd { margin: 0; }

/* ── Gallery, QR, permissions ────────────────────────── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.gallery img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; background: #F1EADB; }
.gallery figcaption { padding: 10px; }
.gallery figcaption input { min-height: 34px; padding: 6px 9px; font-size: .85rem; }
.empty { text-align: center; padding: 28px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-2); background: #FCFAF4; }
.qr { text-align: center; }
.qr img { width: 180px; height: 180px; margin: 0 auto 10px; display: block; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; background: #fff; }
.qr .url { font-size: .78rem; color: var(--ink-2); word-break: break-all; margin-bottom: 12px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: #fff; }
.perm-group h3 { font: 500 .75rem 'Jost', sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--royal); margin: 0 0 8px; }
.perm-group .check { padding: 4px 0; font-size: .88rem; }
.secret { font: 600 1.15rem/1.4 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; background: #fff; border: 1px dashed var(--gold); border-radius: var(--radius-sm); padding: 10px 14px; display: inline-block; user-select: all; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--emerald-tint); color: var(--emerald); display: inline-grid; place-items: center; font-weight: 600; font-size: .85rem; flex: none; }
.who-cell { display: flex; gap: 10px; align-items: center; }
.bar { height: 8px; background: #EFE9DC; border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--emerald); }

/* ── Admin sign-in ───────────────────────────────────── */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ivory); }
.login-panel { width: min(430px, 100%); background: var(--paper); border: 1px solid var(--gold); padding: 36px 32px; position: relative; border-radius: 2px; }
.login-panel::before { content: ''; position: absolute; inset: 6px; border: 1px solid rgba(176,141,87,.35); pointer-events: none; }
.login-panel > * { position: relative; }
.login-panel img { width: 104px; height: auto; margin: 0 auto 12px; display: block; }
.login-panel h1 { text-align: center; font-size: 2rem; margin-bottom: 0; }
.login-panel .tag { text-align: center; font: italic 500 1.1rem 'Cormorant Garamond', serif; color: var(--royal); margin: 4px 0 6px; }
.login-panel .sub { text-align: center; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 22px; }
.login-panel .btn { width: 100%; min-height: 46px; background: var(--cherry); border-color: var(--cherry); letter-spacing: .1em; text-transform: uppercase; }
.pw-wrap { position: relative; } .pw-wrap input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--emerald); cursor: pointer; font: 500 .75rem 'Jost', sans-serif; letter-spacing: .1em; text-transform: uppercase; padding: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
