/* App styles for آیین مهرورزی. Tokens live in tokens.css. */

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); line-height: 1.8; }
h1, h2, h3 { margin: 0; line-height: 1.4; }
h1 { font-size: 1.65rem; font-weight: 800; }
h2 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--teal-700); }
svg { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.ltr { direction: ltr; unicode-bidi: isolate; }
:focus-visible { outline: 2px solid var(--teal-700); outline-offset: 2px; }

/* Shell: sidebar on the right (inline start), content beside it */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--teal-900); color: #fff;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px; padding: 22px 14px 18px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: #fff; text-decoration: none; }
.brand .mark { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; color: var(--sun); }
.brand .name { font-weight: 800; font-size: 1.15rem; line-height: 1.3; }
.brand .tag { font-size: 0.76rem; color: rgba(255, 255, 255, 0.6); }

.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.72); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav a.current { background: rgba(255, 255, 255, 0.13); color: #fff; }
.nav a.current svg { color: var(--sun); }
.nav .sep { height: 1px; background: rgba(255, 255, 255, 0.12); margin: 8px 12px; }

.who { margin-top: auto; display: grid; gap: 10px; padding: 14px 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.who-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-name { font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.who-role { font-size: 0.78rem; color: rgba(255, 255, 255, 0.6); }
.who form { margin: 0; }
.who .btn { width: 100%; background: transparent; border-color: rgba(255, 255, 255, 0.25); color: rgba(255, 255, 255, 0.85); }
.who .btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.5); color: #fff; }

.page { max-width: 1140px; width: 100%; margin: 0 auto; padding: 30px 28px 64px; display: grid; gap: 22px; align-content: start; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.page-head .title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-head .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 0.92rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Avatars: initial letter on one of four soft tones */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 0.95rem; flex: none; background: var(--teal-100); color: var(--teal-800); }
.avatar.lg { width: 56px; height: 56px; font-size: 1.4rem; font-weight: 800; }
.avatar.tone-1 { background: var(--sun-soft); color: var(--sun-ink); }
.avatar.tone-2 { background: #E3E8F8; color: #2F3F85; }
.avatar.tone-3 { background: #F6E3EA; color: #8A2F52; }
.avatar.on-dark { background: var(--sun); color: var(--teal-900); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; padding: 7px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--teal-700); color: var(--teal-700); }
.btn.primary { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.btn.primary:hover { background: var(--teal-800); border-color: var(--teal-800); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(0.93); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.danger:hover { background: var(--bad); color: #fff; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.card.attention { border-color: var(--sun); background: var(--sun-soft); box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; text-decoration: none; color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: border-color 0.15s, transform 0.15s; }
.stat:hover { border-color: var(--teal-700); transform: translateY(-1px); }
.stat .n { font-size: 2rem; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat .k { color: var(--muted); font-size: 0.9rem; }
.stat .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-700); }
.stat.tone-trial .icon { background: var(--sun-soft); color: var(--sun-ink); }
.stat.tone-active .icon { background: var(--ok-soft); color: var(--ok); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; min-width: 0; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 500; padding: 1px 12px; border-radius: 99px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-lead { background: var(--grey-soft); color: var(--muted); }
.status-trial { background: var(--sun-soft); color: var(--sun-ink); }
.card.attention .status-trial { background: var(--surface); }
.status-active { background: var(--ok-soft); color: var(--ok); }
.status-declined { background: var(--bad-soft); color: var(--bad); }
.status-inactive { background: var(--grey-soft); color: var(--muted); }

/* Lists and tables */
.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.rows li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; padding-top: 0; }
.rows li:last-child { padding-bottom: 0; }
.card.attention .rows li { border-color: rgba(122, 86, 0, 0.18); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
a.name { font-weight: 700; text-decoration: none; color: var(--ink); }
a.name:hover { color: var(--teal-700); }
.empty { color: var(--muted); font-size: 0.92rem; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
th, td { text-align: start; padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 0.8rem; font-weight: 500; color: var(--muted); background: var(--paper); }
tbody tr:hover { background: var(--teal-50); }
tr:last-child td { border-bottom: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.chip-link { padding: 3px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--muted); font-size: 0.88rem; }
.chip-link:hover { border-color: var(--teal-700); color: var(--teal-700); }
.chip-link.current { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.search { display: flex; gap: 6px; }
.search input { min-width: 220px; }

/* Forms */
input[type="text"], input[type="password"], input[type="search"], input[type="file"], select, textarea {
  font: inherit; width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal-700); outline: 3px solid var(--teal-50); }
input::placeholder { color: #94A3A4; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > label { font-size: 0.86rem; font-weight: 500; color: var(--muted); }
.field.check { display: flex; align-items: center; gap: 8px; }
.field.check > label { font-size: 1rem; color: var(--ink); }
.field.check input { width: 18px; height: 18px; accent-color: var(--teal-700); }
.field .error, .form-error { color: var(--bad); font-size: 0.86rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; align-items: start; }
.form-grid .wide { grid-column: 1 / -1; }
fieldset { border: 0; margin: 0; padding: 0 0 6px; display: grid; gap: 12px; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; color: var(--teal-700); }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.inline-form .field { flex: 1; min-width: 160px; }
.checks > div { display: grid; gap: 6px; }
.checks label { display: flex; align-items: center; gap: 8px; }
.checks input { accent-color: var(--teal-700); width: 16px; height: 16px; }

/* Trial progress */
.progress { height: 10px; background: var(--grey-soft); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--teal-700); border-radius: 99px; }
.card.attention .progress { background: rgba(122, 86, 0, 0.15); }
.card.attention .progress > span { background: var(--sun); }

/* Key/value */
dl.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 0.94rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.prose { white-space: pre-line; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { position: relative; padding: 0 26px 18px 0; }
.timeline li::before { content: ""; position: absolute; right: 0; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 3px solid var(--teal-700); box-sizing: border-box; }
.timeline li::after { content: ""; position: absolute; right: 5px; top: 22px; bottom: 2px; width: 1px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline li.kind-approved::before { border-color: var(--ok); }
.timeline li.kind-declined::before { border-color: var(--bad); }
.timeline li.kind-trial_start::before { border-color: var(--sun); }
.timeline li.kind-note::before { border-color: var(--muted); }
.timeline .meta { font-size: 0.82rem; color: var(--muted); }
.timeline .kind { font-weight: 700; color: var(--ink); }

/* Messages */
.messages { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.messages li { padding: 9px 16px; border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.messages li.error { background: var(--bad-soft); color: var(--bad); }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-brand { background: var(--teal-900); color: #fff; display: grid; place-items: center; padding: 40px; position: relative; overflow: hidden; }
.login-brand .rays { position: absolute; inset-inline-start: -120px; bottom: -120px; width: 420px; height: 420px; color: rgba(242, 179, 61, 0.14); }
.login-brand .inner { display: grid; gap: 14px; justify-items: center; text-align: center; position: relative; }
.login-brand .mark { width: 84px; height: 84px; border-radius: 24px; background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; color: var(--sun); }
.login-brand h1 { font-size: 2.3rem; }
.login-brand p { color: rgba(255, 255, 255, 0.7); }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-form form { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.login-form h2 { font-size: 1.4rem; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  .btn, .stat { transition: none; }
}

/* Small helpers */
.card.narrow { max-width: 760px; width: 100%; justify-self: start; }
.field .help { color: var(--muted); font-size: 0.8rem; }
.field .help ul { margin: 2px 0 0; padding-inline-start: 18px; }
tr.dim td { color: var(--muted); }
.row-actions { display: flex; gap: 14px; justify-content: flex-end; }
.move-form { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.move-form select { width: auto; max-width: 100%; min-width: 0; padding: 3px 8px; font-size: 0.82rem; }
.move-form .move-label { font-size: 0.8rem; color: var(--muted); }
.move-form.saving { opacity: 0.5; pointer-events: none; }
.row-actions a { text-decoration: none; font-weight: 500; }
.row-actions a:hover { text-decoration: underline; }
.pill.tone-sun { background: var(--sun-soft); color: var(--sun-ink); }
.pill.tone-teal { background: var(--teal-50); color: var(--teal-700); }
table.wrap-text td { white-space: normal; }
input[type="number"] { font: inherit; width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }

/* Assessment section of the case file */
.checks-row { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.checks-row li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px 4px 12px; border-radius: 99px; background: var(--grey-soft); color: var(--muted); font-size: 0.9rem; }
.checks-row li svg { opacity: 0.35; }
.checks-row li.done { background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.checks-row li.done svg { opacity: 1; }

.notice { background: var(--sun-soft); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 10px; }
.notice.bad { background: var(--bad-soft); color: var(--bad); display: block; font-weight: 500; }
.copy-row { display: flex; flex-wrap: wrap; gap: 8px; }
.copy-row input { flex: 1; min-width: 200px; font-size: 0.85rem; }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 46px 92px; align-items: center; gap: 12px; font-size: 0.92rem; }
.bar-track { height: 12px; background: var(--grey-soft); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--teal-700); }
.bar-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: end; }
.bar-band { font-size: 0.78rem; font-weight: 500; }
.band-strength .bar-fill { background: var(--ok); }
.band-strength .bar-band { color: var(--ok); }
.band-support .bar-fill { background: var(--sun); }
.band-support .bar-band { color: var(--sun-ink); }

.rows.tests li { align-items: flex-start; }
.test-meta { display: grid; gap: 2px; justify-items: end; }

/* Parent questionnaire (public page, phone first) */
body.public { background: var(--paper); }
.public-head { background: var(--teal-900); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 16px; }
.public-head .mark { color: var(--sun); display: grid; }
.public-head .name { font-weight: 800; font-size: 1.1rem; }
.public-page { max-width: 680px; margin: 0 auto; padding: 24px 16px 64px; display: grid; gap: 16px; }
.question-group { gap: 0; padding-bottom: 6px; }
.question-group legend { float: inline-start; width: 100%; font-size: 1.05rem; margin-bottom: 4px; }
.question { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); clear: both; }
.question-text { font-weight: 500; }
.question.missing .question-text { color: var(--bad); }
.scale { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.scale-option { position: relative; display: block; cursor: pointer; }
.scale-option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.scale-option span { display: block; text-align: center; padding: 8px 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 0.92rem; }
.scale-option input:checked + span { background: var(--teal-700); border-color: var(--teal-700); color: #fff; font-weight: 700; }
.scale-option input:focus-visible + span { outline: 2px solid var(--teal-700); outline-offset: 2px; }
.btn.big { padding: 12px 18px; font-size: 1.05rem; font-weight: 700; }
.done-card { justify-items: center; text-align: center; padding: 40px 24px; }
.done-icon { width: 76px; height: 76px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; }

@media (max-width: 620px) {
  .bar-row { grid-template-columns: minmax(0, 1fr) 46px; }
  .bar-row .bar-label { grid-column: 1 / -1; font-weight: 500; }
  .bar-row .bar-band { grid-column: 1 / -1; }
}
.field.check { flex-wrap: wrap; }
.field.check .help, .field.check .error { flex-basis: 100%; }
td.row-actions { display: table-cell; text-align: end; }
td.row-actions a + a { margin-inline-start: 14px; }

/* Program bank and sheets */
.btn.small { padding: 3px 12px; font-size: 0.84rem; }
.rows.targets li { align-items: flex-start; flex-wrap: nowrap; }
.rows.targets li:has(.move-form) { flex-wrap: wrap; }
.rows.targets li:has(.move-form) > div { flex: 1; min-width: 0; }
ol.steps { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 6px; counter-reset: step; }
ol.steps li { counter-increment: step; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 0; border-radius: 99px; background: var(--teal-50); color: var(--teal-800); font-size: 0.8rem; }
ol.steps li::before { content: counter(step, persian); font-weight: 700; }

.picks { display: grid; gap: 2px; }
.pick { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.pick:hover { background: var(--paper); }
.pick:has(input:checked) { background: var(--teal-50); }
.pick input { width: 18px; height: 18px; margin-top: 5px; accent-color: var(--teal-700); flex: none; }
.steps-inline { display: block; color: var(--teal-700); }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(to top, var(--paper) 70%, transparent); }

.stat .of { font-size: 1rem; font-weight: 500; color: var(--muted); }
div.stat:hover { border-color: var(--line); transform: none; }

.sheet-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.sheet { font-size: 0.92rem; }
table.sheet th, table.sheet td { white-space: normal; padding: 8px 10px; border-inline-end: 1px solid var(--line); }
table.sheet th:last-child, table.sheet td:last-child { border-inline-end: 0; }
table.sheet .num { width: 46px; text-align: center; color: var(--muted); }
table.sheet .desc { min-width: 280px; }
table.sheet .cell { width: 52px; min-width: 52px; text-align: center; padding: 6px 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.sheet th.cell a { text-decoration: none; }
table.sheet tr.mastered .desc { color: var(--muted); }
table.sheet .edit-link { font-size: 0.8rem; margin-inline-start: 8px; text-decoration: none; opacity: 0.7; }
.mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 700; font-size: 0.85rem; }
.mark-i { background: var(--ok-soft); color: var(--ok); }
.mark-h { background: var(--sun-soft); color: var(--sun-ink); }
.mark-n { background: var(--bad-soft); color: var(--bad); }
.legend { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); }
.legend .mark { width: 22px; height: 22px; margin-inline-start: 8px; }

.group-title { font-size: 1rem; color: var(--teal-700); margin-top: 10px; }
.session-row { grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); align-items: center; gap: 8px 16px; }
.scale-option.tone-i input:checked + span { background: var(--ok); border-color: var(--ok); }
.scale-option.tone-h input:checked + span { background: var(--sun); border-color: var(--sun); color: var(--teal-900); }
.scale-option.tone-n input:checked + span { background: var(--bad); border-color: var(--bad); }
.scale-option.tone-blank input:checked + span { background: var(--grey-soft); border-color: var(--line); color: var(--muted); font-weight: 500; }
@media (max-width: 760px) { .session-row { grid-template-columns: 1fr; } }

/* Abilities on the user page */
.stack.narrow { max-width: 760px; width: 100%; justify-self: start; }
fieldset.abilities { gap: 2px; padding-bottom: 8px; }
fieldset.abilities legend { float: inline-start; width: 100%; margin-bottom: 4px; }
fieldset.abilities .pick { clear: both; }

/* Numeric grades */
.scores { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.scores .scale-option span { padding: 7px 0; font-variant-numeric: tabular-nums; }
.scores .blank { grid-column: 1 / -1; }
.scores .blank span { font-size: 0.84rem; padding: 4px 0; }
.session-row.graded { grid-template-columns: 1fr; }
.grade { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 6px; border-radius: 99px; font-weight: 700; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.grade-good { background: var(--ok-soft); color: var(--ok); }
.grade-mid { background: var(--sun-soft); color: var(--sun-ink); }
.grade-low { background: var(--bad-soft); color: var(--bad); }
.legend .grade { margin-inline-start: 8px; }
table.sheet th.cell { line-height: 1.4; }
table.sheet th.cell .who-taught { display: block; font-size: 0.72rem; font-weight: 400; color: var(--muted); }
table.sheet .cell { width: 60px; min-width: 60px; }
.card > .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.legend .grade { min-width: 0; padding: 0 10px; }
.inline-form .field .help { display: none; }

/* Two-step confirmation */
details.confirm { position: relative; }
details.confirm > summary { list-style: none; }
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm[open] > summary { border-color: var(--bad); color: var(--bad); }
.confirm-box { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 5; width: 300px; max-width: 86vw; display: grid; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(11, 59, 61, 0.18); }

/* Charts */
svg.trend { width: 100%; height: auto; direction: ltr; }
svg.trend .grid { stroke: var(--line); stroke-width: 1; }
svg.trend .pass { stroke: var(--sun-ink); stroke-width: 1; stroke-dasharray: 4 4; }
svg.trend .line { fill: none; stroke: var(--teal-700); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.trend .dot { fill: var(--teal-700); stroke: var(--surface); stroke-width: 2; }
svg.trend .hit { fill: transparent; cursor: default; }
svg.trend .point:hover .dot { r: 6; }
svg.trend .axis { font-family: var(--font); font-size: 11px; fill: var(--muted); }
svg.trend .value { font-family: var(--font); font-size: 12px; font-weight: 700; fill: var(--ink); }
svg.spark { display: block; direction: ltr; }
svg.spark polyline { fill: none; stroke: var(--teal-700); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
svg.spark circle { fill: var(--teal-700); }
table.sheet .spark-cell { width: 92px; min-width: 92px; padding: 4px 8px; }
table.sheet th.spark-cell { text-align: center; }

/* Re-evaluation line in the case file */
.reeval { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--paper); }
.reeval-overdue { background: var(--bad-soft); }
.reeval-soon { background: var(--sun-soft); }
.reeval-form { display: flex; align-items: center; gap: 6px; }
.reeval-form select { width: auto; padding: 3px 8px; }
.delta { font-weight: 700; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.bar-row { grid-template-columns: 150px minmax(0, 1fr) 46px 150px; }

/* Team tasks */
.rows.tasks li { flex-wrap: nowrap; }
.task-check { display: flex; align-items: flex-start; gap: 10px; margin: 0; min-width: 0; }
.task-check > span { display: grid; min-width: 0; }
.tick { width: 22px; height: 22px; margin-top: 4px; flex: none; border-radius: 6px; border: 1.5px solid var(--muted); background: var(--surface); color: #fff; font-size: 0.8rem; line-height: 1; cursor: pointer; padding: 0; }
.tick:hover { border-color: var(--teal-700); }
.tick.on { background: var(--ok); border-color: var(--ok); }
.rows.tasks li.done .task-title { text-decoration: line-through; color: var(--muted); }
.rows li.dim { color: var(--muted); }
details.more > summary { list-style: none; display: inline-flex; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 12px; }

/* Questionnaire editor */
.inline-form.grow { flex: 1; }
.strong-input { font-weight: 700; }
.question-list { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; }
.question-list li { padding-inline-start: 4px; }
.mini-check { display: inline-flex; align-items: center; gap: 4px; font-size: 0.86rem; color: var(--muted); padding-bottom: 8px; }
.mini-check input { accent-color: var(--teal-700); }
.inline-form .btn.small { margin-bottom: 4px; }
.add-row { padding-top: 12px; border-top: 1px dashed var(--line); }
.question-list { list-style: persian; }

/* Elements hidden by the section tabs stay hidden whatever their display rule says. */
[hidden] { display: none !important; }

/* Section tabs */
.section-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.section-tab { font: inherit; font-size: 0.9rem; font-weight: 500; padding: 5px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.section-tab:hover { border-color: var(--teal-700); color: var(--teal-700); }
.section-tab.current { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.tab-count { font-size: 0.74rem; padding: 0 7px; border-radius: 99px; background: var(--grey-soft); color: var(--muted); font-variant-numeric: tabular-nums; }
.tab-count:empty { display: none; }
.tab-count.some { background: var(--ok-soft); color: var(--ok); }
.section-tab.current .tab-count { background: rgba(255, 255, 255, 0.22); color: #fff; }
.section-bar.band-good .bar-fill { background: var(--ok); }
.section-bar.band-mid .bar-fill { background: var(--sun); }
.section-bar.band-low .bar-fill { background: var(--bad); }
.section-bar .bar-band { color: var(--muted); }

/* Steps (sub-skills) of a row */
ol.step-track { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
ol.step-track li { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px 1px 4px; border-radius: 99px; font-size: 0.8rem; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.step-no { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 0.7rem; font-weight: 700; background: var(--grey-soft); color: var(--muted); }
ol.step-track li.step-done { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
ol.step-track li.step-done .step-no { background: var(--ok); color: #fff; }
ol.step-track li.step-current { border-color: var(--teal-700); color: var(--teal-800); font-weight: 500; }
ol.step-track li.step-current .step-no { background: var(--teal-700); color: #fff; }
.cell-step { display: block; font-size: 0.66rem; color: var(--muted); line-height: 1.3; margin-top: 2px; }

.step-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.step-pick-label { font-size: 0.84rem; color: var(--muted); }
.step-option { position: relative; cursor: pointer; }
.step-option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.step-option span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 0.86rem; color: var(--muted); }
.step-option b { font-weight: 700; }
.step-option.step-done span { color: var(--ok); }
.step-option input:checked + span { background: var(--teal-50); border-color: var(--teal-700); color: var(--teal-800); font-weight: 500; }
.step-option input:focus-visible + span { outline: 2px solid var(--teal-700); outline-offset: 2px; }

ol.step-edit { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ol.step-edit li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.step-no-edit { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--teal-50); color: var(--teal-800); font-weight: 700; font-size: 0.85rem; }
ol.step-edit .mini-check { padding-bottom: 0; }

.step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; }
.step-actions form { margin: 0; }
.btn.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--muted); font-size: 0.8rem; text-decoration: underline; }
.btn.link:hover { color: var(--teal-700); }
table.sheet details.confirm .confirm-box { inset-inline-end: auto; inset-inline-start: 0; white-space: normal; }

/* Numbered lists of skills */
.skill-no { display: inline-block; min-width: 30px; padding: 0 6px; border-radius: 6px; background: var(--grey-soft); color: var(--muted); font-size: 0.76rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.pick-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-tools input { flex: 1; min-width: 200px; }
details.pick-group > summary.pick-summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
details.pick-group > summary.pick-summary::-webkit-details-marker { display: none; }
details.pick-group > summary.pick-summary h2::before { content: "‹"; display: inline-block; margin-inline-end: 8px; color: var(--muted); transition: transform 0.15s; }
details.pick-group[open] > summary.pick-summary h2::before { transform: rotate(-90deg); }
details.fold > summary { list-style: none; display: inline-flex; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold[open] > summary { margin-bottom: 10px; }

/* Messages as a floating notice */
.messages { position: fixed; z-index: 60; top: 14px; inset-inline: 0; margin-inline: auto; width: min(560px, calc(100vw - 28px)); pointer-events: none; animation: notice-out 0.4s ease 6s forwards; }
.messages li { box-shadow: 0 8px 28px rgba(11, 59, 61, 0.22); border: 1px solid rgba(31, 122, 77, 0.25); animation: notice-in 0.25s ease; }
.messages li.error { border-color: rgba(178, 58, 42, 0.3); }
@keyframes notice-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes notice-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .messages li { animation: none; } }

/* The school's puzzle mark sits on a white tile wherever it appears. */
.brand .mark, .login-brand .mark, .public-head .mark, .error-page .mark { background: #fff; color: inherit; display: grid; place-items: center; }
.public-head .mark { width: 34px; height: 34px; border-radius: 10px; }
.login-brand .rays { opacity: 0.1; }

/* Error pages */
.error-page { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 32px 20px; text-align: center; }
.error-page .mark { width: 88px; height: 88px; border-radius: 24px; box-shadow: var(--shadow); }
.error-code { font-size: 0.95rem; font-weight: 700; color: var(--muted); letter-spacing: 0.1em; }
.error-page p { max-width: 46ch; }
.error-page .actions { justify-content: center; margin-top: 8px; }
pre.trace { direction: ltr; text-align: left; font-size: 0.76rem; line-height: 1.5; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; max-height: 320px; white-space: pre; }
