:root {
  --ink: #10222e; --panel: #12293d; --panel2: #0d2137; --line: #274b66;
  --paper: #f4f7fa; --card: #ffffff; --text: #16232e; --muted: #5b7186;
  --accent: #0e7c66; --accent2: #0a5c4c; --warn: #b3540e; --bad: #b02a30;
  --train: #8a5a00; --trainbg: #fdf3d7;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--paper); color: var(--text); }
.hidden { display: none !important; }
button { font-family: inherit; }
input, select, textarea { width: 100%; padding: 10px 11px; border: 1.5px solid #c3d0da; border-radius: 8px; font-size: 15px; margin-top: 4px; background: #fff; }
label { display: block; font-size: 13px; font-weight: 700; margin: 10px 0; color: var(--ink); }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 800; font-size: 14.5px; cursor: pointer; }
.btn:hover { background: var(--accent2); }
.btn.big { width: 100%; padding: 13px; font-size: 16px; margin-top: 8px; }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn.secondary { background: #e7eef4; color: var(--ink); }
.btn.danger { background: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; font-size: 13.5px; padding: 4px 6px; }
.err { color: var(--bad); font-size: 13.5px; min-height: 16px; }
.mini { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 90; max-width: 92vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* auth */
.authwrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 18px; background: linear-gradient(160deg, #0d2137, #12293d 55%, #0a5c4c 130%); }
.authcard { background: #fff; border-radius: 16px; padding: 26px 24px; width: min(430px, 100%); box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.brandmark { font-size: 30px; font-weight: 900; letter-spacing: 1px; color: var(--panel2); }
.brandmark span { color: var(--accent); }
.brandmark.small { font-size: 19px; color: #fff; }
.brandmark.small span { color: #39d0ae; }
.tagline { font-size: 14px; line-height: 1.55; color: var(--muted); }
.fineprint { font-size: 11.5px; color: var(--muted); line-height: 1.5; border-top: 1px solid #e3eaf0; padding-top: 10px; margin-top: 16px; }
.authlinks { display: flex; justify-content: space-between; margin-top: 6px; }

/* shell */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--panel2); color: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 16px; flex-wrap: wrap; }
.modeswitch { display: flex; background: #081827; border-radius: 999px; padding: 3px; }
.modebtn { border: 0; background: transparent; color: #bcd; padding: 7px 16px; border-radius: 999px; font-weight: 800; cursor: pointer; font-size: 14px; }
.modebtn.on { background: var(--accent); color: #fff; }
.modebtn.train.on { background: var(--train); color: #fff; }
.topright { margin-left: auto; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.topright .linkbtn { color: #bcd; }
.who { font-size: 12.5px; color: #9fb8cc; margin-right: 8px; }
.testerbanner { background: #3b2f63; color: #fff; text-align: center; font-size: 13px; font-weight: 700; padding: 8px 12px; }
.gatebanner { background: #fff6ec; border: 1.5px solid #e86a00; color: #7a3a00; border-radius: 10px; padding: 10px 14px; font-size: 14px; margin: 0 0 14px; }
.trainbanner { background: var(--trainbg); color: var(--train); text-align: center; font-size: 13px; font-weight: 800; padding: 8px 12px; border-bottom: 2px solid var(--train); }
main { max-width: 980px; margin: 0 auto; padding: 18px 14px 40px; }
.foot { text-align: center; font-size: 11.5px; color: var(--muted); padding: 18px 10px 26px; }
.foot a { color: inherit; text-decoration: underline; }
.rowhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.subhead { margin-top: 26px; color: var(--muted); }
.panel { background: var(--card); border: 1.5px solid #dbe4ec; border-radius: 12px; padding: 14px 16px; margin: 12px 0; }
.panel h3, .panel h4 { margin: 4px 0 8px; }

/* queue */
.filecard { background: var(--card); border: 1.5px solid #dbe4ec; border-left: 6px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin: 10px 0; cursor: pointer; }
.filecard:hover { border-color: var(--accent); }
.filecard .top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.filecard .label { font-weight: 900; font-size: 16px; }
.ref { font-family: ui-monospace, Menlo, monospace; background: #e7eef4; padding: 2px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 700; }
.chip { font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #e7eef4; color: var(--ink); }
.chip.qc { background: #fdf3d7; color: var(--train); }
.chip.complete { background: #dff5ee; color: var(--accent2); }
.chip.overdue { background: #fbe3e4; color: var(--bad); }
.progressbar { background: #e3eaf0; height: 9px; border-radius: 99px; margin: 8px 0 4px; overflow: hidden; }
.progressbar i { display: block; height: 100%; background: var(--accent); }
.filemeta { font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.donwarn { color: var(--bad); font-weight: 800; }

/* file detail */
.sect { background: var(--card); border: 1.5px solid #dbe4ec; border-radius: 12px; margin: 12px 0; overflow: hidden; }
.sect > h3 { margin: 0; padding: 12px 14px; background: #eef3f8; font-size: 15.5px; display: flex; justify-content: space-between; }
.item { display: grid; grid-template-columns: 1fr 168px; gap: 10px; padding: 10px 14px; border-top: 1px solid #eef2f6; align-items: start; }
.item .txt { font-size: 14px; line-height: 1.5; }
.item .req { color: var(--bad); font-weight: 900; }
.item select { margin-top: 0; padding: 7px; font-size: 13.5px; }
.item .reason { grid-column: 1 / -1; }
.blockers { background: #fdf1f1; border: 1.5px solid #efc3c5; border-radius: 12px; padding: 12px 16px; margin: 12px 0; }
.blockers h4 { color: var(--bad); margin: 2px 0 6px; }
.blockers li { font-size: 13.5px; margin: 4px 0; }
.flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.flags label { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 4px 0; }
.flags input { width: auto; margin: 0; }
.note { border-top: 1px solid #eef2f6; padding: 8px 0; font-size: 13.5px; }
.note .kind { font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; color: var(--accent2); }
.note .meta { color: var(--muted); font-size: 12px; }
.attest { background: #eef7f4; border: 1.5px solid #bfe3d8; border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.attest label { display: flex; gap: 9px; align-items: flex-start; font-weight: 600; }
.attest input { width: auto; margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

/* training */
body.training main { background: var(--trainbg); border-radius: 0 0 14px 14px; }
.modcard { background: var(--card); border: 1.5px solid #e3d9bd; border-radius: 12px; padding: 14px 16px; margin: 10px 0; }
.modcard.locked { opacity: .65; }
.pass { color: var(--accent2); font-weight: 900; }
.lesson { background: #fffdf4; border: 1px solid #e9dfc0; border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.lesson p { font-size: 14.5px; line-height: 1.6; }
.quizq { background: var(--card); border: 1.5px solid #dbe4ec; border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.quizq .opt { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; margin: 6px 0; }
.quizq .opt input { width: auto; margin-top: 3px; }
.docpanel { background: #fff; border: 2px dashed #b9a55f; border-radius: 10px; padding: 12px 14px; margin: 10px 0; font-size: 14px; line-height: 1.6; }
.docpanel h4 { color: var(--train); margin: 0 0 6px; }
.obs { display: flex; gap: 9px; align-items: flex-start; background: var(--card); border: 1.5px solid #dbe4ec; border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.obs input { width: auto; margin-top: 3px; }
.debrief { font-size: 13.5px; border-top: 1px solid #eee; padding: 7px 0; }
.debrief .caught { color: var(--accent2); font-weight: 800; }
.debrief .missed { color: var(--bad); font-weight: 800; }

/* dashboards */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 9px; border-bottom: 1px solid #e6edf3; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: var(--card); border: 1.5px solid #dbe4ec; border-radius: 12px; padding: 12px 14px; }
.stat b { font-size: 22px; display: block; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 700; }
.inlineform { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.inlineform label { margin: 0; }

.printarea { display: none; }
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { display: block; position: absolute; inset: 0; padding: 24px; font-size: 13px; }
}
@media (max-width: 640px) {
  .item { grid-template-columns: 1fr; }
  .who { display: none; }
}

/* preview rebuild after blob store connection 2026-10-31 */

/* preview rebuild 2 after store connection confirmed 2026-10-31 */

/* preview rebuild 3 with blob read-write token in place 2026-10-31 */

/* resources tab */
body.resmode main { max-width: 1460px; }
.modebtn.res.on { background: #542d7a; color: #fff; }
.res-head h1 { margin: 6px 0 4px; font-size: 26px; }
.res-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr) 330px; gap: 18px; align-items: start; margin-top: 16px; }
.res-coltitle { font-size: 14px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 3px solid var(--line); }
.res-coltitle.adv { border-color: #542d7a; color: #542d7a; }
.res-coltitle.news { border-color: var(--warn); color: var(--warn); }
.res-coltitle.links { border-color: var(--accent); color: var(--accent2); }
.res-card { background: var(--card); border: 1px solid #d7e0e8; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(16, 34, 46, .06); }
.res-card h3 { margin: 0 0 6px; font-size: 15.5px; }
.res-card p { margin: 6px 0; font-size: 13.5px; line-height: 1.55; }
.res-card ul { margin: 6px 0 2px; padding-left: 18px; font-size: 13.5px; line-height: 1.55; }
.res-date { font-size: 11.5px !important; font-weight: 800; letter-spacing: .6px; color: var(--warn); text-transform: uppercase; margin: 0 0 4px !important; }
.res-pin { border: 2px solid var(--warn); background: #fffaf2; }
.res-link { padding: 8px 0; border-top: 1px solid #e3ebf1; }
.res-link:first-of-type { border-top: 0; padding-top: 2px; }
.res-link a { color: var(--accent2); font-weight: 700; }
@media (max-width: 1080px) { .res-grid { grid-template-columns: 1fr; } }

/* Dashboard navigation (redesign v2.1): role-aware sidebar on desktop,
   a drawer behind the menu button on small screens. Pages hold the
   panels; only one page shows at a time. */
.dashwrap { display: flex; gap: 16px; align-items: flex-start; margin-top: 10px; }
.dashnav { display: flex; flex-direction: column; gap: 4px; min-width: 178px; position: sticky; top: 10px; }
.dashnavbtn { text-align: left; padding: 9px 12px; border: 1px solid #d8dee6; background: #fff; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; color: inherit; }
.dashnavbtn.on { background: var(--accent, #542d7a); border-color: var(--accent, #542d7a); color: #fff; }
.dashpages { flex: 1; min-width: 0; }
.dashpage > .panel:first-child, .dashpage > .statgrid:first-child { margin-top: 0; }
.dashmenubtn { display: none; margin-top: 8px; }
@media (max-width: 860px) {
  .dashmenubtn { display: inline-block; }
  .dashwrap { flex-direction: column; }
  .dashnav { display: none; position: static; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .dashwrap.navopen .dashnav { display: flex; }
  .dashpages { width: 100%; }
}
html[data-theme="dark"] .dashnavbtn { background: #1d1830; border-color: #3a3358; color: #eee; }
html[data-theme="dark"] .dashnavbtn.on { background: var(--accent, #7a4db3); border-color: var(--accent, #7a4db3); color: #fff; }

/* profiles + team notifications (Phase 5.3) */
.avatarimg { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; vertical-align: middle; border: 2px solid var(--accent); }
.avatarbig { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); }
.avatarph { width: 76px; height: 76px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; }
.bellcount { background: #ff5252; color: #fff; border-radius: 99px; font-size: 11px; font-weight: 800; padding: 1px 6px; margin-left: 4px; vertical-align: top; }
.notifpanel { position: fixed; top: 64px; right: 12px; z-index: 70; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.35); padding: 10px 12px; }
.notifitem { padding: 8px 6px; border-top: 1px solid var(--line); }
.notifitem:first-of-type { border-top: 0; }
.notifitem.unread b { color: var(--accent); }

.auditmore { margin-top: 6px; }
.auditmore > summary { cursor: pointer; color: var(--accent); font-weight: 700; font-size: 13.5px; padding: 6px 0; }
