* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    color: #0f172a;
    font-size: 14px;
    line-height: 1.45;
}

code {
    font-family: Consolas, "Courier New", monospace;
}

.shell {
    width: min(1440px, calc(100vw - 24px));
    margin: 0 auto;
    padding: 18px 0 26px;
}

.topbar,
.panel,
.login-card,
.stat-card,
.notice {
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    margin-bottom: 14px;
}

.topbar-home {
    display: block;
    color: inherit;
    text-decoration: none;
}

.topbar-home,
.topbar-home *,
.topbar-home:hover,
.topbar-home:hover *,
.topbar-home:focus-visible,
.topbar-home:focus-visible * {
    color: inherit;
    text-decoration: none;
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2563eb;
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 21px;
}

.subtitle {
    margin: 6px 0 0;
    color: #64748b;
    line-height: 1.4;
    font-size: 13px;
}

.login-card {
    width: min(100%, 460px);
    margin: 32px auto 0;
    padding: 18px;
    display: grid;
    gap: 12px;
}

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

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

label {
    display: grid;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(203, 213, 225, 0.95);
    border-radius: 12px;
    padding: 9px 11px;
    font-size: 13px;
    background: #fff;
    color: #0f172a;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.16);
    border-color: #60a5fa;
}

.btn {
    min-height: 38px;
    border: none;
    border-radius: 12px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.btn.primary {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
}

.btn.ghost,
.btn.small {
    background: #fff;
    color: #334155;
    border: 1px solid rgba(203, 213, 225, 0.95);
}

.btn.small {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.btn.danger {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid rgba(244, 114, 182, 0.25);
}

.notice {
    padding: 11px 14px;
    margin-bottom: 14px;
    font-size: 13px;
}

.notice.success {
    color: #047857;
}

.notice.error {
    color: #b91c1c;
}

.error-text {
    margin: 0;
    color: #dc2626;
    font-size: 13px;
    font-weight: 700;
}

.tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.tab-link {
    min-height: 36px;
    border-radius: 999px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    color: #475569;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(203, 213, 225, 0.95);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.tab-link.is-active {
    color: #1d4ed8;
    background: rgba(219, 234, 254, 0.92);
    border-color: rgba(96, 165, 250, 0.9);
}

.stats-grid,
.content-grid {
    display: grid;
    gap: 12px;
}

.stats-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 14px;
}

.stat-card {
    padding: 14px;
    display: grid;
    gap: 4px;
}

.stat-card strong {
    font-size: 24px;
}

.stat-card span {
    font-size: 12px;
    color: #64748b;
}

.content-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
}

.secondary-grid {
    margin-top: 12px;
}

.settings-grid {
    margin-bottom: 12px;
}

.panel {
    padding: 16px;
}

.panel-spaced {
    margin-top: 0;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.table-wrap {
    overflow: auto;
}

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

th,
td {
    padding: 9px 8px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    text-align: left;
    vertical-align: top;
    font-size: 12px;
}

td strong {
    display: block;
    margin-bottom: 4px;
}

td span {
    color: #64748b;
}

.empty-cell {
    color: #64748b;
    text-align: center;
    padding: 22px 14px;
}

.row-actions {
    white-space: nowrap;
}

.status-pill {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0 8px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-pill.is-active {
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
}

.status-pill.is-trial {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.status-pill.is-passive,
.status-pill.is-expired {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.status-pill.is-pending,
.status-pill.is-scheduled {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.api-card-list {
    display: grid;
    gap: 10px;
}

.api-card {
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    padding: 12px;
    background: #f8fafc;
}

.api-card strong,
.api-card code {
    display: block;
}

.api-card code {
    margin-top: 6px;
    font-size: 12px;
    word-break: break-all;
}

.api-card p {
    margin: 6px 0 0;
    color: #64748b;
    line-height: 1.4;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 720px) {
    .shell {
        width: min(100vw - 20px, 100%);
        padding-top: 12px;
    }

    .topbar {
        flex-direction: column;
        padding: 16px;
    }

    .split,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tab-nav {
        gap: 8px;
    }

    .tab-link {
        width: 100%;
    }
}
