:root {
  --navy-900: #050814; --navy-800: #0a1128; --navy-700: #111b3a; --navy-600: #1a2750;
  --gold: #d4af37; --gold-soft: #e8cf7a; --ivory: #f5f0e1; --ivory-dim: #c9c4b5;
  --danger: #ff8a8a; --ok: #8be0a4; --warn: #f2c66d;
  --radius: 14px;
  --serif: "Noto Serif Thai", "Sarabun", Georgia, serif;
  --sans: "Noto Sans Thai", "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); font-size: 1.0625rem; line-height: 1.75; color: var(--ivory);
  background: radial-gradient(ellipse at top, var(--navy-700) 0%, var(--navy-800) 40%, var(--navy-900) 100%) fixed;
  min-height: 100vh; display: flex; flex-direction: column;
}
.stars { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .7;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff8, transparent), radial-gradient(1px 1px at 78% 12%, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 40% 60%, #e8cf7a99, transparent), radial-gradient(1px 1px at 88% 70%, #fff8, transparent),
    radial-gradient(1px 1px at 22% 82%, #fff7, transparent), radial-gradient(1.5px 1.5px at 62% 34%, #e8cf7a88, transparent);
  animation: twinkle 6s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .45 } to { opacity: .85 } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.35; margin: 0 0 .6em; color: var(--gold-soft); }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); } h2 { font-size: clamp(1.4rem, 3.5vw, 2rem); } h3 { font-size: 1.2rem; }
