:root {
    --bg: #f4f7fb;
    --bg-accent: radial-gradient(circle at top left, rgba(17, 132, 255, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(28, 201, 154, 0.14), transparent 24%),
        linear-gradient(180deg, #f9fbff 0%, #eef4fb 100%);
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --surface-muted: #eff4fb;
    --text: #102033;
    --text-soft: #5f7086;
    --border: rgba(16, 32, 51, 0.09);
    --shadow: 0 20px 50px rgba(18, 38, 63, 0.10);
    --shadow-soft: 0 14px 30px rgba(18, 38, 63, 0.08);
    --brand: #0b6bcb;
    --brand-strong: #074f97;
    --brand-soft: rgba(11, 107, 203, 0.11);
    --success-soft: rgba(16, 185, 129, 0.14);
    --warning-soft: rgba(245, 158, 11, 0.14);
    --danger-soft: rgba(220, 38, 38, 0.12);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background: var(--bg-accent);
}

h1,
h2,
h3,
h4,
h5,
.brand-font {
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.03em;
}

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

a:hover {
    color: var(--brand-strong);
    text-decoration: none;
}

.app-shell {
    position: relative;
    min-height: 100vh;
    padding-bottom: 48px;
}

.container-wide {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

.flash-stack {
    margin-top: 18px;
}

.flash-alert {
    border: 1px solid rgba(16, 32, 51, 0.08);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

.glass-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    margin: 16px auto 0;
    width: min(1200px, calc(100% - 32px));
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
}

.navbar-light .navbar-nav .nav-link,
.navbar-light .navbar-brand {
    color: var(--text);
}

.navbar-light .navbar-nav .nav-link:hover,
.navbar-light .navbar-brand:hover {
    color: var(--brand);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #0b6bcb 0%, #2dd4bf 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(11, 107, 203, 0.25);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-copy small {
    color: var(--text-soft);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 700;
}

.nav-pill.active,
.nav-pill:hover {
    background: var(--brand-soft);
}

.page-hero {
    margin: 28px auto 24px;
    padding: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(244, 249, 255, 0.88));
    box-shadow: var(--shadow);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
    gap: 22px;
    align-items: end;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.page-hero h1 {
    margin-bottom: 14px;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 0.98;
}

.hero-text {
    max-width: 760px;
    color: var(--text-soft);
    font-size: 1.03rem;
}

.hero-actions,
.hero-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.metric-card,
.app-card,
.preview-panel,
.login-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-soft);
}

.metric-card {
    min-width: 140px;
    padding: 18px;
}

.metric-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.metric-value {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.9rem;
    line-height: 1;
}

.app-card {
    padding: 24px;
    margin-bottom: 20px;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.card-title-row h2,
.card-title-row h3 {
    margin: 0;
}

.section-kicker {
    margin: 0 0 4px;
    color: var(--text-soft);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.subtle-text {
    color: var(--text-soft);
}

.btn {
    border: 0;
    border-radius: 14px;
    font-weight: 800;
    padding: 12px 18px;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, #0b6bcb 0%, #2f9bff 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0857a5 0%, #2588e4 100%);
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.75);
    color: var(--text);
}

.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-danger:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.btn-soft {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.btn-soft:hover {
    background: rgba(11, 107, 203, 0.18);
    color: var(--brand-strong);
}

.pill-badge,
.status-badge,
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.pill-badge {
    background: rgba(16, 32, 51, 0.06);
    color: var(--text);
}

.status-badge.active {
    background: var(--success-soft);
    color: #0f766e;
}

.status-badge.optional {
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
}

.category-chip {
    background: rgba(11, 107, 203, 0.08);
    color: var(--brand-strong);
}

.form-control,
.custom-select {
    height: auto;
    min-height: 50px;
    border: 1px solid rgba(16, 32, 51, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    padding: 12px 14px;
    color: var(--text);
}

textarea.form-control {
    min-height: 120px;
}

.form-control:focus,
.custom-select:focus {
    border-color: rgba(11, 107, 203, 0.35);
    box-shadow: 0 0 0 4px rgba(11, 107, 203, 0.12);
}

.field-note {
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.preset-panel {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
}

.snippet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.snippet-option {
    position: relative;
    height: 100%;
}

.snippet-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.snippet-option label {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.snippet-option label:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.snippet-option input:checked + label {
    border-color: rgba(11, 107, 203, 0.4);
    background: rgba(11, 107, 203, 0.08);
    box-shadow: 0 16px 34px rgba(11, 107, 203, 0.12);
}

.snippet-option input:disabled + label {
    opacity: 0.92;
    cursor: default;
}

.snippet-option-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.snippet-option-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.snippet-option-heading small {
    font-size: 0.78rem;
}

.snippet-option-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.snippet-option-title strong {
    font-size: 1rem;
    line-height: 1.25;
}

.snippet-option small {
    color: var(--text-soft);
}

.snippet-item.is-favorite label {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 16px 30px rgba(245, 158, 11, 0.10);
}

.favorite-snippet-toggle,
.favorite-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.favorite-snippet-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-soft);
}

.favorite-snippet-toggle.is-favorite,
.favorite-toggle.is-favorite {
    color: #d97706;
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.2);
}

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

.selected-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    cursor: move;
}

.preview-panel {
    padding: 24px;
    position: sticky;
    top: 104px;
}

.preview-surface {
    min-height: 320px;
    padding: 24px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    border: 1px solid rgba(16, 32, 51, 0.08);
    overflow-wrap: anywhere;
}

.preview-surface h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.15rem;
}

.empty-state {
    padding: 28px;
    border: 1px dashed rgba(16, 32, 51, 0.18);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.5);
    text-align: center;
    color: var(--text-soft);
}

