:root {
    --cms-primary: #0b2a4a;
    --cms-primary-dark: #071c31;
    --cms-secondary: #1e7048;
    --cms-accent: #176fbd;
    --cms-highlight: #e0a928;
    --cms-bg: #f4f7f9;
    --cms-surface: #ffffff;
    --cms-text: #172839;
    --cms-muted: #687a8b;
    --cms-border: #dce4ea;
    --cms-success: #198754;
    --cms-warning: #b77900;
    --cms-danger: #b52a37;
}

html, body { max-width: 100%; overflow-x: hidden; }
body { background: var(--cms-bg); color: var(--cms-text); }
img { max-width: 100%; height: auto; }
.container-fluid > .row > [class*="col-"] { min-width: 0; }

.cms-brand-logo { object-fit: contain; }
img.cms-brand-logo { display: block; }
.cms-brand-fallback { align-items: center; background: var(--cms-secondary); color: #fff; display: inline-flex; justify-content: center; }
.cms-brand-fallback i { font-size: 46%; }

.btn, .form-control, .form-select { min-height: 42px; border-radius: 5px; }
.btn { font-weight: 700; }
.btn-sm, .form-control-sm, .form-select-sm { min-height: 34px; }
.btn-primary, .bg-primary { background-color: var(--cms-primary) !important; border-color: var(--cms-primary) !important; }
.btn-primary:hover { background-color: var(--cms-primary-dark) !important; border-color: var(--cms-primary-dark) !important; }
.btn-success, .bg-success { background-color: var(--cms-secondary) !important; border-color: var(--cms-secondary) !important; }
.btn-outline-primary { color: var(--cms-primary); border-color: var(--cms-primary); }
.btn-outline-primary:hover { background: var(--cms-primary); border-color: var(--cms-primary); }
.text-primary { color: var(--cms-primary) !important; }
.text-success { color: var(--cms-secondary) !important; }

:focus-visible { outline: 3px solid rgba(23,111,189,.4); outline-offset: 2px; }
.card { border: 1px solid var(--cms-border); border-radius: 7px; box-shadow: 0 5px 18px rgba(11,42,74,.06); }
.card-header { border-bottom-color: var(--cms-border); font-weight: 700; }
.page-header { background: #fff; border: 1px solid var(--cms-border); border-left: 4px solid var(--cms-secondary); border-radius: 6px; box-shadow: none; margin-bottom: 20px; padding: 16px 18px; }

.table-responsive { -webkit-overflow-scrolling: touch; overflow-x: auto; }
.table { vertical-align: middle; }
.table thead th { background: #edf2f5; border-bottom: 1px solid #cbd6de; color: #40566a; font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.table th, .table td { overflow-wrap: anywhere; white-space: normal; }
.table-hover tbody tr:hover { background: #f7fafb; }
.badge { border-radius: 4px; font-size: .78rem; letter-spacing: 0; line-height: 1.2; max-width: 100%; padding: .5em .7em; white-space: normal; }
.table td, .table th, .card, .alert, .nav-link, .page-header, .modal-content { overflow-wrap: anywhere; }
.mobile-filter-panel > summary { cursor: pointer; font-weight: 800; list-style: none; }
.mobile-filter-panel > summary::-webkit-details-marker { display: none; }
.mobile-filter-panel > summary i { margin-right: .45rem; }

.navbar.cms-portal-navbar, body > .navbar.bg-primary { background: var(--cms-primary) !important; min-height: 64px; }
.cms-portal-logo { height: 38px; margin-right: .55rem; width: 38px; }
.cms-portal-navbar .navbar-brand { align-items: center; display: inline-flex; font-size: .95rem; text-transform: uppercase; }
.cms-portal-navbar .btn-primary { background: transparent !important; border-color: rgba(255,255,255,.28) !important; }

.cms-sidebar-shell { background: var(--cms-primary-dark); color: #fff; min-height: 100%; }
.desktop-sidebar { min-height: calc(100vh - 64px); position: sticky; top: 0; }
.sidebar-brand { align-items: center; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; gap: .7rem; padding: 17px 16px; }
.sidebar-brand .cms-sidebar-logo { flex: 0 0 42px; height: 42px; width: 42px; }
.sidebar-brand strong { color: #fff; display: block; font-size: .78rem; line-height: 1.2; text-transform: uppercase; }
.sidebar-brand small { color: #9eb0c0; display: block; font-size: .68rem; margin-top: .2rem; }
.user-panel { border-bottom: 1px solid rgba(255,255,255,.1); padding: 16px; }
.user-avatar { align-items: center; background: var(--cms-secondary); color: #fff; display: inline-flex; font-size: .9rem; font-weight: 800; height: 38px; justify-content: center; margin-right: .65rem; width: 38px; }
.user-panel h6 { color: #fff; display: inline; font-size: .84rem; margin: 0; }
.badge-role { background: rgba(224,169,40,.16); color: #f1c85e; display: block; font-size: .65rem; font-weight: 700; margin: .5rem 0 0 3.05rem; text-transform: uppercase; width: max-content; }
.menu-title { color: #71899d; font-size: .64rem; font-weight: 800; letter-spacing: 0; padding: 17px 16px 5px; text-transform: uppercase; }
.cms-sidebar-shell .nav { padding: 2px 9px; }
.cms-sidebar-shell .nav-link { align-items: center; border-left: 3px solid transparent; border-radius: 4px; color: #c3d0db; display: flex; font-size: .84rem; gap: .45rem; margin-bottom: 2px; padding: 9px 11px; }
.cms-sidebar-shell .nav-link:hover, .cms-sidebar-shell .nav-link.active { background: rgba(255,255,255,.08); border-left-color: var(--cms-highlight); color: #fff; }
.cms-sidebar-shell .nav-link i { color: #8fb1ca; text-align: center; width: 20px; }
.cms-sidebar-shell .nav-link.active i { color: var(--cms-highlight); }
.system-info { border-top: 1px solid rgba(255,255,255,.1); color: #7f94a5; font-size: .68rem; margin-top: 18px; padding: 15px; }
.cms-sidebar-offcanvas, .camper-offcanvas { max-width: 86vw; width: 300px; }
.cms-sidebar-offcanvas .offcanvas-body, .camper-offcanvas .offcanvas-body { background: var(--cms-primary-dark); padding: 0; }
.offcanvas-body { overflow-y: auto; }
.offcanvas-header { background: var(--cms-primary) !important; }

.dashboard-content, .camper-content { min-width: 0; }
.camper-sidebar { background: var(--cms-primary-dark); min-height: calc(100vh - 64px); }
.camper-sidebar .nav-link, .camper-offcanvas .nav-link { border-left: 3px solid transparent; border-radius: 4px !important; color: #c3d0db !important; font-size: .84rem; padding: 10px 12px; }
.camper-sidebar .nav-link:hover, .camper-sidebar .nav-link.active, .camper-offcanvas .nav-link:hover, .camper-offcanvas .nav-link.active { background: rgba(255,255,255,.08) !important; border-left-color: var(--cms-highlight); color: #fff !important; }

.modal-dialog { max-width: min(92vw, 700px); }
.modal-content { border: 0; border-radius: 7px; }
.modal-body { overflow-y: auto; }
.alert { border-radius: 5px; }
.form-label { color: #334b60; font-size: .88rem; font-weight: 700; }

.camp-id-card { margin-inline: auto; max-width: 420px; }
.camp-id-photo { background: #dfe8ee; border: 3px solid var(--cms-primary); height: 112px; margin: 0 auto 1rem; object-fit: cover; width: 112px; }
.camp-id-photo-fallback { align-items: center; color: var(--cms-primary); display: flex; font-size: 2rem; font-weight: 800; justify-content: center; }
.camp-id-qr { margin: 1rem auto; min-height: 220px; width: 220px; }
.camp-id-qr canvas, .camp-id-qr img { height: 220px !important; max-width: 100%; width: 220px !important; }
.camp-id-meta { display: grid; gap: .65rem; margin-top: 1rem; text-align: left; }
.camp-id-meta span { color: var(--cms-muted); display: block; font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.camp-id-meta strong { display: block; font-size: 1rem; }

.order-status-strip { background: #fff; border: 1px solid var(--cms-border); border-left: 4px solid var(--cms-secondary); display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 1rem 1.25rem; }
.order-status-strip > div { align-items: center; display: flex; justify-content: space-between; min-width: 0; }
.order-status-strip span:first-child { color: var(--cms-muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.order-item-list { display: grid; gap: .75rem; }
.order-item-row { align-items: center; border-bottom: 1px solid var(--cms-border); display: grid; gap: 1rem; grid-template-columns: 76px minmax(10rem, 1fr) repeat(3, minmax(5rem, auto)); padding: 0 0 .75rem; }
.order-product-image { height: 68px; width: 76px; }
.order-product-image img, .order-image-placeholder { border: 1px solid var(--cms-border); border-radius: 5px; height: 100%; object-fit: cover; width: 100%; }
.order-image-placeholder { align-items: center; background: #edf2f5; color: #607589; display: flex; font-size: 1.5rem; justify-content: center; }
.order-item-name span, .order-item-label { color: var(--cms-muted); display: block; font-size: .78rem; margin-top: .2rem; }
.order-total-row { align-items: center; display: flex; font-size: 1.05rem; justify-content: flex-end; gap: 1.5rem; padding-top: 1rem; }
.order-action-grid { display: grid; gap: .65rem; }
.order-filter-actions .btn { flex: 1 1 auto; }

@media (min-width: 769px) {
    .mobile-filter-panel > summary { display: none; }
}

@media (max-width: 991.98px) {
    .dashboard-content { padding-left: 0 !important; padding-right: 0 !important; }
}

@media (max-width: 768px) {
    .p-4, .camper-main { padding: 1rem !important; }
    .card-body { padding: 1rem; }
    .page-header, .d-flex.justify-content-between.align-items-center { align-items: flex-start !important; flex-wrap: wrap; gap: .75rem; }
    body { font-size: 1rem; }
    .card-header, .card-body, .table, .form-control, .form-select, .btn { font-size: .9375rem; }
    .page-header h1, .page-header h2, .page-header h3, main > h1, main > h2, main > h3, .camper-main > h3 { line-height: 1.2; }
    .table-responsive { border: 0; overflow: visible; }
    .mobile-scroll-shell { border: 1px solid var(--cms-border); overflow-x: auto; position: relative; }
    .mobile-scroll-shell::before { background: #edf2f5; color: #40566a; content: 'Swipe to view all columns'; display: block; font-size: .82rem; font-weight: 700; padding: .55rem .75rem; position: sticky; left: 0; }
    .mobile-scroll-table { min-width: 760px; }
    .mobile-card-table { border: 0; display: block; min-width: 0 !important; width: 100% !important; }
    .mobile-card-table thead { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
    .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td { display: block; width: 100% !important; }
    .mobile-card-table tbody { display: grid; gap: .85rem; }
    .mobile-card-table tbody tr { background: var(--cms-surface); border: 1px solid var(--cms-border); border-left: 4px solid var(--cms-secondary); border-radius: 6px; box-shadow: 0 3px 12px rgba(11,42,74,.07); overflow: hidden; padding: .35rem .85rem; }
    .mobile-card-table tbody td { align-items: start; border: 0; border-bottom: 1px solid #edf1f4; display: grid; font-size: .9375rem; gap: .65rem; grid-template-columns: minmax(7rem, 35%) minmax(0, 1fr); line-height: 1.4; padding: .65rem 0; text-align: left !important; }
    .mobile-card-table tbody td:last-child { border-bottom: 0; }
    .mobile-card-table tbody td::before { color: #53687a; content: attr(data-mobile-label); font-size: .8125rem; font-weight: 800; text-transform: uppercase; }
    .mobile-card-table tbody td:first-child { color: var(--cms-primary); font-size: 1rem; font-weight: 700; }
    .mobile-card-table tbody td[colspan] { display: block; padding: 1rem 0; text-align: center !important; }
    .mobile-card-table tbody td[colspan]::before, .mobile-card-table tbody td[data-mobile-label=""]::before { content: none; }
    .mobile-card-table .mobile-actions { align-items: stretch; display: flex; flex-wrap: wrap; gap: .5rem; }
    .mobile-card-table .mobile-actions::before { flex: 0 0 100%; }
    .mobile-card-table .mobile-actions > a, .mobile-card-table .mobile-actions > button, .mobile-card-table .mobile-actions > form { flex: 1 1 9rem; margin: 0 !important; }
    .mobile-card-table .mobile-actions .btn, .mobile-card-table .mobile-actions form .btn { align-items: center; display: inline-flex; justify-content: center; min-height: 44px; width: 100%; }
    .mobile-detail-table { min-width: 0 !important; width: 100%; }
    .mobile-detail-table tr { display: grid; grid-template-columns: minmax(7rem, 36%) minmax(0, 1fr); }
    .mobile-detail-table th, .mobile-detail-table td { display: block; font-size: .9375rem; min-width: 0; padding: .7rem; width: auto !important; }
    .dataTables_wrapper .row { gap: .6rem; }
    .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { text-align: left !important; }
    .dataTables_wrapper .dataTables_filter label, .dataTables_wrapper .dataTables_length label { display: block; width: 100%; }
    .dataTables_wrapper .dataTables_filter input { display: block !important; margin: .35rem 0 0 !important; width: 100% !important; }
    .dataTables_wrapper .pagination .page-item:not(.previous):not(.next) { display: none; }
    .dataTables_wrapper .pagination { justify-content: space-between !important; width: 100%; }
    .dataTables_wrapper .page-link { align-items: center; display: flex; min-height: 44px; padding: .65rem .9rem; }
    .mobile-filter-panel { background: #fff; border: 1px solid var(--cms-border); border-radius: 6px; margin-bottom: 1rem; padding: .75rem; }
    .mobile-filter-panel > summary { align-items: center; color: var(--cms-primary); display: flex; min-height: 44px; }
    .mobile-filter-panel[open] > summary { border-bottom: 1px solid var(--cms-border); margin-bottom: .9rem; padding-bottom: .65rem; }
    .modal-dialog { align-items: stretch; display: flex; margin: .5rem; min-height: calc(100% - 1rem); }
    .modal-dialog { margin: .5rem; }
    .modal-content { max-height: calc(100dvh - 1rem); overflow: hidden; width: 100%; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer .btn { flex: 1 1 9rem; min-height: 44px; }
    .btn-sm, .form-control-sm, .form-select-sm { font-size: .875rem; min-height: 40px; }
    .badge { font-size: .875rem; padding: .55em .72em; }
    .menu-title, .system-info, .sidebar-brand small, .badge-role { font-size: .75rem; }
    [data-cms-route="camper/shop.php"] .card-img-top, [data-cms-route="camper/shop.php"] .card > .bg-light { height: 240px !important; }
    [data-cms-route="camper/product.php"] .img-fluid { max-height: 420px; object-fit: contain; width: 100%; }
    .order-status-strip { grid-template-columns: 1fr; }
    .order-status-strip > div { min-height: 36px; }
    .order-item-row { align-items: start; grid-template-columns: 72px minmax(0, 1fr); }
    .order-item-row > div:nth-child(n+3) { border-top: 1px solid #edf1f4; grid-column: 1 / -1; padding-top: .55rem; }
    .order-product-image { height: 72px; width: 72px; }
    .order-filter-actions { width: 100%; }
}

@media (max-width: 575.98px) {
    .cms-brand-label, .cms-user-label, .camper-name { display: none; }
    .navbar .dropdown.me-3 { margin-right: .4rem !important; }
    .cms-portal-navbar .navbar-brand { font-size: .82rem; }
    h1 { font-size: 1.7rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.25rem; } h4 { font-size: 1.1rem; }
}

@media (max-width: 480px) {
    .p-4, .camper-main { padding: .75rem !important; }
    .card-body { padding: .9rem; }
    .row.g-4 { --bs-gutter-y: 1rem; }
    form .row > [class*="col-"] { width: 100%; }
    form:not(.d-inline):not(.d-flex) > .btn[type="submit"], form:not(.d-inline):not(.d-flex) > button:not([type]) { min-height: 46px; width: 100%; }
    .mobile-card-table tbody td { display: block; }
    .mobile-card-table tbody td::before { display: block; margin-bottom: .25rem; }
    .cms-sidebar-offcanvas, .camper-offcanvas { max-width: calc(100vw - 28px); width: 300px; }
    .camp-id-card { padding: 1rem !important; }
    .camp-id-qr, .camp-id-qr canvas, .camp-id-qr img { height: 210px !important; width: 210px !important; }
    .order-filter-actions { flex-direction: column; }
    .order-filter-actions .btn { width: 100%; }
    .order-total-row { justify-content: space-between; }
}
