/* ============ ТЕМЫ ============ */
:root {
    --bg: #f4f4f5;
    --text: #1a1a1a;
    --panel: #ffffff;
    --panel-2: #fafafa;
    --border: #e3e3e6;
    --border-soft: #eeeeee;
    --muted: #6b6b6b;
    --code-bg: #ececee;
    --accent: #993556;
    --accent-2: #862f4b;
    --accent-soft: #fbeaf0;
    --nick: #d4537e;
}

/* Тёмная палитра — явный выбор */
:root[data-theme="dark"] {
    --bg: #0f1115;
    --text: #e6e7ea;
    --panel: #1b1e24;
    --panel-2: #22262e;
    --border: #2c313a;
    --border-soft: #23272f;
    --muted: #8a8d94;
    --code-bg: #262b33;
}

/* Системная тема (атрибут не выставлен) → следуем за ОС */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #0f1115;
        --text: #e6e7ea;
        --panel: #1b1e24;
        --panel-2: #22262e;
        --border: #2c313a;
        --border-soft: #23272f;
        --muted: #8a8d94;
        --code-bg: #262b33;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

/* ============ РАСКЛАДКА ============ */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- САЙДБАР (всегда тёмный) ---------- */
.sidebar {
    width: 220px;
    background: #16181c;
    padding: 1rem 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 16px;
    border-bottom: 0.5px solid #2a2d33;
    margin-bottom: 12px;
}

.sidebar-logo .icon-box {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-soft);
    font-weight: 600;
    font-size: 13px;
}

.sidebar-logo span {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-section {
    padding: 0 12px;
    flex: 1;
}

.sidebar-label {
    color: #5f6168;
    font-size: 11px;
    margin: 14px 0 6px 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #a8a9ac;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: #1f2126;
    color: #fff;
}

.nav-item.active {
    background: var(--accent);
    color: var(--accent-soft);
    font-weight: 500;
}

.nav-item.active:hover {
    background: var(--accent);
}

/* ---------- ВЫПАДАЮЩЕЕ МЕНЮ ---------- */
.has-dropdown {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chevron {
    font-size: 12px;
    transition: transform 0.15s ease;
}

.chevron.open {
    transform: rotate(90deg);
}

.submenu {
    display: none;
    flex-direction: column;
    padding-left: 14px;
    margin-top: 2px;
    overflow: hidden;
}

.submenu.open {
    display: flex;
}

.submenu .nav-item {
    font-size: 13px;
    padding: 8px 10px;
}

/* ---------- БЛОК ЮЗЕРА ---------- */
.sidebar-user {
    padding: 0 16px 14px;
    border-bottom: 0.5px solid #2a2d33;
    margin-bottom: 8px;
    color: #a8a9ac;
    font-size: 12px;
}

.sidebar-user .uname {
    color: #fff;
    font-weight: 500;
}

.sidebar-user .badge {
    background: var(--accent);
    color: var(--accent-soft);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 5px;
    margin-left: 4px;
    display: inline-block;
}

.sidebar-user .badge-owner {
    background: #8a6d1f;
    color: #fdf3d6;
}

.sidebar-user a {
    color: var(--nick);
}

.sidebar-user .u-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 7px;
    font-size: 11px;
    color: #7a7c82;
}

.sidebar-user .u-row .u-val {
    color: var(--nick);
    font-weight: 500;
    text-align: right;
}

.sidebar-user .u-logout {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 0.5px solid #2a2d33;
}

/* ---------- ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ ---------- */
.sidebar-footer {
    padding: 10px 14px 4px;
    border-top: 0.5px solid #2a2d33;
}

.theme-switch {
    display: flex;
    gap: 4px;
}

.theme-switch button {
    flex: 1;
    font-size: 10px;
    padding: 5px 4px;
    border: 0;
    border-radius: 6px;
    background: #1f2126;
    color: #a8a9ac;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.theme-switch button:hover {
    background: #2a2d33;
    color: #fff;
}

.theme-switch button.active {
    background: var(--accent);
    color: var(--accent-soft);
}

/* ---------- КОНТЕНТ ---------- */
.content {
    flex: 1;
    padding: 1.5rem 2rem;
}

.content h1 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 1rem;
}

.placeholder {
    color: var(--muted);
    font-size: 14px;
}

/* ---------- ТАБЛИЦА ЛОГОВ ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 0.5px solid var(--border);
    color: var(--muted);
    font-weight: 400;
}

td {
    padding: 8px 6px;
    border-bottom: 0.5px solid var(--border-soft);
}

.nick {
    color: var(--nick);
    font-weight: 500;
}

.tag {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 5px;
}

.tag-green {
    background: #e3f5ea;
    color: #1e7a45;
}

.tag-red {
    background: #fae3e8;
    color: #993556;
}

code {
    background: var(--code-bg);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}

/* ---------- ТУЛБАР (поиск) ---------- */
.toolbar {
    display: flex;
    gap: 8px;
    margin: 4px 0 8px;
}

.toolbar input[type=text] {
    flex: 1;
    max-width: 280px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
}

.toolbar input[type=text]:focus {
    outline: none;
    border-color: var(--accent);
}

.toolbar button {
    padding: 8px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-soft);
    cursor: pointer;
    font-size: 13px;
}

.toolbar button:hover {
    background: var(--accent-2);
}

/* ============ ФОРМЫ ВХОДА / РЕГИСТРАЦИИ ============ */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-box {
    width: 100%;
    max-width: 360px;
    background: var(--panel);
    padding: 28px;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .12);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-logo .icon-box {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-soft);
    font-weight: 600;
    font-size: 14px;
}

