/* Listing Kit, in the Macourt house style: a sunken rail with the wordmark, warm neutrals, hairlines, Inter for
   the interface and Montserrat for titles. Flat surfaces, table-first screens. Phone first, desktop gets the rail. */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/assets/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/assets/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/assets/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('/assets/fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 600; font-display: swap; src: url('/assets/fonts/montserrat-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 700; font-display: swap; src: url('/assets/fonts/montserrat-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #fbfbfa;
  --surface: #fff;
  --sunken: #f5f4f1;
  --hover: #f1f0ec;
  --line: #e7e6e2;
  --line-strong: #d4d2cc;
  --text: #1f1f1e;
  --muted: #5d5c56;
  --faint: #8f8e87;
  --accent: #1f1f1e;
  --link: #2a5a8a;
  --ok: #1d6b45;
  --ok-bg: #edf6f0;
  --warn: #8a5a00;
  --warn-bg: #fbf4e3;
  --err: #a12b2b;
  --err-bg: #fbeeee;
  --radius: 6px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Montserrat', 'Inter', system-ui, sans-serif;
  --pad: 24px;
  --rail: 224px;
  --content-max: 1220px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.show-m { display: none; }
.right { text-align: right; }
.wordmark { display: block; width: auto; height: 18px; }

/* ---------- shell: rail on desktop, bottom nav on phones ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 14px 16px; background: var(--sunken); border-right: 1px solid var(--line); }
.rail__brand { display: block; padding: 0 10px; text-decoration: none; }
.rail__brand .wordmark { height: 21px; }
.rail__brand small { display: block; margin-top: 9px; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.rail nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.navlink { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--muted); font-weight: 500; text-decoration: none; transition: background 0.12s, color 0.12s; }
.navlink:hover { background: var(--hover); color: var(--text); }
.navlink.is-active { background: #fff; color: var(--text); box-shadow: inset 2px 0 0 0 var(--text), 0 0 0 1px var(--line); }
.navlink svg { width: 16px; height: 16px; flex: none; opacity: 0.7; }
.navlink.is-active svg { opacity: 1; }
.rail__foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.userchip { display: block; padding: 4px 10px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail__foot .btn { justify-content: flex-start; }
.mobilebar { display: none; }
main.page { width: 100%; max-width: var(--content-max); padding: 30px 34px 80px; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead h1 { font-family: var(--font-head); font-size: 24px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.pagehead .sub { color: var(--muted); margin-top: 4px; }
.pagehead__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); }
.crumbs .sep { color: var(--line-strong); }
.pagehead__cover { width: 68px; height: 48px; object-fit: cover; border-radius: 5px; background: var(--sunken); flex: none; margin-right: 14px; }
.pagehead__lead { display: flex; align-items: center; }

/* ---------- controls ---------- */
.btn { height: 34px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: #fff; cursor: pointer; white-space: nowrap; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; line-height: 1; transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: var(--hover); border-color: #c4c2bb; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #3a3a38; border-color: #3a3a38; }
.btn--danger { color: var(--err); border-color: #e4c3c3; }
.btn--danger:hover { background: var(--err-bg); border-color: #d9a9a9; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.btn--small { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn--block { width: 100%; height: 40px; }
.link { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.search { height: 34px; padding: 0 10px 0 32px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238f8e87' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 10px center no-repeat; min-width: 240px; outline: none; }
.search:focus { border-color: #8b8a83; }
.select { height: 34px; padding: 0 30px 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235d5c56' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 10px center no-repeat; appearance: none; -webkit-appearance: none; outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); transition: background 0.12s, border-color 0.12s, color 0.12s; }
.chip:hover { border-color: #b3b1aa; color: var(--text); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.is-disabled { opacity: 0.45; cursor: default; }
.chip small { opacity: 0.7; }
.field { display: block; margin-bottom: 12px; }
.field > span, .field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field input, .field textarea, .field select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; outline: none; transition: border-color 0.12s, box-shadow 0.12s; }
.field textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #8b8a83; box-shadow: 0 0 0 3px rgba(31, 31, 30, 0.05); }
.field small, .help { display: block; color: var(--faint); font-size: 12px; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; }
.form-error { margin-top: 10px; color: var(--err); font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.checkrow { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.checkrow input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); }
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type='color'] { width: 36px; height: 36px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; }
.color-field input[type='text'] { width: 110px; }

/* ---------- panels, tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel__head h2 { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.panel__body { padding: 16px; }
.panel + .panel, .stack > * + * { margin-top: 16px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-link { cursor: pointer; }
.table tr.is-link:hover td { background: var(--sunken); }
.table .thumbcell { width: 76px; }
.table--plain td, .table--plain th { padding-left: 16px; }
.table .thumbcell img, .table .thumbcell .noimg { width: 64px; height: 44px; object-fit: cover; border-radius: 4px; background: var(--sunken); display: block; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--sunken); color: var(--muted); }
.pill--published { background: var(--ok-bg); color: var(--ok); }
.pill--ready { background: #eef2f7; color: #2f4f75; }
.pill--draft { background: var(--sunken); color: var(--muted); }
.pill--archived { background: #f4f4f2; color: var(--faint); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--err { background: var(--err-bg); color: var(--err); }
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; font-size: 15px; }
.notice { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font-size: 13px; }
.notice--warn { border-color: #eddcb3; background: var(--warn-bg); color: var(--warn); }
.notice--err { border-color: #e6c2c2; background: var(--err-bg); color: var(--err); }
.notice--ok { border-color: #bfdccb; background: var(--ok-bg); color: var(--ok); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 38px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: color 0.12s; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--text); }
.tab .count { font-size: 11px; background: var(--sunken); color: var(--muted); border-radius: 999px; padding: 1px 6px; }

/* ---------- photos grid ---------- */
.drop { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 20px; text-align: center; color: var(--muted); background: #fff; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.drop:hover, .drop.is-over { border-color: #8b8a83; background: var(--sunken); }
.drop b { color: var(--text); font-weight: 500; }
.drop--small { padding: 12px; font-size: 13px; }
.dropzones { display: grid; grid-template-columns: 1fr 260px; gap: 12px; margin-bottom: 14px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 10px; }
.photo { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.photo.is-dragging { opacity: 0.4; }
.photo.is-over { outline: 2px solid var(--text); outline-offset: -2px; }
.photo__img { position: relative; aspect-ratio: 3 / 2; background: var(--sunken) center/cover no-repeat; overflow: hidden; cursor: grab; }
.photo__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__num { position: absolute; left: 6px; top: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(31, 31, 30, 0.78); color: #fff; font-size: 11.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.photo__cover { position: absolute; right: 6px; top: 6px; height: 22px; padding: 0 7px; border-radius: 999px; background: #fff; color: var(--text); font-size: 11px; font-weight: 600; display: flex; align-items: center; }
.photo__state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px; background: rgba(255, 255, 255, 0.84); color: var(--muted); font-size: 12px; font-weight: 500; padding: 8px; text-align: center; }
.photo__state.is-err { color: var(--err); }
.bar { width: 70%; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--text); width: 0; transition: width 0.2s; }
.photo__meta { display: flex; align-items: center; gap: 6px; padding: 6px 8px; }
.photo__meta select { flex: 1; min-width: 0; height: 28px; border: 1px solid transparent; border-radius: 4px; background: transparent; padding: 0 4px; font-size: 12.5px; color: var(--text); }
.photo__meta select:hover, .photo__meta select:focus { border-color: var(--line-strong); background: #fff; outline: none; }
.photo__menu { display: flex; gap: 2px; }
.iconbtn { width: 28px; height: 28px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; }
.iconbtn:hover { background: var(--hover); color: var(--text); }
.iconbtn.is-danger:hover { color: var(--err); background: var(--err-bg); }
.uploadbar { display: flex; align-items: center; gap: 14px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; flex-wrap: wrap; }
.uploadbar .bar { width: 160px; }
.uploadbar b { font-weight: 600; }
.uploadfails { margin: -6px 0 14px; font-size: 13px; }
.uploadfails li { display: flex; gap: 8px; align-items: center; padding: 4px 0; color: var(--err); }
.orderbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

/* focus editor */
.focus-editor { position: relative; max-width: 720px; margin: 0 auto; cursor: crosshair; user-select: none; }
.focus-editor img { width: 100%; display: block; border-radius: 6px; }
.focus-editor .dot { position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; background: rgba(31, 31, 30, 0.85); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); pointer-events: none; }
.focus-editor .frame { position: absolute; border: 1px dashed rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35); pointer-events: none; }

/* ---------- copy screen ---------- */
.copy-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.steps { display: flex; flex-direction: column; gap: 10px; padding: 28px 18px; }
.step { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.step i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--line-strong); }
.step.is-on { color: var(--text); }
.step.is-on i { border-color: var(--text); animation: pulse 1s infinite alternate; }
.step.is-done i { background: var(--text); border-color: var(--text); }
@keyframes pulse { from { transform: scale(0.8); } to { transform: scale(1.2); } }
.cwf { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cwf:last-child { border-bottom: 0; }
.cwf__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.cwf__title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.cwf__count { font-size: 12px; color: var(--muted); }
.cwf__actions { margin-left: auto; display: flex; gap: 6px; }
.cwf textarea, .cwf input.line { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); line-height: 1.5; font-size: 14px; resize: none; outline: none; }
.cwf textarea:focus, .cwf input.line:focus { border-color: #8b8a83; }
.cwf input.line { font-size: 16px; font-weight: 500; }
.alts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.alt { text-align: left; font-size: 12px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; color: var(--muted); }
.alt:hover { border-color: #8b8a83; color: var(--text); }
.rewrite { display: none; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.rewrite.is-open { display: flex; }
.rewrite input { flex: 1; min-width: 200px; height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); outline: none; font-size: 13px; }
.rewrite .chip { height: 28px; font-size: 12px; }
.cwf.is-busy { opacity: 0.55; pointer-events: none; }
.flags label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--sunken); font-size: 13px; }
.flags label:last-child { border-bottom: 0; }
.flags input { margin-top: 3px; }
.flags small { display: block; color: var(--muted); }
.flags .is-done span { text-decoration: line-through; color: var(--muted); }
.choose { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--sunken); border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- renders ---------- */
.renders { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.render { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.render img { width: 100%; display: block; background: var(--sunken); }
.render__foot { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; font-size: 12px; color: var(--muted); }
.captions .cap { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.captions .cap:last-child { border-bottom: 0; }
.captions pre { white-space: pre-wrap; font: inherit; margin: 6px 0 0; line-height: 1.5; }
.printcard { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.printcard:last-child { border-bottom: 0; }
.printcard .icon { width: 44px; height: 56px; border: 1px solid var(--line-strong); border-radius: 3px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: var(--muted); flex: none; }
.printcard b { display: block; font-weight: 500; }

/* ---------- share link block ---------- */
.linkbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.linkbox input { flex: 1 1 160px; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--sunken); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.events { font-size: 13px; }
.events li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--sunken); }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--faint); white-space: nowrap; min-width: 130px; }

/* ---------- modal, toast ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(31, 31, 30, 0.32); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal__box { width: min(520px, 100%); max-height: 92vh; overflow: auto; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; padding: 20px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.modal__box--wide { width: min(860px, 100%); }
.modal__box h2 { font-family: var(--font-head); font-size: 17px; font-weight: 600; margin-bottom: 14px; letter-spacing: -0.01em; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 80; background: var(--text); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; max-width: min(520px, calc(100vw - 32px)); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #7d1f1f; }
.toast.is-ok { background: #1d6b45; }

/* ---------- login: a listing photo on the left, the form on the right ---------- */
.login-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; background: #fff; }
.login-photo { position: relative; margin: 0; background: var(--sunken) url('/assets/brand/login.jpg') center/cover no-repeat; min-height: 100vh; }
.login-photo figcaption { position: absolute; left: 28px; bottom: 22px; color: #fff; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.92; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login { width: min(380px, 100%); }
.login__logo { height: 26px; width: auto; margin-bottom: 36px; }
.login h1 { font-family: var(--font-head); font-size: 26px; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 6px; }
.login__form { margin-top: 24px; }
.login__foot { margin-top: 28px; font-size: 12px; color: var(--faint); }

/* ---------- lightbox (shared with the agent page) ---------- */
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(12, 12, 14, 0.96); display: flex; align-items: center; justify-content: center; }
.lightbox { touch-action: none; overscroll-behavior: contain; }
.lightbox img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; display: block; }
.lightbox__close, .lightbox__prev, .lightbox__next { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 22px; cursor: pointer; }
.lightbox__prev, .lightbox__next { top: 50%; transform: translateY(-50%); }
.lightbox__prev { left: calc(12px + env(safe-area-inset-left)); right: auto; }
.lightbox__next { right: calc(12px + env(safe-area-inset-right)); }
.lightbox__foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #fff; font-size: 13px; background: rgba(0, 0, 0, 0.55); flex-wrap: wrap; }
.lightbox__foot .btn { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); color: #fff; }

/* ---------- phone ---------- */
.bottomnav { display: none; }
@media (max-width: 820px) {
  :root { --pad: 14px; }
  .shell { display: block; }
  .rail { display: none; }
  .mobilebar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; height: 50px; padding: 0 var(--pad); background: #fff; border-bottom: 1px solid var(--line); }
  .mobilebar .wordmark { height: 18px; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px; text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 500; }
  .bottomnav a svg { width: 20px; height: 20px; }
  .bottomnav a.is-active { color: var(--text); }
  main.page { padding: 18px var(--pad) 96px; }
  .pagehead__cover { display: none; }
  .search { min-width: 0; width: 100%; }
  .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
  .dropzones { grid-template-columns: 1fr; }
  .copy-layout { grid-template-columns: 1fr; }
  .photos { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .photo__img { cursor: default; }
  .photo__meta { flex-wrap: wrap; padding: 6px; }
  .photo__meta select { flex-basis: 100%; height: 34px; }
  .photo__menu { width: 100%; justify-content: space-between; }
  .iconbtn { width: 40px; height: 36px; font-size: 16px; }
  .toast { bottom: calc(66px + env(safe-area-inset-bottom)); }
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .table tr:has(td.thumbcell) { grid-template-columns: 64px 1fr auto; }
  .table td.right { text-align: left; white-space: normal; }
  .table td.nowrap { white-space: normal; display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; }
  .table tr td { border: 0; padding: 0; }
  .table td.thumbcell { grid-row: 1 / span 2; }
  .table td.hide-m { display: none; }
  .show-m { display: inline; }
  .table tr.is-link:hover td { background: transparent; }
  .kv { grid-template-columns: 110px 1fr; }
  .pagehead h1 { font-size: 20px; }
  .panel__body { padding: 12px; }
  .cwf { padding: 12px; }
  .events li { display: block; }
  .events time { display: block; min-width: 0; margin-bottom: 1px; }
  .events li span { display: block; text-align: left; }
  /* All six tabs fit a 375px phone: full-bleed strip, tighter tabs. The active tab is scrolled into view anyway. */
  .tabs { margin: 0 calc(-1 * var(--pad)) 14px; padding: 0 12px; }
  .tab { padding: 0 8px; font-size: 13px; }
  .btn, .chip { min-height: 36px; }
  .login-body { grid-template-columns: 1fr; }
  .login-photo { min-height: 0; height: 200px; }
  .login-side { align-items: flex-start; padding: 28px 20px 40px; }
  .login__logo { margin-bottom: 24px; }
  /* 16px stops iOS Safari zooming the page when a field is focused. */
  .field input, .field select, .field textarea, .search, .select, .cwf textarea, .cwf input.line, .rewrite input, .linkbox input, .login input { font-size: 16px; }
}
@media (max-width: 480px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .grid2.keep, .grid3.keep { grid-template-columns: repeat(3, 1fr); gap: 0 8px; }
}
