/* ==========================================================================
   Palo Alto Networks datasheet palette, lifted from src/panstyle.sty so the
   app reads as a continuation of the printed study material.
   ========================================================================== */

:root {
  --orange:     #FA582D;
  --dark:       #141414;
  --grey:       #53565A;
  --light:      #F4F4F4;
  --rule:       #D9D9D9;
  --blue:       #0086A8;
  --green:      #1F8A5B;
  --red:        #C0341D;
  --wash:       #FDF1EC;   /* orange tint  -- key facts */
  --washblue:   #EDF6F8;   /* blue tint    -- exam focus */
  --washgreen:  #ECF6F1;
  --washred:    #FBEDEA;
  --paper:      #FFFFFF;

  --font: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --shadow: 0 1px 2px rgba(20, 20, 20, .06), 0 4px 14px rgba(20, 20, 20, .05);
  --radius: 3px;           /* the print material is square; keep corners tight */
  --wrap: 1120px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--light);
  color: var(--dark);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-loading { padding: 4rem; text-align: center; color: var(--grey); }

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.2; }
p { margin: 0 0 .75rem; }
a { color: var(--blue); }
code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--light);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .05em .3em;
  word-break: break-word;
}

/* Small uppercase label, the datasheet's section marker. */
.eyebrow {
  font-size: .688rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--orange);
}
.eyebrow.muted { color: var(--grey); }

/* ---------- layout ------------------------------------------------------- */

.topbar { background: var(--paper); border-bottom: 1px solid var(--rule); }
.topbar::before {
  content: ""; display: block; height: 5px; background: var(--orange);
}
.topbar-inner {
  max-width: var(--wrap); margin: 0 auto; padding: .85rem 1.25rem .55rem;
  display: flex; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap;
}
.brand { margin-right: auto; }
.brand .name { font-size: 1.35rem; letter-spacing: -.015em; }
.brand .name .accent { color: var(--orange); }

nav.tabs { display: flex; gap: .2rem; flex-wrap: wrap; margin-bottom: -.55rem; }
nav.tabs a {
  padding: .5rem .8rem; font-size: .875rem; font-weight: 700; color: var(--grey);
  text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap;
}
nav.tabs a:hover { color: var(--dark); background: var(--light); }
nav.tabs a.active { color: var(--dark); border-bottom-color: var(--orange); }

main { max-width: var(--wrap); margin: 0 auto; padding: 1.5rem 1.25rem 5rem; }

.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.75rem; letter-spacing: -.02em; margin: .15rem 0 .3rem; }
.page-head .sub { color: var(--grey); font-size: .938rem; }
.rule { height: 2px; background: var(--orange); margin: .55rem 0 1rem; }
.rule.thin { height: 1px; background: var(--rule); }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }

.card {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1.15rem 1.25rem; box-shadow: var(--shadow);
}
.card.pad-0 { padding: 0; }
.card h2 { font-size: 1.05rem; margin-bottom: .1rem; }
.card h3 { font-size: .95rem; }
.card-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .7rem; }
.card-head .spacer { margin-left: auto; }

/* Accent boxes mirroring keybox / exambox / trapbox from the PDFs. */
.note { border-left: 3px solid; padding: .7rem .9rem; border-radius: 0 2px 2px 0; }
.note.key   { background: var(--wash);      border-color: var(--orange); }
.note.exam  { background: var(--washblue);  border-color: var(--blue); }
.note.trap  { background: var(--washred);   border-color: var(--red); }
.note.good  { background: var(--washgreen); border-color: var(--green); }
.note .eyebrow { margin-bottom: .15rem; display: block; }
.note.exam .eyebrow { color: var(--blue); }
.note.trap .eyebrow { color: var(--red); }
.note.good .eyebrow { color: var(--green); }
.note :last-child { margin-bottom: 0; }
/* Explanations run to several paragraphs, so give them room to breathe. */
.note p { margin: 0 0 .6rem; }
.note p:last-child { margin-bottom: 0; }
.note ul, .note ol { margin: .35rem 0 .6rem; padding-left: 1.15rem; }
.note li { margin-bottom: .2rem; }
.note code { background: rgba(255, 255, 255, .65); }

/* ---------- controls ----------------------------------------------------- */

button, .btn {
  font: inherit; font-weight: 700; font-size: .875rem;
  padding: .55rem 1.05rem; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--dark); background: var(--dark); color: #fff;
  text-decoration: none; display: inline-flex; align-items: center; gap: .45rem;
  transition: background .12s, border-color .12s, color .12s;
}
button:hover, .btn:hover { background: #000; }
button:focus-visible, .btn:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--orange); outline-offset: 2px;
}
.btn-primary { background: var(--orange); border-color: var(--orange); }
.btn-primary:hover { background: #e04a22; border-color: #e04a22; }
.btn-ghost { background: transparent; color: var(--dark); border-color: var(--rule); }
.btn-ghost:hover { background: var(--light); border-color: var(--grey); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--rule); }
.btn-danger:hover { background: var(--washred); border-color: var(--red); }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
button[disabled], .btn[disabled] { opacity: .45; cursor: not-allowed; }

