:root {
    --bg: #f3f1eb;
    --bg-accent: #e6ece8;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --surface-muted: #f8f6f1;
    --ink: #173038;
    --ink-soft: #56707a;
    --line: rgba(23, 48, 56, 0.08);
    --accent: #15746b;
    --accent-soft: rgba(21, 116, 107, 0.12);
    --warning: #b16d10;
    --danger: #b14646;
    --shadow: 0 18px 40px rgba(23, 48, 56, 0.08);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

html {
    font-size: 15px;
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Bahnschrift", "Segoe UI Variable", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top right, rgba(21, 116, 107, 0.08), transparent 28rem),
        radial-gradient(circle at bottom left, rgba(177, 109, 16, 0.08), transparent 24rem),
        linear-gradient(180deg, #f7f5f0, #eeebe4 65%, #ebe7df);
}

a {
    color: var(--accent);
    text-decoration: none;
}

.shell-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.72), transparent 24rem),
        radial-gradient(circle at 80% 22%, rgba(21, 116, 107, 0.06), transparent 22rem);
}

.page-shell {
    position: relative;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem 1.5rem;
    background: rgba(255, 255, 255, 0.54);
    backdrop-filter: blur(22px);
    border-right: 1px solid var(--line);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.64));
    box-shadow: var(--shadow);
}

.brand-symbol {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #143942, #15746b);
    color: #f6fbfa;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
}

.brand-tag {
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.nav-stack {
    display: grid;
    gap: 0.45rem;
}

.nav-link {
    display: block;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    color: var(--ink-soft);
    transition: transform 140ms ease, background-color 140ms ease, color 140ms ease;
}

.nav-link:hover,
.nav-link-active {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(23, 48, 56, 0.04);
}

.workspace {
    padding: 2rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-soft);
    font-size: 0.72rem;
    margin-bottom: 0.35rem;
}

.page-title {
    margin: 0;
    font-size: clamp(1.7rem, 2vw, 2.3rem);
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.operator-chip {
    display: grid;
    gap: 0.1rem;
    padding: 0.8rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
}

.operator-label {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.operator-name {
    font-weight: 700;
}

.content-surface,
.auth-card {
    background: var(--surface);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow);
    border-radius: var(--radius-lg);
}

.content-surface {
    padding: 1.75rem;
}

.auth-surface {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
}

.auth-card {
    width: min(560px, 100%);
    padding: 2rem;
}

.subtle-alert {
    border: 0;
    border-radius: 16px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    padding: 1.15rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--line);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 24px rgba(23, 48, 56, 0.08);
}

.metric-label {
    color: var(--ink-soft);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.metric-value {
    margin-top: 0.6rem;
    font-size: 2rem;
    font-weight: 700;
}

.panel-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 1rem;
}

.panel {
    padding: 1.25rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
}

.panel h2,
.section-header h2 {
    margin: 0 0 0.25rem;
    font-size: 1.18rem;
}

.panel-subtitle {
    color: var(--ink-soft);
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.toolbar .form-control,
.toolbar .form-select {
    min-width: 180px;
}

.table-shell {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--line);
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    background: transparent;
    border-color: rgba(23, 48, 56, 0.06);
    vertical-align: middle;
}

.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.68rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.78rem;
}

.badge-active { background: rgba(21, 116, 107, 0.12); color: #0b5b53; }
.badge-suspended { background: rgba(177, 109, 16, 0.14); color: #8f5810; }
.badge-revoked { background: rgba(177, 70, 70, 0.14); color: #8d3535; }
.badge-expired { background: rgba(98, 72, 52, 0.12); color: #654a36; }
.badge-soft-deleted { background: rgba(67, 77, 92, 0.14); color: #344255; }
.badge-inactive { background: rgba(87, 112, 122, 0.14); color: #445a62; }
.badge-expiring-soon { background: rgba(177, 109, 16, 0.16); color: #8a5310; }

.definition-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.definition-list dt {
    color: var(--ink-soft);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.definition-list dd {
    margin: 0.35rem 0 0;
    font-weight: 600;
}

.pre-block {
    background: #11262d;
    color: #ecf4f2;
    padding: 1rem;
    border-radius: 18px;
    overflow: auto;
    font-family: Consolas, monospace;
    font-size: 0.9rem;
}

.fade-in-up {
    animation: fadeInUp 320ms ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@media (max-width: 991px) {
    .page-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .workspace {
        padding: 1rem;
    }

    .topbar {
        flex-direction: column;
        align-items: start;
    }
}

@media (max-width: 767px) {
    .metric-grid,
    .definition-list {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
    }
}
