:root {
    --bg-top: #091323;
    --bg-bottom: #0f2740;
    --panel: rgba(8, 20, 34, 0.7);
    --panel-strong: rgba(10, 24, 40, 0.9);
    --panel-border: rgba(157, 189, 255, 0.16);
    --text: #edf4ff;
    --muted: #9db2ca;
    --heading: #ffffff;
    --accent: #5cc8ff;
    --accent-strong: #2f9cf7;
    --accent-soft: rgba(92, 200, 255, 0.16);
    --danger: #ff7f73;
    --success: #5fe0a6;
    --warning: #ffd166;
    --shadow: 0 24px 60px rgba(1, 8, 16, 0.38);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    font-family: "Avenir Next", "Segoe UI Variable", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(49, 116, 255, 0.28), transparent 36%),
        radial-gradient(circle at 85% 15%, rgba(92, 200, 255, 0.2), transparent 25%),
        linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    padding: 24px;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(18px);
    opacity: 0.55;
}

body::before {
    width: 240px;
    height: 240px;
    top: 88px;
    right: 8%;
    background: rgba(77, 166, 255, 0.18);
}

body::after {
    width: 180px;
    height: 180px;
    bottom: 10%;
    left: 4%;
    background: rgba(47, 156, 247, 0.14);
}

a {
    color: inherit;
}

h1,
h2,
h3 {
    color: var(--heading);
    line-height: 1.14;
    margin: 0;
}

h1 {
    font-size: clamp(2.1rem, 4vw, 3.6rem);
    letter-spacing: -0.025em;
}

h2 {
    font-size: clamp(1.5rem, 2.4vw, 2.2rem);
    letter-spacing: -0.015em;
}

h3 {
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

p {
    color: var(--muted);
    line-height: 1.6;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.85rem;
    color: #8cd8ff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.lead {
    max-width: 68ch;
    font-size: 1.05rem;
}

.navbar {
    max-width: 1200px;
    margin: 0 auto 24px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: rgba(7, 17, 29, 0.72);
    border: 1px solid var(--panel-border);
    border-radius: 26px;
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #82deff, #2f9cf7);
    color: #03111f;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 12px 24px rgba(47, 156, 247, 0.25);
}

.brand-name {
    display: inline-block;
    color: var(--heading);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.9rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 0.7rem 1rem;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--heading);
    transform: translateY(-1px);
}

.nav-link.is-disabled {
    pointer-events: none;
    opacity: 0.45;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(18px);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.page-header,
.hero,
.panel {
    animation: rise-in 0.45s ease-out both;
}

.page-header {
    margin-bottom: 28px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.9fr);
    gap: 24px;
    align-items: start;
    margin-bottom: 24px;
}

.hero-copy {
    padding-right: 12px;
}

.hero-grid,
.feature-grid {
    display: grid;
    gap: 16px;
}

.hero-card,
.feature-card,
.detail-card {
    padding: 20px;
    border-radius: 20px;
    border: 1px solid rgba(157, 189, 255, 0.14);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hero-card {
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.hero-card:hover,
.hero-card:focus-visible {
    transform: translateY(-3px);
    border-color: rgba(92, 200, 255, 0.38);
    background: linear-gradient(180deg, rgba(92, 200, 255, 0.12), rgba(255, 255, 255, 0.04));
}

.hero-card strong {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--heading);
    font-size: 1.05rem;
}

.hero-card p,
.feature-card p {
    margin-bottom: 0;
}

.hero-card-label {
    display: inline-block;
    margin-bottom: 0.7rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #a9e7ff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
    margin-top: 24px;
    padding: 26px;
    background: var(--panel-strong);
    border: 1px solid rgba(157, 189, 255, 0.12);
    border-radius: 22px;
}

.panel-spaced {
    margin-top: 24px;
}

#edit-form:empty {
    display: none;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section {
    border: 1px solid rgba(157, 189, 255, 0.12);
    border-radius: 18px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.03);
}

.section-title {
    margin-bottom: 0.75rem;
    color: var(--heading);
    font-weight: 700;
}

.muted,
.helper-text {
    color: var(--muted);
}

.rule-form,
.edit-rule-form {
    display: grid;
    gap: 18px;
}

.fields {
    display: grid;
    gap: 12px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
}

