/* =========================================================
   JVM Training Portal — application layer on top of jvm.css
   (same tokens: navy, paper, single orange accent, Inter)
   ========================================================= */

body.portal { background: var(--paper); }
.portal main { min-height: calc(100svh - 160px); }

/* ---------- app header ---------- */
.app-header { background: var(--navy-800); color: #fff; position: sticky; top: 0; z-index: 40; }
.app-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; }
.app-header .brand { color: #fff; }
.app-header .brand__sub { opacity: .75; }
.app-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.app-nav a, .app-nav button {
  appearance: none; background: none; border: 0; cursor: pointer; font: inherit; color: #C6CEDA;
  font-size: 13.5px; padding: 8px 12px; border-radius: 2px; position: relative;
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.app-nav a:hover, .app-nav button:hover { color: #fff; background: rgba(255,255,255,.06); }
.app-nav a[aria-current="page"] { color: #fff; }
.app-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 1px; background: var(--accent); }
.app-nav .who { color: #8794A6; font-size: 12.5px; padding: 0 10px; border-left: 1px solid var(--line-dark); margin-left: 6px; }
@media (max-width: 900px) { .app-header .wrap { flex-direction: column; align-items: flex-start; padding-block: 14px; } }

/* ---------- page scaffolding ---------- */
.page { padding-block: clamp(36px, 5vw, 64px) clamp(56px, 7vw, 96px); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 32px; }
.page-head h1 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); font-weight: 300; margin: 0; }
.page-head .eyebrow { margin-bottom: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn--sm { padding: 10px 16px; font-size: 11.5px; }
.btn--danger { color: #9E2B17; }
.btn--danger::before { background: #9E2B17; }
.btn--danger:hover { border-color: #9E2B17; }
.link { color: var(--navy-700); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.link:hover { text-decoration-color: var(--accent); }

.panel { background: var(--white); border: 1px solid var(--line); padding: clamp(20px, 2.6vw, 32px); margin-bottom: 24px; }
.panel h2 { font-size: 1.35rem; font-weight: 400; margin-bottom: 16px; }
.panel h3 { font-size: 1.05rem; font-weight: 500; margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; border: 1px solid var(--line); background: var(--white); margin-bottom: 28px; }
.stat { padding: 22px 24px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: var(--font-display); font-weight: 300; font-size: 2.1rem; line-height: 1.1; color: var(--navy-800); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-mute); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--paper); white-space: nowrap; }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: rgba(11,31,58,.025); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted-sm { color: var(--ink-mute); font-size: 12.5px; }

/* ---------- badges ---------- */
.badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 2px; background: var(--paper-2); color: var(--ink-soft); white-space: nowrap; }
.badge--ok { background: #E3F1E7; color: #1E6B3A; }
.badge--bad { background: #F8E3DC; color: #9E2B17; }
.badge--warn { background: #FCEFD9; color: #8A5A0B; }
.badge--info { background: #E2EAF5; color: var(--navy-700); }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 28px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }
.f label, .f .label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 8px; }
.f input[type=text], .f input[type=email], .f input[type=password], .f input[type=number], .f input[type=date], .f input[type=search], .f select, .f textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--white);
  border: 1px solid var(--line); border-radius: 2px; padding: 11px 12px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.f textarea { min-height: 96px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(30,58,96,.12); }
.f .hint { font-size: 12.5px; color: var(--ink-mute); margin-top: 6px; }
.f .err { font-size: 13px; color: #9E2B17; margin-top: 6px; }
.check, .f label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); margin-bottom: 0; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--navy-800); flex: none; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.filters .f { min-width: 150px; }

/* ---------- flash ---------- */
.flash { padding: 14px 18px; margin-bottom: 24px; border-left: 3px solid var(--accent); background: var(--white); font-size: 15px; }
.flash--error { border-left-color: #9E2B17; }
.flash ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- public / responder pages ---------- */
.public-hero { background: var(--navy-800); color: #fff; padding-block: clamp(56px, 8vw, 110px); position: relative; overflow: hidden; }
.public-hero::before {
  content: ""; position: absolute; right: var(--gutter); top: 50%; width: min(36vw, 420px); aspect-ratio: 240 / 216; translate: 0 -50%;
  background: url("../img/brand/logo-mark.webp") center / contain no-repeat; opacity: .07; filter: grayscale(1) brightness(2.2); pointer-events: none;
}
.public-hero h1 { font-size: clamp(2.2rem, 5vw, 4rem); max-width: 18ch; }
.public-hero .lede { color: rgba(255,255,255,.8); }
.narrow { max-width: 720px; margin-inline: auto; }
.card-test { background: var(--white); border: 1px solid var(--line); padding: clamp(22px, 4vw, 40px); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; font-size: 15px; margin: 0; }
.kv dt { color: var(--ink-mute); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; padding-top: 3px; }
.kv dd { margin: 0; }

/* ---------- test runner ---------- */
.runner { max-width: 760px; margin-inline: auto; }
.runner-top { position: sticky; top: 0; z-index: 20; background: var(--paper); padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.timer { font-family: var(--font-display); font-size: 1.3rem; font-variant-numeric: tabular-nums; color: var(--navy-800); }
.timer.is-low { color: #9E2B17; }
.progress { height: 3px; background: var(--line); margin-top: 0; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width var(--t-med) var(--ease); }
.q-card { background: var(--white); border: 1px solid var(--line); padding: clamp(20px, 4vw, 36px); margin-top: 22px; }
.q-meta { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 14px; }
.q-text { font-family: var(--font-display); font-size: clamp(1.2rem, 2.6vw, 1.5rem); font-weight: 400; line-height: 1.35; margin: 0 0 20px; }
.q-image { margin: 0 0 20px; border: 1px solid var(--line); background: #fff; }
.q-image img { width: 100%; max-height: 360px; object-fit: contain; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 14px; align-items: flex-start; padding: 15px 16px; border: 1px solid var(--line); background: var(--white); cursor: pointer; font-size: 16px; line-height: 1.45; transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.opt:hover { border-color: var(--navy-600); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .key { flex: none; width: 28px; height: 28px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--ink-soft); border-radius: 50%; transition: all var(--t-fast) var(--ease); }
.opt.is-on { border-color: var(--navy-800); background: #F2F5FA; }
.opt.is-on .key { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.opt:focus-within { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.q-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.q-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 24px; }
.q-dots button { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--white); font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink-soft); }
.q-dots button.is-answered { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.q-dots button.is-current { outline: 2px solid var(--accent); outline-offset: 1px; }
.save-state { font-size: 12.5px; color: var(--ink-mute); }
.result-score { font-family: var(--font-display); font-weight: 200; font-size: clamp(3rem, 9vw, 5rem); line-height: 1; color: var(--navy-800); }

/* ---------- console ---------- */
.console-status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #9AA3AF; }
.dot.on { background: #2E8B57; }
.dot.off { background: #C0392B; }
.person-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.person { text-align: left; background: var(--white); border: 1px solid var(--line); padding: 16px 18px; cursor: pointer; font: inherit; transition: border-color var(--t-fast) var(--ease); }
.person:hover { border-color: var(--navy-700); }
.person b { display: block; font-weight: 500; }
.person[disabled] { opacity: .55; cursor: default; }

/* ---------- pagination ---------- */
nav[role="navigation"] { margin-top: 18px; font-size: 14px; }
nav[role="navigation"] svg { width: 16px; height: 16px; }

/* Disabled buttons must not look clickable */
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
