/* Dancesport Network — admin panel. Self-contained, no build step.
   Palette mirrors the public site's tokens.css (black + gold). */

:root {
  --bg: #0b0b0c;
  --surface: #111113;
  --panel: #16161a;
  --line: #26262a;
  --ink: #f5f5f5;
  --ink-dim: #a2a09a;
  --ink-faint: #6b6a64;
  --gold: #f4d35e;
  --gold-soft: #c9a94a;
  --green: #00966e;
  --red: #d62612;
  --radius: 4px;
  --wrap: 1040px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.86em;
  background: #0000004d;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.05em 0.35em;
}

h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.6rem; letter-spacing: 0.01em; }

.muted { color: var(--ink-dim); }
.muted code { color: var(--ink); }

/* --- top bar ------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 #f4d35e1a;
}
.brand {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
}
.brand span { color: var(--gold); font-weight: 400; }
.brand:hover { text-decoration: none; }

.mainnav { display: flex; gap: 0.35rem; flex-wrap: wrap; flex: 1; }
.mainnav a {
  color: var(--ink-dim);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.mainnav a:hover { color: var(--ink); background: #ffffff0a; text-decoration: none; }
.mainnav a[aria-current="page"] { color: var(--bg); background: var(--gold); }

.logout { display: flex; align-items: center; gap: 0.6rem; margin: 0; }
.logout .who { color: var(--ink-dim); font-size: 0.85rem; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- layout ------------------------------------------------------------- */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}
body.is-bare .wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
}

/* --- cards / sections ------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 1.25rem 0;
}
.card h2 + p { margin-top: 0; }

/* --- stat tiles ------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
}
.stat:hover { border-color: var(--gold-soft); text-decoration: none; }
.stat__n { font-size: 1.9rem; font-weight: 700; color: var(--gold); line-height: 1.1; }
.stat__l { font-size: 0.82rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* --- status grid + pills ------------------------------------------- */
.statusgrid { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0; }
.statusgrid dt { color: var(--ink-dim); }
.statusgrid dd { margin: 0; }

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: #ffffff08;
  white-space: nowrap;
}
.pill--published { border-color: #00966e66; color: #6fe0bf; }
.pill--draft { border-color: var(--line); color: var(--ink-dim); }
.pill--pending_review, .pill--needs_changes { border-color: #f4d35e66; color: var(--gold); }
.pill--archived, .pill--suspended { color: var(--ink-faint); }

/* --- activity log ------------------------------------------------- */
table.log { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.log th, table.log td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); }
table.log th { color: var(--ink-dim); font-weight: 600; }

/* --- forms ------------------------------------------------------- */
.authbox h1 { margin-bottom: 0.25rem; }
.authbox { width: 100%; }

form label {
  display: block;
  margin: 0.9rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-dim);
}
form input[type="text"],
form input[type="email"],
form input[type="url"],
form input[type="password"],
form input[type="date"],
form input[type="time"],
form input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
}
form input:focus { outline: 2px solid var(--gold-soft); outline-offset: 1px; border-color: var(--gold-soft); }

