:root {
    --brand-cyan: #18a9e5;
    --brand-lime: #b7d42f;
    --brand-yellow: #f4d733;
    --brand-pink: #f0528f;
    --brand-violet: #7e2cff;
    --ink: #132238;
    --muted: #64748b;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --surface-tint: #eef6ff;
    --border: rgba(19, 34, 56, 0.08);
    --shadow-soft: 0 16px 40px rgba(19, 34, 56, 0.08);
}

html,
body {
    min-height: 100%;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(126, 44, 255, 0.09), transparent 30%),
        radial-gradient(circle at top right, rgba(24, 169, 229, 0.10), transparent 26%),
        linear-gradient(180deg, #fdfefe, #f5f9ff 55%, #f7f8fc 100%);
}

.app-body {
    background-attachment: fixed;
}

.guest-body {
    background:
        radial-gradient(circle at 15% 15%, rgba(126, 44, 255, 0.12), transparent 25%),
        radial-gradient(circle at 85% 15%, rgba(24, 169, 229, 0.14), transparent 22%),
        linear-gradient(180deg, #fdfefe, #f6fbff 100%);
}

.guest-card,
.panel-card,
.stat-card,
.hero-card,
.soft-card,
.topbar {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.guest-card {
    border-radius: 32px;
}

.guest-brand-panel {
    min-height: 100%;
    padding: 3rem;
    background:
        linear-gradient(160deg, rgba(24, 169, 229, 0.12), rgba(126, 44, 255, 0.12)),
        linear-gradient(180deg, #ffffff, #f6f9ff);
    border-right: 1px solid var(--border);
    align-items: center;
}

.brand-logo,
.brand-logo-lg {
    object-fit: cover;
    background: #fff;
}

.brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 18px;
}

.brand-logo-lg {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    box-shadow: 0 20px 48px rgba(126, 44, 255, 0.18);
}

.eyebrow {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--brand-cyan);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar-panel {
    width: 308px;
    padding: 1.5rem;
    border-right: 0;
}

.app-theme-pro #appSidebar.sidebar-panel,
.app-theme-pro aside.sidebar-panel.offcanvas-lg,
.app-theme-pro aside.sidebar-panel.offcanvas {
    background-color: #353b45 !important;
    color: #eef2f7 !important;
    box-shadow: none;
}

.app-theme-pro #appSidebar .offcanvas-body,
.app-theme-pro aside.sidebar-panel .offcanvas-body {
    background: transparent !important;
    color: inherit;
}

.app-theme-pro .sidebar-panel .sidebar-brand .fw-bold,
.app-theme-pro .sidebar-panel .sidebar-brand small {
    color: #fff;
}

.app-theme-pro .sidebar-panel .sidebar-brand small.text-muted {
    color: rgba(255, 255, 255, 0.72) !important;
    opacity: 1;
}

.app-theme-pro .sidebar-panel .sidebar-user-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: none;
}

.app-theme-pro .sidebar-panel .sidebar-user-card .fw-semibold {
    color: #fff;
}

.app-theme-pro .sidebar-panel .sidebar-user-card .text-muted {
    color: rgba(255, 255, 255, 0.68) !important;
}

.app-theme-pro .sidebar-panel .sidebar-user-card .btn-outline-secondary {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

.app-theme-pro .sidebar-panel .sidebar-user-card .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
}

.app-theme-pro .sidebar-panel .sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    color: rgba(255, 255, 255, 0.92) !important;
    font-weight: 600;
    transition: 0.2s ease;
}

.app-theme-pro .sidebar-panel .sidebar-nav .nav-link i {
    color: inherit;
}

.app-theme-pro .sidebar-panel .sidebar-nav .nav-link:hover,
.app-theme-pro .sidebar-panel .sidebar-nav .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08);
}

.app-theme-pro .content-shell {
    background: #eef2f6;
    transition: margin-left 0.25s ease, width 0.25s ease;
}

.app-theme-pro #appSidebar.sidebar-panel,
.app-theme-pro aside.sidebar-panel.offcanvas-lg {
    transition: width 0.25s ease, opacity 0.25s ease, padding 0.25s ease, flex-basis 0.25s ease;
    flex: 0 0 308px;
    width: 308px;
    max-width: 308px;
}

body.sidebar-collapsed .app-theme-pro #appSidebar.sidebar-panel,
body.sidebar-collapsed .app-theme-pro aside.sidebar-panel.offcanvas-lg,
#appSidebar.sidebar-is-collapsed.sidebar-panel,
#appSidebar.sidebar-is-collapsed.offcanvas-lg {
    display: none !important;
    flex: 0 0 0 !important;
    width: 0 !important;
    max-width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    border: 0 !important;
    transform: none !important;
}