.field-label {
    margin-bottom: 0.45rem;
}

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

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid rgba(157, 189, 255, 0.18);
    border-radius: 14px;
    background: rgba(4, 13, 22, 0.7);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: #7f95ae;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(92, 200, 255, 0.52);
    box-shadow: 0 0 0 4px rgba(92, 200, 255, 0.12);
    background: rgba(4, 13, 22, 0.92);
}

input[disabled] {
    opacity: 0.65;
}

button {
    padding: 0.8rem 1.15rem;
    border-radius: 14px;
    border: 0;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

button:hover,
button:focus-visible {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #79d9ff, #2f9cf7);
    color: #03111f;
    font-weight: 800;
    box-shadow: 0 12px 24px rgba(47, 156, 247, 0.25);
}

.btn-secondary,
.btn-edit,
.btn-delete {
    background: rgba(255, 255, 255, 0.05);
    color: var(--heading);
    border: 1px solid rgba(157, 189, 255, 0.12);
}

.btn-delete {
    border-color: rgba(255, 127, 115, 0.35);
    color: #ffd1cb;
}

.actions {
    display: flex;
    justify-content: flex-end;
}

.action-buttons,
.table-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.action-link {
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--heading);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.action-link:hover,
.action-link:focus-visible {
    background: rgba(92, 200, 255, 0.16);
    color: #bdeeff;
}

.action-link-danger:hover,
.action-link-danger:focus-visible {
    background: rgba(255, 127, 115, 0.12);
    color: #ffd1cb;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 18px;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(157, 189, 255, 0.12);
    vertical-align: top;
}

.data-table th {
    color: #b7cbdf;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.table-id {
    color: #a9c8ea;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.wrap-text {
    word-break: break-word;
}

.source-badge,
.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
}

.source-badge {
    background: rgba(255, 255, 255, 0.06);
    color: var(--heading);
}

.status-chip {
    text-transform: capitalize;
}

.status-success {
    color: var(--success);
    background: rgba(95, 224, 166, 0.12);
}

.status-failed {
    color: #ffb0a8;
    background: rgba(255, 127, 115, 0.14);
}

.status-pending {
    color: var(--warning);
    background: rgba(255, 209, 102, 0.14);
}

.status-retrying {
    color: #8cd8ff;
    background: rgba(92, 200, 255, 0.16);
}

.status-processing {
    color: #c1b5ff;
    background: rgba(153, 128, 255, 0.16);
}

.status-skipped {
    color: #c7d4e1;
    background: rgba(199, 212, 225, 0.1);
}

.status-dead_lettered {
    color: #ffc1b9;
    background: rgba(255, 127, 115, 0.2);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 0 0 28px;
}

.metric-card {
    padding: 20px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(92, 200, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(157, 189, 255, 0.12);
}

.metric-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #a8c7e2;
}

.metric-value {
    margin-top: 0.45rem;
    color: var(--heading);
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.metrics-section {
    margin-bottom: 8px;
}

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

.inspect-layout {
    padding: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 22px;
}

.detail-label {
    display: block;
    margin-bottom: 0.45rem;
    color: #a9c8ea;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.code-block {
    margin: 0 0 18px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(4, 13, 22, 0.88);
    color: #dbeaff;
    border: 1px solid rgba(157, 189, 255, 0.12);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.static-field strong {
    display: block;
    margin-top: 0.45rem;
}

.checkbox-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.checkbox-row input {
    width: auto;
    margin-top: 0;
}

.empty-state {
    padding: 28px;
    border: 1px dashed rgba(157, 189, 255, 0.2);
    border-radius: 18px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
}

.empty-state p {
    margin-bottom: 0;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: min(100%, 460px);
    padding: 36px;
    background: rgba(7, 17, 29, 0.82);
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    animation: rise-in 0.45s ease-out both;
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 960px) {
    .navbar,
    .container {
        padding: 20px;
    }

    .navbar,
    .hero,
    .feature-grid,
    .detail-grid,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .navbar {
        display: grid;
        justify-content: stretch;
    }

    .nav-links {
        justify-content: flex-start;
    }

    .brand-subtitle {
        display: none;
    }

    .feature-grid {
        display: grid;
    }
}

@media (max-width: 720px) {
    body {
        padding: 14px;
    }

    .container,
    .panel,
    .login-container {
        padding: 18px;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }

    .table-actions,
    .action-buttons,
    .actions {
        align-items: stretch;
    }
}
