:root {
    color-scheme: dark;

    --bg: #0a1020;
    --panel: #111a2e;
    --panel2: #17223a;
    --border: #263652;
    --text: #eef4ff;
    --muted: #8fa2bf;
    --blue: #3b82f6;
    --green: #28c76f;
    --red: #ef4444;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        sans-serif;
}

.hidden {
    display: none !important;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: 0;
    border-radius: 9px;
    padding: 10px 14px;
    background: var(--blue);
    color: white;
    cursor: pointer;
}

button.secondary {
    background: #253654;
}

button.danger {
    background: #47212a;
    color: #ffb8c1;
}

input,
textarea,
select {
    width: 100%;
    padding: 11px 12px;
    color: var(--text);
    background: #0b1426;
    border: 1px solid var(--border);
    border-radius: 8px;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-card {
    width: min(420px, calc(100% - 32px));
    display: grid;
    gap: 14px;
    padding: 30px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.brand {
    color: #7fb2ff;
    font-weight: 900;
    letter-spacing: .14em;
}

.error {
    color: #ff8a97;
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    background: #0c1426;
    border-right: 1px solid var(--border);
}

.nav {
    text-align: left;
    background: transparent;
    color: var(--muted);
}

.nav.active {
    color: white;
    background: #19315b;
}

.grow {
    flex: 1;
}

.main {
    padding: 26px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 0 0 5px;
}

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

.provider-grid {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fill,
            minmax(220px, 1fr)
        );
    gap: 14px;
    margin-bottom: 20px;
}

.provider-card {
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 13px;
    cursor: pointer;
}

.provider-card:hover {
    border-color: #5177ae;
}

.provider-card h3 {
    margin: 0 0 6px;
}

.provider-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.provider-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.status {
    display: inline-flex;
    margin-top: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #263652;
}

.status.online {
    color: #8dffc0;
    background: #143324;
}

.status.error,
.status.offline {
    color: #ffb4bb;
    background: #3a1e26;
}

.panel {
    padding: 20px;
    margin-bottom: 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.detail-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.actions,
.secret-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tabs {
    display: flex;
    gap: 7px;
    margin: 20px 0;
    border-bottom: 1px solid var(--border);
}

.tab {
    background: transparent;
    color: var(--muted);
    border-radius: 0;
}

.tab.active {
    color: white;
    border-bottom: 2px solid var(--blue);
}

.provider-tab {
    display: grid;
    gap: 14px;
}

.secret-form {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 18px;
    background: #0c1528;
    border-radius: 12px;
}

.secret-form button {
    align-self: end;
}

.secret-list {
    display: grid;
    gap: 9px;
}

.secret-row {
    display: grid;
    grid-template-columns:
        minmax(170px, 1fr)
        100px
        150px
        170px
        auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: var(--panel2);
    border-radius: 10px;
}

.secret-row.expired {
    border: 1px solid #883b45;
}

.notice {
    padding: 12px;
    background: #14233e;
    border-left: 3px solid var(--blue);
    color: #bfd4f5;
}

pre {
    min-height: 300px;
    max-height: 600px;
    overflow: auto;
    padding: 16px;
    background: #050a13;
    border-radius: 10px;
    color: #a8ffb9;
}

form {
    display: grid;
    gap: 12px;
}

.check {
    display: flex;
    align-items: center;
    gap: 9px;
}

.check input {
    width: auto;
}

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

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

.new-key {
    margin: 14px 0;
    padding: 16px;
    word-break: break-all;
    background: #173423;
    border-radius: 10px;
    color: #b6ffd0;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    max-width: 420px;
    padding: 13px 16px;
    border-radius: 10px;
    background: #18335b;
    box-shadow: 0 20px 50px #0008;
}

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

    .sidebar {
        height: auto;
        position: static;
        flex-direction: row;
        overflow-x: auto;
    }

    .grow {
        display: none;
    }

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

    .secret-row {
        grid-template-columns: 1fr;
    }
}
