/* =====================================================================
   8A142RDS — panel admin
   ===================================================================== */
:root {
  --sogan: #3a2416; --sogan-2: #4a2f1d; --sogan-3: #5e3d26;
  --bronze: #a8743f; --gold: #e2b65b; --gold-hi: #f7dd97;
  --red: #c8102e; --green: #2f7a46; --amber: #a86a0b;
  --bg: #f4ede1; --card: #fffdf9; --ink: #24170f; --muted: #75614f; --line: #e1d3bb; --line-2: #efe5d4;
  --display: "Oswald", "Arial Narrow", sans-serif;
  --body: "Plus Jakarta Sans", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 400 15px/1.55 var(--body); color: var(--ink); background: var(--bg); }
a { color: var(--red); }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 700; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--display); font-weight: 500; font-size: 1.02rem; letter-spacing: .03em; }
.mono a { color: var(--ink); text-decoration: none; }
.mono a:hover { color: var(--red); text-decoration: underline; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 28px; }
.upper { text-transform: uppercase; }

/* ---------- layout ---------- */
.adm { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--sogan) 248px, var(--bg) 248px); }
.side { background: var(--sogan); color: #e9d9bd; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side__brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 20px; text-decoration: none; color: inherit; border-bottom: 1px solid rgba(226,182,91,.16); }
.side__brand img { height: 42px; width: auto; }
.side__brand b { display: block; font: 700 1.45rem/1 var(--display); letter-spacing: .01em; color: var(--gold-hi); }
.side__brand small { color: #bea684; font-size: .8rem; }
.side__nav { display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; flex: 1; }
.side__nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #e4d2b2; text-decoration: none; font-weight: 500; }
.side__nav svg { fill: currentColor; opacity: .75; flex: none; }
.side__nav a:hover { background: var(--sogan-2); color: #fff; }
.side__nav a[aria-current=page] { background: #fff6e4; color: var(--sogan); font-weight: 700; }
.side__nav a[aria-current=page] svg { opacity: 1; fill: var(--red); }
.side__foot { padding: 14px 12px 18px; border-top: 1px solid rgba(226,182,91,.16); }
.side__user { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 8px; border-radius: 8px; }
.side__user:hover { background: var(--sogan-2); }
.side__user b { display: block; color: #fff; font-weight: 600; font-size: .92rem; }
.side__user small { color: #bea684; font-size: .8rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--sogan); font: 700 1rem var(--display); flex: none; }
.side__links { display: flex; gap: 16px; padding: 8px 8px 0; font-size: .85rem; }
.side__links a { color: #d8c09b; }

.main { min-width: 0; padding: 0 32px 48px; }
.bar { display: flex; align-items: center; gap: 12px; padding: 26px 0 20px; }
.bar h1 { font: 600 1.9rem/1.1 var(--display); letter-spacing: .005em; }
.bar__menu { display: none; border: 0; background: var(--card); border-radius: 8px; padding: 8px; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.content { display: grid; gap: 20px; }
.intro { max-width: 80ch; }

/* ---------- panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; min-width: 0; }
.panel > h2 { margin-bottom: 14px; }
.panel--plain { background: transparent; border-style: dashed; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.panel__head h2 { display: flex; align-items: center; gap: 10px; }
.panel__head > a { font-weight: 600; font-size: .9rem; text-decoration: none; }
.panel__head p { margin: 4px 0 0; font-size: .9rem; }
.count { font: 600 .8rem var(--body); background: var(--line-2); padding: 2px 9px; border-radius: 20px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2--top { align-items: start; }
.grid-2--wide { grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr); }
.panel--span { grid-column: 1 / -1; }
.chart--wide { height: 240px; }
.narrow-panel { max-width: 520px; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state p { margin: 8px auto 20px; max-width: 46ch; color: var(--muted); }
.actions { display: flex; gap: 10px; align-items: center; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.kpi > span { display: block; color: var(--muted); font-size: .85rem; font-weight: 600; }
.kpi b { display: block; font: 600 2.1rem/1.15 var(--display); margin-top: 4px; }
.kpi b i { font-style: normal; color: #bfa98a; font-weight: 400; }
.kpi--medals { background: var(--sogan); border-color: var(--sogan); color: #f3e6cf; }
.kpi--medals > span { color: #cdb592; }
.kpi--medals ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; justify-content: space-between; gap: 8px; }
.kpi--medals li { display: flex; align-items: center; gap: 6px; }
.kpi--medals li b { font-size: 1.6rem; margin: 0; color: #fff3d6; }
.kpi--medals img { width: 30px; height: 30px; }

.chart { position: relative; height: 260px; }

/* ---------- tables ---------- */
.scroll { overflow-x: auto; position: relative; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover { background: #fbf4e6; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .end { text-align: right; white-space: nowrap; }
.tbl .check { width: 34px; }
.tbl td img.medal-sm, .medal-sm { display: inline-block; vertical-align: middle; width: 22px; height: 22px; }
.panel__head .medal-sm { width: 28px; height: 28px; }
.tbl--roles td:not(:first-child), .tbl--roles th:not(:first-child) { text-align: center; }
.tbl--roles td { font-size: .9rem; }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 12px; flex-wrap: wrap; }
.pager { display: flex; gap: 14px; align-items: center; font-size: .9rem; }
.pager a { font-weight: 600; text-decoration: none; }
.role { font-size: .8rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: var(--line-2); white-space: nowrap; }
.role--superadmin { background: var(--sogan); color: var(--gold-hi); }
.role--admin { background: #f5dfb3; color: #6b4310; }

/* ---------- forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px; padding: 11px 20px; background: var(--red); color: #fff; font: 600 .95rem var(--body); cursor: pointer; text-decoration: none; }
.btn:hover { background: #a50d25; }
.btn--sm { padding: 8px 14px; font-size: .88rem; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn--ghost:hover { background: var(--line-2); }
.btn--danger { background: var(--ink); }
.btn-link { border: 0; background: none; padding: 4px 6px; color: var(--red); font: 600 .88rem var(--body); cursor: pointer; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #9b1c1c; }
.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-weight: 600; font-size: .88rem; padding: 0; margin-bottom: 4px; }
.field small { font-size: .8rem; }
input, select, textarea { font: 500 .95rem var(--body); color: var(--ink); }
.field input:not([type=radio]):not([type=checkbox]):not([type=file]), .field select, textarea, .inline-form input, .inline-form select, .input-sm {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; width: 100%;
}
.input-sm { padding: 7px 10px; width: 180px; font-size: .9rem; }
.field input:disabled { background: var(--line-2); color: var(--muted); }
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; resize: vertical; margin-top: 8px; }
.radio, .check-line { display: flex; align-items: center; gap: 8px; font-size: .92rem; margin: 2px 0; }
.field--inline { grid-template-columns: auto; gap: 4px; }
.field--inline > span { font-size: .78rem; color: var(--muted); margin: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 16px; }
.filters .field input, .filters .field select { padding: 8px 10px; min-width: 150px; }
.filters__count { margin-left: auto; color: var(--muted); font-weight: 600; font-size: .9rem; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.paste summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--red); }
.code { background: var(--sogan); color: #f3e6cf; border-radius: 8px; padding: 14px 16px; font: .82rem/1.5 ui-monospace, Menlo, Consolas, monospace; overflow-x: auto; margin: 0 0 12px; }

/* upload */
.upload { display: grid; gap: 16px; justify-items: start; }
.drop { width: 100%; border: 2px dashed #cdb48c; border-radius: 12px; padding: 40px 20px; display: grid; justify-items: center; gap: 6px; text-align: center; cursor: pointer; background: #fffaf0; transition: background .15s, border-color .15s; }
.drop svg { fill: var(--bronze); margin-bottom: 6px; }
.drop b { font-size: 1.05rem; }
.drop > span { color: var(--muted); font-size: .9rem; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.drop.is-over { background: #fbeccd; border-color: var(--bronze); }
.drop__files { font-weight: 600; color: var(--ink) !important; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.results__item { display: grid; gap: 2px; padding: 12px 14px; border-radius: 8px; background: #eef6ef; border-left: 4px solid var(--green); }
.results__item.is-error { background: #fbeceb; border-left-color: var(--red); }
.results__item span { font-size: .92rem; }
.checks { margin: 0; padding-left: 20px; display: grid; gap: 8px; max-width: 90ch; }

/* flash & notes */
.flash { margin: 0 0 16px; padding: 12px 16px; border-radius: 10px; font-weight: 500; background: #fff6e0; border: 1px solid #f0d79d; }
.flash--success { background: #eaf5ec; border-color: #b9dcc1; color: #1e4d2b; }
.flash--error { background: #fbeceb; border-color: #f0c2bd; color: #7d1717; }
.flash--warning { background: #fff4dc; border-color: #f0d79d; color: #6b4310; }
.note { padding: 14px 18px; border-radius: 10px; background: #fff4dc; border: 1px solid #f0d79d; color: #5a3a0c; }
.note a { font-weight: 700; margin-left: 6px; }

/* templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.tpl { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.tpl__img { aspect-ratio: 1.42; background: var(--line-2); display: grid; place-items: center; overflow: hidden; }
.tpl__img img { width: 100%; height: 100%; object-fit: cover; }
.tpl.is-missing .tpl__img { background: repeating-linear-gradient(45deg, #f4ead8 0 10px, #efe2cb 10px 20px); color: var(--muted); font-weight: 600; }
.tpl.is-missing { border-color: #e7b65b; }
.tpl__body { padding: 16px 18px 18px; display: grid; gap: 10px; }
.tpl__form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tpl__form input[type=file] { font-size: .82rem; max-width: 100%; flex: 1; }
.tpl__links { display: flex; gap: 8px; align-items: center; }

/* dialog */
.dialog { border: 0; border-radius: 14px; padding: 24px; width: min(440px, 92vw); box-shadow: 0 30px 80px rgba(36,23,15,.35); }
.dialog::backdrop { background: rgba(36,23,15,.45); }
.dialog__actions { display: flex; gap: 10px; }
.dialog__danger { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); }

/* ---------- login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); min-height: 100vh; background: var(--card); }
.login__art { position: relative; overflow: hidden; background: radial-gradient(800px 500px at 30% 40%, rgba(168,116,63,.45), transparent 65%), var(--sogan); }
.login__art img { position: absolute; bottom: 0; left: 8%; height: 88%; width: auto; }
.login__call { position: absolute; right: 6%; bottom: 7%; margin: 0; font: 700 clamp(3rem, 8vw, 7rem)/0.9 var(--display);
  background: linear-gradient(180deg, #fff3c9, var(--gold-hi) 25%, var(--gold) 55%, #9c6a22 80%, #e7bf63); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(40,20,8,.55)); }
.login__panel { display: grid; place-items: center; padding: 40px 32px; }
.login__form { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.login__form img { height: 56px; width: auto; }
.login__form h1 { font: 600 2rem/1.1 var(--display); margin-top: 6px; }
.login__form p { margin: -6px 0 6px; }
.login__form .flash { margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi--medals { grid-column: 1 / -1; }
  .grid-2, .grid-2--wide { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .adm { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(36,23,15,.4); }
  .bar__menu { display: inline-flex; }
  .main { padding: 0 16px 40px; }
  .bar h1 { font-size: 1.5rem; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .login { grid-template-columns: 1fr; }
  .login__art { display: none; }
}
@media (prefers-reduced-motion: reduce) { .side, .drop { transition: none; } }