a { color: var(--gold-soft); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: #000; padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.muted { color: var(--ivory-dim); font-size: .95rem; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
main { flex: 1; width: min(1120px, 100% - 2rem); margin: 0 auto; padding: 1.5rem 0 3rem; outline: none; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: .6rem 1rem; background: #050814ee; border-bottom: 1px solid #d4af3733; backdrop-filter: blur(8px); }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--gold); letter-spacing: .04em; }
.brand small { font-weight: 500; color: var(--ivory-dim); letter-spacing: 0; }
.brand-mark { color: var(--gold); }
.menu-btn { display: none; }
#nav { display: flex; gap: .25rem; flex-wrap: wrap; align-items: center; }
#nav a, #nav button.linklike { color: var(--ivory); text-decoration: none; padding: .55rem .8rem; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; background: none; border: 0; font: inherit; cursor: pointer; }
#nav a:hover, #nav a[aria-current="page"], #nav button.linklike:hover { background: #d4af3722; color: var(--gold-soft); }
.avatar-s { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; margin-right: .5rem; border: 1px solid var(--gold); }
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  #nav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  #nav.open { display: flex; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 46px; padding: .6rem 1.3rem; border-radius: 999px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 1px solid var(--gold); color: var(--gold-soft); background: transparent; transition: background .2s, transform .2s; }
.btn:hover { background: #d4af3722; }
.btn.primary { background: linear-gradient(135deg, #e8cf7a, #c79a1f); color: #1a1405; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { min-height: 38px; padding: .3rem .9rem; font-size: .95rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 1rem; }

.hero { text-align: center; padding: 3.5rem 1rem 2.5rem; position: relative; }
.hero .circle { position: absolute; left: 50%; top: 50%; width: min(520px, 90vw); aspect-ratio: 1; transform: translate(-50%, -50%); z-index: -1; opacity: .35; }
.hero p.lead { max-width: 46rem; margin: 0 auto 1.5rem; color: var(--ivory-dim); font-size: 1.15rem; }
.hero h1 { text-shadow: 0 0 32px #d4af3766; }
.section { margin-top: 3rem; }
.section-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

.panel { background: linear-gradient(180deg, #111b3acc, #0a1128cc); border: 1px solid #d4af3733; border-radius: var(--radius); padding: 1.25rem; }
.sample-tag { display: inline-block; font-size: .78rem; padding: .05rem .6rem; border-radius: 999px; border: 1px dashed var(--warn); color: var(--warn); }
.badge { display: inline-block; font-size: .85rem; padding: .05rem .7rem; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold-soft); }
.badge.pending { color: var(--warn); border-color: var(--warn); } .badge.approved, .badge.published { color: var(--ok); border-color: var(--ok); }
.badge.rejected, .badge.hidden { color: var(--danger); border-color: var(--danger); } .badge.needs_info { color: #9ec9ff; border-color: #9ec9ff; }

.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid #d4af3744; background: var(--navy-800); text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: transform .25s, box-shadow .25s; }
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 30px #d4af3722; }
.card .pic { aspect-ratio: 4/5; width: 100%; object-fit: cover; display: block; background: var(--navy-700); }
.card .info { padding: .9rem 1rem 1.1rem; }
.card h3 { margin: 0; font-size: 1.15rem; } .card .epi { color: var(--gold-soft); font-size: .95rem; }
.card .meta { color: var(--ivory-dim); font-size: .9rem; margin-top: .35rem; }
.card .sample-tag { position: absolute; top: 10px; left: 10px; background: #050814cc; }
.ph { display: grid; place-items: center; font-family: var(--serif); font-size: 4rem; color: #fff9; aspect-ratio: 4/5; width: 100%; }
.ph.sq { aspect-ratio: 1; }

.filters { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.25rem; }
label.f { display: block; font-weight: 500; }
label.f > span { display: block; margin-bottom: .25rem; }
label.f small { display: block; color: var(--ivory-dim); }
input, select, textarea { width: 100%; min-height: 46px; padding: .6rem .8rem; border-radius: 10px; border: 1px solid #d4af3766; background: #050814; color: var(--ivory); font: inherit; }
textarea { min-height: 120px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--gold); flex: none; }
label.check { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid #d4af3733; border-radius: var(--radius); padding: 1rem; margin: 0 0 1.25rem; }
legend { font-family: var(--serif); color: var(--gold-soft); padding: 0 .5rem; font-size: 1.1rem; }
.err-text { color: var(--danger); margin: .25rem 0 0; }

.notice { border-radius: 12px; padding: .9rem 1.1rem; border: 1px solid; margin: 1rem 0; }
.notice.info { border-color: #9ec9ff88; background: #9ec9ff14; } .notice.warn { border-color: var(--warn); background: #f2c66d14; }
.notice.error { border-color: var(--danger); background: #ff8a8a14; } .notice.ok { border-color: var(--ok); background: #8be0a414; }
#banner .notice { margin: 0; border-radius: 0; text-align: center; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--ivory-dim); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #d4af3744; border-top-color: var(--gold); animation: spin 1s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg) } }

.profile-cover { height: clamp(140px, 28vw, 280px); border-radius: var(--radius); background-size: cover; background-position: center; background-color: var(--navy-700); border: 1px solid #d4af3744; }
.profile-head { display: flex; gap: 1.25rem; align-items: flex-end; flex-wrap: wrap; margin: -56px 1rem 1rem; position: relative; }
.profile-avatar { width: 128px; height: 128px; border-radius: 50%; border: 3px solid var(--gold); object-fit: cover; background: var(--navy-700); flex: none; box-shadow: 0 0 24px #d4af3755; }
.profile-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .profile-grid { grid-template-columns: 320px 1fr; } }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 0; }
dl.facts dt { color: var(--gold-soft); } dl.facts dd { margin: 0; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { padding: 0 .7rem; border-radius: 999px; background: #d4af3722; font-size: .9rem; }
.gallery { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gallery figure { margin: 0; } .gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; cursor: zoom-in; border: 1px solid #d4af3744; }
.gallery figcaption { font-size: .85rem; color: var(--ivory-dim); }
.links { display: flex; flex-wrap: wrap; gap: .5rem; }
.links a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .9rem; border: 1px solid #d4af3766; border-radius: 999px; text-decoration: none; min-height: 40px; }
.links svg { width: 18px; height: 18px; fill: currentColor; }

.img-edit { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding: .6rem; border: 1px solid #d4af3733; border-radius: 12px; }
.img-edit img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; }
.progress { height: 10px; border-radius: 99px; background: #ffffff1a; overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--gold); width: 0; transition: width .15s; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid #d4af3722; vertical-align: top; }
.table-wrap { overflow-x: auto; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button { min-height: 44px; }
.stat { text-align: center; } .stat b { display: block; font-family: var(--serif); font-size: 2rem; color: var(--gold-soft); }

.modal-bg { position: fixed; inset: 0; background: #000b; z-index: 50; display: grid; place-items: center; padding: 1rem; overflow: auto; }
.modal { background: var(--navy-800); border: 1px solid var(--gold); border-radius: var(--radius); padding: 1.25rem; width: min(560px, 100%); max-height: 95vh; overflow: auto; }
.crop-canvas { width: 100%; max-width: 320px; aspect-ratio: 1; border-radius: 12px; touch-action: none; cursor: grab; display: block; margin: 0 auto; background: #000; }
.lightbox img { max-width: 100%; max-height: 80vh; display: block; margin: 0 auto; }

#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: .5rem; width: min(480px, 92vw); }
.toast { padding: .8rem 1rem; border-radius: 12px; background: var(--navy-700); border: 1px solid var(--gold); box-shadow: 0 6px 24px #000a; }
.toast.error { border-color: var(--danger); } .toast.ok { border-color: var(--ok); }
.footer { text-align: center; padding: 2rem 1rem; border-top: 1px solid #d4af3722; color: var(--ivory-dim); font-size: .95rem; }
.footer p { margin: .2rem 0; }
.steps { counter-reset: s; display: grid; gap: .6rem; padding: 0; list-style: none; }
.steps li { counter-increment: s; padding-left: 2.6rem; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--gold); display: grid; place-items: center; color: var(--gold-soft); }
