:root {
    --kh-navy: #0c2340;
    --kh-gold: #c9a227;
    --kh-gold-light: #e8d48a;
    --kh-cream: #faf8f4;
    --kh-slate: #4a5568;
    --kh-success: #1a7f4b;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--kh-cream);
    color: #1a1a1a;
}

.font-display { font-family: 'Playfair Display', serif; }

.kh-navbar {
    background: linear-gradient(135deg, var(--kh-navy) 0%, #163a5c 100%);
}

.kh-navbar .navbar-brand {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: var(--kh-gold-light) !important;
    letter-spacing: 0.02em;
}

.kh-sidebar {
    background: #fff;
    border-right: 1px solid #e8e4dc;
    min-height: calc(100vh - 56px);
}

.kh-sidebar .nav-link {
    color: var(--kh-slate);
    border-radius: 8px;
    margin-bottom: 2px;
    font-weight: 500;
}

.kh-sidebar .nav-link.active,
.kh-sidebar .nav-link:hover {
    background: rgba(201, 162, 39, 0.12);
    color: var(--kh-navy);
}

.kh-stat {
    background: #fff;
    border-left: 4px solid var(--kh-gold);
    padding: 1.25rem;
}

.kh-stat h3 { font-size: 1.75rem; font-weight: 700; color: var(--kh-navy); margin: 0; }

.btn-kh-primary {
    background: var(--kh-gold);
    border-color: var(--kh-gold);
    color: var(--kh-navy);
    font-weight: 600;
}

.btn-kh-primary:hover {
    background: #b8921f;
    border-color: #b8921f;
    color: var(--kh-navy);
}

.hero-marketplace {
    background: linear-gradient(160deg, rgba(12,35,64,0.92) 0%, rgba(12,35,64,0.75) 40%);
    min-height: 72vh;
    color: #fff;
}

.hero-marketplace h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
}

.calendar-slot {
    border-left: 3px solid var(--kh-gold);
    background: #fff;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
}

.badge-status-confirmed { background: #1a7f4b; }
.badge-status-hold { background: #d97706; }
.badge-status-cancelled { background: #991b1b; }

.kh-venue-card {
    display: block;
    background: #fff;
    height: 100%;
    text-decoration: none;
    color: inherit;
    border-left: 4px solid var(--kh-gold);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(12, 35, 64, 0.06);
}

.kh-venue-card:hover {
    color: inherit;
}

.kh-venue-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.kh-venue-card__body {
    padding: 1.25rem;
}

.kh-venue-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.kh-venue-gallery img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
}

.kh-venue-map {
    width: 100%;
    height: 320px;
    border: 0;
    border-radius: 8px;
}

.kh-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 1.5rem;
    padding: 0.875rem 0;
}

.kh-pager__meta {
    margin: 0;
    font-size: 0.875rem;
    color: var(--kh-slate);
}

.kh-pager__meta-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.kh-pager__per-page {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.kh-pager__per-page-label {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--kh-slate);
}

.kh-pager__per-page .form-select {
    width: auto;
    min-width: 4.5rem;
    padding-right: 1.75rem;
}

/* Sortable table headers */
.kh-sort-th {
    white-space: nowrap;
}

.kh-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
}