input[type=text], input[type=password], input[type=number], input[type=search],
select, textarea {
  font: inherit; font-size: .938rem; width: 100%;
  padding: .55rem .7rem; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--paper); color: var(--dark);
}
textarea { resize: vertical; min-height: 4.5rem; }
label.field { display: block; margin-bottom: .9rem; }
label.field > span.lbl {
  display: block; font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--grey); margin-bottom: .3rem;
}
.hint { font-size: .813rem; color: var(--grey); }

.check {
  display: flex; align-items: flex-start; gap: .55rem; padding: .4rem .55rem;
  border: 1px solid var(--rule); border-radius: var(--radius); cursor: pointer;
  background: var(--paper); font-size: .875rem; line-height: 1.35;
}
.check:hover { border-color: var(--grey); }
.check input { margin: .18rem 0 0; accent-color: var(--orange); flex: none; }
.check.on { border-color: var(--orange); background: var(--wash); }
.check .meta { color: var(--grey); font-size: .8rem; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .18rem .5rem; border-radius: 2px; background: var(--light);
  color: var(--grey); border: 1px solid var(--rule); white-space: nowrap;
}
.chip.orange { background: var(--wash); color: var(--orange); border-color: #f6cbb9; }
.chip.blue { background: var(--washblue); color: var(--blue); border-color: #bfe2ea; }
.chip.green { background: var(--washgreen); color: var(--green); border-color: #bfe0d1; }
.chip.red { background: var(--washred); color: var(--red); border-color: #f0c6bd; }
.chip.solid { background: var(--orange); color: #fff; border-color: var(--orange); }

/* ---------- stats -------------------------------------------------------- */

.stat .value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .value.sm { font-size: 1.35rem; }
.stat .label {
  font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--grey);
}
.stat .sub { font-size: .813rem; color: var(--grey); }

.bar { height: 7px; background: var(--light); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--orange); border-radius: 4px; }
.bar > span.green { background: var(--green); }
.bar > span.red { background: var(--red); }
.bar > span.blue { background: var(--blue); }
.bar.stack { display: flex; }
.bar.stack > span { border-radius: 0; }

table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  text-align: left; font-size: .7rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--grey); padding: .5rem .6rem; border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
td { padding: .55rem .6rem; border-bottom: 1px solid var(--light); vertical-align: middle; }
tbody tr:hover { background: #fbfbfb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- login -------------------------------------------------------- */

.login-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem;
  background: var(--light);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--paper);
  border: 1px solid var(--rule); box-shadow: var(--shadow); border-radius: var(--radius);
  overflow: hidden;
}
.login-card .stripe { height: 5px; background: var(--orange); }
.login-card .body { padding: 1.75rem 1.6rem 1.6rem; }
.login-card h1 { font-size: 1.4rem; margin: .3rem 0 .2rem; letter-spacing: -.02em; }
.login-card .sub { color: var(--grey); font-size: .875rem; margin-bottom: 1.35rem; }
.login-error {
  background: var(--washred); border-left: 3px solid var(--red); color: var(--red);
  padding: .55rem .7rem; font-size: .875rem; margin-bottom: .9rem; font-weight: 600;
}

/* ---------- quiz runner -------------------------------------------------- */

.runner { display: grid; grid-template-columns: 1fr 232px; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .runner { grid-template-columns: 1fr; } }

.runner-bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: .6rem .9rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.runner-bar .title { font-weight: 700; font-size: .938rem; }
.runner-bar .spacer { margin-left: auto; }
.timer {
  font-family: var(--mono); font-size: 1.05rem; font-weight: 700;
  font-variant-numeric: tabular-nums; padding: .15rem .5rem; border-radius: 2px;
}
.timer.warn { background: var(--wash); color: var(--orange); }
.timer.danger { background: var(--washred); color: var(--red); }

.qcard { background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.qcard .qhead {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  padding: .7rem 1.15rem; border-bottom: 1px solid var(--rule); background: #fcfcfc;
}
.qcard .qbody { padding: 1.15rem; }
.qstem { font-size: 1.06rem; line-height: 1.45; margin-bottom: 1rem; }
.qstem strong { font-weight: 700; }

.options { display: grid; gap: .5rem; }
.opt {
  display: flex; gap: .7rem; align-items: flex-start; width: 100%; text-align: left;
  padding: .7rem .85rem; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper); color: var(--dark); font-weight: 400; font-size: .95rem;
  cursor: pointer; line-height: 1.4; transition: border-color .1s, background .1s;
}
.opt:hover:not([disabled]) { border-color: var(--orange); background: var(--wash); }
.opt .letter {
  flex: none; width: 1.55rem; height: 1.55rem; border-radius: 2px;
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
  background: var(--light); color: var(--grey); border: 1px solid var(--rule);
}
.opt.selected { border-color: var(--orange); background: var(--wash); }
.opt.selected .letter { background: var(--orange); color: #fff; border-color: var(--orange); }
.opt.correct { border-color: var(--green); background: var(--washgreen); }
.opt.correct .letter { background: var(--green); color: #fff; border-color: var(--green); }
.opt.wrong { border-color: var(--red); background: var(--washred); }
.opt.wrong .letter { background: var(--red); color: #fff; border-color: var(--red); }
.opt[disabled] { cursor: default; }
.opt .mark { margin-left: auto; font-weight: 700; font-size: .8rem; flex: none; }

.verdict { margin-top: 1rem; }
.qactions {
  display: flex; gap: .6rem; align-items: center; flex-wrap: wrap;
  padding: .8rem 1.15rem; border-top: 1px solid var(--rule); background: #fcfcfc;
}
.qactions .spacer { margin-left: auto; }

.flagbtn { border-color: var(--rule); background: transparent; color: var(--grey); }
.flagbtn:hover { background: var(--wash); border-color: var(--orange); color: var(--orange); }
.flagbtn.on { background: var(--orange); border-color: var(--orange); color: #fff; }

/* Question navigator */
.navigator { position: sticky; top: 1rem; }
.navgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .3rem; }
.navgrid button {
  padding: 0; aspect-ratio: 1; font-size: .75rem; font-weight: 700;
  background: var(--paper); color: var(--grey); border: 1px solid var(--rule);
  display: grid; place-items: center; position: relative;
}
.navgrid button:hover { border-color: var(--grey); background: var(--light); }
.navgrid button.answered { background: var(--light); color: var(--dark); border-color: var(--rule); }
.navgrid button.correct { background: var(--washgreen); color: var(--green); border-color: #bfe0d1; }
.navgrid button.wrong { background: var(--washred); color: var(--red); border-color: #f0c6bd; }
.navgrid button.current { border-color: var(--orange); border-width: 2px; color: var(--dark); }
.navgrid button.flagged::after {
  content: ""; position: absolute; top: 2px; right: 2px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--orange);
}
.legend { display: grid; gap: .3rem; margin-top: .7rem; font-size: .75rem; color: var(--grey); }
.legend div { display: flex; align-items: center; gap: .4rem; }
.legend i { width: 11px; height: 11px; border: 1px solid var(--rule); flex: none; }

/* ---------- results ------------------------------------------------------ */

.score-hero { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.score-ring {
  --pct: 0; --ring: var(--orange);
  width: 128px; height: 128px; border-radius: 50%; flex: none; display: grid;
  place-items: center; position: relative;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), var(--light) 0);
}
.score-ring::after {
  content: ""; position: absolute; inset: 11px; background: var(--paper); border-radius: 50%;
}
.score-ring .inner { position: relative; z-index: 1; text-align: center; }
.score-ring .pct { font-size: 1.85rem; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.score-ring .of { font-size: .75rem; color: var(--grey); font-weight: 700; }

.review-item { border-bottom: 1px solid var(--rule); padding: 1rem 0; }
.review-item:last-child { border-bottom: 0; }
.review-item .stem { font-weight: 600; margin: .35rem 0 .5rem; }
.review-opt { font-size: .875rem; padding: .3rem .55rem; border-left: 3px solid transparent; }
.review-opt.correct { background: var(--washgreen); border-color: var(--green); }
.review-opt.wrong { background: var(--washred); border-color: var(--red); }

/* ---------- misc --------------------------------------------------------- */

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--grey); }
.empty h3 { color: var(--dark); margin-bottom: .35rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.tight { gap: .35rem; }
.muted { color: var(--grey); }
.small { font-size: .875rem; }
.xs { font-size: .8rem; }
.mt { margin-top: 1rem; }
.mt-sm { margin-top: .5rem; }
.mb { margin-bottom: 1rem; }
.nowrap { white-space: nowrap; }
.spin { display: inline-block; width: 1rem; height: 1rem; border: 2px solid var(--rule);
  border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toasts {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  display: grid; gap: .5rem; z-index: 50; width: min(440px, calc(100vw - 2rem));
}
.toast {
  background: var(--dark); color: #fff; padding: .6rem .9rem; border-radius: var(--radius);
  font-size: .875rem; box-shadow: var(--shadow); animation: rise .18s ease-out;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

dialog {
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 0;
  max-width: min(520px, calc(100vw - 2rem)); box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
dialog::backdrop { background: rgba(20, 20, 20, .45); }
dialog .body { padding: 1.35rem; }
dialog h2 { font-size: 1.15rem; margin-bottom: .5rem; }

kbd {
  font-family: var(--mono); font-size: .75rem; background: var(--light);
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px;
  padding: .05em .35em; color: var(--grey);
}

@media print {
  .topbar, .qactions, .navigator, .toasts, button { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
