/* NIU Quality Assurance System. NexusIU navy #052B48 and orange #F68720. */
:root {
  --navy: #052B48; --navy2: #2D5A80; --orange: #F68720; --orange-d: #B4561A; --ink: #1E2A33; --muted: #6B7680;
  --line: #D6DEE6; --bg: #F3F6F9; --card: #FFFFFF; --tint: #E3EAF1; --otint: #FDEBD8;
  --green: #1E8E5A; --amber: #C77A0E; --red: #C0392B; --blue: #2D6CB0; --grey: #8A949C;
  --radius: 8px; --shadow: 0 1px 2px rgba(5,43,72,.06), 0 2px 8px rgba(5,43,72,.05);
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: "Segoe UI", Calibri, Carlito, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--navy2); }
a:hover { color: var(--orange-d); }
code { background: var(--tint); padding: 1px 5px; border-radius: 4px; font-size: .9em; word-break: break-all; }
h1 { font-size: 1.55rem; margin: 0; color: var(--navy); }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; color: var(--navy); }
.muted { color: var(--muted); }
small, .help { color: var(--muted); font-size: .85rem; }
.help { display: block; margin-top: .3rem; }

/* Top bar and shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; background: var(--navy); color: #fff; padding: .55rem 1rem; border-bottom: 3px solid var(--orange); }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-size: 1.05rem; }
.brand img { width: 30px; height: 30px; background: #fff; border-radius: 6px; padding: 2px; }
.brand strong { color: var(--orange); }
.topright { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.topright a { color: #fff; text-decoration: none; }
.topright .me small { display: block; color: #B8C7D6; font-size: .75rem; }
.topright .akili { border: 1px solid #ffffff55; padding: .25rem .6rem; border-radius: 6px; }
.linkbtn { background: none; border: 0; color: inherit; cursor: pointer; text-decoration: underline; font: inherit; padding: 0; }
.topbar .linkbtn { color: #fff; }
.navtoggle { display: none; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
.shell { display: flex; min-height: calc(100vh - 100px); }
.sidenav { width: 230px; flex: 0 0 230px; background: #fff; border-right: 1px solid var(--line); padding: 1rem .6rem; }
.navgroup { margin-bottom: 1rem; }
.navgroup span { display: block; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; color: var(--muted); margin: 0 .5rem .3rem; }
.navgroup a { display: block; padding: .38rem .6rem; border-radius: 6px; text-decoration: none; color: var(--ink); }
.navgroup a:hover { background: var(--tint); }
.navgroup a.active { background: var(--navy); color: #fff; }
.navfoot { font-size: .75rem; color: var(--muted); padding: .5rem; border-top: 1px solid var(--line); }
.main { flex: 1; min-width: 0; padding: 1.25rem 1.5rem 2rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pagehead .sub { margin: .3rem 0 0; color: var(--muted); max-width: 70ch; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Cards, grids, tiles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.cardhead h2 { margin: 0; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.twocol.wide-left { grid-template-columns: 1.6fr 1fr; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--navy2); border-radius: var(--radius); padding: .7rem .85rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
a.tile:hover { border-color: var(--orange); }
.tile .tl { font-size: .8rem; color: var(--muted); }
.tile .tv { font-size: 1.6rem; font-weight: 700; color: var(--navy); line-height: 1.2; }
.tile .tn { font-size: .78rem; color: var(--muted); }
.tile.t-green { border-left-color: var(--green); } .tile.t-amber { border-left-color: var(--amber); } .tile.t-red { border-left-color: var(--red); }
.tile.t-red .tv { color: var(--red); }

/* Buttons and badges */
.btn { display: inline-block; background: #fff; color: var(--navy); border: 1px solid var(--navy2); border-radius: 6px; padding: .42rem .85rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--tint); color: var(--navy); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-d); border-color: var(--orange-d); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: #fbeaea; }
.btn.small { padding: .22rem .55rem; font-size: .85rem; }
.btn.wide { width: 100%; }
form.inline { display: inline; margin: 0; }
.badge { display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.b-green { background: #E3F4EC; color: var(--green); border-color: #BFE3D0; }
.b-amber { background: #FDF0DD; color: #985C08; border-color: #F3D3A4; }
.b-red { background: #FBE7E5; color: var(--red); border-color: #F1C3BE; }
.b-blue { background: #E4EEF8; color: var(--blue); border-color: #C3D7EE; }
.b-grey { background: #EEF1F3; color: #56616A; border-color: #D9DFE3; }
.rag { display: inline-block; width: 13px; height: 13px; border-radius: 50%; vertical-align: middle; border: 1px solid #0002; }
.rag-green { background: var(--green); } .rag-amber { background: #E9A23B; } .rag-red { background: var(--red); } .rag-none { background: #D3D9DE; }
.score { display: inline-block; min-width: 2rem; text-align: center; border-radius: 6px; padding: .05rem .35rem; font-weight: 700; color: #fff; }
.score.sg { background: var(--green); } .score.sa { background: #E9A23B; } .score.sr { background: var(--red); }

/* Flash */
.flash { border-radius: var(--radius); padding: .7rem .9rem; margin-bottom: 1rem; border: 1px solid; }
.flash ul { margin: .3rem 0 0 1.1rem; padding: 0; }
.flash-ok { background: #E8F6EF; border-color: #BFE3D0; color: #145C3B; }
.flash-info { background: #E8F0F9; border-color: #C3D7EE; color: #1D4B7C; }
.flash-warn { background: #FEF3E3; border-color: #F3D3A4; color: #7A4A06; }
.flash-error { background: #FCEBEA; border-color: #F1C3BE; color: #8E2A20; }
code.pw { font-size: 1.15rem; padding: .2rem .5rem; background: #fff; border: 1px dashed var(--navy2); user-select: all; }

/* Tables */
.tablewrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; background: var(--navy); color: #fff; font-weight: 600; padding: .5rem .6rem; white-space: nowrap; }
.tbl td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:nth-child(even) td { background: #F7F9FB; }
.tbl tbody tr:hover td { background: #FFF6EC; }
.tbl tr.rowwarn td { background: #FDF0EE !important; }
.tbl td.empty { color: var(--muted); text-align: center; padding: 1.2rem; }
.count { margin: 0 0 .5rem; color: var(--muted); font-size: .85rem; }
.pager { display: flex; gap: .3rem; margin-top: .75rem; flex-wrap: wrap; }
.pager a, .pager span { padding: .2rem .55rem; border: 1px solid var(--line); border-radius: 5px; text-decoration: none; }
.pager span { background: var(--navy); color: #fff; }
.sparkwrap { color: var(--navy2); }

/* Forms */
.form .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem 1.1rem; }
.field { display: flex; flex-direction: column; margin-bottom: .2rem; }
.field.wide { grid-column: 1 / -1; }
.field label { font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #B9C6D2; border-radius: 6px; padding: .45rem .55rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #F6872055; border-color: var(--orange); }
textarea { resize: vertical; }
label.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
label.check input { width: auto; }
.readonly { padding: .45rem 0; }
.formactions { margin-top: 1rem; display: flex; gap: .6rem; align-items: center; }
.form.narrow { max-width: 480px; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters input[type=search], .filters select { width: auto; min-width: 160px; }
.uploadform { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .8rem; }
.uploadform input[type=text] { flex: 1; min-width: 200px; }
.copylink { font-family: Consolas, monospace; font-size: .8rem; cursor: copy; min-width: 220px; }
.copylink.wide { width: 100%; }
.copylink.copied { border-color: var(--green); background: #E8F6EF; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }

/* Details list */
.details { display: grid; grid-template-columns: 220px 1fr; gap: .55rem 1rem; margin: 0; }
.details dt { font-weight: 600; color: var(--navy); }
.details dd { margin: 0; }

/* Checklist and rubric */
.checklist td:nth-child(4) { min-width: 140px; }
.checklist td:nth-child(5) { min-width: 200px; }
.rubric td { min-width: 130px; }
.rubcell { display: flex; gap: .4rem; align-items: flex-start; cursor: pointer; font-size: .85rem; }
.rubcell input { margin-top: .2rem; width: auto; }
.rubcell:has(input:checked) { color: var(--navy); font-weight: 600; }

/* Heat map */
.heat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: .3rem; max-width: 360px; }
.heat-y { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; color: var(--muted); font-size: .8rem; }
.heat-x { grid-column: 2; text-align: center; color: var(--muted); font-size: .8rem; }
.heatmap { border-collapse: separate; border-spacing: 3px; }
.heatmap th { font-size: .8rem; color: var(--muted); font-weight: 600; width: 1.5rem; }
.heatmap td { width: 52px; height: 40px; text-align: center; border-radius: 5px; font-weight: 700; }
.heatmap td a { display: block; color: #fff; text-decoration: none; line-height: 40px; }
.hg { background: #CDEBDB; } .ha { background: #F6D7A4; } .hr { background: #EFA9A1; }
.hg a { color: #145C3B !important; } .ha a { color: #7A4A06 !important; } .hr a { color: #7A1F16 !important; }

/* Survey bars */
.stack { display: flex; height: 16px; border-radius: 4px; overflow: hidden; background: #EEF1F3; min-width: 200px; }
.st { display: inline-block; height: 16px; }
.st1 { background: #C0392B; } .st2 { background: #E9A23B; } .st3 { background: #C9D1D8; } .st4 { background: #6FA8DC; } .st5 { background: #052B48; }
.legend { margin-top: .6rem; font-size: .8rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.legend .st { width: 14px; height: 10px; border-radius: 2px; }

/* Public pages */
body.public { background: linear-gradient(180deg, var(--navy) 0, var(--navy) 160px, var(--bg) 160px); }
.publicwrap { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 2rem; }
.publiclogo { background: #fff; display: inline-block; padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; border-bottom: 3px solid var(--orange); }
.publiclogo img { height: 52px; display: block; }
.publicfoot { text-align: center; color: var(--muted); font-size: .8rem; }
body.public h1 { margin-bottom: .5rem; }
.likert { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; margin: 0 0 .8rem; }
.likert legend { font-weight: 600; padding: 0 .3rem; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.scale label { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; font-size: .8rem; padding: .45rem .2rem; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.scale label:has(input:checked) { border-color: var(--orange); background: var(--otint); font-weight: 600; }
.scale input { width: auto; }

/* Responsive */
@media (max-width: 900px) {
  .navtoggle { display: block; }
  .sidenav { position: fixed; top: 52px; left: 0; bottom: 0; z-index: 15; transform: translateX(-100%); transition: transform .2s; overflow-y: auto; box-shadow: 2px 0 12px #0002; }
  body.navopen .sidenav { transform: none; }
  .main { padding: 1rem; }
  .twocol, .twocol.wide-left { grid-template-columns: 1fr; }
  .details { grid-template-columns: 1fr; gap: .2rem; }
  .details dd { margin-bottom: .5rem; }
  .topright .me small, .topright .akili { display: none; }
  .brand span { font-size: .95rem; }
}
@media (max-width: 520px) {
  .scale { grid-template-columns: 1fr; }
  .scale label { flex-direction: row; justify-content: flex-start; }
  .filters input[type=search], .filters select { width: 100%; }
}
@media print {
  .topbar, .sidenav, .actions, .filters, .uploadform, .foot { display: none !important; }
  .main { padding: 0; } .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
.tbl td:first-child a { white-space: nowrap; }
