/* Всё локальное: шрифты системные, иначе пришлось бы ослаблять CSP. */

:root {
    --bg:        #110d0b;
    --bg-side:   #161110;
    --bg-card:   #1b1512;
    --bg-raise:  #231b17;
    --bg-input:  #0e0b09;
    --line:      #2e241e;
    --line-hi:   #3d3028;
    --text:      #efe6de;
    --muted:     #a39386;
    --faint:     #74665c;
    --accent:    #f0736a;
    --accent-2:  #f5a24c;
    --accent-dk: #8e3029;
    --ok:        #8cc084;
    --warn:      #e8b34f;
    --danger:    #ec5f55;
    --gold:      #f2c14e;
    --radius:    4px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

a { color: var(--text); }
a:hover { color: #fff; }
code { font-family: var(--mono); font-size: .9em; background: var(--bg-input); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
::selection { background: var(--accent-dk); color: #fff; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.inline { display: inline-block; margin: 0; }

.app { display: flex; min-height: 100vh; }

.side {
    position: sticky;
    top: 0;
    flex: 0 0 236px;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 14px;
    background: var(--bg-side);
    border-right: 1px solid var(--line);
}

.shell { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.brand, .auth__brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 6px;
    text-decoration: none;
    white-space: nowrap;
}

.brand__icon { image-rendering: pixelated; flex: 0 0 auto; }
.brand__text { display: flex; flex-direction: column; font-weight: 750; font-size: 16px; line-height: 1.15; letter-spacing: .01em; }
.brand__sub { color: var(--faint); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .18em; }
.brand__mark { color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; }

.nav__group {
    margin: 16px 10px 6px;
    color: var(--faint);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
}

.nav__item {
    padding: 7px 10px;
    border-radius: 3px;
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
}

.nav__item:hover { background: var(--bg-raise); color: var(--text); }

.nav__item.is-active {
    background: var(--bg-raise);
    color: var(--text);
    box-shadow: inset 2px 0 0 var(--accent);
}

.side__user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.who {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
    padding: 4px 6px;
    border-radius: 3px;
    text-decoration: none;
}

.who:hover, .who.is-active { background: var(--bg-raise); }
.who__name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }

.main { flex: 1 1 auto; width: 100%; max-width: 1600px; padding: 28px 32px 48px; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-head .page-title { margin-bottom: 4px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 18px; }
.page-sub { margin: 0; color: var(--muted); font-size: 13.5px; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.card--accent { border-color: var(--accent-dk); box-shadow: inset 3px 0 0 var(--accent); }

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.card__title {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.card__head .card__title { margin: 0; }

.footer { padding: 0 32px 24px; color: var(--faint); font-size: 12px; }

.status, .dot {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--muted);
}

.status::before, .dot::before {
    content: "";
    width: 7px;
    height: 7px;
    background: currentColor;
    flex: 0 0 auto;
}

.status--up { color: var(--ok); }
.status--down { color: var(--faint); }
.status--wait { color: var(--warn); }

.badge {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid var(--line-hi);
    color: var(--muted);
    background: var(--bg-input);
}

.badge--owner { color: var(--gold); border-color: rgba(242, 193, 78, .4); }
.badge--admin { color: var(--accent); border-color: rgba(240, 115, 106, .4); }
.badge--helper { color: var(--ok); border-color: rgba(140, 192, 132, .35); }

.result { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.result--success { color: var(--ok); }
.result--failure { color: var(--danger); }
.result--warning { color: var(--warn); }

.table-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }

.table th {
    text-align: left;
    color: var(--faint);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line-hi);
}

.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:hover td { background: rgba(255, 236, 220, .018); }
.table tr:last-child td { border-bottom: none; }
.table--users td { vertical-align: middle; }
.is-blocked { opacity: .5; }

/* Строка, которая ждёт действия человека: назначение без подтверждения. */
.is-pending td { background: rgba(232, 179, 79, .06); }

.th-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.th-sort:hover { color: var(--text); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.details-cell code { font-size: 12px; color: var(--muted); word-break: break-all; background: none; border: 0; padding: 0; }
.table--tg td, .table--tg th { vertical-align: middle; padding-left: 7px; padding-right: 7px; }
.table--tg td.actions { display: table-cell; width: 1%; }
.table--tg .actions form { display: block; margin: 0 0 4px; }
.table--tg .actions form:last-child { margin-bottom: 0; }
.table--tg .actions .btn { width: 100%; white-space: nowrap; }
.table--tg td:not(.actions) form.inline { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.table--tg .field__input--small { width: 124px; }
.ua { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form--narrow { max-width: 420px; }
.form--row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.field__label { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.field__input {
    background: var(--bg-input);
    border: 1px solid var(--line-hi);
    border-radius: 3px;
    color: var(--text);
    padding: 9px 11px;
    font-size: 14.5px;
    font-family: inherit;
    width: 100%;
}

.field__input::placeholder { color: var(--faint); }
.field__input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(245, 162, 76, .16); }
.field__input--code { font-family: var(--mono); font-size: 22px; letter-spacing: 6px; text-align: center; }
.field__input--small { padding: 6px 9px; font-size: 13.5px; width: auto; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { accent-color: var(--accent); }

.btn {
    display: inline-block;
    background: var(--bg-raise);
    color: var(--text);
    border: 1px solid var(--line-hi);
    border-bottom: 2px solid #0a0706;
    border-radius: 3px;
    padding: 8px 14px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn:hover { background: #2c221d; color: #fff; }
.btn:active { transform: translateY(1px); border-bottom-width: 1px; margin-bottom: 1px; }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn--primary { background: #d85a50; border-color: #ea7469; border-bottom-color: var(--accent-dk); color: #fff; }
.btn--primary:hover { background: #e2655b; }
.btn--danger { color: #ff9c94; border-color: rgba(236, 95, 85, .45); }
.btn--danger:hover { background: rgba(236, 95, 85, .12); }
.btn--ghost { background: transparent; border-color: transparent; border-bottom-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--bg-raise); color: var(--text); }
.btn--small { padding: 5px 10px; font-size: 12.5px; }
.btn--wide { width: 100%; }

.flash {
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: 3px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 14px;
    background: var(--bg-card);
}

.flash--ok { border-left-color: var(--ok); }
.flash--error { border-left-color: var(--danger); }
.flash--warning { border-left-color: var(--warn); }

.warn {
    border: 1px dashed rgba(232, 179, 79, .6);
    border-radius: 3px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--warn);
    margin: 0;
}

.stats { display: flex; flex-wrap: wrap; gap: 32px; margin: 0 0 16px; }
.stats__item { margin: 0; }
.stats dt { color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.stats dd { margin: 4px 0 0; font-size: 15px; }
.stats dd.stats__big { font-family: var(--mono); font-size: 28px; font-weight: 700; line-height: 1.1; }
.stats__of { font-size: 15px; font-weight: 400; color: var(--faint); }

.motd { margin-bottom: 14px; }
.motd__label { color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

.motd__text {
    font-family: var(--mono);
    font-size: 13px;
    background: var(--bg-input);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 10px 12px;
    margin: 6px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.link { color: var(--muted); font-size: 13.5px; }
.link:hover { color: var(--accent-2); }

.steps { color: var(--muted); font-size: 14px; padding-left: 20px; margin: 0 0 12px; }

.secret {
    font-family: var(--mono);
    font-size: 19px;
    letter-spacing: 2px;
    background: var(--bg-input);
    border: 1px dashed var(--accent-dk);
    border-radius: 3px;
    padding: 12px 14px;
    word-break: break-all;
    user-select: all;
    cursor: pointer;
}

.secret--uri { font-size: 12px; letter-spacing: 0; border-style: solid; border-color: var(--line); }

.codes { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px; }

.codes__item {
    font-family: var(--mono);
    font-size: 15px;
    background: var(--bg-input);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 7px 11px;
    user-select: all;
}

.details { margin: 12px 0; font-size: 14px; }
.details summary { cursor: pointer; color: var(--muted); }
.details summary:hover { color: var(--text); }

.pager { display: flex; align-items: center; gap: 14px; margin-top: 16px; font-size: 14px; }

.search { display: flex; align-items: center; gap: 8px; }

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.tabs__item {
    padding: 8px 12px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
}

.tabs__item:hover { color: var(--text); }
.tabs__item.is-active { color: var(--text); border-bottom-color: var(--accent); }

.tabs__count {
    margin-left: 7px;
    padding: 0 6px;
    border-radius: 3px;
    background: var(--bg-raise);
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--faint);
}

.tabs__item.is-active .tabs__count { color: var(--accent-2); }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.seg { display: inline-flex; border: 1px solid var(--line-hi); border-radius: 3px; overflow: hidden; }
.seg__item { padding: 5px 11px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.seg__item + .seg__item { border-left: 1px solid var(--line-hi); }
.seg__item:hover { color: var(--text); background: var(--bg-raise); }
.seg__item.is-active { color: var(--text); background: var(--bg-raise); box-shadow: inset 0 -2px 0 var(--accent-2); }

.empty { padding: 40px 20px; text-align: center; border: 1px dashed var(--line-hi); border-radius: var(--radius); }
.empty__title { margin: 0 0 4px; font-size: 16px; font-weight: 650; }

.head {
    image-rendering: pixelated;
    border-radius: 2px;
    background: var(--bg-raise);
    box-shadow: 0 2px 0 rgba(0, 0, 0, .45);
    flex: 0 0 auto;
}

.head--lg { box-shadow: 0 4px 0 rgba(0, 0, 0, .45); }

.rep-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.rep {
    display: grid;
    grid-template-columns: 40px minmax(150px, 210px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-hi);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
}

.rep:hover { background: var(--bg-raise); border-color: var(--line-hi); color: var(--text); }
.rep--warm { border-left-color: var(--accent-2); }
.rep--hot { border-left-color: var(--accent); }

.rep__who { display: flex; flex-direction: column; min-width: 0; }
.rep__nick { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.rep__meta { color: var(--faint); font-size: 12px; }

.rep__reasons { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

.chip {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    max-width: 100%;
    padding: 2px 8px;
    background: var(--bg-input);
    border: 1px solid var(--line);
    border-radius: 3px;
    font-size: 12.5px;
    color: #dccfc4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chip__n { font-family: var(--mono); font-size: 11.5px; color: var(--accent-2); }
.chip--more { color: var(--faint); border-style: dashed; }

.rep__count { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.rep__num { font-family: var(--mono); font-size: 22px; font-weight: 700; line-height: 1; }
.rep--warm .rep__num { color: var(--accent-2); }
.rep--hot .rep__num { color: var(--accent); }
.rep__split { display: flex; gap: 10px; }
.rep__split .dot { font-size: 11.5px; }
.dot--open { color: var(--accent-2); }
.dot--work { color: var(--warn); }
.dot--done { color: var(--faint); }

.back { display: inline-block; margin-bottom: 14px; color: var(--muted); font-size: 13.5px; text-decoration: none; }
.back:hover { color: var(--accent-2); }

.player { display: flex; align-items: center; gap: 24px; }
.player__info { min-width: 0; }
.player__nick { margin: 0; font-size: 26px; font-weight: 750; letter-spacing: -.01em; }
.player__uuid { display: inline-block; margin-top: 2px; color: var(--faint); font-size: 12px; background: none; border: 0; padding: 0; }
.stats--inline { margin: 16px 0 0; }

.soon {
    padding: 64px 20px;
    border: 1px dashed var(--line-hi);
    border-radius: var(--radius);
    text-align: center;
    font-size: 52px;
    font-weight: 800;
    letter-spacing: .4em;
    text-indent: .4em;
    color: var(--accent);
    text-shadow: 4px 4px 0 var(--accent-dk);
}

.auth-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.auth { width: 100%; max-width: 400px; padding: 24px 16px; }

.auth__card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 4px 0 rgba(0, 0, 0, .35);
    padding: 26px 24px;
}

.auth__brand { margin-bottom: 20px; padding: 0; }
.auth__title { font-size: 19px; margin: 0 0 6px; }
.auth__hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.auth__note { color: var(--faint); font-size: 12px; text-align: center; margin-top: 18px; }
.cf-turnstile { min-height: 65px; }

@media (max-width: 900px) {
    .app { flex-direction: column; }

    .side {
        position: static;
        height: auto;
        flex: 0 0 auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px 16px;
        padding: 12px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .nav { order: 3; flex: 1 1 100%; flex-direction: row; overflow-x: auto; gap: 4px; }
    .nav__group { display: none; }
    .nav__item { white-space: nowrap; }
    .nav__item.is-active { box-shadow: inset 0 -2px 0 var(--accent); }
    .side__user { margin-left: auto; padding-top: 0; border-top: 0; }
    .main { padding: 20px 16px 40px; }
    .footer { padding: 0 16px 20px; }
    .rep { grid-template-columns: 40px minmax(0, 1fr) auto; }
    .rep__reasons { grid-column: 1 / -1; }
    .player { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 700px) {
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dd { margin-bottom: 8px; }
    .form--row { flex-direction: column; align-items: stretch; }
    .field { min-width: 0; }
    .soon { font-size: 36px; }
}

.status--bad { color: var(--danger); }

.who-cell { display: flex; align-items: center; gap: 10px; }
.who-cell__name { font-weight: 700; }

.grp {
    display: inline-block;
    margin-top: 2px;
    padding: 0 6px;
    border: 1px solid var(--line-hi);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
}

.num { font-family: var(--mono); font-weight: 700; }
.num--ok { color: var(--ok); }
.num--bad { color: var(--accent); }
.num__of { font-family: var(--mono); color: var(--faint); font-size: 12px; }

.bar {
    display: block;
    width: 72px;
    height: 4px;
    margin-top: 5px;
    border: 0;
    border-radius: 0;
    background: var(--bg-input);
    appearance: none;
}

.bar::-webkit-progress-bar { background: var(--bg-input); }
.bar::-webkit-progress-value { background: var(--accent); }
.bar::-moz-progress-bar { background: var(--accent); }
.bar--ok::-webkit-progress-value { background: var(--ok); }
.bar--ok::-moz-progress-bar { background: var(--ok); }

.table--staff td { vertical-align: middle; }
.table--norms td { vertical-align: middle; }
.field__input--num { width: 64px; padding: 5px 7px; font-family: var(--mono); font-size: 13px; }

.num--warn { color: var(--accent-2); }

.ac-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.ac-grid .card { margin-bottom: 0; }
.ac__big { font-size: 34px; line-height: 1.1; }
.ac__cap { color: var(--faint); font-size: 12px; margin-bottom: 12px; }
.ac__kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 13.5px; }
.ac__kv dt { color: var(--muted); }
.ac__kv dd { margin: 0; font-family: var(--mono); text-align: right; }
.ac__list { list-style: none; margin: 0 0 12px; padding: 0; font-size: 13px; }
.ac__list li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.ac__list li:last-child { border-bottom: 0; }
.ac__kv dd.ac__when { font-family: var(--font); color: var(--muted); }
.ac__kv + .ac__list { margin-top: 12px; }