.sidebar-toggle-btn {
    position: fixed;
    left: calc(308px - 14px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1040;
    width: 28px;
    height: 56px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0 12px 12px 0;
    background: #17a2b8;
    color: #fff;
    box-shadow: 0 8px 20px rgba(23, 162, 184, 0.28);
    transition: left 0.25s ease, background 0.2s ease;
    cursor: pointer;
}

@media (min-width: 992px) {
    .sidebar-toggle-btn {
        display: inline-flex;
    }
}

.sidebar-toggle-btn:hover {
    background: #1494a8;
    color: #fff;
}

body.sidebar-collapsed .sidebar-toggle-btn,
#appSidebar.sidebar-is-collapsed ~ .sidebar-toggle-btn {
    left: 0;
    border-radius: 0 12px 12px 0;
}

body.sidebar-collapsed .sidebar-toggle-btn i,
#appSidebar.sidebar-is-collapsed ~ .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.pending-labels-panel {
    border: 1px solid rgba(23, 162, 184, 0.22);
    box-shadow: 0 12px 28px rgba(23, 162, 184, 0.12);
}

.pending-labels-panel .dashboard-panel-title {
    color: #0f766e;
}

.desktop-topbar {
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 72px;
    margin: 0;
    padding: 0 1.5rem;
    background: linear-gradient(90deg, #17a2b8, #18a9e5);
    color: #fff;
    box-shadow: 0 8px 24px rgba(23, 162, 184, 0.18);
}

.desktop-topbar-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-width: 0;
}

.desktop-topbar-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.desktop-topbar-church {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    font-weight: 600;
    opacity: 0.95;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.desktop-topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
}

.dashboard-page {
    max-width: 100%;
}

.dashboard-hero,
.dashboard-panel,
.dashboard-stat-card,
.dashboard-mini-card {
    background: #fff;
    border: 1px solid rgba(19, 34, 56, 0.08);
    box-shadow: 0 10px 28px rgba(19, 34, 56, 0.06);
}

.dashboard-hero {
    border-radius: 18px;
    padding: 1.5rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.dashboard-hero-main {
    min-width: 0;
}

.dashboard-hero-actions {
    flex-shrink: 0;
}

.dashboard-quick-checkin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    border-radius: 999px;
    padding: 0.85rem 1.2rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #17a2b8 0%, #4cc9f0 100%);
    border: none;
    box-shadow: 0 12px 28px rgba(23, 162, 184, 0.28);
}

.dashboard-quick-checkin-btn:hover,
.dashboard-quick-checkin-btn:focus {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(23, 162, 184, 0.32);
}

.dashboard-quick-checkin-btn i {
    font-size: 1.15rem;
}

.dashboard-quick-tabs .nav-link {
    border-radius: 999px;
    font-weight: 700;
    color: #64748b;
}

.dashboard-quick-tabs .nav-link.active {
    background: #17a2b8;
}

.dashboard-chart-wrap {
    position: relative;
    height: 320px;
}

.child-lookup-shell {
    position: relative;
}

.child-lookup-results {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 1080;
    background: #fff;
    border: 1px solid rgba(19, 34, 56, 0.12);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(19, 34, 56, 0.14);
    max-height: 280px;
    overflow: auto;
    padding: 0.35rem;
}

.child-lookup-results.child-lookup-results-portal {
    right: auto;
}

.modal .child-lookup-shell {
    position: relative;
    z-index: 1;
}

.child-lookup-option {
    width: 100%;
    display: block;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
}

.child-lookup-option:hover,
.child-lookup-option:focus {
    background: rgba(23, 162, 184, 0.1);
}

.child-lookup-option-child {
    display: block;
    font-weight: 700;
    color: #1f2a37;
}

.child-lookup-option-guardian {
    display: block;
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 0.15rem;
}

.child-lookup-empty {
    padding: 0.8rem 0.9rem;
    color: #64748b;
    font-size: 0.92rem;
}

@media (max-width: 991.98px) {
    .dashboard-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-quick-checkin-btn {
        width: 100%;
        justify-content: center;
    }
}

.dashboard-kicker {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #17a2b8;
}

.dashboard-title {
    font-size: 1.9rem;
    font-weight: 800;
    color: #1f2a37;
}

.dashboard-subtitle {
    color: #64748b;
}

