/* Оформление дашборда и админ-панели Otherworld D&D. */

:root {
  --bg:      #0e1014;
  --surface: #171a21;
  --raised:  #1e222b;
  --line:    #2a2f3a;
  --line2:   #363d4b;

  --text: #e7eaf0;
  --dim:  #8d96a8;
  --mute: #626c7e;

  --accent:     #7aa2f7;
  --accent-ink: #0d1117;
  --ok:   #7bd88f;
  --warn: #e0af68;
  --bad:  #f7768e;

  --r:  10px;
  --r2: 7px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 15% -10%, #1a2030 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.55 ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; }

/* ---------------------------------------------------------------- шапка */

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(14,16,20,.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.top-in {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
}

.brand { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.brand span { color: var(--dim); font-weight: 400; }

.top .spacer { flex: 1; }

.stat-inline { display: flex; gap: 16px; flex-wrap: wrap; color: var(--dim); font-size: 13px; }
.stat-inline b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- каркас */

main { max-width: 1240px; margin: 0 auto; padding: 20px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); }

.card {
  background: linear-gradient(180deg, var(--surface), #14171d);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.card > h2 {
  margin: 0 0 14px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--mute);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card > h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.card.span2 { grid-column: 1 / -1; }

/* ------------------------------------------------------------- значения */

.metric { display: flex; align-items: baseline; gap: 10px; }
.metric .v {
  font-size: 30px;
  font-weight: 640;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.metric .u { color: var(--dim); font-size: 13px; }
.sub { color: var(--dim); font-size: 12.5px; margin-top: 4px; }

dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; }
dl.kv dt { color: var(--dim); white-space: nowrap; }
dl.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.bar { height: 5px; background: #11141a; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; border-radius: 99px; transition: width .4s ease; background: var(--accent); }
.bar.ok > i   { background: linear-gradient(90deg, #4c9f6a, var(--ok)); }
.bar.warn > i { background: linear-gradient(90deg, #b3822f, var(--warn)); }
.bar.bad > i  { background: linear-gradient(90deg, #b04559, var(--bad)); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.pill.ok   { background: rgba(123,216,143,.12); color: var(--ok);   border-color: rgba(123,216,143,.28); }
.pill.bad  { background: rgba(247,118,142,.12); color: var(--bad);  border-color: rgba(247,118,142,.28); }
.pill.warn { background: rgba(224,175,104,.12); color: var(--warn); border-color: rgba(224,175,104,.28); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--mute); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.chips li {
  background: var(--raised);
  border: 1px solid var(--line2);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 13px;
}
.empty { color: var(--mute); font-style: italic; }

/* ------------------------------------------------------------- вкладки */

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.tabs button {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--dim);
  padding: 8px 15px;
  border-radius: var(--r2);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { color: var(--text); background: var(--raised); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

.tabpanel[hidden] { display: none; }

/* --------------------------------------------------------------- формы */

.field { margin-bottom: 12px; }
.field > label,
.lbl { display: block; color: var(--dim); font-size: 11.5px; font-weight: 550; margin-bottom: 5px; letter-spacing: .02em; }

input, select, textarea {
  width: 100%;
  background: #12151b;
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: var(--r2);
  padding: 8px 10px;
  font: inherit;
}
input::placeholder { color: var(--mute); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122,162,247,.15);
}
select { cursor: pointer; }

.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row > * { flex: 1 1 120px; min-width: 0; }
.row > .g2 { flex: 2 1 200px; }
.row > .g3 { flex: 3 1 280px; }
.row > .fix { flex: 0 0 auto; }

.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

button.b {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: var(--r2);
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
button.b:hover { filter: brightness(1.1); }
button.b:active { transform: translateY(1px); }
button.b.ghost { background: var(--raised); color: var(--text); border-color: var(--line2); }
button.b.ghost:hover { background: #262b36; filter: none; }
button.b.danger { background: var(--bad); color: #200d12; }
button.b.wide { width: 100%; justify-content: center; }

fieldset { border: 0; padding: 0; margin: 0 0 18px; }
fieldset:last-child { margin-bottom: 0; }
fieldset > legend {
  padding: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 9px;
}
.hint { color: var(--mute); font-size: 12px; margin: 8px 0 0; }

/* ----------------------------------------------------- поиск в списке */

.combo { position: relative; }
.combo-list {
  position: absolute;
  z-index: 40;
  left: 0; right: 0; top: calc(100% + 4px);
  max-height: 260px;
  overflow-y: auto;
  background: var(--raised);
  border: 1px solid var(--line2);
  border-radius: var(--r2);
  box-shadow: var(--shadow);
  padding: 4px;
}
.combo-list[hidden] { display: none; }
.combo-list .grp {
  padding: 7px 9px 4px;
  color: var(--mute);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.combo-list .opt {
  padding: 7px 9px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.combo-list .opt:hover,
.combo-list .opt.on { background: var(--accent); color: var(--accent-ink); }
.combo-list .opt .id { color: var(--mute); font-size: 11.5px; font-family: ui-monospace, monospace; }
.combo-list .opt:hover .id,
.combo-list .opt.on .id { color: rgba(13,17,23,.65); }
.combo-list .none { padding: 10px; color: var(--mute); }

/* ------------------------------------------------------------- вывод */

.notice { border-radius: var(--r); padding: 12px 14px; margin-bottom: 18px; border: 1px solid var(--line2); background: var(--surface); }
.notice.ok  { border-color: rgba(123,216,143,.35); background: rgba(123,216,143,.07); }
.notice.bad { border-color: rgba(247,118,142,.35); background: rgba(247,118,142,.07); }
.notice .t { font-weight: 640; margin-bottom: 8px; }

.log {
  background: #0b0d11;
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 11px 13px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  max-height: 340px;
  overflow: auto;
  color: #c9d1dc;
}

.foot { max-width: 1240px; margin: 0 auto; padding: 8px 20px 28px; color: var(--mute); font-size: 12px; }

@media (max-width: 640px) {
  main { padding: 14px; }
  .top-in { padding: 10px 14px; }
  .metric .v { font-size: 26px; }
}