button {
  margin-top: 1.2rem;
  padding: 0.55rem 1.2rem;
  background: var(--gold);
  color: #1a1400;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #ffe486; }
button:disabled { background: var(--line); color: var(--ink-faint); cursor: not-allowed; }

.logout button {
  margin: 0;
  padding: 0.35rem 0.8rem;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  font-weight: 400;
  font-size: 0.85rem;
}
.logout button:hover { color: var(--ink); border-color: var(--gold-soft); background: transparent; }

/* --- flash messages ------------------------------------------- */
.flash {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin: 0 0 1rem;
  font-size: 0.9rem;
}
.flash--ok { border-color: #00966e66; background: #00966e1a; color: #9fe9d0; }
.flash--error { border-color: #d6261266; background: #d626121a; color: #f3a99f; }
.flash--warn { border-color: #f4d35e66; background: #f4d35e14; color: var(--gold); }

/* --- list pages ------------------------------------------------------ */
.pagehead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.btn {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  background: var(--gold);
  color: #1a1400;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
}
.btn:hover { background: #ffe486; text-decoration: none; }
.btn--ghost {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
}
.btn--ghost:hover { color: var(--ink); border-color: var(--gold-soft); background: transparent; }

table.grid { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.grid th, table.grid td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.grid th { color: var(--ink-dim); font-weight: 600; white-space: nowrap; }
table.grid tbody tr:hover td { background: #ffffff05; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; margin: 0; }
button.link-danger {
  margin: 0;
  padding: 0.2rem 0.4rem;
  background: transparent;
  border: 0;
  color: #e08c82;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}
button.link-danger:hover { color: var(--red); background: transparent; }

/* --- forms (editors) --------------------------------------------- */
.backlink { display: inline-block; margin-bottom: 0.5rem; color: var(--ink-dim); font-size: 0.9rem; }

form.card { max-width: 760px; }
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 1rem 1rem;
  margin: 1.25rem 0 0;
}
fieldset legend { color: var(--gold); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 0 0.4rem; }

form select,
form textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
}
form textarea { min-height: 5rem; resize: vertical; line-height: 1.5; }
form input[type="file"] { margin-top: 0.4rem; color: var(--ink-dim); font-size: 0.85rem; max-width: 100%; }
form input[type="file"]::file-selector-button {
  margin-right: 0.6rem;
  padding: 0.3rem 0.7rem;
  background: var(--line);
  color: var(--ink);
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  cursor: pointer;
}
form select:focus, form textarea:focus { outline: 2px solid var(--gold-soft); outline-offset: 1px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

label.check,
label.inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
  color: var(--ink);
  font-size: 0.92rem;
}
label.check input, label.inline input { width: auto; margin: 0; }

.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.3rem 0.8rem;
  margin-top: 0.5rem;
}
.checks label { display: flex; gap: 0.45rem; align-items: center; margin: 0; color: var(--ink); font-size: 0.9rem; }
.checks input { width: auto; margin: 0; }

.hint { margin: 0.3rem 0 0; font-size: 0.82rem; color: var(--ink-dim); }
.mt-1 { margin-top: 1rem; }

.thumbs { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.6rem; }
.thumb {
  width: 120px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-dim);
}
.thumb img { display: block; width: 100%; height: 78px; object-fit: cover; border-radius: 2px; margin-bottom: 0.3rem; }
.thumb label { display: flex; gap: 0.35rem; align-items: center; margin: 0; font-size: 0.78rem; }
.thumb input { width: auto; margin: 0; }

.formactions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.5rem; }
.formactions .btn--ghost { padding: 0.55rem 1rem; }

@media (max-width: 600px) {
  .topbar { gap: 0.6rem; }
  .logout .who { display: none; }
  table.grid { font-size: 0.82rem; }
}

/* Back-to-top arrow (injected by admin.js) */
.totop {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  width: 2.9rem;
  height: 2.9rem;
  border: 1px solid var(--gold-soft);
  border-radius: 50%;
  background: var(--panel);
  color: var(--gold);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s, background 0.2s;
}
.totop.is-on { opacity: 1; visibility: visible; transform: none; }
.totop:hover { background: var(--gold); color: var(--bg); }
.totop:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (max-width: 600px) { .totop { right: 0.9rem; bottom: 0.9rem; } }

/* Unsaved-changes bar (admin.js) + "not yet published" pill (view.php) */
.unsaved {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 60;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 0.9rem;
  padding: 0.55rem 0.6rem 0.55rem 1rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--panel);
  color: var(--gold);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
.has-unsaved .unsaved { display: flex; }
.unsaved button { margin: 0; padding: 0.4rem 0.95rem; border-radius: 999px; }
.has-unsaved .wrap { padding-bottom: 5rem; }
.has-unsaved .formactions button[type="submit"] { box-shadow: 0 0 0 3px #f4d35e55; }
.pubnag {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.pubnag:hover { background: var(--gold); color: var(--bg); text-decoration: none; }
@media (max-width: 600px) {
  .unsaved { left: 0.9rem; right: 4.6rem; transform: none; justify-content: space-between; white-space: normal; }
}

/* Training locations (lib/crud.php locations_form) */
fieldset.loc {
  margin: 1rem 0 0;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-soft);
  border-radius: var(--radius);
}
fieldset.loc legend { color: var(--gold); font-weight: 600; padding: 0 0.4rem; }
details.loc-add { margin-top: 1rem; }
details.loc-add > summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 600;
  padding: 0.5rem 0;
}

/* Club panel profile checklist */
.checklist--todo { border-color: var(--gold-soft); }
.checklist__list { list-style: none; margin: 0.75rem 0 1rem; padding: 0; display: grid; gap: 0.35rem; }
.checklist__list li.is-ok span { color: #9fe9d0; }
.checklist__list li.is-todo span { color: var(--gold); }
.checklist__list li.is-todo { color: var(--ink); }

/* Group rows inside a training place (lib/crud.php locations_form) */
.groups { margin: 1rem 0 0.5rem; }
.groups__h { margin: 0 0 0.5rem; font-weight: 600; color: var(--ink); }
.grp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  padding: 0.6rem 0;
  border-top: 1px dashed var(--line);
}
.grp--new { opacity: 0.85; }
.grp select,
.grp input[type="text"] { width: auto; flex: 1 1 9.5rem; min-width: 0; margin: 0; }
.grp input[type="time"] { width: auto; margin: 0; }
.grp__days { display: inline-flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; }
.grp__days label { display: inline-flex; align-items: center; gap: 0.2rem; margin: 0; font-size: 0.85rem; color: var(--ink-dim); }
.grp__time { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--ink-dim); }
.grp__rm { margin: 0; font-size: 0.82rem; }

/* Dashboard „Чака действие“ */
.tasks__list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.45rem; }
.tasks__list a { color: var(--ink); }
.tasks__list a:hover { color: var(--gold); text-decoration: none; }
.tasks__list strong { color: var(--gold); }

/* „Подсещане“ recipients */
.rcpts { display: grid; gap: 0.4rem; margin: 0.75rem 0 1rem; }
.rcpts label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.6rem; margin: 0; }
.rcpts input { flex: none; }
.rem-sent { color: #9fe9d0; font-size: 0.82rem; }
.rem-done { margin: 0.5rem 0; color: #9fe9d0; font-weight: 600; }
.rem-more > summary { cursor: pointer; color: var(--gold); margin: 0.25rem 0 0.5rem; }
.confirm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-top: 0.75rem; }
.confirm-row button { margin: 0; }

/* Club panel step bar + sticky save (club/index.php) */
.steps {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 1rem 0;
  padding: 0.7rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.steps__pct { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.5rem; font-size: 0.88rem; color: var(--ink-dim); }
.steps__pct strong { color: var(--gold); font-size: 1rem; }
.steps__bar { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.steps__bar > span { display: block; height: 100%; background: var(--gold); }
.steps__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; }
.steps__list a { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-dim); font-size: 0.85rem; }
.steps__list a:hover { border-color: var(--gold-soft); color: var(--ink); text-decoration: none; }
.steps__list .is-ok a { border-color: #00966e66; color: #9fe9d0; }
.steps__n { font-weight: 700; color: var(--gold); }
.steps__list .is-ok .steps__n { color: #9fe9d0; }
fieldset[id^="step-"], section[id^="step-"] { scroll-margin-top: 7.5rem; }
.savebar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 1rem -1.25rem -1.1rem;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.savebar button { margin: 0; }
