:root {
  --plum: #260019; --wine: #77014D; --magenta: #B92675; --pink: #ffe0f0; --pink2: #ffcde4;
  --bg: #f7eef2; --card: #fff; --ink: #2a1422; --muted: #8a7480; --ok: #2f8a5b; --err: #b3261e;
  --r: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
.loading, .empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; background: var(--plum); color: var(--pink);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 16px; margin: 0; font-weight: 700; flex: 1; }
.top .sub { font-size: 12px; opacity: .75; display: block; font-weight: 500; }
.top select { background: transparent; border: 1px solid rgba(255,224,240,.35); color: var(--pink); border-radius: 10px; padding: 4px 6px; font-size: 13px; }
.progress { height: 4px; background: rgba(255,224,240,.2); }
.progress i { display: block; height: 100%; background: var(--magenta); transition: width .3s; }
.tabs { display: flex; gap: 6px; padding: 10px 16px 0; overflow-x: auto; }
.tabs button { border: 0; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: var(--wine); color: #fff; }

main { max-width: 560px; margin: 0 auto; padding: 14px 14px 120px; }

/* card */
.card { background: var(--card); border-radius: var(--r); box-shadow: 0 6px 24px rgba(38,0,25,.08); overflow: hidden;
  touch-action: pan-y; transition: transform .25s, opacity .25s; will-change: transform; }
.card.gone-r { transform: translateX(120%) rotate(8deg); opacity: 0; }
.card.gone-l { transform: translateX(-120%) rotate(-8deg); opacity: 0; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 700; letter-spacing: .02em; padding: 3px 9px; border-radius: 999px; background: var(--pink); color: var(--wine); }
.badge.long { background: var(--wine); color: #fff; }
.badge.st-approved, .badge.st-scheduled { background: #e2f3ea; color: var(--ok); }
.badge.st-fix { background: #fff2d6; color: #8a5a00; }
.badge.st-deleted, .badge.st-error { background: #fde4e2; color: var(--err); }
.when { margin-left: auto; font-size: 13px; color: var(--muted); }
.title-line { padding: 0 14px 8px; font-weight: 700; }

.pf-tabs { display: flex; gap: 4px; padding: 0 14px 8px; overflow-x: auto; }
.pf-tabs button { border: 1px solid #ecdde4; background: #fff; border-radius: 10px; padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.pf-tabs button.on { border-color: var(--magenta); color: var(--magenta); font-weight: 700; }

.preview { position: relative; background: #f1e6ec; overflow: hidden; }
.preview iframe { border: 0; transform-origin: 0 0; display: block; pointer-events: none; }
.preview video, .preview img.media { display: block; width: 100%; max-height: 72vh; background: #000; object-fit: contain; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.85); font-size: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.nav.prev { left: 8px; } .nav.next { right: 8px; }
.dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.6); box-shadow: 0 0 2px rgba(0,0,0,.3); }
.dots i.on { background: var(--magenta); }

.why { margin: 12px 14px 0; padding: 10px 12px; background: #faf3f6; border-radius: 12px; font-size: 14px; color: #5d4552; }
.why b { color: var(--wine); }
.field { padding: 10px 14px 0; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.field textarea, .field input { width: 100%; border: 1px solid #ecdde4; border-radius: 12px; padding: 10px 12px; background: #fff; }
.field textarea { min-height: 120px; resize: vertical; }
.field textarea[rows="2"] { min-height: 0; }
.count { font-size: 12px; color: var(--muted); text-align: right; }
.saved { color: var(--ok); font-size: 12px; }
.ghl-err { margin: 10px 14px 0; padding: 8px 10px; border-radius: 10px; background: #fde4e2; color: var(--err); font-size: 13px; }

/* action bar */
.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  padding: 10px 14px calc(env(safe-area-inset-bottom) + 10px); display: flex; gap: 8px; justify-content: center; box-shadow: 0 -4px 18px rgba(38,0,25,.08); }
.actions button { flex: 1; max-width: 180px; border: 0; border-radius: 14px; padding: 13px 8px; font-weight: 700; font-size: 15px; }
.b-ok { background: var(--ok); color: #fff; }
.b-fix { background: #fff2d6; color: #8a5a00; }
.b-del { background: #fde4e2; color: var(--err); }
.b-main { background: var(--wine); color: #fff; }
.b-ghost { background: #fff; border: 1px solid #ecdde4 !important; }

/* sheets */
.sheet-bg { position: fixed; inset: 0; background: rgba(38,0,25,.35); z-index: 10; display: flex; align-items: flex-end; }
.sheet { background: #fff; width: 100%; max-width: 560px; margin: 0 auto; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 16px); }
.sheet h3 { margin: 0 0 10px; font-size: 17px; }
.sheet textarea { width: 100%; min-height: 110px; border: 1px solid #ecdde4; border-radius: 12px; padding: 10px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chips button { border: 1px solid #ecdde4; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.chips button.on { background: var(--pink); border-color: var(--magenta); color: var(--wine); }
.row { display: flex; gap: 8px; margin-top: 12px; }
.row button { flex: 1; border: 0; border-radius: 14px; padding: 12px; font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--plum); color: var(--pink);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 20; max-width: 90vw; text-align: center; }

/* done + lists */
.done { text-align: center; padding: 30px 10px; }
.done .big { font-size: 44px; }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.li { background: #fff; border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; text-align: left; border: 0; width: 100%; }
.li .t { flex: 1; font-size: 14px; }
.li .t small { display: block; color: var(--muted); }
.li .thumb { width: 44px; height: 55px; border-radius: 6px; background: #f1e6ec center/cover; flex: none; }
.admin-box { background: #fff; border-radius: 14px; padding: 12px; margin-top: 12px; }
.admin-box textarea { width: 100%; min-height: 360px; font: 12px/1.4 ui-monospace, Menlo, monospace; border: 1px solid #ecdde4; border-radius: 10px; padding: 8px; }
.admin-box pre { white-space: pre-wrap; font-size: 12px; max-height: 300px; overflow: auto; }
.mini { border: 1px solid #ecdde4; background: #fff; border-radius: 10px; padding: 5px 10px; font-size: 13px; }
.note { font-size: 13px; color: var(--muted); }
.row .mini { border: 1px solid #ecdde4; background: #fff; padding: 8px; font-weight: 600; }
.badge.st-review { background: #e8e1f5; color: #4b2f86; }
button:disabled { opacity: .45; }
.admin-box textarea.tall { min-height: 420px; font: 13px/1.5 ui-monospace, Menlo, monospace; }
.mini.on { background: var(--wine); color: #fff; border-color: var(--wine); }
.dec { margin-top: 10px; max-height: 420px; overflow: auto; }
.dli { padding: 8px 10px; border-radius: 10px; background: #faf3f6; margin-bottom: 6px; font-size: 14px; }
.dli.fresh { border-left: 3px solid var(--magenta); }
.dli small { display: block; color: var(--muted); }
.login { max-width: 360px; margin: 18vh auto 0; text-align: center; padding: 0 20px; }
.login img { width: 240px; max-width: 80%; }
.login p { color: var(--muted); margin: 18px 0 26px; }
.login a { display: block; padding: 14px; border-radius: 14px; text-decoration: none; font-weight: 700; }
.top .logout { color: var(--pink); opacity: .7; font-size: 12px; text-decoration: none; }
.qhead { margin: 18px 4px 2px; font-size: 14px; color: var(--wine); }
.li.cal { align-items: flex-start; }
.li.cal .wk { flex: none; width: 54px; font-weight: 700; color: var(--wine); }
.li.cal .wk small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.li.cal .flags { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.li.cal.now { outline: 2px solid var(--magenta); }
.li.cal.past { opacity: .55; }
.admin-box .field { padding: 10px 0 0; }
.admin-box select, .field select { width: 100%; border: 1px solid #ecdde4; border-radius: 12px; padding: 10px 12px; background: #fff; }
.script.md { margin-top: 10px; font-size: 15px; }
.md h3 { font-size: 18px; margin: 14px 0 6px; color: var(--wine); }
.md h4 { font-size: 16px; margin: 14px 0 4px; color: var(--wine); }
.md h5, .md h6 { font-size: 15px; margin: 10px 0 4px; }
.md p { margin: 6px 0; } .md ul { margin: 4px 0; padding-left: 20px; }
.row.pad { padding: 0 14px 14px; }
.group { border-left: 3px solid var(--pink2); padding: 4px 0 8px 10px; margin-bottom: 8px; }
.group textarea { margin-bottom: 6px; min-height: 0; }
.group small { color: var(--muted); }
.admin-box .field textarea, .admin-box .field input, #p-script { font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; min-height: 0; }
#p-script { min-height: 420px; }
.ed-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.ed-head img, .ed-noimg { width: 64px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; background: #f1e6ec; font-size: 11px; display: flex; align-items: center; text-align: center; color: var(--muted); }
.ed-head > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ed-head select { width: 100%; border: 1px solid #ecdde4; border-radius: 10px; padding: 6px 8px; background: #fff; font-size: 14px; }
.ed-head .row { margin-top: 0; }
.tall-sheet { max-height: 88vh; overflow: auto; }
.libgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.libgrid button { border: 0; padding: 0; background: none; border-radius: 8px; overflow: hidden; aspect-ratio: 2 / 3; }
.libgrid img { width: 100%; height: 100%; object-fit: cover; display: block; }
label.sub { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 8px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
#c-tone { width: 100%; border: 1px solid #ecdde4; border-radius: 12px; padding: 10px 12px; background: #fff; }
