/* =========================================================
   Admin Dashboard — Obsidian Emerald Studio (Dark & Light)
   ========================================================= */

:root,
[data-theme="dark"] {
  --accent: #34d399;
  --olive-btn: #154b30;
  --olive-btn-hover: #1d613e;
  --olive-border: rgba(74, 222, 128, 0.36);
  --bg: #050c08;
  --surface: #0c1c13;
  --surface-2: #12291c;
  --fg: #eef6f0;
  --fg-2: #b4cdbc;
  --fg-3: #80a38d;
  --line: rgba(134, 212, 160, 0.16);
  --line-2: rgba(134, 212, 160, 0.30);
  --danger: #f87171;
  --ok: #4ade80;
  --side-w: 262px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .42);
  --shadow: 0 12px 32px -10px rgba(0, 0, 0, .68);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .86);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --font: 'Plus Jakarta Sans', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Space Grotesk', 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

html[data-theme="light"] {
  --accent: #15803d;
  --olive-btn: #15803d;
  --olive-btn-hover: #166534;
  --olive-border: rgba(21, 128, 61, 0.35);
  --bg: #f1f7f3;
  --surface: #ffffff;
  --surface-2: #edf6f0;
  --fg: #091e12;
  --fg-2: #2d4c3b;
  --fg-3: #4f705d;
  --line: rgba(21, 128, 61, 0.14);
  --line-2: rgba(21, 128, 61, 0.28);
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow-sm: 0 2px 6px rgba(15, 38, 24, .06);
  --shadow: 0 10px 28px -10px rgba(15, 38, 24, .14);
  --shadow-lg: 0 28px 64px -20px rgba(15, 38, 24, .22);
}

