:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1c2430; --muted: #6b7686; --line: #e4e8ee;
  --accent: #d6457b; --accent-2: #7a4bd6; --ok: #1f9d6b; --warn: #c98a12; --bad: #d2432f; --info: #2f7fd1;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 14px rgba(20, 30, 50, .05);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --panel: #1c2028; --text: #e8ecf2; --muted: #93a0b2; --line: #2a303b;
          --shadow: 0 1px 2px rgba(0, 0, 0, .4); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
code { background: var(--line); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
h1 { font-size: 24px; margin: 0 0 18px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 28px 0 12px; }
h3 { font-size: 13px; margin: 0 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.muted { color: var(--muted); }
.big { font-size: 30px; font-weight: 700; margin: 4px 0; } .big small { font-size: 13px; font-weight: 400; color: var(--muted); }

.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 800; font-size: 20px; color: var(--text); padding: 4px 10px 18px; letter-spacing: -.02em; }
.brand span, .login h1 span { color: var(--accent); font-weight: 600; margin-left: 2px; }
.side nav { display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.side nav a { color: var(--text); padding: 9px 12px; border-radius: 9px; }
.side nav a:hover { background: var(--bg); }
.side nav a.on { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }
.group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 12px 6px; }
.logout { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.who { color: var(--muted); font-size: 13px; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.main { padding: 28px 34px 60px; max-width: 1280px; width: 100%; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card p { margin: 6px 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 60%, var(--panel)); }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; white-space: nowrap; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.badge.info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }

.meter, .bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.meter span, .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; transition: width .4s; }

.btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 9px 16px; border-radius: 10px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 8px; }

.login { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 30px; }
.login h1 { margin: 0; font-size: 28px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.alert { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 14px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: column; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .group { display: none; }
  .main { padding: 18px 14px 40px; }
}

/* Куклы и галереи */
.imggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.imggrid figure { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; font-size: 13px; }
.imggrid img { width: 100%; height: 210px; object-fit: contain; background: #fff; border-radius: 6px; }
.imggrid figcaption { margin-top: 6px; color: var(--muted); }
.cols { display: grid; grid-template-columns: minmax(280px, 520px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 960px) { .cols { grid-template-columns: 1fr; } }
.overlay-wrap { position: relative; background: #fff; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.overlay-wrap img { display: block; width: 100%; }
.overlay-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.overlay-wrap.off svg { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 12px 0; }
.form-grid .wide { grid-column: 1 / -1; }
textarea, select { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); width: 100%; }
textarea { min-height: 70px; resize: vertical; }
details.card > summary { cursor: pointer; font-weight: 600; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline input[type=number] { width: 90px; }
.kv td:first-child { color: var(--muted); width: 38%; }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; }
.uplist { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.uplist label { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px; align-items: center; font-size: 12px; text-align: center; }
.uplist img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; }
.btn.danger { color: var(--bad); }