.dashboard-stat-card {
    border-radius: 16px;
    padding: 1.15rem 1.25rem;
    min-height: 108px;
}

.dashboard-stat-label {
    color: #64748b;
    font-size: 0.92rem;
}

.dashboard-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #17a2b8;
    line-height: 1.1;
    margin-top: 0.35rem;
}

.dashboard-panel {
    border-radius: 18px;
    padding: 1.25rem;
}

.dashboard-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.dashboard-panel-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1f2a37;
}

.dashboard-panel-meta {
    color: #64748b;
    font-size: 0.88rem;
}

.dashboard-search-shell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: min(100%, 320px);
    background: #f8fafc;
    border: 1px solid rgba(19, 34, 56, 0.08);
    border-radius: 999px;
    padding: 0.35rem 0.35rem 0.35rem 1rem;
}

.dashboard-search-shell .form-control {
    min-height: 42px;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding-left: 0;
}

.dashboard-search-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 0;
    color: #fff;
    background: #17a2b8;
}

.dashboard-table-wrap {
    border: 1px solid rgba(19, 34, 56, 0.06);
    border-radius: 14px;
    overflow: hidden;
}

.dashboard-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(19, 34, 56, 0.08);
}

.dashboard-table tbody td {
    border-bottom-color: rgba(19, 34, 56, 0.06);
}

.dashboard-panel-footer {
    margin-top: 1rem;
}

.dashboard-mini-card,
.dashboard-timeline-item {
    border-radius: 14px;
    padding: 0.95rem;
    background: #f8fafc;
    border: 1px solid rgba(19, 34, 56, 0.06);
}

.dashboard-timeline-item + .dashboard-timeline-item {
    margin-top: 0.75rem;
}

.badge-status-open {
    background: #0d6efd !important;
    color: #fff !important;
}

.badge-status-closed {
    background: #374151 !important;
    color: #fff !important;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.app-theme-pro .sidebar-panel .sidebar-user-card {
    margin-top: 1.5rem;
    border-radius: 24px;
    padding: 1rem;
}

.content-shell {
    flex: 1;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    border-radius: 0 0 24px 24px;
    margin: 0 0.75rem;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--ink);
    font-weight: 800;
}

.main-content {
    max-width: 1440px;
}

.app-footer {
    max-width: 1440px;
}

.footer-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1rem 1.25rem;
    color: var(--muted);
    box-shadow: var(--shadow-soft);
}

.footer-install-links {
    min-width: 0;
}

.footer-install-btn {
    white-space: nowrap;
}

.hero-card {
    border-radius: 28px;
    padding: 2rem;
    background:
        linear-gradient(135deg, rgba(24, 169, 229, 0.14), rgba(244, 215, 51, 0.12), rgba(126, 44, 255, 0.10)),
        #fff;
}

.install-guide-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 252, 0.95));
}

.install-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    box-shadow: 0 14px 28px rgba(19, 34, 56, 0.12);
}

