:root {
    --bg: #f3f5f7;
    --panel: #ffffff;
    --ink: #16202a;
    --muted: #66727f;
    --line: #d8dee6;
    --brand: #0f766e;
    --brand-dark: #0b5c56;
    --danger: #b42318;
    --warn: #b76e00;
    --good: #12753a;
    --shadow: 0 14px 32px rgba(20, 29, 38, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.45 "Segoe UI", Arial, sans-serif;
}

a {
    color: var(--brand-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    background: #eef2f5;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px 5px;
}

h1, h2 {
    margin: 0;
}

h1 {
    font-size: 26px;
}

h2 {
    font-size: 18px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 14px 28px;
    background: #111827;
    color: #fff;
}

.brand {
    font-weight: 700;
    font-size: 19px;
    letter-spacing: 0;
}

.brand.large {
    font-size: 28px;
}

.layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: calc(100vh - 68px);
}

.sidebar {
    padding: 24px 16px;
    background: #ffffff;
    border-right: 1px solid var(--line);
}

.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--ink);
    margin-bottom: 4px;
}

.nav-link:hover {
    background: #eef6f5;
    text-decoration: none;
}

.sidebar-note {
    margin-top: 24px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    font-size: 12px;
}

.content {
    padding: 28px;
    overflow: auto;
}

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

.muted,
.help {
    color: var(--muted);
}

.help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}

.flash {
    padding: 12px 14px;
    border: 1px solid #b8dfd9;
    background: #e7f8f5;
    border-radius: 6px;
    margin-bottom: 18px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.metric,
.panel,
.login-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric {
    padding: 16px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.metric strong {
    display: block;
    font-size: 25px;
}

.panel {
    padding: 18px;
    margin-bottom: 22px;
}

.panel.narrow {
    max-width: 980px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    vertical-align: top;
    padding: 10px 9px;
    border-bottom: 1px solid var(--line);
}

th {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 28px;
}

.status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef2f5;
    color: #344050;
    font-size: 12px;
    font-weight: 700;
}

.status.active {
    background: #e4f7eb;
    color: var(--good);
}

.status.blocked,
.status.not_found,
.status.max_accounts_reached,
.status.expired,
.status.wrong_product,
.status.version_not_allowed {
    background: #fde8e6;
    color: var(--danger);
}

.status.suspended,
.status.activation_disabled,
.status.missing_key {
    background: #fff3d6;
    color: var(--warn);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--line);
    cursor: pointer;
    font-weight: 700;
    color: var(--ink);
    background: #fff;
}

.button:hover {
    text-decoration: none;
    filter: brightness(0.98);
}

.button.primary {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.button.secondary {
    background: #f8fafc;
}

.button.danger {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.button.warning {
    color: #111827;
    background: #ffd166;
    border-color: #f5bf35;
}

.button.good {
    color: #fff;
    background: var(--good);
    border-color: var(--good);
}

.button.small {
    min-height: 28px;
    padding: 4px 9px;
    font-size: 12px;
}

.button.full {
    width: 100%;
}

.button-row,
.search-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-row {
    margin-bottom: 16px;
}

input,
select,
textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #c8d0d9;
    border-radius: 6px;
    font: inherit;
    background: #fff;
}

textarea {
    resize: vertical;
}

label {
    display: block;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 16px;
}

.span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.license-key {
    font-size: 16px;
}

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    width: min(420px, 100%);
    padding: 28px;
}

.stack {
    display: grid;
    gap: 14px;
}

@media (max-width: 960px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-note {
        display: none;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }
}
