/* FACTS Assessment console — brand taken from factsonline.in
   Blue #0094D9, light blue #56CCF2, navy #273254, charcoal #333033, tint #EBF8FF.
   Primary gradient as on the site: linear-gradient(90deg,#0094d9,#56ccf2). Poppins self-hosted. */
@font-face { font-family: 'Poppins'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/Poppins-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/Poppins-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/Poppins-Bold.ttf') format('truetype'); }

:root {
  --blue: #0094D9; --blue-l: #56CCF2; --navy: #273254; --char: #333033; --tint: #EBF8FF;
  --cool: #424D5E; --grey: #5B5B5B; --line: #E4E4E8; --bg: #F5F7FA; --white: #fff;
  --crit: #B3261E; --high: #E8590C; --med: #E0A800; --low: #2E86DE; --uns: #8A8F98;
  --pass: #1E9E5A; --fail: #B3261E; --warn: #E0A800;
  --grad: linear-gradient(90deg, #0094d9, #56ccf2);
  --radius: 12px; --shadow: 0 1px 2px rgba(39,50,84,.06), 0 2px 8px rgba(39,50,84,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Poppins', 'DejaVu Sans', Arial, sans-serif; font-size: 13px; line-height: 1.5; color: var(--char); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); font-weight: 700; margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', monospace; font-size: 12px; }
.muted { color: #6B6F78; } .small { font-size: 11.5px; } .nowrap { white-space: nowrap; }
.right { text-align: right; } .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; } .c { text-align: center; }

/* ---------- Header (white, like the site, with blue underline on nav) ---------- */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar .inner { display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 60px; max-width: 1600px; margin: 0 auto; }
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .brand img { height: 30px; display: block; }
.topbar .brand span { font-weight: 500; color: var(--cool); font-size: 12px; border-left: 2px solid var(--blue); padding-left: 10px; line-height: 1.2; }
.nav { display: flex; gap: 22px; height: 100%; flex-wrap: nowrap; overflow-x: auto; }
.nav a { position: relative; color: var(--char); font-weight: 500; font-size: 13.5px; display: flex; align-items: center; white-space: nowrap; }
.nav a::before { content: ''; position: absolute; left: 50%; bottom: 0; height: 3px; width: 0; background: var(--blue); transition: all .3s ease-in-out; }
.nav a:hover { color: var(--blue); text-decoration: none; }
.nav a:hover::before, .nav a.active::before { width: 100%; left: 0; }
.nav a.active { color: var(--blue); }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12px; white-space: nowrap; }
.role { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--tint); color: var(--blue); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.strip { height: 3px; background: var(--grad); }

main { max-width: 1600px; margin: 0 auto; padding: 22px 24px 48px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; }
.pagehead .sub { color: #6B6F78; font-size: 12.5px; margin-top: 2px; }
.crumbs { font-size: 12px; color: #6B6F78; margin-bottom: 4px; }

/* ---------- Cards / tiles ---------- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.card > h2:first-child, .card > .cardhead:first-child { margin-top: 0; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.cardhead h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g-2-1 { grid-template-columns: 2fr 1fr; } .g-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2-1, .g-1-2 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .topbar .brand span { display: none; } }
.grid > .card { margin-bottom: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; border-top: 3px solid var(--blue); transition: box-shadow .3s; }
.tile:hover { box-shadow: var(--shadow-lg); }
.tile .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--cool); font-weight: 500; }
.tile .val { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.2; margin-top: 2px; }
.tile .sub { font-size: 11.5px; color: #6B6F78; }
.tile.crit { border-top-color: var(--crit); } .tile.crit .val { color: var(--crit); }
.tile.high { border-top-color: var(--high); } .tile.high .val { color: var(--high); }
.tile.kev { border-top-color: var(--navy); }
.tile.ok { border-top-color: var(--pass); }
.tile.warn { border-top-color: var(--warn); }

/* ---------- Buttons (site: gradient, bold, uppercase, rounded) ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em; padding: 8px 16px; border-radius: 10px; color: var(--white); background: var(--grad);
  transition: all .3s ease-in-out; white-space: nowrap; text-decoration: none; line-height: 1.4; }
.btn:hover { filter: brightness(1.1); box-shadow: var(--shadow-lg); text-decoration: none; }
.btn.sec { background: var(--white); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.btn.sec:hover { background: var(--tint); }
.btn.navy { background: var(--navy); }
.btn.danger { background: var(--crit); }
.btn.ghost { background: transparent; color: var(--cool); box-shadow: inset 0 0 0 1px var(--line); }
.btn.sm { padding: 4px 10px; font-size: 11px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; box-shadow: none; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

/* ---------- Forms ---------- */
label { display: block; font-size: 11.5px; font-weight: 500; color: var(--cool); margin-bottom: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=file], select, textarea {
  font-family: inherit; font-size: 13px; color: var(--char); padding: 7px 10px; border: 1px solid #D2D2D2; border-radius: 8px; background: var(--white); width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,148,217,.15); }
.field { margin-bottom: 12px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; align-items: end; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; margin-bottom: 12px; }
.filters .f { min-width: 130px; flex: 0 1 170px; }
.filters .f.wide { flex: 1 1 220px; }
.check { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--char); font-weight: 400; margin: 0; }
.help { font-size: 11px; color: #6B6F78; margin-top: 2px; }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.t th { text-align: left; background: var(--tint); color: var(--navy); font-weight: 700; font-size: 11.5px; padding: 7px 9px; border-bottom: 2px solid var(--blue); white-space: nowrap; }
table.t th a { color: var(--navy); } table.t th a.sorted { color: var(--blue); }
table.t td { padding: 6px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tbody tr:hover td { background: #F8FCFF; }
table.t.compact td { padding: 4px 8px; }
table.kv { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.kv th { text-align: left; width: 38%; color: var(--cool); font-weight: 500; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv td { padding: 5px 8px; border-bottom: 1px solid var(--line); word-break: break-word; }
.empty { padding: 22px; text-align: center; color: #6B6F78; }

/* ---------- Severity / status pills ---------- */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #fff; letter-spacing: .02em; white-space: nowrap; }
.pill.crit { background: var(--crit); } .pill.high { background: var(--high); } .pill.med { background: var(--med); color: #222; } .pill.low { background: var(--low); } .pill.uns { background: var(--uns); }
.st { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700; white-space: nowrap; border: 1px solid; }
.st.pass { color: var(--pass); border-color: var(--pass); background: #EAF7F0; }
.st.fail { color: var(--fail); border-color: var(--fail); background: #FBECEB; }
.st.warn { color: #9A7400; border-color: var(--warn); background: #FFF8E1; }
.st.info { color: var(--blue); border-color: var(--blue); background: var(--tint); }
.st.off { color: #6B6F78; border-color: #B2B4B7; background: #F3F3F3; }
.crit-t { color: var(--crit); } .high-t { color: var(--high); } .med-t { color: #9A7400; } .low-t { color: var(--low); } .fail-t { color: var(--fail); } .pass-t { color: var(--pass); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.on { background: var(--pass); } .dot.off { background: #B2B4B7; } .dot.bad { background: var(--crit); }
.tag { display: inline-block; padding: 0 7px; border-radius: 999px; background: #F2F2F2; color: var(--cool); font-size: 11px; margin: 1px 2px 1px 0; }

/* Grade circle (same colours as the PDF) */
.grade { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; }
.grade.sm { width: 24px; height: 24px; font-size: 12px; }
.grade.lg { width: 96px; height: 96px; font-size: 48px; box-shadow: var(--shadow-lg); }
.grade.gA { background: #1E9E5A; } .grade.gB { background: #7CB342; } .grade.gC { background: #F2B705; } .grade.gD { background: #E8590C; } .grade.gF { background: #B3261E; } .grade.gN { background: #B2B4B7; }
.gradebox { text-align: center; padding: 8px 0; }
.gradebox .lbl { font-weight: 700; color: var(--navy); margin-top: 8px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--cool); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a:hover { color: var(--blue); text-decoration: none; }
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ---------- Flash / alerts ---------- */
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 12.5px; border-left: 4px solid var(--blue); background: var(--tint); }
.alert.err { border-left-color: var(--crit); background: #FBECEB; color: #7A1A14; }
.alert.ok { border-left-color: var(--pass); background: #EAF7F0; color: #145F38; }
.alert.warn { border-left-color: var(--warn); background: #FFF8E1; color: #6B5200; }

.findings { list-style: none; padding: 0; margin: 0; }
.findings li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 10px; font-size: 12px; }
.bar { height: 8px; border-radius: 4px; background: #F2F2F2; overflow: hidden; display: flex; }
.bar span { display: block; height: 100%; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--tint); border: 1px dashed var(--blue); border-radius: 8px; padding: 10px 12px; word-break: break-all; font-size: 12.5px; }
pre.cmd { background: #1F2638; color: #E6EDF7; border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 6px 0 10px; }
.copyrow { position: relative; } .copyrow .btn { position: absolute; top: 8px; right: 8px; }
.chartbox { position: relative; height: 230px; }
.htmx-indicator { opacity: 0; transition: opacity .2s; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--tint); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
details.confirm summary { cursor: pointer; list-style: none; display: inline-block; }
details.confirm summary::-webkit-details-marker { display: none; }
details.confirm[open] .confirmbox { display: block; }
.confirmbox { margin-top: 10px; padding: 12px; border: 1px solid var(--crit); border-radius: 10px; background: #FFF9F8; max-width: 460px; }

/* ---------- Login (navy ground, white logo, gradient strip) ---------- */
body.auth { background: var(--navy); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.authbox { width: 100%; max-width: 400px; }
.authbox .logo { text-align: center; margin-bottom: 22px; } .authbox .logo img { height: 46px; }
.authbox .card { padding: 26px 28px; border-top: 4px solid; border-image: var(--grad) 1; border-radius: 4px 4px var(--radius) var(--radius); }
.authbox h1 { font-size: 18px; }
.authbox .btn { width: 100%; justify-content: center; padding: 11px; font-size: 13px; }
.authfoot { text-align: center; color: #B6C3DA; font-size: 11px; margin-top: 18px; }
.qr { text-align: center; margin: 10px 0; } .qr img, .qr svg { width: 200px; height: 200px; }

footer.foot { text-align: center; color: #8A8F98; font-size: 11px; padding: 16px; border-top: 1px solid var(--line); background: var(--white); }
.bignum { font-size: 24px; font-weight: 700; color: var(--navy); }
