:root {
    --cef-sidebar-width: 17rem;
    --cef-sidebar-collapsed-width: 5.25rem;
    --cef-navy: #12395d;
    --cef-blue: #1769aa;
    --cef-surface: #f4f7fb;
}

html, body { min-height: 100%; }
body { margin: 0; background: var(--cef-surface); color: #18324a; }
.auth-body { min-height: 100vh; background: linear-gradient(135deg,#eaf2f9,#f8fafc); display: grid; align-items: center; }
.auth-shell { max-width: 31rem; }
.auth-brand { display: grid; width: 4rem; height: 4rem; place-items: center; border-radius: 1.25rem; color: #fff; background: linear-gradient(135deg,var(--cef-blue),var(--cef-navy)); font-weight: 800; letter-spacing: .04em; box-shadow: 0 .75rem 2rem rgba(18,57,93,.2); }
.auth-brand-image { overflow: hidden; padding: .35rem; background: #fff; }
.auth-brand-image img { width: 100%; height: 100%; object-fit: contain; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 2000; padding: .6rem 1rem; background: #fff; border-radius: .5rem; }
.admin-shell { min-height: 100vh; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1045; display: flex; width: var(--cef-sidebar-width); flex-direction: column; overflow-y: auto; color: #fff; background: linear-gradient(180deg, var(--cef-navy), #0b2842); transition: transform .2s ease; }
.sidebar-brand { display: flex; min-height: 5rem; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand small { color: rgba(255,255,255,.65); font-size: .75rem; }
.brand-mark { display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border-radius: .75rem; background: #fff; color: var(--cef-navy); font-size: .8rem; font-weight: 800; }
.brand-mark-image { overflow: hidden; padding: .2rem; }
.brand-mark-image img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-nav { flex: 1; padding: 1.25rem .85rem; }
.sidebar-label { margin: 0 .65rem .55rem; color: rgba(255,255,255,.5); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-link { display: flex; align-items: center; gap: .75rem; margin-bottom: .25rem; padding: .75rem .8rem; border-radius: .7rem; color: rgba(255,255,255,.76); text-decoration: none; }
.sidebar-link:hover, .sidebar-link.active { color: #fff; background: rgba(255,255,255,.12); }
.sidebar-link.disabled { cursor: not-allowed; opacity: .5; }
.sidebar-meta { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; color: rgba(255,255,255,.65); border-top: 1px solid rgba(255,255,255,.12); }
.admin-main { display: flex; min-height: 100vh; margin-left: var(--cef-sidebar-width); flex-direction: column; }
.admin-navbar { min-height: 5rem; padding: .65rem 1.25rem; }
.navbar-eyebrow { color: #697b8c; font-size: .75rem; }
.navbar-title { margin: 0; font-size: 1.15rem; font-weight: 700; }
.admin-content { flex: 1; padding: 1.75rem; }
.admin-footer { padding: 1rem 1.75rem; color: #6a7c8d; font-size: .8rem; }
.feature-icon { display: grid; width: 3rem; height: 3rem; flex: 0 0 auto; place-items: center; border-radius: .9rem; font-size: 1.3rem; }
.status-item { display: flex; height: 100%; align-items: flex-start; gap: .7rem; padding: .9rem; border: 1px solid #e5eaf0; border-radius: .75rem; background: #fff; }
.status-item strong, .status-item span { display: block; }
.status-item span { margin-top: .15rem; color: #6a7c8d; font-size: .82rem; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 1040; background: rgba(8,22,34,.48); }
.sidebar-logout-form { margin: 0; }
.sidebar-logout-form .sidebar-link { background: transparent; text-align: left; }
.sidebar-collapse-button { align-items: center; justify-content: center; }
.metric-card { transition: transform .2s ease, box-shadow .2s ease; }
.metric-card:hover { transform: translateY(-2px); }
.metric-value { font-size: 2rem; line-height: 1; }
.metric-icon { display: grid; width: 3rem; height: 3rem; place-items: center; border-radius: .9rem; font-size: 1.2rem; }
.dashboard-placeholder, .empty-state { display: grid; min-height: 14rem; place-items: center; align-content: center; gap: .65rem; padding: 2rem; border: 1px dashed #cad5df; border-radius: 1rem; color: #6a7c8d; text-align: center; background: #f8fafc; }
.dashboard-placeholder strong, .empty-state strong { color: #294760; }
.delivery-search-sticky { position: sticky; top: 5.25rem; z-index: 1020; }
.delivery-table { min-width: 74rem; }
.delivery-table thead th { white-space: nowrap; background: #f3f6f9; color: #3b5268; font-size: .78rem; letter-spacing: .025em; text-transform: uppercase; }
.status-legend { font-size: .8rem; color: #5f7181; }
.status-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.status-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; }
.cef-no-shirt-row > * { background-color: #dff4e7 !important; color: #183f2a; }
.cef-no-shirt-badge { color: #17472d; background: #a9dfbd; }
.cef-no-shirt-dot { background: #72c894; }
.cef-no-shirt-check:checked { background-color: #72c894; border-color: #4eaa70; }
.cef-completed-check:checked { background-color: #198754; border-color: #198754; }
.column-contract { display: grid; grid-template-columns: repeat(6,minmax(max-content,1fr)); overflow-x: auto; border: 1px solid #d9e2ea; border-radius: .75rem; background: #f8fafc; }
.column-contract span { padding: .75rem; border-right: 1px solid #d9e2ea; color: #294760; font-size: .8rem; font-weight: 700; text-align: center; white-space: nowrap; }
.column-contract span:last-child { border-right: 0; }
.participant-block { padding: 1rem; border: 1px solid #dfe6ed; border-radius: .85rem; background: #f8fafc; }
.participant-block legend { float: none; width: auto; margin: 0 0 .5rem; padding: 0 .35rem; color: var(--cef-navy); }
.inventory-history { max-height: 28rem; overflow: auto; }
.inventory-history thead { position: sticky; top: 0; z-index: 1; }
.branding-preview { display: grid; min-height: 8rem; place-items: center; padding: 1rem; border: 1px dashed var(--bs-border-color); border-radius: .75rem; background: var(--bs-tertiary-bg); }
.branding-preview img { max-width: 100%; max-height: 9rem; object-fit: contain; }

[data-bs-theme="dark"] { --cef-surface: #111820; }
[data-bs-theme="dark"] body { color: var(--bs-body-color); }
[data-bs-theme="dark"] .auth-body { background: linear-gradient(135deg,#111820,#182532); }
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .card-footer.bg-white,
[data-bs-theme="dark"] .card-header.bg-white { background-color: var(--bs-body-bg) !important; }
[data-bs-theme="dark"] .navbar-eyebrow,
[data-bs-theme="dark"] .admin-footer,
[data-bs-theme="dark"] .status-legend { color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .status-item,
[data-bs-theme="dark"] .dashboard-placeholder,
[data-bs-theme="dark"] .empty-state,
[data-bs-theme="dark"] .column-contract,
[data-bs-theme="dark"] .participant-block { color: var(--bs-body-color); background: var(--bs-tertiary-bg); border-color: var(--bs-border-color); }
[data-bs-theme="dark"] .dashboard-placeholder strong,
[data-bs-theme="dark"] .empty-state strong,
[data-bs-theme="dark"] .column-contract span,
[data-bs-theme="dark"] .participant-block legend { color: var(--bs-body-color); }
[data-bs-theme="dark"] .delivery-table thead th { background: #253443; color: #eef4fa; }
[data-bs-theme="dark"] .cef-no-shirt-row > * { background-color: #183b2b !important; color: #e0f5e8; }
[data-bs-theme="dark"] .cef-no-shirt-badge { color: #dff4e7; background: #286544; }

@media (min-width: 992px) {
    body.sidebar-collapsed .admin-sidebar { width: var(--cef-sidebar-collapsed-width); }
    body.sidebar-collapsed .admin-main { margin-left: var(--cef-sidebar-collapsed-width); }
    body.sidebar-collapsed .sidebar-brand > span:not(.brand-mark),
    body.sidebar-collapsed .sidebar-link span,
    body.sidebar-collapsed .sidebar-label,
    body.sidebar-collapsed .sidebar-meta small,
    body.sidebar-collapsed .sidebar-meta .badge { display: none; }
    body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: .65rem; }
    body.sidebar-collapsed .sidebar-brand .brand-mark { flex: 0 0 auto; }
    body.sidebar-collapsed .sidebar-collapse-button { position: absolute; top: 4.15rem; left: 50%; transform: translateX(-50%); margin: 0 !important; }
    body.sidebar-collapsed .sidebar-nav { padding-inline: .65rem; padding-top: 2rem; }
    body.sidebar-collapsed .sidebar-link { justify-content: center; padding-inline: .6rem; }
    body.sidebar-collapsed .sidebar-meta { justify-content: center; min-height: 3rem; }
}

@media (max-width: 991.98px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-main { margin-left: 0; }
    body.sidebar-open .admin-sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .admin-content { padding: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
.cef-wristband-edit { font-weight: 600; text-decoration: underline; white-space: nowrap; }
.cef-wristband-inline { width: 4.75rem; min-width: 4.75rem; max-width: 4.75rem; padding-inline: .4rem; }
.cef-operation-popover { --bs-popover-max-width: 15rem; --bs-popover-border-color: #e3a008; --bs-popover-header-bg: #fff3cd; }
.cef-operation-popover .popover-body { padding: .5rem .7rem; color: #664d03; font-size: .82rem; font-weight: 600; }
.cef-participant-group summary { cursor: pointer; list-style-position: outside; }
.cef-participant-group summary::marker { color: var(--bs-primary); }
.cef-participant-group[open] summary { margin-bottom: .45rem; }
.cef-participant-group-content { min-width: 18rem; padding: .55rem .7rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; background: var(--bs-body-bg); }
.cef-participant-member + .cef-participant-member { margin-top: .45rem; padding-top: .45rem; border-top: 1px solid var(--bs-border-color); }
.cef-participant-member-name { font-weight: 600; }
.cef-participant-group > summary { list-style: none; }
.cef-participant-group > summary::-webkit-details-marker { display: none; }
.cef-participant-group > summary { display: inline-flex; align-items: center; gap: .45rem; }
.cef-participant-arrow { display: inline-flex; align-items: center; justify-content: center; width: 1.8rem; height: 1.6rem; padding: 0; color: #fff; }
.cef-participant-group .cef-arrow-open { display: none; }
.cef-participant-group[open] .cef-arrow-closed { display: none; }
.cef-participant-group[open] .cef-arrow-open { display: inline-block; }
