/* NB Radar — solid content only (no glass here), scoped under .nb, built on the shell's tokens.
   Calm statuses: "on track" uses the accent, "careful" amber, "at the line" a deeper orange. Red stays
   reserved for destructive actions. No colour mixing functions (old WebViews): rgb(var(--x-rgb) / a). */

.nb {
  --nb-ok: var(--accent-rgb);
  --nb-careful: 255 159 10;
  --nb-danger: 240 100 20;
  --nb-careful-text: #9a5700;
  --nb-danger-text: #b34200;
}
:root[data-scheme="dark"] .nb { --nb-careful-text: #ffb340; --nb-danger-text: #ff9f5a; }

.nb .nb-ok { --nb-c: var(--nb-ok); --nb-t: var(--accent); }
.nb .nb-careful { --nb-c: var(--nb-careful); --nb-t: var(--nb-careful-text); }
.nb .nb-danger { --nb-c: var(--nb-danger); --nb-t: var(--nb-danger-text); }
.nb .nb-unknown { --nb-c: var(--text-rgb); --nb-t: var(--hint); }

.section-body.nb > .group:first-child { margin-top: 0; }   /* the section's own title is right above */

.nb-p { margin: 0; font-size: 15px; line-height: 1.4; color: var(--text); }
.nb-p + .nb-p { margin-top: 8px; }
.nb-hint { font-size: 13px; color: var(--hint); }
.nb-pad { padding: 12px 16px; color: var(--hint); }
.nb-foot { margin: 18px 4px 0; font-size: 13px; color: var(--hint); }
.nb-intro { padding: 14px 16px 12px; }

.nb-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  line-height: 18px; white-space: nowrap; color: var(--nb-t); background: rgb(var(--nb-c) / 0.14);
}

/* the semester ring */
.nb-sem { display: flex; align-items: center; gap: 14px; padding: 4px 6px; }
.nb-ring { position: relative; flex: none; width: 64px; height: 64px; }
.nb-ring-svg { display: block; width: 64px; height: 64px; }
.nb-ring-track { fill: none; stroke: rgb(var(--text-rgb) / 0.08); stroke-width: 7; }
.nb-ring-arc {
  fill: none; stroke: rgb(var(--nb-c)); stroke-width: 7; stroke-linecap: round;
  transition: stroke-dashoffset .7s cubic-bezier(.2, .8, .2, 1);
}
.nb-ring-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.nb-sem-main { min-width: 0; display: grid; gap: 2px; }
.nb-sem-title { font-size: 13px; color: var(--hint); }
.nb-sem-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nb-sem-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--hint); }

/* subjects as calm bars */
.nb-subj { position: relative; padding: 11px 16px 12px; display: grid; gap: 7px; }
.nb-subj + .nb-subj::before, .group-pad + .nb-subj::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: .5px solid var(--sep);
}
.nb-subj-top { display: flex; align-items: baseline; gap: 10px; }
.nb-subj-name { flex: 1; min-width: 0; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.nb-subj-val { flex: none; font-size: 14px; color: var(--hint); font-variant-numeric: tabular-nums; }
.nb-subj-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--hint); }
.nb .progress.nb-bar { height: 6px; background: rgb(var(--nb-c) / 0.16); }
.nb .progress.nb-bar i { background: rgb(var(--nb-c)); }
.nb-subj + .row-item::before, .nb-pad + .row-item::before {
  content: ""; position: absolute; top: 0; right: 0; left: 56px; border-top: .5px solid var(--sep);
}

/* marking classes */
.nb-lesson { position: relative; padding: 12px 16px; display: grid; gap: 6px; }
.nb-lesson + .nb-lesson::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: .5px solid var(--sep);
}
.nb-lesson-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--hint); }
.nb-pair {
  flex: none; display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 6px;
  border-radius: 7px; background: rgb(var(--accent-rgb) / 0.12); color: var(--accent);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.nb-lesson-time { font-variant-numeric: tabular-nums; }
.nb-lesson-subj { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.nb-lesson-note { font-size: 13px; color: var(--hint); }
.nb-later .nb-lesson-subj { color: var(--subtitle); }
.nb-lesson .segmented { margin-top: 2px; }

/* the opt-in switch */
.nb-switch-row { padding-right: 16px; }
.nb-switch {
  position: relative; flex: none; width: 51px; height: 31px; border-radius: 16px;
  background: rgb(var(--text-rgb) / 0.16); transition: background .2s ease;
}
.nb-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / .2); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.nb-switch-row[aria-checked="true"] .nb-switch { background: var(--accent); }
.nb-switch-row[aria-checked="true"] .nb-switch::after { transform: translateX(20px); }

/* the planner */
.nb-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.nb-cell {
  display: grid; justify-items: center; gap: 1px; min-height: 60px; padding: 6px 0;
  border: 0; border-radius: 12px; background: rgb(var(--text-rgb) / 0.05); color: var(--text);
  font: inherit; cursor: pointer;
}
.nb-cell-wd { font-size: 11px; color: var(--hint); }
.nb-cell-day { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.nb-cell-n { font-size: 11px; color: var(--accent); font-weight: 600; }
.nb-cell-none .nb-cell-n, .nb-cell-unknown .nb-cell-n { color: var(--hint); font-weight: 400; }
.nb-cell-none .nb-cell-day, .nb-cell-unknown .nb-cell-day { color: var(--hint); }
.nb-cell[aria-checked="true"] { background: var(--accent); }
.nb-cell[aria-checked="true"] span { color: var(--accent-text); }
.nb-plan-title { margin-top: 22px; }
.nb-plan-title + .group, .nb-plan-title + .empty { margin-top: 0; }
.nb-plan-row { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 11px 16px; }
.nb-plan-row .nb-pair { margin-top: 1px; }
.nb-plan-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.nb-plan-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.nb-plan-top .row-title { min-width: 0; }
.nb-plan-row + .nb-plan-row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: .5px solid var(--sep);
}
.nb-cost {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 12px 16px; font-size: 15px; font-weight: 600;
}
.nb-cost::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: .5px solid var(--sep); }
.nb-advice .nb-p { margin-top: 6px; }

/* settings */
.nb-rule { display: grid; gap: 8px; padding: 12px 16px; }
.nb-rule + .nb-rule { border-top: .5px solid var(--sep); }
.nb-rule-label { font-size: 15px; }
.nb-danger { margin-top: 22px; }

@media (prefers-reduced-motion: reduce) {
  .nb-ring-arc, .nb-switch, .nb-switch::after { transition: none; }
}
@media (prefers-contrast: more) {
  .nb-badge { box-shadow: inset 0 0 0 1px currentColor; }
  .nb-cell { box-shadow: inset 0 0 0 1px var(--sep); }
  .nb .progress.nb-bar { box-shadow: inset 0 0 0 1px rgb(var(--nb-c)); }
}
