:root {
    --bg: #0b0c0f;
    --panel: #14161b;
    --panel-2: #1a1d23;
    --text: #f3f4f6;
    --muted: #9aa3af;
    --brand: #ff0040;
    --brand-2: #ff3b6a;
    --line: #232833;
    --ok: #19c37d;
    --warn: #ffca28;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #0a0b0e, #0d1016);
}

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

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

/* Top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(140%) blur(8px);
    background: rgba(10, 11, 14, .7);
    border-bottom: 1px solid var(--line);
}

.topbar__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    font-weight: 700;
    letter-spacing: .5px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 18px;
}

.topnav {
    margin-left: auto;
    display: flex;
    gap: 14px;
}

.topnav a[aria-current="page"] {
    color: var(--brand-2);
    font-weight: 600;
}

.topbar__actions {
    margin-left: 8px;
}

/* Buttons */
.btn {
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
}

.btn:hover {
    border-color: #2a3140;
}

.btn--primary {
    background: linear-gradient(180deg, var(--brand), var(--brand-2));
    border: 0;
}

.btn--ghost {
    background: transparent;
}

.btn--icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
}

/* Cards */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}

.card--gate {
    max-width: 420px;
    margin: 80px auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
    margin-bottom: 12px;
}

/* Gate */
.gate {
    padding: 24px;
}

.gate__title {
    margin: 0 0 6px 0;
    font-weight: 700;
}

.gate__hint {
    margin: 0 0 16px 0;
    color: var(--muted);
}

.error {
    color: #ff7a7a;
    min-height: 1.2em;
}

/* Form */
.form {
    display: grid;
    gap: 12px;
}

.field {
    display: grid;
    gap: 6px;
}

.field--inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.field__label {
    color: var(--muted);
    font-size: 12px;
}

input {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    outline: none;
}

input:focus {
    border-color: #334155;
}

/* App shell */
.app {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
    display: grid;
    gap: 16px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}

.stat h3 {
    margin: 0 0 6px 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.stat__num {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toolbar__left,
.toolbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar input {
    min-width: 240px;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

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

/* Application cards */
.appcard {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.appcard__media {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    background: #0f1218;
    border-bottom: 1px solid var(--line);
}

.appcard__media img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.appcard__body {
    padding: 12px;
    display: grid;
    gap: 6px;
}

.appcard__title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.appcard__name {
    margin: 0;
    font-weight: 700;
    font-size: 16px;
}

.appcard__role {
    color: var(--muted);
    font-size: 12px;
}

.kv {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    margin-top: 6px;
}

.kv div {
    color: var(--muted);
    font-size: 12px;
}

.kv strong {
    color: var(--text);
    display: block;
    font-weight: 600;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
}

.badge--ok {
    color: var(--ok);
    border-color: rgba(25, 195, 125, .35);
}

.badge--warn {
    color: var(--warn);
    border-color: rgba(255, 202, 40, .35);
}

.appcard__actions {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--line);
}

/* Modal */
.modal {
    width: min(980px, calc(100% - 24px));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0;
    background: var(--panel);
    color: var(--text);
}

.modal::backdrop {
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(2px);
}

.modal__content {
    padding: 0;
    margin: 0;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
}

.modal__body {
    padding: 16px;
    display: grid;
    gap: 12px;
}

.modal__footer {
    border-top: 1px solid var(--line);
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 960px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar__left,
    .toolbar__right {
        width: 100%;
        justify-content: space-between;
    }

    .toolbar input {
        min-width: auto;
        width: 100%;
    }
}