:root {
    --bg: #07111c;
    --bg-2: #0a1826;
    --panel: #0d1d2c;
    --panel-2: #102438;
    --line: rgba(160, 184, 205, .17);
    --line-strong: rgba(160, 184, 205, .29);
    --text: #edf5fb;
    --muted: #8fa4b8;
    --accent: #f2a228;
    --accent-2: #ffc45f;
    --green: #43d99b;
    --red: #ff7078;
    --yellow: #ffc857;
    --shadow: 0 30px 90px rgba(0, 0, 0, .4);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 92% 5%, rgba(242, 162, 40, .08), transparent 28rem),
        var(--bg);
}
a { color: inherit; }
button, input, select { font: inherit; }
code, pre { font-family: Consolas, "Cascadia Code", monospace; }
small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.muted { color: var(--muted); }
.eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .22em;
}
.online-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(67, 217, 155, .08), 0 0 16px rgba(67, 217, 155, .55);
}
.brand-logo {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(242, 162, 40, .45);
    color: var(--accent-2);
    background: linear-gradient(135deg, rgba(242, 162, 40, .18), rgba(242, 162, 40, .03));
    font-weight: 950;
    letter-spacing: -.06em;
}

/* Login */
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(380px, .96fr) minmax(460px, 1.04fr);
}
.login-brand {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    padding: clamp(34px, 5vw, 72px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--line);
    background:
        linear-gradient(145deg, rgba(13, 38, 58, .98), rgba(5, 17, 29, .99)),
        repeating-linear-gradient(0deg, transparent, transparent 43px, rgba(255, 255, 255, .03) 44px),
        repeating-linear-gradient(90deg, transparent, transparent 43px, rgba(255, 255, 255, .03) 44px);
}
.login-brand:after {
    content: "";
    position: absolute;
    width: 460px;
    height: 460px;
    right: -220px;
    bottom: -150px;
    border: 1px solid rgba(242, 162, 40, .18);
    border-radius: 50%;
    box-shadow: 0 0 0 75px rgba(242, 162, 40, .025), 0 0 0 150px rgba(242, 162, 40, .017);
}
.brand-top, .brand-copy, .brand-security { position: relative; z-index: 1; }
.brand-top { display: flex; align-items: center; gap: 14px; }
.brand-top strong { display: block; font-size: 22px; }
.brand-top small { margin-top: 2px; letter-spacing: .14em; }
.brand-copy { max-width: 620px; }
.brand-copy h1 {
    margin: 0;
    font-size: clamp(44px, 5.5vw, 78px);
    line-height: .94;
    letter-spacing: -.065em;
}
.brand-copy p {
    max-width: 520px;
    margin: 28px 0 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.8;
}
.brand-security { display: grid; gap: 13px; color: #bccbd8; font-size: 13px; }
.brand-security span { display: flex; align-items: center; gap: 11px; }
.brand-security i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.login-area {
    min-height: 100vh;
    padding: 36px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 24px;
}
.login-card {
    width: min(100%, 520px);
    padding: clamp(28px, 4vw, 48px);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(15, 35, 54, .98), rgba(8, 24, 39, .98));
    box-shadow: var(--shadow);
}
.login-card header { display: flex; gap: 18px; margin-bottom: 32px; }
.shield {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(242, 162, 40, .35);
    color: var(--accent);
    background: rgba(242, 162, 40, .08);
    font-size: 22px;
    font-weight: 900;
}
.login-card h2 { margin: 0; font-size: 31px; letter-spacing: -.04em; }
.login-card header p { margin: 8px 0 0; color: var(--muted); line-height: 1.6; }
.alert {
    margin-bottom: 23px;
    padding: 13px 14px;
    border: 1px solid rgba(255, 112, 120, .3);
    color: #ffc2c6;
    background: rgba(255, 112, 120, .08);
    font-size: 13px;
}
.login-card form { display: grid; }
.login-card label, .stack-form label {
    margin: 0 0 8px;
    color: #cbd7e0;
    font-size: 13px;
    font-weight: 750;
}
.login-card label:not(:first-of-type) { margin-top: 20px; }
.field { position: relative; }
.field > span {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: #71879a;
}
.field input {
    width: 100%;
    height: 52px;
    padding: 0 70px 0 46px;
    border: 1px solid var(--line-strong);
    outline: 0;
    color: var(--text);
    background: rgba(3, 14, 24, .76);
}
.field input:focus, .stack-form input:focus, .stack-form select:focus, .search-form input:focus {
    border-color: rgba(242, 162, 40, .72);
    box-shadow: 0 0 0 4px rgba(242, 162, 40, .08);
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 11px;
    transform: translateY(-50%);
    border: 0;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}