.install-icon.ios {
    background: linear-gradient(135deg, #111827, #334155);
}

.install-icon.android {
    background: linear-gradient(135deg, #45c14f, #18a9e5);
}

.install-steps {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--ink);
}

.install-steps li {
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

.install-steps li:last-child {
    margin-bottom: 0;
}

.stat-card,
.panel-card {
    border-radius: 26px;
    padding: 1.5rem;
}

.stat-label {
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: capitalize;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    margin-top: 0.35rem;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.page-head h2,
.panel-header h3 {
    font-weight: 800;
}

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

.soft-card {
    border-radius: 22px;
    padding: 1rem;
    background: linear-gradient(180deg, #ffffff, var(--surface-soft));
}

.timeline-item {
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
    border-bottom: 0;
}

.btn-brand {
    border: 0;
    border-radius: 999px;
    padding: 0.9rem 1.35rem;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(90deg, var(--brand-cyan), var(--brand-violet));
    box-shadow: 0 14px 28px rgba(24, 169, 229, 0.18);
}

.btn-brand:hover,
.btn-brand:focus {
    color: #fff;
    opacity: 0.96;
}

.alert {
    border: 0;
    border-radius: 18px;
}

.form-control,
.form-select {
    min-height: 52px;
    border-radius: 16px;
    border-color: rgba(19, 34, 56, 0.12);
    padding: 0.85rem 1rem;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(24, 169, 229, 0.4);
    box-shadow: 0 0 0 0.25rem rgba(24, 169, 229, 0.12);
}

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

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink);
}

.table > :not(caption) > * > * {
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
    border-bottom-color: rgba(19, 34, 56, 0.06);
}

.checkins-layout {
    overflow-x: hidden;
}

.checkins-layout > [class*='col-'] {
    min-width: 0;
}

.checkins-layout .panel-card,
.checkins-layout .soft-card,
.checkins-layout form,
.checkins-layout .d-grid {
    min-width: 0;
    max-width: 100%;
}

.checkins-layout .form-control,
.checkins-layout .form-select,
.checkins-layout .btn,
.checkins-layout label,
.checkins-layout p,
.checkins-layout h3,
.checkins-layout .small,
.checkins-layout .fw-semibold {
    max-width: 100%;
}

.responsive-history-table {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.responsive-history-table .table {
    min-width: 760px;
    margin-bottom: 0;
}

.avatar-sm,
.avatar-md,
.avatar-xl {
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 50%;
    background: var(--surface-tint);
    border: 2px solid rgba(24, 169, 229, 0.12);
}

.avatar-sm {
    width: 44px;
    height: 44px;
}

.avatar-md {
    width: 64px;
    height: 64px;
}

.avatar-xl {
    width: 112px;
    height: 112px;
}

.badge.text-bg-light {
    background: var(--surface-tint) !important;
    color: var(--ink) !important;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.85rem;
}

.calendar-day {
    min-height: 128px;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0.85rem;
    background: #fff;
}

.calendar-day.has-service {
    background: linear-gradient(180deg, #ffffff, var(--surface-soft));
}

.calendar-day-number {
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.calendar-empty {
    color: var(--muted);
    font-size: 0.9rem;
}

.calendar-service-btn {
    width: 100%;
    text-align: left;
    border: 0;
    border-radius: 14px;
    padding: 0.65rem 0.75rem;
    background: rgba(24, 169, 229, 0.08);
    margin-bottom: 0.45rem;
}

.calendar-service-btn:hover {
    background: rgba(24, 169, 229, 0.14);
}

.qr-scanner-shell {
    border-radius: 24px;
    overflow: hidden;
    background: #111;
    min-height: 340px;
    display: grid;
    place-items: center;
}

.qr-video {
    width: 100%;
    height: 340px;
    object-fit: cover;
}

#qrReader {
    width: 100%;
    min-height: 340px;
}

#qrReader video {
    width: 100% !important;
    height: 340px !important;
    object-fit: cover;
}

#qrReader__scan_region {
    background: #111;
}

.pagination .page-link {
    border-radius: 999px;
    margin: 0 0.15rem;
    border: 1px solid var(--border);
    color: var(--ink);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(90deg, var(--brand-cyan), var(--brand-violet));
    border-color: transparent;
}

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

    .sidebar-panel {
        width: min(88vw, 320px);
        border-right: 0;
        padding: 1.25rem;
    }

    .main-content {
        padding-top: 1rem !important;
    }

    .app-footer {
        padding-top: 0 !important;
    }

    .panel-card,
    .stat-card,
    .hero-card {
        padding: 1.25rem;
        border-radius: 22px;
    }

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

@media (max-width: 767.98px) {
    .guest-card {
        border-radius: 24px;
    }

    .brand-logo-lg {
        width: 108px;
        height: 108px;
    }

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

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

    .responsive-history-table {
        margin: 0 -0.2rem;
        padding-bottom: 0.35rem;
    }

    .responsive-history-table .table {
        min-width: 680px;
        font-size: 0.92rem;
    }

    .responsive-history-table .btn {
        white-space: nowrap;
    }

    .footer-install-btn {
        width: 100%;
    }
}

.event-hero-card .event-description {
    line-height: 1.7;
    color: #475569;
}

.event-hero-card h3 {
    color: #132238;
}

.event-card-link {
    display: block;
    color: inherit;
}

.event-card {
    border-radius: 1.25rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(19, 34, 56, 0.08);
    box-shadow: 0 12px 30px rgba(19, 34, 56, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.event-card-link:hover .event-card,
.event-card-link:focus .event-card {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(19, 34, 56, 0.12);
}

.event-card-cover {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #eef2f7;
}

.event-card-body {
    padding: 1.1rem 1.15rem 1.25rem;
}

.event-card-cta {
    display: inline-block;
    font-weight: 600;
    color: #1d4ed8;
}

.event-show-cover {
    height: 260px;
    background-size: cover;
    background-position: center;
    background-color: #eef2f7;
}

.event-table-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 0.75rem;
    border: 1px solid rgba(19, 34, 56, 0.08);
}

.event-card-cover-sm {
    height: 120px;
}
