/* Адмінка «Наступник» — токени ті самі, що на сайті (concept / Light), розміри парні. */
:root {
  --bg: #f4f5f7; --surface: #fff; --ink: #0f1b2d; --muted: #5b6676; --line: #dfe3e9; --accent: #14804f; --accent-h: #0f6b41;
  --soft: #e2f2ea; --dark: #0f1b2d; --on-dark-m: #a9b4c4; --note: #ffe38a; --danger: #d13d3d; --danger-soft: #fbe9e9;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/20px var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 700 18px/24px var(--font); text-decoration: none; }
.logo i { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; font: 700 16px/32px var(--font); font-style: normal; text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid transparent; font: 600 14px/20px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn--p { background: var(--accent); color: #fff; } .btn--p:hover { background: var(--dark); }
.btn--s { background: var(--surface); border-color: var(--ink); } .btn--s:hover { background: var(--bg); }
.btn--d { background: var(--surface); border-color: var(--danger); color: var(--danger); } .btn--d:hover { background: var(--danger-soft); }
.btn:disabled { background: #d5dae1; border-color: #d5dae1; color: var(--muted); cursor: default; }
.btn--sm { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: 600 14px/20px var(--font); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* вхід */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { font: 700 22px/28px var(--font); }
.err { color: var(--danger); font-size: 13px; }

/* каркас */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--dark); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; }
.side nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side nav a { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--on-dark-m); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side nav a.is-on { background: rgba(255, 255, 255, .12); color: #fff; }
.side nav .cnt { min-width: 22px; padding: 2px 7px; border-radius: 999px; background: var(--accent); color: #fff; font: 600 12px/16px var(--font); text-align: center; }
.me { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.me span { color: var(--on-dark-m); font-size: 12px; }
.me .link { color: #7fd1a8; align-self: flex-start; margin-top: 6px; }
.menu-btn { display: none; }
.main { padding: 32px 40px 64px; min-width: 0; }
.page-h { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h h1 { font: 700 28px/34px var(--font); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.bar input[type=search] { flex: 1 1 240px; max-width: 360px; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); outline: none; }
.bar input[type=search]:focus { border-color: var(--accent); }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; cursor: pointer; }
.chip:hover { background: var(--bg); }
.chip.is-on { background: var(--dark); border-color: var(--dark); color: #fff; }
.chip .n { margin-left: 6px; color: var(--muted); font-size: 12px; }
.chip.is-on .n { color: var(--on-dark-m); }

/* таблиці */
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 12px/16px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .02em; background: #fafbfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: #fafbfc; }
td .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
td.num { text-align: right; white-space: nowrap; }
td .thumb { width: 64px; height: 40px; border-radius: 6px; object-fit: cover; background: #d5dae1; display: block; }
td select { height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); padding: 0 8px; max-width: 160px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.pill { display: inline-flex; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--accent); font: 600 12px/16px var(--font); white-space: nowrap; }
.pill--note { background: var(--note); color: var(--ink); } .pill--bg { background: var(--bg); color: var(--muted); } .pill--dark { background: var(--dark); color: #fff; }
.pill--danger { background: var(--danger-soft); color: var(--danger); } .pill--accent { background: var(--accent); color: #fff; }

/* дашборд */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
.kpi:hover { border-color: var(--accent); }
.kpi b { font: 700 28px/34px var(--font); } .kpi span { color: var(--muted); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.box h2 { font: 700 18px/24px var(--font); }
.box .row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.box .row:last-child { border-bottom: 0; }
.note-box { background: var(--note); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }

/* шухляда з формою */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-bg { position: absolute; inset: 0; background: rgba(15, 27, 45, .45); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--surface); display: flex; flex-direction: column; box-shadow: -16px 0 48px rgba(15, 27, 45, .2); }
.drawer-panel header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.drawer-panel header h2 { font: 700 20px/26px var(--font); }
.x { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; cursor: pointer; }
.x:hover { background: var(--bg); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 32px; }
.drawer-panel footer { display: flex; gap: 8px; align-items: center; padding: 16px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.drawer-panel footer .sp { flex: 1; }
.group { border: 0; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.group legend { grid-column: 1 / -1; font: 700 16px/22px var(--font); padding: 0; margin-bottom: 4px; }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld > span { font: 500 13px/18px var(--font); }
.fld small { color: var(--muted); font-size: 12px; line-height: 16px; }
.fld input[type=text], .fld input[type=number], .fld input[type=password], .fld input[type=date], .fld select, .fld textarea {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); outline: none; font-size: 14px; line-height: 20px; }
.fld textarea { resize: vertical; min-height: 80px; font-family: var(--font); }
.fld textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; min-height: 200px; }
.fld input:focus, .fld select:focus, .fld textarea:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fld.is-err input, .fld.is-err textarea { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.chk { flex-direction: row; align-items: center; gap: 8px; }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); }
.imgpick { display: flex; gap: 12px; align-items: flex-start; }
.imgpick img { width: 120px; height: 72px; border-radius: 8px; object-fit: cover; background: #d5dae1; flex: none; }
.imgpick .c { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.imgpick .c div { display: flex; gap: 8px; flex-wrap: wrap; }
.kv-list { display: flex; flex-direction: column; gap: 6px; }
.kv-list .r { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv-list .r span:first-child { width: 160px; flex: none; color: var(--muted); }
.token-box { background: var(--soft); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; word-break: break-all; }
.token-box code { font: 500 13px/18px ui-monospace, Menlo, monospace; background: var(--surface); padding: 10px; border-radius: 8px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--dark); color: #fff; padding: 12px 20px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: calc(100% - 32px); }
.toast.is-err { background: var(--danger); }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .nav-open .side { transform: none; }
  .menu-btn { display: flex; flex-direction: column; justify-content: center; gap: 5px; position: fixed; z-index: 41; top: 12px; right: 12px; width: 44px; height: 44px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
  .menu-btn b { display: block; height: 2px; background: var(--ink); border-radius: 1px; }
  .main { padding: 24px 16px 48px; }
  .page-h h1 { font-size: 24px; line-height: 30px; padding-right: 52px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .cols { grid-template-columns: 1fr; }
  .group { grid-template-columns: 1fr; }
  .hide-m { display: none; }
}
