/* Website admin: light, brand green #323f2f + gold #ffd700, works on phones. */
:root {
  --brand: #323f2f; --brand-2: #283325; --gold: #ffd700; --ink: #0f140f; --ink-2: #1c2420; --muted: #4a544d;
  --line: #e3e5e0; --bg: #f6f6f2; --card: #fff; --bad: #b3261e; --good: #1f6b3a;
  --head: 'Manrope', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--head); }
a { color: var(--brand); text-underline-offset: 3px; }
code { padding: 2px 6px; border-radius: 6px; background: #f0f1ec; font-size: 13px; word-break: break-all; }

/* top bar */
.ad-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px clamp(16px, 3vw, 40px); background: var(--brand); color: #fff; border-bottom: 3px solid var(--gold); }
.ad-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 17px; }
.ad-brand__mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--gold); color: var(--brand); font-weight: 900; font-size: 13px; letter-spacing: .04em; }
.ad-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ad-nav a, .ad-nav button { padding: 8px 12px; border: 0; border-radius: 8px; background: none; color: #fff; font: 700 14px/1 var(--head); text-decoration: none; cursor: pointer; }
.ad-nav a:hover, .ad-nav button:hover { background: rgba(255, 255, 255, .12); }
.ad-nav form { margin: 0; }
.ad-main { max-width: 1180px; margin: 0 auto; padding: 26px clamp(16px, 3vw, 40px) 120px; }

/* type */
.ad-h1 { margin: 0 0 6px; font-size: clamp(24px, 3vw, 32px); line-height: 1.2; color: var(--brand); }
.ad-h2 { margin: 34px 0 12px; font-size: 18px; color: var(--brand); }
.ad-h2::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 3px; background: var(--gold); }
.ad-muted { color: var(--muted); }
.ad-small { font-size: 13px; }
.ad-err { padding: 10px 14px; border-radius: 10px; background: #fdecea; color: var(--bad); font-weight: 600; white-space: pre-line; }
.ad-ok { padding: 10px 14px; border-radius: 10px; background: #e8f4ec; color: var(--good); font-weight: 600; }
.ad-crumbs { margin-bottom: 10px; font-size: 13px; color: var(--muted); }

/* buttons */
.ad-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border: 1.5px solid var(--brand);
  border-radius: 999px; background: #fff; color: var(--brand); font: 700 14px/1.2 var(--head); text-decoration: none; cursor: pointer; transition: background .15s, color .15s; }
.ad-btn:hover { background: #f1f3ee; }
.ad-btn:disabled { opacity: .55; cursor: progress; }
.ad-btn--main { background: var(--brand); color: #fff; }
.ad-btn--main:hover { background: var(--brand-2); }
.ad-btn--gold { border-color: var(--gold); background: var(--gold); color: var(--brand); }
.ad-btn--gold:hover { background: #f2cb00; }
.ad-btn--big { min-height: 52px; padding: 12px 26px; font-size: 16px; }
.ad-btn--small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.ad-btn--add { margin-top: 6px; border-style: dashed; }
.ad-iconbtn { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--brand); font-size: 15px; cursor: pointer; }
.ad-iconbtn:hover:not(:disabled) { border-color: var(--brand); }
.ad-iconbtn:disabled { opacity: .3; cursor: default; }
.ad-iconbtn--del { color: var(--bad); }

/* cards and tiles */
.ad-card { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 10px 28px -22px rgba(20, 30, 20, .4); }
.ad-narrow { max-width: 460px; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ad-tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 14px;
  background: #fff; color: var(--ink); text-decoration: none; transition: translate .15s, box-shadow .15s, border-color .15s; }
.ad-tile:hover { translate: 0 -2px; border-color: var(--brand); border-left-color: var(--gold); box-shadow: 0 12px 24px -18px rgba(20, 30, 20, .55); }
.ad-tile b { color: var(--brand); font-size: 15.5px; }
.ad-tile span { color: var(--muted); font-size: 13px; line-height: 1.45; }

/* publish */
.ad-publish { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-start; border-top: 4px solid var(--gold); }
.ad-publish > div:first-child { flex: 1 1 380px; }
.ad-publish__side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex: 0 1 380px; }
.ad-pubstate { margin: 10px 0 0; font-weight: 600; color: var(--ink-2); }
.ad-log { width: 100%; font-size: 13px; }
.ad-log summary { cursor: pointer; color: var(--muted); text-align: right; }
.ad-log pre { max-height: 260px; overflow: auto; margin: 8px 0 0; padding: 10px; border-radius: 10px; background: #1c2420; color: #e9efe5; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* editor */
.ad-edithead { position: sticky; top: 61px; z-index: 20; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin: 0 -8px 18px; padding: 12px 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.ad-edithead__btns { display: flex; gap: 8px; }
.ad-editor { display: grid; gap: 4px; }
.ad-obj { display: grid; gap: 4px; }
.ad-field { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 6px 16px; align-items: start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.ad-field__label { padding-top: 9px; font-weight: 700; color: var(--brand); font-size: 14px; }
.ad-field--block { grid-template-columns: 1fr; }
.ad-field--block > .ad-field__label { padding-top: 4px; font-size: 15px; }
.ad-field--check { display: flex; align-items: center; gap: 10px; }
.ad-field--check .ad-field__label { padding: 0; }
.ad-field--check input { width: 20px; height: 20px; accent-color: var(--brand); }
.ad-field > small, .ad-field > a { grid-column: 2; }
.ad-field--block > .ad-obj { padding: 4px 0 4px 16px; border-left: 3px solid #eef0ea; }
input, textarea, select { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid #cfd3cb; border-radius: 10px; background: #fff; color: var(--ink);
  font: 400 15px/1.5 var(--head); }
textarea { resize: vertical; }
input:focus, textarea:focus, .ad-rte__box:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--brand); }
.ad-raw { width: 100%; min-height: 60vh; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; }

/* lists */
.ad-list { display: grid; gap: 8px; }
.ad-list--imgs { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-items: start; }
.ad-list--imgs > .ad-btn--add { align-self: center; justify-self: start; }
.ad-item { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ad-item > input, .ad-item > textarea { flex: 1; }
.ad-item > .ad-obj, .ad-item > .ad-list { flex: 1; }
.ad-item__tools { display: inline-flex; gap: 4px; flex: none; }
.ad-list--imgs .ad-item { flex-direction: column; }
.ad-list--imgs .ad-item__tools { align-self: flex-end; }
.ad-item--obj { display: block; padding: 0; }
.ad-item--obj[open] { border-color: var(--brand); box-shadow: 0 10px 24px -20px rgba(20, 30, 20, .6); }
.ad-item__sum { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; list-style: none; }
.ad-item__sum::-webkit-details-marker { display: none; }
.ad-item__sum::before { content: '▸'; color: var(--brand); transition: rotate .15s; }
.ad-item--obj[open] > .ad-item__sum::before { rotate: 90deg; }
.ad-item__title { flex: 1; min-width: 0; overflow: hidden; font-weight: 700; color: var(--ink-2); white-space: nowrap; text-overflow: ellipsis; }
.ad-item__thumb { width: 44px; height: 44px; flex: none; border-radius: 8px; object-fit: cover; background: #eef0ea; }
.ad-item--obj > .ad-obj { padding: 4px 14px 12px; border-top: 1px solid var(--line); }

/* photo field */
.ad-img { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ad-img__pic { position: relative; display: grid; place-items: center; width: 150px; height: 104px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px;
  background: repeating-conic-gradient(#f2f3ef 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.ad-img__pic img { width: 100%; height: 100%; object-fit: contain; }
.ad-img__empty { color: var(--muted); font-size: 13px; }
.ad-img__side { display: grid; gap: 6px; flex: 1 1 180px; min-width: 0; }
.ad-img__side .ad-btn { justify-self: start; }
.ad-img__path { min-height: 32px; padding: 4px 8px; font-size: 12px; color: var(--muted); }
.ad-list--imgs .ad-img { flex-direction: column; align-items: stretch; }
.ad-list--imgs .ad-img__pic { width: 100%; height: 130px; }

/* rich text */
.ad-rte { border: 1px solid #cfd3cb; border-radius: 10px; background: #fff; }
.ad-rte__bar { position: sticky; top: 130px; z-index: 5; display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; background: #f7f8f4; }
.ad-rte__bar button { min-width: 34px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--brand); font: 700 13px/1 var(--head); cursor: pointer; }
.ad-rte__bar button:hover { border-color: var(--brand); }
.ad-rte__box { min-height: 90px; max-height: 420px; overflow: auto; padding: 10px 14px; border-radius: 0 0 10px 10px; line-height: 1.65; }
.ad-rte--big .ad-rte__box { min-height: 60vh; max-height: none; padding: 20px 26px; font-size: 17px; }
.ad-rte__box p, .ad-rte__box div { margin: 0 0 10px; }
.ad-rte__box h2, .ad-rte__box h3, .ad-rte__box h4, .ad-rte__box h5 { margin: 18px 0 8px; color: var(--brand); }

/* save bar */
.ad-savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: none; justify-content: flex-end; align-items: center; gap: 14px;
  padding: 10px clamp(16px, 3vw, 40px); background: #fff; border-top: 3px solid var(--gold); box-shadow: 0 -10px 24px -18px rgba(0, 0, 0, .4); }
.is-dirty .ad-savebar { display: flex; }
.ad-savebar [data-dirty] { font-weight: 700; color: #8a5a00; }

/* history */
.ad-hist { display: grid; gap: 0; padding: 6px 18px; }
.ad-hist__row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ad-hist__row:last-child { border-bottom: 0; }
.ad-hist__row b { display: block; color: var(--ink-2); font-size: 14.5px; word-break: break-word; }
.ad-hist__row span { color: var(--muted); font-size: 13px; }

/* login */
.ad-auth { display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(900px 500px at 15% 0%, rgba(255, 215, 0, .18), transparent 60%), var(--bg); }
.ad-authbox { width: min(420px, 100%); padding: 30px 28px; border: 1px solid var(--line); border-top: 5px solid var(--gold); border-radius: 18px; background: #fff;
  box-shadow: 0 30px 60px -36px rgba(20, 30, 20, .55); }
.ad-authbox__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-weight: 800; color: var(--brand); }
.ad-authbox h1 { margin: 0 0 12px; color: var(--brand); font-size: 24px; }
.ad-authbox form, .ad-narrow { display: grid; gap: 14px; }
.ad-authbox label, .ad-narrow label { display: grid; gap: 6px; font-weight: 700; color: var(--ink-2); font-size: 14px; }
.ad-qr { display: block; width: 210px; height: 210px; margin: 6px auto; border: 1px solid var(--line); border-radius: 12px; image-rendering: pixelated; }

/* toast */
.ad-toast { position: fixed; left: 50%; bottom: 84px; z-index: 50; max-width: min(560px, calc(100% - 32px)); translate: -50% 0; padding: 12px 18px; border-radius: 12px;
  background: var(--brand); color: #fff; font-weight: 700; white-space: pre-line; box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .5); }
.ad-toast.is-bad { background: var(--bad); }

@media (max-width: 760px) {
  .ad-field { grid-template-columns: 1fr; }
  .ad-field > small, .ad-field > a { grid-column: 1; }
  .ad-field__label { padding-top: 0; }
  .ad-edithead { top: 0; position: static; }
  .ad-rte__bar { top: 0; position: static; }
  .ad-publish__side { align-items: stretch; flex-basis: 100%; }
  .ad-log summary { text-align: left; }
  .ad-nav { width: 100%; }
}