*, *::before, *::after { box-sizing: border-box; }
body.adm {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.62;
  color: var(--fg); background: var(--bg);
  background-image:
    radial-gradient(680px 480px at 85% 8%, rgba(52, 211, 153, 0.12), transparent 65%),
    radial-gradient(640px 480px at 15% 85%, rgba(16, 185, 129, 0.10), transparent 65%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1 { font-family: var(--serif); font-size: 2rem; font-weight: 700; margin: 0 0 .15rem; letter-spacing: -.025em; line-height: 1.15; }
h2 { font-size: 1rem; letter-spacing: -.015em; }
p { margin: 0 0 .6rem; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
.mono { font-family: var(--mono); font-size: .84em; }
.muted { color: var(--fg-2); }
.small { font-size: .82rem; }
.adm-kicker {
  margin: 0 0 .25rem;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--accent);
}
code { font-family: var(--mono); font-size: .85em; padding: .08em .38em; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------------- Layout ---------------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto;
  min-width: 0;
}
.side-brand {
  display: flex; align-items: center; gap: .55rem; padding: 1.15rem 1.2rem;
  font-family: var(--serif); font-size: 1.32rem; font-weight: 600; letter-spacing: .01em;
  border-bottom: 1px solid var(--line);
}
.brand-leaf-adm {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--olive-btn);
  border: 1px solid var(--olive-border);
  color: #e2f2e6;
}
.side-brand .dot, .login-brand .dot {
  width: 8px; height: 8px; border-radius: 50%; margin-left: auto;
  background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.16);
}
.side-nav { flex: 1; padding: .85rem .65rem; }
.side-nav a {
  display: flex; align-items: center; gap: .62rem; padding: .5rem .68rem;
  border-radius: 10px; color: var(--fg-2); font-weight: 500; font-size: .88rem;
  transition: background .16s, color .16s;
}
.side-nav a span { color: var(--fg-3); display: grid; place-items: center; }
.side-nav a:hover { background: var(--surface-2); color: var(--fg); }
.side-nav a.on {
  background: var(--olive-btn);
  border: 1px solid var(--olive-border);
  color: #e9f5ec;
}
.side-nav a.on span { color: #8ad4a2; }
.side-nav a em {
  margin-left: auto; font-style: normal; font-family: var(--mono); font-size: .71rem;
  color: var(--fg-2); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 20px; padding: .04rem .46rem;
}
.side-nav a em.warn { color: #fbbf24; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); }
.side-grp { margin: 1.15rem .65rem .38rem; font-family: var(--mono); font-size: .66rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
.side-foot { padding: .75rem .65rem 1rem; border-top: 1px solid var(--line); display: grid; gap: .15rem; }
.side-mini {
  display: flex; align-items: center; gap: .55rem; width: 100%; padding: .44rem .65rem;
  border: 0; background: none; border-radius: 9px; color: var(--fg-2); font-size: .84rem;
  cursor: pointer; text-align: left; transition: background .15s, color .15s;
}
.side-mini:hover { background: var(--surface-2); color: var(--fg); }

.main { padding: clamp(1.1rem, 3vw, 2.4rem); max-width: 1180px; width: 100%; min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1.6rem; }
.topbar > div { min-width: 0; max-width: 100%; }
.topbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumb { margin: 0 0 .2rem; font-family: var(--mono); font-size: .76rem; color: var(--fg-3); }
.crumb a:hover { color: var(--accent); }

/* ---------------- Primitives ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: .42rem; padding: .52rem 1rem; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--fg);
  font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .16s var(--ease), box-shadow .2s, background .16s, border-color .16s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--accent); }
.btn-primary {
  background: var(--olive-btn);
  border-color: var(--olive-border);
  color: #e9f5ec;
  box-shadow: inset 0 1px 0 rgba(215, 245, 222, 0.14), 0 8px 20px -10px rgba(0, 0, 0, 0.6);
}
.btn-primary:hover { background: var(--olive-btn-hover); border-color: var(--accent); }
.btn-ghost { background: var(--surface); }
.btn-lg { padding: .68rem 1.35rem; font-size: .92rem; }
.btn-sm { padding: .32rem .68rem; font-size: .78rem; border-radius: 999px; }
.btn-block { width: 100%; justify-content: center; }
.btn.danger, .danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: rgba(239, 68, 68, 0.1); }
.tag { font-family: var(--mono); font-size: .7rem; font-weight: 600; padding: .24rem .58rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-2); }
.tag.warn { color: #fbbf24; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.32); }

.card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.45rem;
  box-shadow: var(--shadow-sm);
}
.block { margin-bottom: 1.5rem; }
.block-h { margin: 0 0 .9rem; font-family: var(--mono); font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.grid { display: grid; gap: .75rem; }
.quick { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: .8rem; }

.fld { margin-bottom: 1rem; }
.lbl { display: block; margin-bottom: .34rem; font-size: .8rem; font-weight: 600; color: var(--fg-2); }
.lbl em { color: var(--danger); font-style: normal; }
.lbl .hint { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--line); color: var(--fg-2); font-size: .66rem; cursor: help; }
.in {
  width: 100%; padding: .58rem .78rem; font: inherit; font-size: .9rem; color: var(--fg);
  background: color-mix(in srgb, var(--bg) 45%, var(--surface)); border: 1px solid var(--line-2); border-radius: 11px;
  transition: border-color .16s, box-shadow .16s;
}
.in:hover { border-color: var(--accent); }
.in:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
textarea.in { resize: vertical; min-height: 82px; line-height: 1.58; }
select.in { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.in-sm { padding: .38rem .55rem; font-size: .85rem; }
.hint-row { margin: .3rem 0 0; font-size: .78rem; color: var(--fg-3); }

input[type="range"] { width: 100%; accent-color: var(--accent); }
output { float: right; font-family: var(--mono); font-size: .8rem; color: var(--fg-3); }
.colorrow { display: flex; align-items: center; gap: .6rem; }
input[type="color"] { width: 46px; height: 36px; padding: 2px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); cursor: pointer; }
.accenthex { color: var(--fg-2); }
.swatches { display: flex; gap: .45rem; margin: .3rem 0 1.2rem; }
.swatch { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--c); cursor: pointer; transition: transform .16s var(--ease); }
.swatch:hover { transform: scale(1.12); }
.radiusrow { display: flex; align-items: center; gap: .8rem; }
.radiusrow input[type="range"] { flex: 1; }
.switch-mini .track { width: 34px; height: 20px; }
.switch-mini .knob { width: 14px; height: 14px; }
.switch-mini input:checked + .track .knob { transform: translateX(14px); }

/* ---------------- Theme Gallery (Settings) ---------------- */
.theme-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; margin-bottom: .5rem; }
.theme-card {
  position: relative; display: block; cursor: pointer; border: 2px solid var(--line);
  border-radius: 16px; overflow: hidden; background: var(--surface);
  transition: border-color .16s, transform .16s var(--ease), box-shadow .2s;
}
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--line-2); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.theme-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-shot {
  display: block; position: relative; aspect-ratio: 16 / 10; padding: .55rem;
  background: var(--tb); border-bottom: 1px solid var(--line); overflow: hidden;
}
.shot-bar { display: block; height: 8px; border-radius: 3px; background: color-mix(in srgb, var(--tf) 82%, transparent); opacity: .85; margin-bottom: .5rem; }
.shot-hero { display: block; padding: .1rem .15rem .45rem; }
.shot-line { display: block; height: 7px; border-radius: 3px; background: var(--tf); opacity: .82; margin-bottom: 4px; }
.shot-line-lg { width: 78%; height: 9px; }
.shot-line-sm { width: 52%; opacity: .5; }
.shot-btn { display: block; width: 40px; height: 11px; border-radius: 999px; background: var(--ta); margin-top: 6px; }
.shot-cards { position: absolute; left: .5rem; right: .5rem; bottom: .5rem; display: flex; gap: .28rem; }
.shot-cards i { flex: 1; height: 24px; border-radius: 4px; background: var(--ts); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.theme-meta { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .55rem .7rem; }
.theme-meta strong { font-size: .86rem; font-weight: 600; }
.theme-meta em { font-style: normal; font-family: var(--mono); font-size: .68rem; color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; }
.theme-tick {
  position: absolute; top: .45rem; right: .45rem; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff;
  opacity: 0; transform: scale(.7); transition: opacity .16s, transform .16s var(--ease);
}
.theme-card.on .theme-tick { opacity: 1; transform: scale(1); }

.switches { display: grid; gap: .7rem; }
.switch { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.track { position: relative; width: 38px; height: 22px; flex: none; border-radius: 20px; background: var(--line-2); transition: background .2s; }
.knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .22s var(--ease); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .knob { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch-lbl { font-size: .82rem; color: var(--fg-3); min-width: 22px; }

.alert { padding: .65rem .9rem; border-radius: 12px; font-size: .88rem; border: 1px solid; }
.alert.success { background: rgba(34, 197, 94, 0.14); border-color: rgba(74, 222, 128, 0.35); color: var(--fg); }
.alert.error { background: rgba(239, 68, 68, 0.14); border-color: rgba(248, 113, 113, 0.35); color: #fca5a5; }
.flashes { display: grid; gap: .5rem; margin-bottom: 1.1rem; }
.empty { padding: 2.4rem 1rem; text-align: center; border: 1px dashed var(--line-2); border-radius: 16px; background: var(--surface); }

/* ---------------- Login ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login { width: 100%; max-width: 390px; padding: 2.1rem; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: .5rem; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; margin-bottom: 1.6rem; }
.login h1 { font-size: 1.7rem; }
.login .btn { margin-top: .5rem; }
.login .small { margin: 1.1rem 0 0; text-align: center; }
.login .alert { margin-bottom: .9rem; }

/* ---------------- Overview Dashboard Tiles & Section Cards ---------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .85rem; margin-bottom: 1.8rem; }
.tile {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.35rem;
  box-shadow: inset 0 1px 0 rgba(215, 245, 222, 0.06), var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.tile-ic {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--olive-btn); border: 1px solid var(--olive-border);
  color: #daf2e1; margin-bottom: .65rem;
}
.tile strong { display: block; font-family: var(--serif); font-size: 2.25rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; color: var(--fg); }
.tile span { font-size: .82rem; color: var(--fg-2); }

.scard {
  display: flex; align-items: center; gap: .9rem; padding: 1.05rem 1.2rem;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(215, 245, 222, 0.05);
  transition: transform .18s var(--ease), box-shadow .2s, border-color .2s;
}
.scard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.scard-ic {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: var(--olive-btn); border: 1px solid var(--olive-border); color: #daf2e1; flex: none;
}
.scard-t { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.scard-t strong { font-size: .95rem; font-weight: 600; }
.scard-t em { font-style: normal; font-size: .81rem; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard-n {
  font-family: var(--mono); font-size: .8rem; font-weight: 600;
  color: var(--accent); padding: .2rem .55rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid var(--line);
}
.scard.is-empty { border-style: dashed; }

/* ---------------- Section Editor ---------------- */
.items-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; min-width: 0; }
#items { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; min-width: 0; }
.item {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  min-width: 0;
  transition: box-shadow .2s, border-color .2s;
}
.item.open { border-color: var(--line-2); box-shadow: var(--shadow); }
.item.dirty { border-left: 3px solid var(--accent); }
.item-head { display: flex; align-items: center; min-width: 0; }
.item-toggle { flex: 1; display: flex; align-items: center; gap: .6rem; padding: .9rem 1.05rem; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; min-width: 0; overflow: hidden; }
.item-toggle strong { font-size: .94rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; flex: 0 1 auto; }
.item-sub { font-style: normal; font-size: .82rem; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; }
.caret { display: grid; place-items: center; color: var(--fg-3); transition: transform .22s var(--ease); flex: none; }
.item.open .caret { transform: rotate(90deg); }
.item-tools { display: flex; gap: .15rem; padding-right: .6rem; flex: none; }
.tool { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; border-radius: 7px; color: var(--fg-2); cursor: pointer; font-size: 1rem; line-height: 1; }
.tool:hover { background: var(--surface-2); color: var(--fg); }
.tool.danger:hover { background: rgba(239, 68, 68, 0.14); color: var(--danger); }
.item-body { padding: 0 1.2rem 1.25rem; border-top: 1px solid var(--line); padding-top: 1.15rem; }
.item-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .9rem 1rem; align-items: start; }
.item-fields .fld { grid-column: 1 / -1; margin-bottom: 0; min-width: 0; }
.item-fields .fld.span-half { grid-column: span 3; }
.item-fields .fld.span-third { grid-column: span 2; }
.item-fields .fld-switch { display: flex; flex-direction: column; justify-content: flex-end; }
.item-fields .fld-switch .switch { min-height: 38px; padding: .2rem 0; }
.item-grip { cursor: grab; padding: 0 .5rem 0 .1rem; color: var(--fg-3); font-size: 1rem; line-height: 1; user-select: none; }
.item-grip:hover { color: var(--fg); }
.item-grip:active { cursor: grabbing; }
.item.dragging { opacity: .45; border-style: dashed; }

/* ---------------- End Date / Present State ---------------- */
.end-date-wrap { position: relative; display: flex; align-items: center; }
.end-date-wrap.is-present input.in {
  color: transparent;
  pointer-events: none;
  opacity: .75;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.end-date-wrap.is-present input.in::-webkit-calendar-picker-indicator { opacity: 0; pointer-events: none; }
.present-pill {
  position: absolute; left: .65rem; padding: .16rem .6rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  color: var(--accent); font-family: var(--mono); font-size: .72rem; font-weight: 600;
  pointer-events: none;
}
.present-pill[hidden] { display: none; }

/* ---------------- Interactive Bullet Highlights Editor ---------------- */
.bullets-wrap {
  background: color-mix(in srgb, var(--bg) 36%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .9rem 1rem;
}
.bullets-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex-wrap: wrap; margin-bottom: .7rem;
}
.bullets-head-left { display: inline-flex; align-items: center; gap: .55rem; }
.bullets-head-left .lbl { margin-bottom: 0; }
.bullet-count {
  font-family: var(--mono); font-size: .71rem; font-weight: 600;
  padding: .15rem .55rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  color: var(--accent);
}

.bulk-drawer {
  margin-bottom: .8rem; padding: .85rem .95rem;
  border-radius: 12px; background: var(--surface-2);
  border: 1px dashed var(--line-2);
}
.bulk-drawer[hidden] { display: none; }
.bulk-tip { margin: 0 0 .5rem; font-size: .78rem; color: var(--fg-2); }
.bulk-textarea { min-height: 110px; font-size: .86rem; line-height: 1.55; }
.bulk-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; margin-top: .6rem;
}
.bulk-preview { font-family: var(--mono); font-size: .74rem; color: var(--accent); }
.bulk-btns { display: flex; gap: .45rem; flex-wrap: wrap; }

.bullet-list { display: grid; gap: .48rem; }
.bullet-row {
  display: flex; align-items: flex-start; gap: .48rem;
  padding: .42rem .5rem; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.bullet-row:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.bullet-row.is-dragging { opacity: .45; border-style: dashed; border-color: var(--accent); }
.bullet-grip {
  cursor: grab; padding: .42rem .18rem 0; color: var(--fg-3);
  font-size: .92rem; line-height: 1; user-select: none; flex: none;
}
.bullet-grip:hover { color: var(--fg); }
.bullet-grip:active { cursor: grabbing; }
.bullet-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  margin-top: .68rem; background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
textarea.in.bullet-in {
  flex: 1; min-width: 0; min-height: 32px; resize: none; overflow: hidden;
  border: 0; background: transparent; padding: .34rem .25rem;
  font-size: .89rem; line-height: 1.52; border-radius: 6px;
}
textarea.in.bullet-in:focus { box-shadow: none; background: transparent; }

.bullet-actions { display: inline-flex; align-items: center; gap: .15rem; flex: none; padding-top: .18rem; }
.btool {
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 7px;
  color: var(--fg-3); font-size: .88rem; line-height: 1; cursor: pointer;
  transition: background .14s, color .14s;
}
.btool:hover { background: var(--surface-2); color: var(--fg); }
.btool.danger:hover { background: rgba(239, 68, 68, 0.14); color: var(--danger); }

.bullet-add-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .6rem; padding-top: .25rem;
}
.bullet-hint { font-size: .74rem; color: var(--fg-3); }

/* ---------------- Optional Collapsible List (Gallery) ---------------- */
.fld-optional {
  border: 1px dashed var(--line-2); border-radius: 12px;
  padding: .65rem .9rem; background: color-mix(in srgb, var(--bg) 25%, var(--surface));
}
.fld-optional-sum {
  display: flex; align-items: center; gap: .5rem; cursor: pointer;
  list-style: none; user-select: none; font-size: .82rem; color: var(--fg-2);
}
.fld-optional-sum::-webkit-details-marker { display: none; }
.opt-caret { display: grid; place-items: center; color: var(--fg-3); transition: transform .2s var(--ease); }
.fld-optional[open] .opt-caret { transform: rotate(90deg); }
.fld-optional-sum em { font-style: normal; font-family: var(--mono); font-size: .72rem; color: var(--fg-3); margin-left: auto; }
.fld-optional .rows { margin-top: .75rem; }

.rows { display: grid; gap: .45rem; }
.row { display: flex; gap: .4rem; align-items: center; }
.bullet-row.row { align-items: flex-start; }
.row-lbl { font-size: .78rem; color: var(--fg-2); width: 78px; flex: none; }
.row-x { width: 26px; height: 26px; flex: none; border: 0; background: none; border-radius: 6px; color: var(--fg-3); cursor: pointer; font-size: 1.05rem; }
.row-x:hover { background: rgba(239, 68, 68, 0.14); color: var(--danger); }
.rows .btn { justify-self: start; }

.imgrow { display: flex; gap: .4rem; }
.imgrow .in { flex: 1; }
.preview { margin-top: .55rem; }
.preview img { max-height: 170px; width: auto; border-radius: 10px; border: 1px solid var(--line); }
.filepill { display: inline-block; padding: .4rem .7rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: .82rem; font-family: var(--mono); }

.savebar { position: sticky; bottom: 0; margin-top: 1rem; padding: .85rem 0; display: flex; align-items: center; gap: .9rem; background: linear-gradient(transparent, var(--bg) 35%); }
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* ---------------- Media Library ---------------- */
.drop { border: 2px dashed var(--line-2); text-align: center; padding: 2.2rem 1rem; margin-bottom: 1.4rem; transition: border-color .2s, background .2s; }
.drop.hot, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop input[type="file"] { display: block; margin: 0 auto .8rem; }
.drop p { margin: 0 0 .5rem; }
.drop-inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .85rem; }
.mcard { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.mthumb { aspect-ratio: 4/3; background: var(--surface-2); display: grid; place-items: center; border-bottom: 1px solid var(--line); }
.mthumb img { width: 100%; height: 100%; object-fit: cover; }
.mfile { font-family: var(--mono); font-size: .8rem; color: var(--fg-2); }
.mcard figcaption { padding: .75rem; display: grid; gap: .45rem; }
.mrow { display: flex; gap: .4rem; flex-wrap: wrap; }
.mrow form { margin: 0; }

.users { display: grid; gap: .5rem; margin-bottom: 1rem; }
.users li { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.u-t { flex: 1; display: flex; align-items: center; gap: .5rem; }
.u-t em { font-style: normal; font-size: .72rem; color: var(--fg-2); background: var(--line); border-radius: 20px; padding: .05rem .4rem; }
.ava { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--olive-btn); color: #e2f2e6; font-size: .76rem; font-weight: 600; }
.adduser { display: flex; gap: .7rem; align-items: flex-end; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid var(--line); }
.adduser .fld { margin-bottom: 0; min-width: 180px; }

/* ---------------- Modal ---------------- */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 1.5rem; background: rgba(4, 12, 8, .72); backdrop-filter: blur(5px); animation: fade .18s var(--ease); }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0 } }
.modal-card { width: min(760px, 100%); max-height: 82vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .95rem 1.15rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.15rem; overflow-y: auto; }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .55rem; margin-top: 1rem; }
.pick { border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-2); padding: 0; aspect-ratio: 1; }
.pick:hover { border-color: var(--accent); }
.pick img { width: 100%; height: 100%; object-fit: cover; }
.pick span { display: grid; place-items: center; height: 100%; font-size: .68rem; font-family: var(--mono); color: var(--fg-2); padding: .3rem; word-break: break-all; }

/* ---------------- Public Error Pages ---------------- */
body:not(.adm) .err { min-height: 100vh; display: grid; align-content: center; gap: .4rem; padding: 6vw; max-width: 640px; margin-inline: auto; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { display: flex; flex-wrap: wrap; gap: .25rem; }
  .side-grp { width: 100%; margin: .7rem 0 .2rem; }
  .side-foot { display: flex; flex-wrap: wrap; gap: .4rem; }
  .side-mini { width: auto; }
}
@media (max-width: 720px) {
  .item-body { padding: .95rem .85rem 1.05rem; }
  .item-fields { grid-template-columns: minmax(0, 1fr); }
  .item-fields .fld.span-half,
  .item-fields .fld.span-third { grid-column: 1 / -1; }
  .item-toggle { padding: .8rem .75rem; }
  .item-sub { display: none; }
  .bullets-wrap { padding: .75rem; }
  .bullet-row { flex-wrap: wrap; }
  .bullet-actions { width: 100%; justify-content: flex-end; border-top: 1px dashed var(--line); padding-top: .25rem; }
}