.primary-button, .secondary-button, .danger-button, .warning-button, .success-button {
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-weight: 850;
}
.primary-button {
    min-height: 50px;
    margin-top: 28px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #241604;
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
}
.primary-button.compact { min-height: 38px; margin-top: 8px; justify-content: center; }
.login-card footer {
    margin-top: 25px;
    padding-top: 22px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}
.login-note { margin: 0; color: #62788d; font-size: 11px; letter-spacing: .05em; }

/* Admin */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 23px 18px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(8, 25, 39, .99), rgba(6, 18, 29, .99));
}
.sidebar-brand { padding: 0 7px; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.sidebar-brand strong { display: block; font-size: 20px; }
.sidebar-brand small { margin-top: 1px; letter-spacing: .12em; }
.sidebar nav { display: grid; gap: 5px; margin-top: 40px; }
.sidebar nav a {
    min-height: 43px;
    padding: 0 13px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 720;
}
.sidebar nav a:hover { color: var(--text); background: rgba(255, 255, 255, .025); }
.sidebar nav a.active {
    color: var(--text);
    border-color: var(--line);
    background: linear-gradient(90deg, rgba(242, 162, 40, .12), rgba(242, 162, 40, .025));
    box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar nav a span { width: 20px; color: var(--accent); text-align: center; }
.nav-title { margin: 22px 13px 8px; color: #5f7488; font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.sidebar-user {
    margin-top: auto;
    padding: 16px 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
}
.sidebar-user strong { display: block; font-size: 12px; }
.sidebar-user button { border: 0; color: #ff9da2; background: transparent; cursor: pointer; font-size: 12px; font-weight: 800; }
.main-column { min-width: 0; }
.topbar {
    height: 66px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(8, 23, 36, .88);
    color: var(--muted);
    font-size: 12px;
}
.topbar span { display: flex; align-items: center; gap: 11px; }
.page-content { padding: clamp(25px, 4vw, 48px); }
.page-heading { margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: clamp(31px, 4vw, 48px); letter-spacing: -.045em; }
.page-heading p { margin: 9px 0 0; color: var(--muted); }
.heading-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    min-height: 142px;
    padding: 22px;
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(15, 35, 53, .98), rgba(8, 24, 38, .98));
}
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 750; }
.stat-card strong { display: block; margin-top: 17px; font-size: 36px; letter-spacing: -.05em; }
.panel { margin-bottom: 22px; border: 1px solid var(--line); background: rgba(11, 27, 42, .94); }
.panel-heading {
    padding: 21px 23px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
}
.panel-heading h2 { margin: 0; font-size: 17px; }
.panel-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
    padding: 13px 16px;
    color: #879bae;
    background: rgba(4, 15, 25, .54);
    text-align: left;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}
