@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-app: #f8fafc;
    --bg-sidebar: #0f172a;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
}

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

.portal-sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.5rem 1.5rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    object-fit: cover;
    border-radius: 50%;
}

.brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: 0.75rem;
    color: #94a3b8;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1.5rem;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.sidebar-nav a.active {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.key-label {
    display: block;
    margin-bottom: 0.35rem;
}

.key-input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    border: 1px solid #334155;
    background-color: #1e293b;
    color: #f8fafc;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.db-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #cbd5e1;
    font-weight: 500;
}

.dot-live {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.portal-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.portal-content {
    padding: 2rem 2.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Page Headers & Cards */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin: 0.25rem 0 0 0;
    color: var(--text-muted);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.kpi-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-value {
    font-size: 1.85rem;
    font-weight: 700;
    margin-top: 0.35rem;
    color: var(--text-main);
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

table.data-table th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background-color: #f8fafc;
}

table.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-live, .badge-paid {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-provisioning, .badge-pending, .badge-new {
    background-color: #fef3c7;
    color: #b45309;
}

.badge-intake, .badge-draft, .badge-waived {
    background-color: #e2e8f0;
    color: #475569;
}

.badge-paused {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Buttons & Forms */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #ffffff;
    border-color: var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #f1f5f9;
}

.btn-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #334155;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
}

.code-box {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    max-height: 360px;
    white-space: pre;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .portal-shell {
        flex-direction: column;
    }
    .portal-sidebar {
        width: 100%;
    }
    .portal-content {
        padding: 1.25rem;
    }
}

/* Public JB Digital Services Storefront & Auth Gate */
.public-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

.public-container {
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.public-header {
    background-color: #0f172a;
    color: #f8fafc;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.public-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #ffffff;
}

.public-brand-title {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}

.public-brand-sub {
    font-size: 0.72rem;
    color: #94a3b8;
}

.public-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.public-nav a:not(.btn) {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
}

.public-nav a:not(.btn):hover {
    color: #ffffff;
}

.public-main {
    flex: 1;
}

.public-hero {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.78) 0%, rgba(15, 23, 42, 0.88) 100%), url('../images/cover.jpg') center / cover no-repeat, #0f172a;
    color: #ffffff;
    padding: 4.5rem 0;
}

.hero-inner {
    max-width: 820px;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(96, 165, 250, 0.35);
    color: #93c5fd;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.hero-title {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.18;
    margin: 0 0 1.25rem 0;
    letter-spacing: -0.02em;
}

.hero-lead {
    font-size: 1.08rem;
    color: #cbd5e1;
    line-height: 1.65;
    margin: 0 0 2rem 0;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.public-section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 2.75rem auto;
}

.section-header h2 {
    font-size: 1.85rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.section-header p {
    color: var(--text-muted);
    font-size: 0.98rem;
    margin: 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.feature-icon {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.08rem;
}

.feature-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

.pricing-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.pricing-featured {
    border: 2px solid var(--primary);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.12);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.pricing-tier {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
}

.pricing-price {
    font-size: 2.3rem;
    font-weight: 700;
    margin: 0.5rem 0 0.25rem 0;
    color: var(--text-main);
}

.pricing-price span {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
}

.pricing-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.75rem 0;
    flex: 1;
}

.pricing-features li {
    font-size: 0.88rem;
    margin-bottom: 0.65rem;
    color: #334155;
}

.public-footer {
    background-color: #0f172a;
    color: #cbd5e1;
    padding: 3.5rem 0 1.5rem 0;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: #ffffff;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.25rem;
    font-size: 0.8rem;
    color: #64748b;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.auth-gate-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.auth-gate-card {
    max-width: 440px;
    width: 100%;
    margin-bottom: 0;
    padding: 2rem;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 1.9rem;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
}