.auth-logo span {
    font-size: 16px;
    font-weight: 600;
}

.auth-box h1 {
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 18px;
    color: var(--muted);
}

.auth-box label {
    display: block;
    margin-bottom: 13px;
    font-size: 13px;
    color: var(--muted);
}

.auth-box input {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    font-size: 14px;
}

.auth-box input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--panel);
}

.auth-box button {
    width: 100%;
    padding: 11px;
    margin-top: 4px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-soft);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.auth-box button:hover {
    background: var(--accent-2);
}

.error {
    background: #fae3e8;
    color: #993556;
    padding: 9px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.muted {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    margin-top: 14px;
}

.muted a {
    color: var(--accent);
    font-weight: 500;
}

/* ============ ПРОФИЛЬ ============ */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    flex-shrink: 0;
}

.profile-avatar.admin {
    background: linear-gradient(135deg, #993556, #5c1f33);
}

.profile-avatar.player {
    background: linear-gradient(135deg, #3a6b99, #1f3f5c);
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-name-row .nick {
    font-size: 18px;
    font-weight: 500;
}

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
}

.badge.online {
    background: #e3f5ec;
    color: #1d9e75;
}

.badge.admin-level {
    background: #3a2230;
    color: #f0a8c0;
}

.profile-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.card {
    background: var(--panel);
    border: 0.5px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}

.card-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric-box {
    background: var(--panel);
    border: 0.5px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.metric-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 20px;
    font-weight: 500;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 0;
}

.row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--panel-2);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.inventory-slot {
    position: relative;
    background: var(--panel-2);
    border-radius: 8px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
    padding: 8px;
}

.inventory-slot .inv-img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.inventory-slot .inv-name {
    color: var(--text);
    line-height: 1.2;
}

.inventory-slot .inv-amount {
    position: absolute;
    right: 4px;
    bottom: 3px;
    background: var(--accent);
    color: var(--accent-soft);
    font-weight: 600;
    font-size: 10px;
    padding: 0 5px;
    border-radius: 6px;
}

/* ---------- ВКЛАДКИ ПРОФИЛЯ ---------- */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.tabs .tab {
    padding: 8px 16px;
    font-size: 13px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 500;
}

/* ---------- НОМЕРНОЙ ЗНАК ---------- */
.plate {
    position: relative;
    display: inline-block;
    width: 132px;
    height: 33px;
    /* 4:1, как 512x128 */
    background-size: 100% 100%;
    background-repeat: no-repeat;
    vertical-align: middle;
}

/* Текст номера — общий holder (только шрифт/цвет) */
.plate .plate-text {
    position: absolute;
    inset: 0;
    z-index: 2;
    font-family: "Consolas", "Courier New", monospace;
    font-weight: 700;
    font-size: 11px;
    color: #111;
    line-height: 1;
    white-space: nowrap;
}

/* Номер и регион позиционируются НЕЗАВИСИМО (без обрезки) */
.plate .plate-main,
.plate .plate-region {
    position: absolute;
    top: 6%;
    bottom: 26%;
    display: flex;
    align-items: center;
}

.plate .plate-main {
    left: 4%;
    letter-spacing: 0.5px;
}

.plate .plate-region {
    right: 29%;
}

/* кастом без региона — номер по центру */
.plate--custom .plate-main {
    left: 4%;
    right: 12%;
    justify-content: center;
}

/* ===== Настройки под каждый тип =====
   Для каждого можно крутить:
     left/right       — лево-право
     top/bottom       — выше-ниже
     font-size        — размер букв
     letter-spacing   — расстояние между буквами (растянуть/сжать)
*/

/* РФ */
.plate--rus .plate-main {
    left: 7%;
    top: 17%;
    bottom: 26%;
    font-size: 17px;
    letter-spacing: 4.5px;
}

.plate--rus .plate-region {
    right: 8%;
    top: 4%;
    bottom: 26%;
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* Казахстан */
.plate--kz .plate-main {
    left: 26%;
    top: 17%;
    bottom: 26%;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.plate--kz .plate-region {
    right: 7%;
    top: 19%;
    bottom: 26%;
    font-size: 15px;
    letter-spacing: 0.5px;
}

/* Беларусь */
.plate--by .plate-main {
    left: 21%;
    top: 14%;
    bottom: 26%;
    font-size: 19px;
    letter-spacing: 0.5px;
}

.plate--by .plate-region {
    right: 29%;
    top: 6%;
    bottom: 26%;
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* Украина */
.plate--ua .plate-main {
    left: 14%;
    top: 17%;
    bottom: 26%;
    font-size: 17px;
    letter-spacing: 0.5px;
}

.plate--ua .plate-region {
    right: 29%;
    top: 6%;
    bottom: 26%;
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* Кастомный (без региона) */
.plate--custom .plate-main {
    left: 11%;
    right: 12%;
    top: 15%;
    bottom: 26%;
    font-size: 19px;
    letter-spacing: 0.5px;
}

/* Полиция */
.plate--police .plate-main {
    left: 4%;
    top: 6%;
    bottom: 26%;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.plate--police .plate-region {
    right: 29%;
    top: 6%;
    bottom: 26%;
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* Такси */
.plate--taxi .plate-main {
    left: 4%;
    top: 6%;
    bottom: 26%;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.plate--taxi .plate-region {
    right: 29%;
    top: 6%;
    bottom: 26%;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.moderation-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.moderation-grid .mod-value {
    font-size: 18px;
    font-weight: 500;
}

.moderation-grid .mod-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}