:root {
    --app-bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #eef3f9;
    --border-soft: #d9e2ec;
    --text-main: #183247;
    --text-muted: #5f7385;
    --brand: #1f6aa5;
    --brand-strong: #174f7b;
    --sidebar-bg: #163247;
    --sidebar-text: #dbe7f1;
}

body.app-shell {
    min-height: 100vh;
    background: linear-gradient(180deg, #f8fbff 0%, var(--app-bg) 100%);
    color: var(--text-main);
    overflow-x: hidden;
}

.topbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(217, 226, 236, 0.9);
}

.topbar-shell {
    gap: 0.75rem;
}

.topbar-menu {
    flex-basis: 100%;
}

.topbar-actions {
    flex-wrap: wrap;
}

.topbar-user-name {
    max-width: min(40vw, 320px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-sidebar-toggle,
.topbar-account-toggle {
    min-height: 42px;
}

.navbar-brand {
    color: var(--text-main);
}

.app-layout {
    display: flex;
    min-height: calc(100vh - 73px);
    position: relative;
}

.app-layout.no-sidebar {
    display: block;
}

.app-sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0f2434 100%);
    color: var(--sidebar-text);
    padding: 1.5rem 1rem;
    flex-shrink: 0;
}

.sidebar-card {
    position: sticky;
    top: 96px;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.sidebar-subtitle {
    color: rgba(219, 231, 241, 0.72);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.app-sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.8rem 0.95rem;
    border-radius: 0.85rem;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.app-main {
    flex: 1;
    min-width: 0;
}

.app-sidebar-overlay {
    position: fixed;
    inset: 73px 0 0;
    background: rgba(9, 24, 35, 0.42);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 1030;
}

.hero-panel {
    background: radial-gradient(circle at top left, rgba(31, 106, 165, 0.18), transparent 45%), var(--surface);
    border: 1px solid rgba(217, 226, 236, 0.9);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 18px 40px rgba(15, 36, 52, 0.06);
}

.hero-badge,
.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(31, 106, 165, 0.1);
    color: var(--brand-strong);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

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

.btn-brand:hover,
.btn-brand:focus {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
    color: #ffffff;
}

.card,
.auth-card,
.stat-card {
    border-radius: 1.25rem;
}

.auth-card {
    background: var(--surface);
}

.stat-card {
    background: var(--surface);
    border: 1px solid rgba(217, 226, 236, 0.9);
    padding: 1.4rem;
    box-shadow: 0 12px 30px rgba(15, 36, 52, 0.05);
    height: 100%;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
}

.stat-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-control {
    border-radius: 0.85rem;
    border-color: var(--border-soft);
    padding: 0.8rem 0.95rem;
}

.table-responsive {
    border-radius: 1rem;
    -webkit-overflow-scrolling: touch;
}

.table td,
.table th {
    vertical-align: middle;
}

.ilan-form-intro {
    gap: 1.25rem;
}

.ilan-progress-card {
    min-width: 280px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5fb 100%);
    border: 1px solid rgba(217, 226, 236, 0.95);
    border-radius: 1rem;
    padding: 1rem;
}

.ilan-progress {
    height: 0.65rem;
    background: #dbe7f1;
    border-radius: 999px;
}

.ilan-checklist {
    display: grid;
    gap: 0.45rem;
}

.ilan-check-item {
    position: relative;
    padding-left: 1.4rem;
    font-size: 0.92rem;
    color: var(--text-muted);
}

.ilan-check-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.3rem;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: #d0dbe6;
}

.ilan-check-item.is-complete {
    color: var(--text-main);
    font-weight: 600;
}

.ilan-check-item.is-complete::before {
    background: #198754;
    box-shadow: 0 0 0 0.18rem rgba(25, 135, 84, 0.16);
}

.ilan-privacy-box {
    background: linear-gradient(180deg, #eef6ff 0%, #f7fbff 100%);
    border-radius: 1rem;
    padding: 1rem 1.1rem;
}

.ilan-privacy-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 106, 165, 0.14);
    color: var(--brand-strong);
    font-weight: 700;
    flex-shrink: 0;
}

.ilan-section-header {
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(217, 226, 236, 0.8);
}

.ilan-char-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    white-space: nowrap;
}

.ilan-form-actions > .btn {
    min-width: 170px;
}

.ilan-side-stack {
    display: grid;
    gap: 1rem;
    position: sticky;
    top: 96px;
}

.ilan-preview-card {
    overflow: hidden;
}

.ilan-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ilan-preview-meta span {
    display: inline-flex;
    align-items: center;
    padding: 0.38rem 0.72rem;
    background: var(--surface-soft);
    border-radius: 999px;
    font-size: 0.88rem;
    color: var(--text-main);
}

