:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2129; --muted: #6b7280; --line: #e3e5e9;
  --side: #15181d; --side-text: #c9ccd2; --side-hover: #23272e;
  --ok: #157347; --warn: #b45309; --bad: #b42318;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; }
.layout { display: flex; min-height: 100vh; }

/* sidebar */
.side { width: 220px; background: var(--side); color: var(--side-text); flex-shrink: 0; display: flex; flex-direction: column; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: #fff; text-decoration: none; font-weight: 700; }
.side .brand img { max-height: 30px; max-width: 120px; }
.side .brand .mark { width: 30px; height: 30px; border-radius: 7px; background: var(--brand); color: var(--brand-text); display: grid; place-items: center; font-weight: 800; }
.side nav a { display: flex; gap: 10px; align-items: center; padding: 9px 16px; text-decoration: none; border-left: 3px solid transparent; }
.side nav a:hover { background: var(--side-hover); color: #fff; }
.side nav a.on { border-left-color: var(--brand); background: var(--side-hover); color: #fff; font-weight: 600; }
.side nav .sep { margin: 14px 16px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7c818a; }
.side .foot { margin-top: auto; padding: 14px 16px; font-size: 12px; color: #7c818a; border-top: 1px solid #262a31; }
.side .foot a { color: #c9ccd2; }

.main { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.top .who { color: var(--muted); font-size: 13px; display: flex; gap: 12px; align-items: center; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; padding: 0 6px; }
.content { padding: 22px 24px 40px; max-width: 1400px; }

h1 { font-size: 21px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .val { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12px; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; text-decoration: none; cursor: pointer; font: inherit; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #b9bdc5; }
.btn.primary { background: var(--brand); color: var(--brand-text); border-color: transparent; }
.btn.primary:hover { filter: brightness(.95); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd3da; border-radius: 8px; font: inherit; background: #fff;
}
input[type=color] { width: 60px; height: 36px; padding: 2px; border: 1px solid #cfd3da; border-radius: 8px; background: #fff; }
input[type=checkbox] { width: 16px; height: 16px; vertical-align: middle; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[name=q] { min-width: 240px; flex: 1; max-width: 380px; }

.form { max-width: 760px; }
.form .row { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; padding: 9px 0; border-bottom: 1px solid #f0f1f3; align-items: start; }
.form .row label { font-weight: 600; padding-top: 7px; }
.form .help { color: var(--muted); font-size: 12px; margin-top: 3px; }
.form .err { color: var(--bad); font-size: 13px; margin-top: 3px; }
.form .buttons { padding-top: 16px; display: flex; gap: 8px; }

/* tables */
.tbl-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #eef0f2; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; white-space: nowrap; position: sticky; top: 0; }
tbody tr:hover { background: #fafbfc; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; white-space: nowrap; }
tfoot td { font-weight: 700; background: #fafbfc; }
.zero { color: #c3c7cd; }
table a { text-decoration: none; }
table a:hover { text-decoration: underline; }
.kv td:first-child { color: var(--muted); width: 40%; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef0f3; color: #444; }
.pill.ok { background: #e3f4ea; color: var(--ok); }
.pill.warn { background: #fdf1e1; color: var(--warn); }
.pill.bad { background: #fde8e7; color: var(--bad); }
.pill.in { background: #e3f4ea; color: var(--ok); }
.pill.out { background: #fde8e7; color: var(--bad); }

.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.msg.success { background: #e9f6ee; border-color: #bfe3cc; color: #0f5132; }
.msg.error { background: #fdecea; border-color: #f5c2c0; color: #842029; }
.msg.info, .msg.warning { background: #fff7e6; border-color: #f3dca8; color: #7a4b00; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 0; color: var(--muted); }
.thumb { width: 160px; height: 160px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile { display: block; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tile:hover { border-color: var(--brand); }
.tile .ic { font-size: 22px; }
.tile b { display: block; margin: 6px 0 2px; }
.empty { text-align: center; padding: 30px; color: var(--muted); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--side); }
.login { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 28px; }
.login .mark { width: 44px; height: 44px; border-radius: 10px; background: var(--brand); color: var(--brand-text); display: grid; place-items: center; font-weight: 800; font-size: 20px; margin-bottom: 12px; }
.login label { display: block; font-weight: 600; margin: 12px 0 4px; }
.login .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 10px; }

@media (max-width: 900px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .side { position: fixed; z-index: 20; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .menu-btn { display: block; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
  .form .row { grid-template-columns: 1fr; }
  .form .row label { padding-top: 0; }
  .filters input, .filters select, .filters input[name=q] { min-width: 0; width: 100%; max-width: none; }
  .stat .val { font-size: 20px; }
  .top .who .name { display: none; }
}

/* sidebar drop-down groups (0.01.02) */
.side nav details > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 9px 16px; cursor: pointer; border-left: 3px solid transparent; user-select: none; }
.side nav details > summary::-webkit-details-marker { display: none; }
.side nav details > summary::after { content: "▸"; margin-left: auto; font-size: 11px; color: #7c818a; transition: transform .15s; }
.side nav details[open] > summary::after { transform: rotate(90deg); }
.side nav details > summary:hover { background: var(--side-hover); color: #fff; }
.side nav details > summary.on { border-left-color: var(--brand); color: #fff; font-weight: 600; }
.side nav details > a { padding: 7px 16px 7px 44px; font-size: 13px; border-left: 3px solid transparent; }
.side nav details[open] { background: #1b1e24; padding-bottom: 4px; }
.side nav .soon summary { opacity: .5; }
.side nav .soon-tag { font-size: 10px; background: #2c3038; color: #aeb3bb; border-radius: 4px; padding: 0 5px; }
.side nav .soon-item { display: block; padding: 6px 16px 6px 44px; font-size: 13px; color: #6b7079; }
.side { overflow-y: auto; }