.kh-sort-link:hover,
.kh-sort-link:focus-visible {
    color: var(--kh-navy, #0f2a4a);
    text-decoration: underline;
}

.kh-sort-link i {
    font-size: 0.8em;
    opacity: 0.45;
    transition: opacity 0.15s ease;
}

.kh-sort-th.is-active .kh-sort-link {
    color: var(--kh-navy, #0f2a4a);
}

.kh-sort-th.is-active .kh-sort-link i {
    opacity: 1;
    color: var(--kh-gold, #c9a227);
}

.crm-filter-bar--search-only {
    margin-bottom: 1rem;
}

.crm-filter-bar--search-only .crm-search {
    max-width: 420px;
}

.crm-filter-bar--search-only .crm-filter-bar__search {
    flex: 1 1 240px;
}

.kh-sort-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--kh-slate);
    text-decoration: none;
}

.kh-sort-toggle:hover {
    color: var(--kh-navy, #0f2a4a);
}

.kh-pagination {
    gap: 0.35rem;
    margin: 0;
}

.kh-pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.7rem;
    border-radius: 999px;
    border: 1px solid #e8e4dc;
    color: var(--kh-navy);
    font-size: 0.8125rem;
    font-weight: 600;
}

.kh-pagination .page-link:hover {
    background: rgba(201, 162, 39, 0.12);
    border-color: var(--kh-gold);
    color: var(--kh-navy);
}

.kh-pagination .page-item.active .page-link {
    background: var(--kh-navy);
    border-color: var(--kh-navy);
    color: #fff;
}

.kh-appbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(135deg, var(--kh-navy) 0%, #163a5c 100%);
    color: #fff;
    padding-top: env(safe-area-inset-top);
}

.kh-appbar__inner {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 56px;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0.35rem 0.75rem;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
}

.kh-appbar__brand {
    flex: 1;
    min-width: 0;
    color: var(--kh-gold-light);
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kh-appbar__brand:hover {
    color: #fff;
}

.kh-appbar__back,
.kh-appbar__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.kh-appbar__back {
    width: 44px;
    font-size: 1.25rem;
}

.kh-appbar__action {
    padding: 0 0.35rem;
}

.kh-bookbar {
    display: none;
}

.kh-hero-actions .btn {
    min-height: 48px;
}

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

.kh-public {
    max-width: 100%;
    overflow-x: clip;
}

.kh-public img {
    max-width: 100%;
}

.kh-public :is(a, button, input, select, textarea):focus-visible {
    outline: 3px solid rgba(201, 162, 39, 0.42);
    outline-offset: 2px;
}

.kh-venue-card {
    border-radius: 12px;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.kh-venue-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(12, 35, 64, 0.12);
}

@media (prefers-reduced-motion: reduce) {
    .kh-public *,
    .kh-public *::before,
    .kh-public *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 991.98px) {
    .kh-public .container {
        max-width: 100%;
    }

    .kh-public .row > [class*="col-md-"] {
        min-width: 0;
    }
}

@media (max-width: 767.98px) {
    .kh-public {
        overflow-x: hidden;
    }

    .hero-marketplace {
        min-height: 52vh;
    }

    .hero-marketplace .lead {
        font-size: 1.05rem;
    }

    .kh-hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .kh-hero-actions .btn {
        width: 100%;
    }

    .kh-public .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .kh-public .py-5 {
        padding-top: 1.25rem !important;
        padding-bottom: 1.5rem !important;
    }

    .kh-venue-card img,
    .kh-venue-gallery img {
        height: 220px;
    }

    .kh-public .form-control,
    .kh-public .form-select,
    .kh-public textarea.form-control {
        font-size: 16px;
        min-height: 44px;
    }

    .kh-public .btn {
        min-height: 44px;
    }

    .kh-public:has(.kh-bookbar) {
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
    }

    .kh-bookbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1030;
        padding: 0.65rem 0.9rem calc(0.65rem + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid #e8e4dc;
        box-shadow: 0 -8px 24px rgba(12, 35, 64, 0.08);
    }

    .kh-bookbar__meta {
        display: flex;
        flex-direction: column;
        min-width: 0;
        color: var(--kh-navy);
        font-size: 0.8125rem;
    }

    .kh-bookbar__meta strong {
        font-size: 0.95rem;
    }

    .kh-bookbar .btn {
        flex-shrink: 0;
        min-height: 48px;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #venue-halls .btn {
        width: 100%;
    }

    .kh-public h1 {
        overflow-wrap: anywhere;
    }

    .kh-public .card-body {
        padding: 1rem;
    }

    .kh-venue-map {
        height: min(320px, 65vh);
    }

    .kh-pager {
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 375px) {
    .kh-appbar__action {
        max-width: 42%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .kh-bookbar__meta {
        font-size: 0.75rem;
    }

    .kh-bookbar .btn {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }
}

.kh-missing-page {
    background: #07182d;
    min-height: 100vh;
}

.kh-missing {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 32px 20px;
    background:
        radial-gradient(circle at 50% 0%, rgba(35, 75, 115, 0.7), transparent 42%),
        linear-gradient(145deg, #061426 0%, #0c2340 58%, #091b31 100%);
}

.kh-missing::before {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 52px 52px;
    content: "";
    mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.kh-missing__glow {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    pointer-events: none;
}

.kh-missing__glow--one {
    top: -100px;
    right: -80px;
    background: var(--kh-gold);
}

.kh-missing__glow--two {
    bottom: -140px;
    left: -80px;
    background: #527ca8;
}

.kh-missing__card {
    position: relative;
    width: 100%;
    max-width: 460px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.075);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(20px);
    text-align: center;
}

.kh-missing__brand {
    display: flex;
    min-height: 108px;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.96);
}

.kh-missing__logo {
    display: block;
    width: auto;
    height: 52px;
}

.kh-missing__content {
    padding: 44px 40px 42px;
}

.kh-missing__code {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 -4px;
    color: #fff;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(5rem, 18vw, 7.2rem);
    font-weight: 700;
    line-height: 0.82;
    letter-spacing: -0.07em;
}

.kh-missing__zero {
    display: inline-flex;
    width: 0.72em;
    height: 0.72em;
    align-items: center;
    justify-content: center;
    margin: 0 0.06em;
    border: 0.055em solid rgba(201, 162, 39, 0.86);
    border-radius: 50%;
    color: var(--kh-gold-light);
    font-size: 0.64em;
    letter-spacing: normal;
}

.kh-missing__zero i {
    font-size: 0.38em;
}

.kh-missing__rule {
    width: 48px;
    height: 2px;
    margin: 27px auto 21px;
    border-radius: 10px;
    background: linear-gradient(90deg, transparent, var(--kh-gold), transparent);
}

.kh-missing__title {
    margin: 0 0 18px;
    color: #fff;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(1.55rem, 6vw, 1.9rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.kh-missing__redirect {
    display: grid;
    gap: 9px;
    width: min(100%, 220px);
    margin: 0 auto 26px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.78rem;
}

.kh-missing__progress {
    display: block;
    height: 3px;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
}

.kh-missing__progress i {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: var(--kh-gold);
    transform-origin: left;
    animation: kh-missing-countdown 15s linear forwards;
}

@keyframes kh-missing-countdown {
    to { transform: scaleX(0); }
}

.kh-missing__action,
.kh-missing__action:visited {
    display: inline-flex;
    min-width: 12rem;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 12px 22px;
    border: 1px solid var(--kh-gold);
    border-radius: 12px;
    background: var(--kh-gold);
    color: #07182d;
    font-weight: 700;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.kh-missing__action:hover {
    background: #dfbd43;
    color: #07182d;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(201, 162, 39, 0.24);
}

.kh-missing__action:focus-visible {
    outline: 3px solid rgba(232, 212, 138, 0.55);
    outline-offset: 4px;
}

.kh-denied__mark {
    display: inline-flex;
    width: 4.5rem;
    height: 4.5rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.15rem;
    border: 1px solid rgba(201, 162, 39, 0.45);
    border-radius: 1.35rem;
    background: linear-gradient(160deg, rgba(201, 162, 39, 0.22), rgba(255, 255, 255, 0.06));
    color: var(--kh-gold-light);
    font-size: 1.7rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.kh-denied__code {
    margin: 0 0 0.35rem;
    color: var(--kh-gold-light);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.22em;
}

.kh-denied__text {
    max-width: 28rem;
    margin: 0 auto 0.55rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.98rem;
    line-height: 1.55;
}

.kh-denied__hint {
    margin: 0 auto 1.6rem;
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.84rem;
    line-height: 1.45;
}

@media (max-width: 480px) {
    .kh-missing {
        padding: 18px;
    }

    .kh-missing__card {
        border-radius: 22px;
    }

    .kh-missing__brand {
        min-height: 92px;
    }

    .kh-missing__logo {
        height: 44px;
    }

    .kh-missing__content {
        padding: 40px 24px 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kh-missing__action {
        transition: none;
    }

    .kh-missing__progress i {
        animation: none;
    }
}