.table-shell {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
}

.table td,
.table th {
    vertical-align: middle;
    border-color: rgba(16, 32, 51, 0.06);
}

.modal-content {
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
    border-color: rgba(16, 32, 51, 0.08);
}

.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(242, 246, 252, 0.94);
    backdrop-filter: blur(20px);
}

body.drawer-open {
    overflow: hidden;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 19, 33, 0.32);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 2100;
}

.drawer-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.editor-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(70vw, 1080px);
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    background: rgba(249, 252, 255, 0.98);
    box-shadow: -24px 0 60px rgba(18, 38, 63, 0.16);
    transform: translateX(100%);
    transition: transform 0.24s ease;
    z-index: 2200;
}

.editor-drawer.is-open {
    transform: translateX(0);
}

.editor-drawer-form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-drawer-header,
.editor-drawer-footer {
    padding: 24px 28px;
    background: rgba(255, 255, 255, 0.88);
}

.editor-drawer-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    border-bottom: 1px solid rgba(16, 32, 51, 0.08);
}

.editor-drawer-body {
    flex: 1;
    overflow: auto;
    padding: 24px 28px 32px;
}

.editor-drawer-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid rgba(16, 32, 51, 0.08);
}

.editor-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.editor-preview-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.editor-preview-surface {
    min-height: 140px;
    margin-top: 12px;
}

.category-manager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.category-manager-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    color: var(--text);
    text-align: left;
}

.category-manager-chip strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(11, 107, 203, 0.1);
    color: var(--brand-strong);
}

.category-manager-form {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    padding: 20px;
}

.search-overlay-inner {
    width: min(920px, calc(100% - 32px));
    margin: 48px auto;
    padding: 28px;
    border-radius: 28px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow);
}

.result-link {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    color: inherit;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.9fr);
    gap: 24px;
    width: min(1200px, calc(100% - 32px));
    margin: 36px auto;
    align-items: stretch;
}

.login-hero,
.login-panel {
    padding: 34px;
}

.login-hero {
    border: 1px solid var(--border);
    border-radius: 30px;
    background: linear-gradient(145deg, rgba(7, 79, 151, 0.95), rgba(16, 185, 129, 0.88));
    color: #fff;
    box-shadow: var(--shadow);
}

.login-hero p,
.login-hero li {
    color: rgba(255, 255, 255, 0.86);
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.snippet-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.content-block {
    padding: 18px;
    min-height: 180px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.content-block p:last-child {
    margin-bottom: 0;
}

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

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.muted-separator {
    height: 1px;
    margin: 18px 0;
    background: rgba(16, 32, 51, 0.08);
}

@media (max-width: 991.98px) {
    .hero-grid,
    .login-shell {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        position: static;
    }

    .glass-nav {
        width: calc(100% - 20px);
    }

    .editor-drawer {
        width: 100vw;
    }

    .editor-preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .container-wide {
        width: calc(100% - 20px);
    }

    .page-hero,
    .app-card,
    .preview-panel,
    .login-hero,
    .login-panel,
    .search-overlay-inner {
        padding: 20px;
    }

    .page-hero h1 {
        font-size: 2.2rem;
    }

    .toolbar-row,
    .hero-actions,
    .hero-metrics {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
    }
}
