:root {
    --pink: #FF85BB;
    --pink-hover: #FF6BAD;
    --pink-soft: #FFCEE3;
    --pink-muted: rgba(255, 133, 187, 0.15);
    --navy: #021A54;
    --bg: #F5F5F5;
    --white: #fff;
    --border: rgba(2, 26, 84, 0.1);
    --text: #021A54;
    --text-muted: rgba(2, 26, 84, 0.6);
    --shadow: 0 8px 30px rgba(2, 26, 84, 0.08);
    --radius: 12px;
    --font: 'Rubik', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--navy); }

.shell { min-height: 100vh; display: flex; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--navy);
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-brand img { height: 34px; width: auto; filter: brightness(1.1); }

.sidebar-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 133, 187, 0.15);
    color: var(--pink);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.nav a:hover, .nav a.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.nav a.active { box-shadow: inset 3px 0 0 var(--pink); }

.sidebar-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    background: rgba(245, 245, 245, 0.9);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.topbar h1 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.content { padding: 28px; flex: 1; }

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-body { padding: 22px; }

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary { background: var(--pink); color: var(--navy); }
.btn-primary:hover { background: var(--pink-hover); }
.btn-secondary { background: var(--white); color: var(--navy); border: 1px solid var(--border); }
.btn-navy { background: var(--navy); color: #fff; }

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 600;
}

.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.data th, table.data td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

table.data th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: #fafafa;
}

table.data tr:hover td { background: #fafcff; }

.pill {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.pill-trial { background: #eff6ff; color: #1d4ed8; }
.pill-active { background: #ecfdf5; color: #059669; }
.pill-past_due { background: #fffbeb; color: #b45309; }
.pill-suspended { background: #fef2f2; color: #dc2626; }
.pill-cancelled { background: #f1f5f9; color: #64748b; }

.pill-health-ok { background: #ecfdf5; color: #059669; }
.pill-health-error { background: #fef2f2; color: #dc2626; }
.pill-health-unknown { background: #f1f5f9; color: #64748b; }

.flash-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
}

.api-key-value {
    display: block;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    word-break: break-all;
    border: 1px solid var(--border);
}

.integration-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.config-snippet {
    margin: 12px 0 0;
    padding: 12px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    overflow-x: auto;
}

.provision-form { margin-top: 8px; }

.alert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.alert-card { border-left: 4px solid var(--border); }
.alert-error { border-left-color: #dc2626; }
.alert-warn { border-left-color: #b45309; }
.alert-info { border-left-color: #1d4ed8; }

.alert-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
}

.alert-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.alert-list li:last-child { border-bottom: none; }
.alert-list span { color: var(--text-muted); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-row { margin-bottom: 16px; }
.form-row.full { grid-column: 1 / -1; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="date"], input[type="number"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
}

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

.error-text { color: #dc2626; font-size: 12px; margin-top: 4px; }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
}

.filters input, .filters select { width: auto; min-width: 180px; }

.detail-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
}

.meta-list { margin: 0; padding: 0; list-style: none; }
.meta-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.meta-list span { color: var(--text-muted); }

.note {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.note-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(50% 55% at 50% 0%, rgba(255, 133, 187, 0.14), transparent 55%),
        var(--navy);
    color: #fff;
}

.auth-card {
    width: min(100%, 420px);
    background: #fff;
    color: var(--text);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.auth-card h1 { margin: 0 0 8px; font-size: 1.5rem; }
.auth-card p { margin: 0 0 24px; color: var(--text-muted); font-size: 14px; }

.install-wrap {
    max-width: 720px;
    margin: 40px auto;
    padding: 0 20px 40px;
}

.install-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.check-list { list-style: none; padding: 0; margin: 0 0 20px; }
.check-list li { padding: 8px 0; font-size: 14px; }
.check-list .ok { color: #059669; }
.check-list .bad { color: #dc2626; }

@media (max-width: 960px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .form-grid, .detail-grid { grid-template-columns: 1fr; }
}