td { padding: 15px 16px; border-top: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: rgba(255, 255, 255, .018); }
td code { color: #bad8ef; font-size: 11px; overflow-wrap: anywhere; }
.empty-cell { padding: 34px; color: var(--muted); text-align: center; }
.badge {
    min-width: 72px;
    padding: 5px 8px;
    display: inline-flex;
    justify-content: center;
    border: 1px solid var(--line);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .08em;
}
.badge-active, .badge-approved { color: #9bf0ca; border-color: rgba(67, 217, 155, .27); background: rgba(67, 217, 155, .08); }
.badge-pending { color: #ffe2a3; border-color: rgba(255, 200, 87, .28); background: rgba(255, 200, 87, .08); }
.badge-blocked, .badge-rejected, .badge-revoked, .badge-expired { color: #ffb5ba; border-color: rgba(255, 112, 120, .28); background: rgba(255, 112, 120, .08); }
.badge-offline { color: #9bb0c3; background: rgba(143, 164, 184, .06); }
.secondary-button, .danger-button, .warning-button, .success-button {
    min-height: 34px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.secondary-button { border-color: var(--line-strong); color: #d4e0e9; background: rgba(255, 255, 255, .035); }
.danger-button { border-color: rgba(255, 112, 120, .3); color: #ffb0b5; background: rgba(255, 112, 120, .08); }
.warning-button { border-color: rgba(255, 200, 87, .3); color: #ffe0a0; background: rgba(255, 200, 87, .08); }
.success-button { border-color: rgba(67, 217, 155, .3); color: #9df0cb; background: rgba(67, 217, 155, .08); }
.search-form { display: flex; gap: 8px; }
.search-form input, .stack-form input, .stack-form select {
    height: 38px;
    border: 1px solid var(--line-strong);
    outline: 0;
    color: var(--text);
    background: rgba(3, 14, 24, .72);
}
.search-form input { width: min(360px, 45vw); padding: 0 13px; }
.stack-form { display: grid; gap: 8px; }
.stack-form.padded { padding: 23px; }
.stack-form input, .stack-form select { width: 100%; padding: 0 11px; }
.stack-form fieldset { margin: 4px 0; padding: 12px; border: 1px solid var(--line); }
.stack-form legend { padding: 0 6px; color: var(--muted); font-size: 11px; }
.check-label { display: flex; align-items: center; gap: 7px; margin: 7px 0 !important; font-weight: 600 !important; }
.check-label input { width: 15px; height: 15px; }
.action-box { min-width: 225px; }
.action-box summary { color: var(--accent); cursor: pointer; font-weight: 800; }
.action-box[open] { padding: 12px; border: 1px solid var(--line); background: rgba(3, 14, 24, .82); }
.action-box form + form { margin-top: 10px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.activation { padding-bottom: 20px; }
.activation pre { margin: 20px; padding: 18px; overflow-x: auto; border: 1px solid rgba(67, 217, 155, .22); color: #b8efd7; background: rgba(3, 14, 24, .82); line-height: 1.7; }
.activation > p { margin: 0 20px; }
.split-grid { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(520px, 1.25fr); gap: 20px; }
.flash-stack { position: fixed; z-index: 100; top: 78px; right: 22px; width: min(390px, calc(100vw - 36px)); display: grid; gap: 10px; }
.flash { position: relative; padding: 14px 42px 14px 15px; border: 1px solid var(--line); background: #102337; box-shadow: var(--shadow); font-size: 13px; }
.flash-success { border-color: rgba(67, 217, 155, .3); color: #b8efd7; }
.flash-error { border-color: rgba(255, 112, 120, .3); color: #ffc2c6; }
.flash button { position: absolute; top: 8px; right: 10px; border: 0; color: inherit; background: transparent; cursor: pointer; font-size: 20px; }

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { min-height: 330px; padding: 28px; border-right: 0; border-bottom: 1px solid var(--line); }
    .brand-copy h1 { font-size: 42px; }
    .brand-copy p, .brand-security { display: none; }
    .login-area { min-height: auto; padding: 26px 18px 44px; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 24px; }
    .nav-title { grid-column: 1 / -1; }
    .sidebar-user { margin-top: 22px; }
    .heading-actions { align-items: stretch; flex-direction: column; }
    .search-form input { width: 100%; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-content { padding: 22px 14px; }
    .topbar { padding: 0 15px; }
    .sidebar nav { grid-template-columns: 1fr; }
    .login-card { padding: 25px 20px; }
    .shield { display: none; }
}


/* Activation request modal */
body.modal-open {
    overflow: hidden;
}

.activation-open-button {
    gap: 8px;
    white-space: nowrap;
}

.activation-modal[hidden] {
    display: none;
}

.activation-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    padding: 32px;
    display: grid;
    place-items: center;
}

.activation-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 8, 14, .82);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.activation-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(960px, calc(100vw - 64px));
    max-height: calc(100vh - 64px);
    overflow: auto;
    border: 1px solid rgba(242, 162, 40, .34);
    outline: 0;
    background:
        radial-gradient(circle at 100% 0, rgba(242, 162, 40, .1), transparent 30rem),
        linear-gradient(150deg, rgba(15, 35, 53, .995), rgba(6, 20, 32, .995));
    box-shadow: 0 40px 120px rgba(0, 0, 0, .72);
    animation: activationModalEnter .18s ease-out;
}

.activation-modal-header {
    min-height: 120px;
    padding: 27px 30px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line);
}

.activation-modal-header h2 {
    margin: 0;
    font-size: clamp(26px, 3vw, 38px);
    letter-spacing: -.04em;
}

.activation-modal-header p {
    margin: 9px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.activation-modal-close {
    flex: 0 0 auto;
    width: 43px;
    height: 43px;
    border: 1px solid var(--line-strong);
    color: #d7e3ec;
    background: rgba(255, 255, 255, .035);
    cursor: pointer;
    font-size: 27px;
    line-height: 1;
}

.activation-modal-close:hover {
    color: #fff;
    border-color: rgba(242, 162, 40, .55);
    background: rgba(242, 162, 40, .09);
}

.activation-modal-body {
    padding: 28px 30px 30px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr);
    gap: 24px;
}

.activation-machine-card,
.activation-form-card {
    min-width: 0;
    border: 1px solid var(--line);
    background: rgba(3, 14, 24, .54);
}

.activation-machine-card {
    padding: 23px;
}

.activation-machine-title {
    padding-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--line);
}

.activation-machine-title small {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .13em;
}

.activation-machine-title h3 {
    margin: 0;
    font-size: 21px;
    overflow-wrap: anywhere;
}

.activation-machine-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(242, 162, 40, .34);
    color: var(--accent);
    background: rgba(242, 162, 40, .08);
}

.activation-info-grid {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.activation-info-grid > div {
    min-width: 0;
    padding: 17px 0;
    border-bottom: 1px solid var(--line);
}

.activation-info-grid > div:nth-child(odd) {
    padding-right: 17px;
}

.activation-info-grid > div:nth-child(even) {
    padding-left: 17px;
    border-left: 1px solid var(--line);
}

.activation-info-grid > div:nth-last-child(-n + 2) {
    border-bottom: 0;
}

.activation-info-grid dt {
    margin-bottom: 7px;
    color: #70879a;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.activation-info-grid dd {
    min-width: 0;
    margin: 0;
    color: #e7f1f8;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.activation-info-grid code {
    color: #b9dbf3;
    font-size: 11px;
}

.activation-form-card {
    padding: 23px;
}

.activation-form {
    gap: 10px;
}

.activation-form-heading {
    margin-bottom: 9px;
}

.activation-form-heading h3 {
    margin: 0;
    font-size: 20px;
}

.activation-form-heading p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.activation-form input {
    height: 48px;
}

.activation-form-note {
    margin: 0;
    color: #72889b;
    font-size: 11px;
    line-height: 1.6;
}

.activation-modal-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px;
}

.activation-cancel-button,
.activation-confirm-button {
    width: 100%;
    min-height: 48px;
    margin: 0;
}

.activation-confirm-button {
    justify-content: space-between;
}

.activation-reject-form {
    margin-top: 17px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
}

.activation-reject-form .danger-button {
    width: 100%;
    min-height: 42px;
}

@keyframes activationModalEnter {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 900px) {
    .activation-modal {
        padding: 18px;
    }

    .activation-modal-dialog {
        width: calc(100vw - 36px);
        max-height: calc(100vh - 36px);
    }

    .activation-modal-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .activation-modal {
        padding: 0;
        place-items: stretch;
    }

    .activation-modal-dialog {
        width: 100vw;
        max-height: 100vh;
        min-height: 100vh;
        border-left: 0;
        border-right: 0;
    }

    .activation-modal-header,
    .activation-modal-body {
        padding-left: 18px;
        padding-right: 18px;
    }

    .activation-info-grid {
        grid-template-columns: 1fr;
    }

    .activation-info-grid > div,
    .activation-info-grid > div:nth-child(odd),
    .activation-info-grid > div:nth-child(even) {
        padding: 14px 0;
        border-left: 0;
        border-bottom: 1px solid var(--line);
    }

    .activation-info-grid > div:last-child {
        border-bottom: 0;
    }

    .activation-modal-actions {
        grid-template-columns: 1fr;
    }
}
