:root {
  --admin-blue:#356493; --admin-blue-dark:#284f79; --admin-ink:#243a55;
  --admin-muted:#687d94; --admin-line:#dfe7f0; --admin-surface:#fff;
  --bs-primary:#356493; --bs-primary-rgb:53,100,147; --bs-body-bg:#f3f6fb;
  --bs-body-color:#243a55; --bs-link-color:#356493; --bs-link-hover-color:#284f79;
}
body { font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif!important; background:#f3f6fb!important; color:var(--admin-ink); }
.admin-workspace { min-height:100vh; padding:0!important; background:radial-gradient(ellipse at 4% 0,#e6eef9 0,transparent 40%),#f3f6fb!important; -webkit-font-smoothing:antialiased; }

/* Add shared navigation while preserving each page's toolbar and actions. */
.admin-shell { position:relative; z-index:1020; border-bottom:1px solid #d6e1ee; background:linear-gradient(110deg,#fff,#f7faff 60%,#edf3fb); box-shadow:0 3px 18px #34557d06; }
.admin-shell-row { display:flex; align-items:center; justify-content:space-between; gap:24px; min-height:78px; width:min(100% - 48px,1320px); margin:0 auto; }
.admin-shell-brand { display:flex; align-items:center; gap:12px; flex:0 1 auto; min-width:0; color:var(--admin-ink); text-decoration:none; }
.admin-shell-brand:hover { color:var(--admin-blue); }
.admin-shell-logo { display:grid; place-items:center; width:42px; height:42px; flex:0 0 42px; color:#fff; border:1px solid #ffffff3d; border-radius:13px; background:linear-gradient(145deg,#5689bd,#356493 65%,#2b527a); box-shadow:0 5px 12px #35649320,inset 0 1px 0 #ffffff45; }
.admin-shell-brand-text { display:grid; gap:3px; min-width:0; }
.admin-shell-brand-text strong { font-size:17px; line-height:1.2; letter-spacing:.4px; }
.admin-shell-brand-text small { max-width:235px; overflow:hidden; color:var(--admin-muted); text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
.admin-shell svg { width:19px; height:19px; flex:0 0 19px; }
.admin-shell-logo svg { width:24px; height:24px; }
.admin-navigation { display:flex; align-items:center; gap:5px; }
.admin-nav-link,.admin-more summary { display:flex; align-items:center; justify-content:center; gap:6px; min-height:41px; padding:9px 11px; border:1px solid transparent; border-radius:10px; color:#597089; text-decoration:none; font-size:13px; font-weight:600; line-height:1.4; white-space:nowrap; transition:background-color .15s,color .15s; }
.admin-nav-link:hover,.admin-more summary:hover { background:#eaf1f9; color:var(--admin-blue-dark); }
.admin-nav-link[aria-current="page"],.admin-more.is-current>summary { border-color:#d4e2f0; background:linear-gradient(135deg,#e4effb,#eef4fb); color:var(--admin-blue-dark); box-shadow:inset 0 1px 0 #fff; }
.admin-more { position:relative; }
.admin-more summary { cursor:pointer; list-style:none; user-select:none; }
.admin-more summary::-webkit-details-marker { display:none; }
.admin-more summary::after { content:""; width:6px; height:6px; margin-left:3px; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:rotate(45deg) translateY(-2px); }
.admin-more[open] summary::after { transform:rotate(225deg) translate(-1px,-1px); }
.admin-more-links { position:absolute; top:calc(100% + 11px); right:0; display:grid; min-width:210px; padding:8px; border:1px solid var(--admin-line); border-radius:14px; background:#fff; box-shadow:0 16px 45px #243a551c; }
.admin-more-links .admin-nav-link { justify-content:flex-start; padding:10px 12px; }
.admin-shell-menu-toggle { display:none; }
.admin-shell a:focus-visible,.admin-shell summary:focus-visible,.admin-shell button:focus-visible { outline:3px solid #78a8da; outline-offset:3px; }

/* Leave the editor's bed states and status badges to their page-specific styles. */
.admin-workspace>.container,.admin-workspace>main.container,.admin-workspace>.container-fluid,.admin-workspace>main.container-fluid { width:min(100% - 48px,1320px); max-width:1320px; margin-left:auto; margin-right:auto; padding-left:0!important; padding-right:0!important; }
.admin-workspace>.container.py-5 { padding-top:30px!important; }
.admin-workspace>.alert { width:min(100% - 48px,1320px); margin:20px auto; }
.admin-workspace h1,.admin-workspace h2,.admin-workspace h3,.admin-workspace h4 { color:var(--admin-ink); letter-spacing:-.3px; line-height:1.45; }
.admin-workspace h3 { font-size:clamp(1.15rem,1.8vw,1.5rem); }
.admin-workspace h4 { font-size:clamp(1.1rem,1.6vw,1.35rem); }
.admin-workspace .text-muted { color:var(--admin-muted)!important; }
.admin-workspace .card { border:1px solid var(--admin-line); border-radius:16px!important; background:#fff; box-shadow:0 4px 18px #29486906; }
.admin-workspace .card:hover { transform:none!important; }
.admin-workspace .card>.card-body:first-child { border-top-left-radius:inherit; border-top-right-radius:inherit; }
.admin-workspace .card>.card-body:last-child { border-bottom-left-radius:inherit; border-bottom-right-radius:inherit; }
.admin-workspace .card-header { border-bottom-color:var(--admin-line); }
.admin-workspace .card-footer { border-top-color:var(--admin-line); background:#f8fafd; }
.admin-workspace .card-active { border-color:#93b2d1!important; background:#f1f6fc!important; }
.admin-workspace .section-title { color:var(--admin-blue)!important; border-color:#6798c6!important; }
.admin-workspace .activity-title { color:var(--admin-ink); }
.admin-workspace .table .activity-title { min-width:180px; }
.admin-workspace .limit-tag { border-color:#d9e4ef; background:#f5f8fc; }
.admin-workspace .mobile-quick-card { border:1px solid #d4e2f0; border-radius:15px; background:linear-gradient(130deg,#f9fbff,#edf4fc); box-shadow:none; }

/* Existing page headers become a compact second-level toolbar. */
.admin-workspace>.navbar,.admin-workspace>.topbar { width:min(100% - 48px,1320px); margin:20px auto 0!important; padding:13px 18px; border:1px solid #d7e3f0; border-radius:13px; background:linear-gradient(105deg,#456e98,#356493 70%,#3c719e)!important; box-shadow:0 4px 14px #3564930a!important; }
.admin-workspace>.navbar>.container,.admin-workspace>.topbar>.container { max-width:none; padding:0; }
.admin-workspace>.navbar .navbar-brand { margin:0; font-size:1rem; }
.admin-workspace>.topbar .fs-4 { font-size:1.15rem!important; }
.admin-workspace>.navbar+.container { padding-top:24px; }

.btn-primary,.btn-student-library,.btn-student { --bs-btn-bg:var(--admin-blue); --bs-btn-border-color:var(--admin-blue); --bs-btn-hover-bg:var(--admin-blue-dark); --bs-btn-hover-border-color:var(--admin-blue-dark); --bs-btn-active-bg:var(--admin-blue-dark); --bs-btn-active-border-color:var(--admin-blue-dark); color:#fff!important; border-color:#356493!important; background:linear-gradient(140deg,#4b7eaf,#356493 70%,#315d89)!important; }
.btn-primary:hover,.btn-student-library:hover,.btn-student:hover { border-color:#284f79!important; background:linear-gradient(140deg,#3d709f,#284f79)!important; }
.btn-outline-primary { --bs-btn-color:#356493; --bs-btn-border-color:#a9c1da; --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#356493; --bs-btn-hover-border-color:#356493; --bs-btn-active-color:#fff; --bs-btn-active-bg:#284f79; --bs-btn-active-border-color:#284f79; color:#356493; border-color:#a9c1da; }
.btn-outline-primary:hover { color:#fff; background-color:#356493; border-color:#356493; }
.admin-workspace .btn { border-radius:9px; font-weight:500; }
.admin-workspace .btn:not(.btn-sm):not(.btn-lg):not(.btn-close):not(.btn-link) { padding:.52rem .95rem; }
.admin-workspace .btn-primary { box-shadow:0 3px 8px #35649315; }
.admin-workspace .btn-white { border-color:var(--admin-line); }
.admin-workspace .btn.border-2 { border-width:1px!important; }
.admin-workspace .btn.shadow-sm { box-shadow:none!important; }
.bg-primary { background-color:#356493!important; }
.text-primary { color:#356493!important; }

.admin-workspace .form-control,.admin-workspace .form-select { border-color:#d5dfeb; border-radius:9px; color:var(--admin-ink); background-color:#fff; min-height:39px; }
.admin-workspace .form-control:disabled,.admin-workspace .form-select:disabled { background-color:#edf1f6; color:#78899c; }
.admin-workspace .form-control-sm,.admin-workspace .form-select-sm { min-height:35px; }
.admin-workspace .form-control::placeholder { color:#8595a7; }
.admin-workspace .form-label { color:#475e78; font-size:.88rem; font-weight:600; }
.form-control:focus,.form-select:focus { border-color:#87a8d3; box-shadow:0 0 0 .2rem #35649316; }
.admin-workspace .form-check-input:checked { background-color:#356493; border-color:#356493; }
.admin-workspace .form-check-input:focus { box-shadow:0 0 0 .2rem #35649316; border-color:#87a8d3; }
.admin-workspace .alert { border-radius:12px; }
.admin-workspace .modal-content { border:1px solid #dce6f1; border-radius:18px; background-color:#fff; box-shadow:0 24px 70px #142d5020; }
.admin-workspace .modal-header { border-bottom-color:#e5ebf3; background:#f6f9fd; border-radius:18px 18px 0 0; }
.admin-workspace .modal-footer { border-top-color:#e5ebf3; background:#f9fbfe; border-radius:0 0 18px 18px; }
.admin-workspace .modal-title { color:var(--admin-ink); }

/* Roster candidates stay readable inside the room editor's inline lock panel. */
.admin-workspace #lock-student-results { max-height:240px; overflow-y:auto; overscroll-behavior:contain; padding:2px; color:var(--admin-muted); font-size:.875rem; }
.admin-workspace #lock-student-results>button { position:relative; display:block; width:100%; padding:11px 13px; border:1px solid #dce6f1; border-radius:10px!important; background:#fff; color:var(--admin-ink); text-align:left; line-height:1.5; transition:background-color .15s,border-color .15s; }
.admin-workspace #lock-student-results>button+button { margin-top:7px; }
.admin-workspace #lock-student-results>button:not(:disabled):hover { background:#f2f7fd; border-color:#a9c1da; }
.admin-workspace #lock-student-results>button.active { background:linear-gradient(120deg,#e8f2fd,#f3f8fe); border-color:#6798c6; box-shadow:inset 3px 0 #356493; }
.admin-workspace #lock-student-results>button:disabled { background:#f5f7fa; color:#77889b; cursor:not-allowed; }
.admin-workspace #lock-student-results>button:focus-visible { outline:2px solid #6798c6; outline-offset:1px; }
.admin-workspace #seat-lock-panel .form-control[readonly] { background:#f2f6fb; border-color:#e1e8f1; color:#526b86; }

.admin-workspace .table { --bs-table-bg:#fff; --bs-table-color:#3e536c; --bs-table-border-color:#e6ecf3; --bs-table-hover-bg:#f3f7fc; font-size:.875rem; }
.admin-workspace .table td,.admin-workspace .table th { vertical-align:middle; padding:13px 14px; }
.admin-workspace .table>thead:not(.table-dark)>tr>th { --bs-table-bg:#f3f7fc; background-color:#f3f7fc; color:#60758d; font-size:.78rem; font-weight:600; white-space:nowrap; }
.admin-workspace .table>thead.table-dark { --bs-table-bg:#456888; --bs-table-color:#fff; --bs-table-border-color:#63809c; }
.admin-workspace .table-sm td,.admin-workspace .table-sm th { padding:9px 12px; }
.admin-workspace .table-responsive,.admin-table-scroll { max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.admin-workspace .table-responsive { border-radius:13px; }
.admin-workspace .table-responsive:focus-visible,.admin-table-scroll:focus-visible { outline:2px solid #87a8d3; outline-offset:2px; }
.admin-workspace .reg-count-pill { background:#eaf2fc; color:#356493; }
.admin-workspace a.reg-count-pill:hover { background:#356493; color:#fff; }
.admin-workspace .page-link { color:var(--admin-blue); border-color:#dfe7f0; border-radius:7px!important; }
.admin-workspace .page-item.active .page-link { background:var(--admin-blue); border-color:var(--admin-blue); }
.admin-workspace .pagination { gap:4px; flex-wrap:wrap; }

/* Keep room counts visible without resurrecting the old empty black block. */
.room-availability-badge { display:inline-flex; align-items:center; width:auto; height:auto; min-height:0; padding:6px 10px; margin-top:4px; border-radius:8px; background:#e4eef9; color:#356493; font-size:12px; line-height:1.4; font-weight:600; }
.room-availability-badge:empty { display:none; }
.bunk-admin-label { display:block; margin:0 0 10px; color:#64748b; font-size:13px; }
.admin-workspace .legend-box { flex-wrap:wrap; gap:12px 24px; border-color:var(--admin-line); background:#f7fafe; }
.admin-workspace .legend-item { line-height:1.6; }
.admin-seat-tools,.admin-room-presets { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:14px 16px; margin-bottom:16px; border:1px solid #d9e5f2; border-radius:12px; background:linear-gradient(115deg,#f4f8fe,#fff); }
.admin-seat-tools .form-select,.admin-room-presets .form-select { width:auto; max-width:100%; }
.editor-summary { display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; padding:14px 18px; margin-bottom:18px; border:1px solid #dae6f2; border-radius:12px; background:#edf4fc; color:#526c88; font-size:.875rem; }
.editor-summary strong { color:#2d557c; }
.editor-save-bar { position:sticky; z-index:10; bottom:12px; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin-top:24px; padding:16px 20px; border:1px solid #d5e2f0; border-radius:14px; background:#ffffffed; box-shadow:0 8px 28px #284b7614; backdrop-filter:blur(12px); }

/* Standalone login, with no navigation shell. */
body:has(.login-card) { min-height:100dvh; height:auto!important; padding:28px 18px; background:radial-gradient(ellipse at 10% 0,#dceafa,transparent 55%),linear-gradient(145deg,#f2f6fc,#eaf1f9)!important; }
.login-card { margin:auto!important; overflow:hidden; border:1px solid #dce4f0!important; border-radius:22px!important; background:#fff; box-shadow:0 18px 60px #284e7a16!important; }
.login-card::before { content:""; display:block; height:5px; background:linear-gradient(90deg,#83afdb,#356493); }
.login-card .card-body { padding:36px; }
.login-card h3 { margin:3px 0 28px; color:#2b527c; font-size:1.4rem; font-weight:700; }
.login-card .form-label { color:#61758c; font-size:.88rem; }
.login-card .form-control { min-height:46px; border-color:#d5dfeb; border-radius:10px; background-color:#f9fbfe; }
.login-card .btn { min-height:46px; margin-top:10px; border-radius:10px; }
.login-card .card-header { background:#356493!important; color:#fff!important; }

@media(max-width:1100px) and (min-width:901px) {
  .admin-shell-row { gap:14px; }
  .admin-nav-link,.admin-more summary { padding:9px 8px; }
  .admin-navigation { gap:1px; }
  .admin-shell-brand-text small { max-width:170px; }
}
@media(max-width:900px) {
  .admin-shell-row { min-height:68px; width:calc(100% - 32px); gap:12px; }
  .admin-shell-logo { width:38px; height:38px; flex-basis:38px; border-radius:11px; }
  .admin-shell-brand-text strong { font-size:16px; }
  .admin-shell-brand-text small { max-width:min(55vw,320px); }
  .admin-shell-menu-toggle { display:flex; align-items:center; justify-content:center; gap:6px; min-height:38px; padding:7px 10px; border:1px solid #cfddeb; border-radius:9px; background:#f5f9fe; color:#356493; font-size:13px; white-space:nowrap; }
  .admin-navigation { position:absolute; top:calc(100% - 2px); left:16px; right:16px; display:none; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; padding:12px; border:1px solid #d8e4f0; border-radius:0 0 15px 15px; background:#fff; box-shadow:0 14px 30px #243a551b; max-height:min(75vh,580px); overflow-y:auto; }
  .admin-nav-open .admin-navigation { display:grid; }
  .admin-navigation>.admin-nav-link { justify-content:flex-start; padding:11px 12px; background:#f6f9fd; }
  .admin-more { grid-column:1/-1; }
  .admin-more summary { justify-content:flex-start; padding:10px 12px; }
  .admin-more-links { position:static; grid-template-columns:repeat(2,minmax(0,1fr)); min-width:0; box-shadow:none; margin-top:5px; padding:5px; border-color:#e9eef5; }
  .admin-more-links .admin-nav-link { white-space:normal; font-size:12px; }
}
@media(max-width:767px) {
  .admin-workspace>.container,.admin-workspace>main.container,.admin-workspace>.container-fluid,.admin-workspace>main.container-fluid,.admin-workspace>.navbar,.admin-workspace>.topbar,.admin-workspace>.alert { width:calc(100% - 28px); }
  .admin-workspace>.navbar,.admin-workspace>.topbar { margin-top:14px!important; padding:12px 14px; }
  .admin-workspace>.navbar>.container,.admin-workspace>.topbar>.container { gap:10px; }
  .admin-workspace>.navbar .navbar-brand { font-size:.9rem; }
  .admin-workspace>.navbar .d-flex { gap:5px; flex-wrap:wrap; }
  .admin-workspace>.navbar .me-3 { margin-right:.35rem!important; }
  .admin-workspace>.navbar .small { font-size:11px; }
  .admin-workspace>.container.py-5 { padding-top:22px!important; }
  .admin-workspace>.container.py-4,.admin-workspace>main.container.py-4,.admin-workspace>.container-fluid.py-4 { padding-top:22px!important; }
  .admin-workspace .card { border-radius:13px!important; }
  .admin-workspace .card-body.p-4,.admin-workspace .card.p-4 { padding:18px!important; }
  .admin-workspace #mainForm .card-body>.d-flex.justify-content-between { flex-wrap:wrap; gap:12px; }
  .admin-workspace #mainForm .card-body>.d-flex.justify-content-between>.section-title { flex-basis:100%; }
  .admin-workspace #mainForm .card-body>.d-flex.justify-content-between>div { display:flex; flex-wrap:wrap; gap:8px; }
  .admin-workspace .table { font-size:12px; }
  .admin-workspace .table td,.admin-workspace .table th { padding:10px 12px; }
  .admin-workspace .form-control,.admin-workspace .form-select { font-size:16px; }
  .admin-workspace .btn-sm { min-height:32px; }
  .admin-workspace .modal-body { padding:16px; }
  .admin-workspace .modal-footer { gap:8px; }
  .admin-workspace #lock-student-results { max-height:220px; }
  .admin-seat-tools,.admin-room-presets { padding:12px; gap:8px; }
  .editor-summary { padding:12px 14px; gap:8px 12px; font-size:12px; }
  .editor-save-bar { padding:12px; bottom:max(8px,env(safe-area-inset-bottom)); gap:10px; }
  .editor-save-bar .btn-lg { padding:.65rem 1.25rem!important; font-size:1rem; }
  .login-card .card-body { padding:28px; }
}
@media(prefers-reduced-motion:reduce) {
  .admin-workspace *,.admin-shell * { scroll-behavior:auto!important; transition-duration:.01ms!important; animation-duration:.01ms!important; }
}
@media print {
  .admin-shell,.admin-workspace>.navbar,.admin-workspace>.topbar { display:none!important; }
  .admin-workspace { background:#fff!important; }
  .admin-workspace>.container,.admin-workspace>.container-fluid { width:100%; max-width:none; }
  .admin-workspace .table-responsive,.admin-table-scroll { overflow:visible; }
  .editor-save-bar { position:static; box-shadow:none; }
}