.ilan-preview-text {
    color: var(--text-main);
    line-height: 1.65;
    min-height: 5.5rem;
}

.ilan-preview-footnote {
    padding: 0.95rem 1rem;
    border-radius: 0.9rem;
    background: rgba(24, 50, 71, 0.04);
    color: var(--text-muted);
    font-size: 0.92rem;
}

.ilan-helper-list {
    padding-left: 1rem;
    color: var(--text-muted);
}

.ilan-helper-list li + li {
    margin-top: 0.55rem;
}

.discovery-summary {
    background: linear-gradient(180deg, #f8fbff 0%, #eef5fb 100%);
    border: 1px solid rgba(217, 226, 236, 0.95);
    border-radius: 1rem;
    padding: 1rem 1.1rem;
}

.filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-badges .badge {
    font-weight: 500;
}

.listing-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.listing-meta .badge {
    font-weight: 500;
}

.detail-hero {
    background: radial-gradient(circle at top left, rgba(31, 106, 165, 0.15), transparent 50%), var(--surface);
    border: 1px solid rgba(217, 226, 236, 0.95);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: 0 14px 32px rgba(15, 36, 52, 0.05);
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.detail-meta-item {
    background: rgba(238, 243, 249, 0.7);
    border-radius: 0.95rem;
    padding: 0.9rem 1rem;
}

.detail-meta-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.detail-meta-value {
    font-weight: 600;
    color: var(--text-main);
}

.contact-card {
    border-radius: 1.1rem;
    border: 1px solid rgba(217, 226, 236, 0.95);
}

.contact-card.is-opened {
    background: linear-gradient(180deg, #f6fffb 0%, #effaf5 100%);
}

.contact-card.is-locked {
    background: linear-gradient(180deg, #fffaf4 0%, #fdf5ea 100%);
}

.contact-note-list {
    display: grid;
    gap: 0.5rem;
}

.admin-detail-grid {
    display: grid;
    gap: 1rem;
}

.admin-detail-grid .card {
    height: 100%;
}

.error-code {
    display: inline-block;
    font-size: 4rem;
    line-height: 1;
    font-weight: 700;
    color: rgba(31, 106, 165, 0.3);
    margin-bottom: 1rem;
}

@media (max-width: 991.98px) {
    .app-layout.has-sidebar {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        top: 73px;
        left: 0;
        bottom: 0;
        width: min(88vw, 320px);
        padding: 1rem;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 1040;
        box-shadow: 18px 0 40px rgba(15, 36, 52, 0.18);
    }

    .sidebar-card {
        position: static;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .app-sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .topbar-shell {
        flex-wrap: wrap;
    }

    .topbar-menu {
        order: 3;
        width: 100%;
    }

    .topbar-actions {
        width: 100%;
        align-items: stretch !important;
    }

    .topbar-actions > .btn,
    .topbar-actions > a,
    .topbar-actions > span {
        width: 100%;
    }

    .topbar-user-name {
        max-width: none;
        white-space: normal;
    }

    .app-main .d-flex.flex-wrap.gap-2 > .btn,
    .app-main .d-flex.gap-2.flex-wrap > .btn {
        flex: 1 1 100%;
    }

    .app-main .d-flex.flex-wrap.justify-content-end.gap-2 > .btn,
    .app-main .d-flex.flex-wrap.justify-content-end.gap-2 > form,
    .app-main .d-flex.flex-wrap.justify-content-end.gap-2 > a {
        flex: 1 1 100%;
    }

    .app-main .d-flex.flex-wrap.justify-content-end.gap-2 form .btn {
        width: 100%;
    }

    .ilan-side-stack {
        position: static;
    }

    .ilan-progress-card {
        min-width: 100%;
    }

    .detail-meta-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .card-body {
        padding: 1.25rem !important;
    }

    .table-responsive .table {
        min-width: 640px;
    }

    .ilan-form-actions > .btn {
        width: 100%;
    }

    .ilan-char-meta {
        justify-content: space-between;
        width: 100%;
    }

    .d-flex.flex-column.flex-lg-row.align-items-lg-center.justify-content-between.gap-3 > div:last-child {
        width: 100%;
    }

    .d-flex.flex-column.flex-lg-row.align-items-lg-center.justify-content-between.gap-3 .btn,
    .d-flex.flex-column.flex-lg-row.align-items-lg-center.justify-content-between.gap-3 .d-flex.gap-2 > .btn,
    .d-flex.flex-column.flex-lg-row.align-items-lg-center.justify-content-between.gap-3 .d-flex.flex-wrap.gap-2 > .btn {
        width: 100%;
    }
}
