/* ============================================================================
 *  Админка PARI · TI2026
 *  Палитра и типографика унаследованы от мини-аппа: тот же уголь, золото и
 *  шанхайский красный, те же жёсткие тени без скруглений. Но плотность —
 *  десктопная: таблицы, а не карточки, и никакой декоративной анимации.
 * ==========================================================================*/

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/f02.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/f05.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/f12.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/f15.woff2') format('woff2');
}

:root {
  --ink:      #0f0f0f;
  --panel:    #161616;
  --panel-2:  #1c1c1c;
  --sunk:     #101010;
  --line:     #2c2c2c;
  --line-2:   #3a3a3a;
  --text:     #EDE6D6;
  --muted:    #8f8875;
  --dim:      #6f6a5c;
  --gold:     #E8C15A;
  --gold-dk:  #6b511a;
  --red:      #E0453A;
  --red-lt:   #F0685A;
  --red-dk:   #A32E22;
  --green:    #5BC98A;
  --teal:     #2BE0BE;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.seal {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  background: linear-gradient(160deg, #D8483A, var(--red-dk));
  border: 2px solid #6d1f16;
  box-shadow: 3px 3px 0 #000;
  color: #FFE9A8; font-size: 17px;
}

/* ------------------------------------------------------------------- вход */

.login {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(520px 340px at 82% -40px, rgba(224,69,58,.16), transparent 70%),
    radial-gradient(460px 380px at -8% 40%, rgba(232,193,90,.10), transparent 70%),
    var(--ink);
}
.login__box {
  width: 100%; max-width: 380px;
  background: var(--panel);
  border: 2px solid var(--line-2);
  box-shadow: 8px 8px 0 #000;
  padding: 28px 26px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login__title { font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.login__sub { font-size: 10px; color: var(--red); letter-spacing: 2px; margin-top: 3px; }
.login__err {
  background: rgba(224,69,58,.1); border: 2px solid var(--red);
  color: var(--red-lt); font-size: 12px; padding: 9px 11px;
}
.login__note { font-size: 11px; color: var(--dim); text-align: center; margin-top: 2px; }

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

.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }

.side {
  background: var(--panel);
  border-right: 2px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side__brand { display: flex; align-items: center; gap: 11px; padding: 18px 16px; border-bottom: 2px solid var(--line); }
.side__title { font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.side__sub { font-size: 9px; color: var(--red); letter-spacing: 2px; margin-top: 2px; }

.nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav__i {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 10px 16px;
  background: none; border: 0; border-left: 3px solid transparent;
  color: var(--muted); font: inherit; font-size: 13px; text-align: left;
  cursor: pointer;
}
.nav__i:hover { color: var(--text); background: rgba(255,255,255,.03); }
.nav__i.is-on { color: var(--gold); border-left-color: var(--gold); background: rgba(232,193,90,.06); }

.badge {
  min-width: 20px; padding: 1px 6px;
  background: var(--gold); color: var(--ink);
  font-size: 11px; font-weight: 600; text-align: center;
}
.badge--red { background: var(--red); color: #fff; }

.side__foot { padding: 12px 16px; border-top: 2px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.who { font-size: 11px; line-height: 1.4; min-width: 0; }
.who em { display: block; color: var(--dim); font-style: normal; font-size: 10px; text-transform: uppercase; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 24px; border-bottom: 2px solid var(--line);
  position: sticky; top: 0; background: var(--ink); z-index: 5;
}
.top__title { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: .3px; }
.top__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 22px 24px 60px; }

/* --------------------------------------------------------------- элементы */

.btn {
  padding: 9px 15px;
  background: var(--panel-2); border: 2px solid var(--line-2);
  color: var(--text); font: inherit; font-size: 13px;
  cursor: pointer; box-shadow: 3px 3px 0 #000;
  transition: transform .06s;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn--gold { background: var(--gold); border-color: #0e0e0e; color: var(--ink); box-shadow: 3px 3px 0 var(--gold-dk); font-weight: 600; }
.btn--gold:hover { background: #FFE9A8; color: var(--ink); border-color: #0e0e0e; }
.btn--red { background: var(--red-dk); border-color: #6d1f16; color: #FFE9DF; }
.btn--red:hover { background: var(--red); color: #fff; border-color: #6d1f16; }
.btn--green { background: rgba(63,166,106,.16); border-color: #3FA66A; color: var(--green); }
.btn--ghost { background: transparent; box-shadow: none; }
.btn--sm { padding: 5px 10px; font-size: 12px; box-shadow: 2px 2px 0 #000; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
input, select, textarea {
  background: var(--sunk); border: 2px solid var(--line-2);
  color: var(--text); font: inherit; font-size: 13px;
  padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; }
textarea { resize: vertical; min-height: 90px; }
input[type=checkbox] { width: auto; accent-color: var(--gold); }

.grid { display: grid; gap: 14px; }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

.card {
  background: var(--panel-2); border: 2px solid var(--line);
  box-shadow: 4px 4px 0 #000; padding: 16px;
}
.card__t { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.4px; margin-bottom: 10px; }
.card__v { font-size: 27px; font-weight: 600; color: var(--gold); line-height: 1.1; }
.card__x { font-size: 12px; color: var(--dim); margin-top: 6px; }

.section { margin-bottom: 26px; }
.section > h2 {
  font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.6px;
  margin: 0 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--line);
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 400; background: var(--panel); position: sticky; top: 0; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; border: 2px solid var(--line); box-shadow: 4px 4px 0 #000; background: var(--panel-2); }

.tag { display: inline-block; padding: 2px 7px; font-size: 11px; border: 1px solid var(--line-2); color: var(--muted); }
.tag--gold  { border-color: var(--gold); color: var(--gold); background: rgba(232,193,90,.08); }
.tag--red   { border-color: var(--red); color: var(--red-lt); background: rgba(224,69,58,.08); }
.tag--green { border-color: #3FA66A; color: var(--green); background: rgba(63,166,106,.1); }
.tag--teal  { border-color: #1FC7A8; color: var(--teal); background: rgba(43,224,190,.1); }

.risk { display: inline-block; min-width: 34px; padding: 2px 6px; text-align: center; font-size: 11px; font-weight: 600; }
.risk--lo { background: rgba(63,166,106,.14); color: var(--green); }
.risk--md { background: rgba(232,193,90,.14); color: var(--gold); }
.risk--hi { background: rgba(224,69,58,.16); color: var(--red-lt); }

.empty { padding: 34px 18px; text-align: center; color: var(--dim); font-size: 13px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 6px; }
.danger-zone { border-color: var(--red-dk); box-shadow: 4px 4px 0 rgba(224,69,58,.2); }

/* ------------------------------------------------------------------ тост */

.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 100;
  max-width: 360px; padding: 12px 15px;
  background: var(--panel); border: 2px solid var(--gold);
  box-shadow: 5px 5px 0 #000; font-size: 13px;
}
.toast--err { border-color: var(--red); color: var(--red-lt); }

/* ----------------------------------------------------------------- модал */

.modal { border: 0; padding: 0; background: transparent; max-width: 520px; width: 92vw; }
.modal::backdrop { background: rgba(0,0,0,.72); }
.modal__box { background: var(--panel); border: 2px solid var(--gold); box-shadow: 8px 8px 0 #000; padding: 22px; }
.modal__title { margin: 0 0 14px; font-size: 16px; }
.modal__body { display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------------------------------------------------------------- мобилка */

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 2px solid var(--line); }
  .side__brand { border-bottom: 0; }
  .nav { display: flex; overflow-x: auto; padding: 0; width: 100%; border-top: 2px solid var(--line); }
  .nav__i { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .nav__i.is-on { border-left: 0; border-bottom-color: var(--gold); }
  .content { padding: 16px; }
  .top { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
