/* Аргумент · Админка — простая светлая тема */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1f2328;
    --text-soft: #5b6270;
    --text-faint: #8a909c;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --ok: #16a34a;
    --ok-bg: #f0fdf4;
    --ok-border: #bbf7d0;
    --radius: 8px;
    --sidebar-w: 240px;
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

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

h1, h2, h3 {
    margin: 0;
    font-weight: 600
}

button {
    font: inherit
}

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

/* ── AUTH ── */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-brand .mark {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 10px;
}

.auth-brand .name {
    display: block;
    font-weight: 600;
    font-size: 15px;
}

.auth-title {
    font-size: 18px;
    margin-bottom: 4px;
    text-align: center;
}

.auth-sub {
    color: var(--text-soft);
    font-size: 13px;
    text-align: center;
    margin-bottom: 24px;
}

.auth-foot {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-faint);
}

/* ── APP LAYOUT (flex, не grid — надёжнее) ── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand .mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar-brand .name {
    font-weight: 600;
    font-size: 14px;
}

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

.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-faint);
    padding: 8px 10px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius);
    color: var(--text-soft);
    font-size: 13.5px;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-link.active {
    background: #eff6ff;
    color: var(--primary);
}

.nav-link .ic {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
}

.sidebar-foot {
    border-top: 1px solid var(--border);
    padding: 12px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 10px;
}

.sidebar-user .av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.sidebar-user .meta {
    min-width: 0;
    flex: 1;
}

.sidebar-user .nm {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .em {
    font-size: 11.5px;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    font-size: 13px;
}

.logout-btn:hover {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

.content-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.topbar-title {
    font-weight: 600;
    font-size: 15px;
}

.topbar-crumb {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 1px;
}

.main {
    flex: 1;
    padding: 24px;
    max-width: 1100px;
    width: 100%;
}

/* ── общие компоненты ── */
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.flash.ok {
    background: var(--ok-bg);
    border-color: var(--ok-border);
    color: var(--ok);
}

.flash.error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

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

.page-head h1 {
    font-size: 20px;
}

.page-sub {
    color: var(--text-soft);
    font-size: 13px;
    margin-top: 4px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card-pad {
    padding: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-soft);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg);
    color: var(--text);
}

.btn-danger {
    background: var(--surface);
    border-color: var(--danger-border);
    color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-bg);
}

.btn .ic {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.field .hint {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 6px;
}

.input {
    width: 100%;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font: inherit;
    padding: 0 12px;
    border-radius: var(--radius);
    outline: none;
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.input.is-invalid {
    border-color: var(--danger);
}

.field-error {
    color: var(--danger);
    font-size: 12.5px;
    margin-top: 6px;
}

.pass-field {
    position: relative;
}

.pass-field .input {
    padding-right: 42px;
}

.pass-toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--text-faint);
    cursor: pointer;
}

.pass-toggle .ic {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
}

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

.checkbox-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.checkbox-row label {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

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

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.data th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-faint);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

table.data td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

table.data tbody tr:last-child td {
    border-bottom: 0;
}

.cell-strong {
    font-weight: 600;
}

.cell-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
}

.icon-btn:hover {
    background: var(--bg);
}

.icon-btn.danger:hover {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

.icon-btn .ic {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: #eff6ff;
    color: var(--primary);
    margin-left: 6px;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-soft);
}

.empty-state h3 {
    font-size: 15px;
    color: var(--text);
    margin-bottom: 6px;
}

.pagination {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: var(--radius);
    font-size: 13px;
    border: 1px solid transparent;
}

.pagination a:hover {
    border-color: var(--border);
}

.pagination .active span {
    background: var(--primary);
    color: #fff;
}

.pagination .disabled span {
    color: var(--text-faint);
}

.stat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1 1 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.stat-card .stat-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-faint);
    font-weight: 600;
}

.stat-card .stat-value {
    font-weight: 700;
    font-size: 18px;
    margin-top: 8px;
}

/* модалка подтверждения */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s;
}

.confirm-modal.open {
    opacity: 1;
    visibility: visible;
}

.confirm-modal-ov {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .4);
}

.confirm-modal-box {
    position: relative;
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px;
}

.confirm-modal-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.confirm-modal-text {
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.confirm-modal-actions .btn {
    flex: 1;
}

.sidebar-toggle {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-scrim {
    display: none;
}

/* ── responsive ── */
@media (max-width: 820px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(260px, 82vw);
        flex: none;
        transform: translateX(-100%);
        transition: transform .2s;
        z-index: 90;
    }

    .sidebar.open {
        transform: none;
    }

    .sidebar-scrim.open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .35);
        z-index: 89;
    }

    .sidebar-toggle {
        display: flex;
    }

    .content-col {
        display: block;
    }
}

@media (max-width: 560px) {
    .main {
        padding: 16px;
    }

    .topbar {
        padding: 0 14px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }
}
