/* Generated by scripts/build.ts from constants/colors.ts, constants/fonts.ts and assets/fonts. */
@font-face { font-family: 'Inter-Bold'; src: url('../fonts/Inter-Bold.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'JustSans-Regular'; src: url('../fonts/JustSans-Regular.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'YearOfTheCamel'; src: url('../fonts/YearOfTheCamel.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'YearOfTheCamel-Bold'; src: url('../fonts/YearOfTheCamel-Bold.otf') format('opentype'); font-display: swap; }
:root {
  --primary: #567089;
  --primary-dark: #323D48;
  --bg-splash: #465A6C;
  --bg-white: #FFFFFF;
  --bg-light: #F5F7FA;
  --bg-input: #F0F4F8;
  --bg-mist: #F5F6F8;
  --mist: #708CA5;
  --mist-border: rgba(112,140,165,0.2);
  --mist-tint: rgba(112,140,165,0.15);
  --mist-light: #B2C0D5;
  --text-dark: #3B3E44;
  --text-primary: #1A1A2E;
  --text-secondary: #6B7280;
  --text-body: #4B5563;
  --text-muted: #B0B3B7;
  --text-white: #F5F7FA;
  --text-white-soft: #E4E8ED;
  --border-light: #E4E8ED;
  --border-dark: #323D48;
  --border-mid: #E5E7EB;
  --success: #27AE60;
  --error: #E74C3C;
  --warning: #9A5B13;
  --warning-tint: rgba(154,91,19,0.08);
  --emergency: #9B4A46;
  --emergency-tint: rgba(155,74,70,0.08);
  --overlay-light: rgba(255,255,255,0.15);
  --overlay-border: rgba(255,255,255,0.2);
  --overlay-text: rgba(255,255,255,0.8);
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-xxl: 28px;
  --fs-display: 32px;
  --fs-hero: 38px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 50px;
  --r-tab-rowpill: 50px;
  --r-circle: 100px;
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 24px;
  --sp-xxl: 32px;
  --sp-xxxl: 48px;
  --font-heading: 'Inter-Bold', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: 'JustSans-Regular', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-arabic: 'YearOfTheCamel', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-arabic-bold: 'YearOfTheCamel-Bold', system-ui, -apple-system, "Segoe UI", sans-serif;
}

/*
 * MtBadi team dashboard. Colours, font sizes, radii, spacing and font families are the app's own tokens
 * (--primary-dark, --fs-sm, ... generated from constants/ by scripts/build.ts). The only raw colours are the ones
 * the design rules already allow: the overlay rgba(50,61,72,0.7) and soft black shadows.
 * Logical properties (inline-start/end) so right-to-left and left-to-right both lay out from one stylesheet.
 */

:root {
  --overlay: rgba(50, 61, 72, 0.7);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-raised: 0 8px 28px rgba(0, 0, 0, 0.16);
}

:root[lang='ar'],
[lang='ar'] {
  --f-body: var(--font-arabic);
  --f-head: var(--font-arabic-bold);
}

:root[lang='en'],
[lang='en'] {
  --f-body: var(--font-body);
  --f-head: var(--font-heading);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg-light);
  color: var(--text-dark);
  font-family: var(--f-body);
  font-size: var(--fs-sm);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[lang] {
  font-family: var(--f-body);
}

h1,
h2,
h3,
strong,
th {
  font-family: var(--f-head);
  font-weight: normal;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--font-body);
}

.muted {
  color: var(--text-secondary);
  margin: 0;
}

.small {
  font-size: var(--fs-xs);
}

.nowrap {
  white-space: nowrap;
}

.center {
  display: flex;
  justify-content: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.noscript {
  text-align: center;
  padding: var(--sp-xxxl);
}

/* Arrows point the way the page reads. */
:root[dir='rtl'] .icon-back,
:root[dir='rtl'] .icon-next,
:root[dir='rtl'] .icon-logout {
  transform: scaleX(-1);
}

/* ─── Buttons ─────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--primary-dark);
  background: var(--bg-white);
  color: var(--primary-dark);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--bg-input);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.is-busy:disabled {
  opacity: 0.8;
  cursor: progress;
}

.btn-primary {
  background: var(--primary-dark);
  color: var(--text-white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  opacity: 0.9;
}

.btn-danger {
  border-color: var(--error);
  color: var(--error);
}

.btn-warning {
  border-color: var(--warning);
  color: var(--warning);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-small {
  min-height: 32px;
  padding: 0 12px;
  font-size: var(--fs-xs);
}

.btn-block {
  width: 100%;
  min-height: 48px;
}

.btn-icon-end {
  flex-direction: row-reverse;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-circle);
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  align-self: center;
}

/* ─── Spinner and states ──────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid var(--border-light);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.spinner-small {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.btn-primary .spinner {
  border-color: var(--overlay-border);
  border-top-color: var(--text-white);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-xxxl) var(--sp-lg);
  color: var(--text-secondary);
  text-align: center;
}

.state p {
  margin: 0;
}

.state-title {
  font-size: var(--fs-md);
}

.state-error {
  color: var(--text-body);
}

.state-error .icon {
  color: var(--warning);
}

.loading-bar {
  position: relative;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--border-light);
}

.loading-bar::after {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 40%;
  background: var(--primary);
  animation: bar 1s ease-in-out infinite;
}

@keyframes bar {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Cards, chips, pills ─────────────────────────────────────────── */

.card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: var(--sp-lg) 18px;
}

.card h2 {
  margin: 0 0 var(--sp-md);
  font-size: var(--fs-lg);
  color: var(--primary-dark);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 10px;
  border-radius: var(--r-circle);
  font-size: var(--fs-xs);
  line-height: 1.7;
  white-space: nowrap;
  background: var(--bg-input);
  color: var(--primary-dark);
}

.chip-dark {
  background: var(--primary-dark);
  color: var(--text-white);
}

.chip-warning {
  background: var(--warning-tint);
  color: var(--warning);
}

.chip-muted {
  background: var(--bg-light);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--sp-lg);
  border-radius: var(--r-circle);
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  color: var(--primary-dark);
  cursor: pointer;
}

.pill.is-on {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--text-white);
}

.pill-count {
  font-size: var(--fs-xs);
  opacity: 0.8;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--primary-dark);
}

.section-head > .muted {
  flex: 1;
  min-width: 260px;
}

.note {
  margin: var(--sp-sm) 0 0;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}

.note-warning {
  background: var(--warning-tint);
  color: var(--warning);
}

.banner {
  margin: 0;
  padding: 10px var(--sp-md);
  border-radius: 10px;
  font-size: var(--fs-sm);
}

.banner-info {
  background: var(--bg-input);
  color: var(--primary-dark);
}

.banner-warning {
  background: var(--warning-tint);
  color: var(--warning);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  padding-top: var(--sp-xs);
}

/* ─── Tables ──────────────────────────────────────────────────────── */

/* position: relative makes the wrapper the containing block of its absolutely positioned bits (the .sr-only header
   texts), so a wide table scrolls inside it instead of widening the whole page on a phone. */
.table-wrap {
  position: relative;
  overflow-x: auto;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: start;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  padding: 10px 14px;
  background: var(--bg-input);
  white-space: nowrap;
}

.table td {
  padding: var(--sp-md) 14px;
  border-top: 1px solid var(--border-light);
  vertical-align: top;
}

.table-click tbody tr {
  cursor: pointer;
}

.table tbody tr:hover td,
.table tbody tr.is-selected td {
  background: var(--bg-light);
}

.table tbody tr:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* flex-start: each line sits at the reading start even when it is an email or English name (its own direction). */
.cell-lines {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.cell-lines > *,
.field-body > * {
  max-width: 100%;
}

.cell-action {
  text-align: end;
  white-space: nowrap;
}

.cell-details {
  max-width: 380px;
  color: var(--text-body);
  font-size: var(--fs-xs);
}

.id-text {
  font-size: var(--fs-xs);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  padding: var(--sp-sm) 0;
}

.pager-text {
  color: var(--text-secondary);
}

/* ─── Shell ───────────────────────────────────────────────────────── */

.shell {
  display: flex;
  min-height: 100vh;
}

.side {
  width: 252px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xl);
  padding: var(--sp-xl) var(--sp-lg);
  /* The app's gradient fallback ['#465A6C', '#323D48']. */
  background: linear-gradient(180deg, var(--bg-splash), var(--primary-dark));
  color: var(--text-white);
  overflow-y: auto;
}

.side-brand {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: 0 var(--sp-sm);
}

.side-brand img {
  width: 150px;
}

.side-brand span {
  color: var(--text-white-soft);
  font-size: var(--fs-xs);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.side-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  color: var(--text-white-soft);
  text-decoration: none;
}

.side-link:hover {
  background: var(--overlay-light);
  color: var(--text-white);
}

.side-link.is-active {
  background: var(--bg-white);
  color: var(--primary-dark);
  font-family: var(--f-head);
}

.side-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--r-circle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-family: var(--font-heading);
  background: var(--bg-white);
  color: var(--primary-dark);
}

.side-link.is-active .side-badge {
  background: var(--primary-dark);
  color: var(--text-white);
}

.side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--overlay-border);
}

.side-me {
  display: flex;
  flex-direction: column;
}

.side-me-name {
  color: var(--text-white);
  font-family: var(--f-head);
  overflow-wrap: anywhere;
}

.side-me-role {
  color: var(--text-white-soft);
  font-size: var(--fs-xs);
}

.side-out {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: none;
  border: none;
  padding: var(--sp-xs) 0;
  color: var(--text-white-soft);
  cursor: pointer;
}

.side-out:hover {
  color: var(--text-white);
}

.lang-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--r-circle);
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  color: var(--primary-dark);
  cursor: pointer;
}

.lang-toggle.on-dark {
  background: transparent;
  border-color: var(--overlay-border);
  color: var(--text-white);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: var(--sp-xl) var(--sp-xxl) var(--sp-sm);
}

.topbar h1 {
  margin: 0;
  font-size: var(--fs-xl);
  color: var(--primary-dark);
}

.content {
  padding: var(--sp-md) var(--sp-xxl) var(--sp-xxxl);
  max-width: 1240px;
  width: 100%;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  color: var(--primary-dark);
  text-decoration: none;
  font-family: var(--f-head);
}

.back-link:hover {
  text-decoration: underline;
}

/* ─── Reports ─────────────────────────────────────────────────────── */

.radio-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: start;
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  color: inherit;
  cursor: pointer;
}

.radio-card:hover:not(:disabled) {
  background: var(--bg-light);
}

.radio-card.is-on {
  border-color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px var(--primary-dark);
}

.radio-card:disabled {
  cursor: progress;
}

.radio-dot {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border-radius: 50%;
  border: 2px solid var(--border-dark);
  flex-shrink: 0;
}

.radio-card.is-on .radio-dot {
  background: radial-gradient(circle, var(--primary-dark) 0 4px, transparent 5px);
}

.radio-text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.radio-text strong {
  color: var(--primary-dark);
}

.radio-text span {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}

.qcard,
.rcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qcard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-md);
}

.qcard-author {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.qcard-author strong {
  color: var(--primary-dark);
}

.qcard-title {
  margin: 0;
  font-family: var(--f-head);
  font-size: var(--fs-md);
  color: var(--primary-dark);
}

.qcard-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--fs-md);
  color: var(--text-dark);
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.thumb {
  width: 128px;
  height: 128px;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: var(--bg-light);
  cursor: zoom-in;
}

.thumb img,
.video-thumb img,
.media-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb {
  position: relative;
  width: 144px;
  height: 192px;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  background: var(--primary-dark);
  cursor: pointer;
}

.play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--overlay);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
}

.duration {
  position: absolute;
  bottom: 6px;
  inset-inline-end: 6px;
  padding: 0 6px;
  border-radius: var(--r-circle);
  background: var(--overlay);
  color: var(--text-white);
  font-family: var(--font-heading);
  font-size: var(--fs-xs);
}

.story-tile {
  width: 144px;
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  padding: var(--sp-md);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-white);
  font-family: var(--f-head);
  overflow-wrap: anywhere;
}

.context {
  background: var(--bg-input);
  border-radius: 10px;
  padding: 10px var(--sp-md);
}

.context p {
  margin: var(--sp-xs) 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reports-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--warning);
}

/* ─── Chat report ─────────────────────────────────────────────────── */

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
}

.summary-head h2 {
  margin: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px var(--sp-lg);
  margin: var(--sp-md) 0;
}

.summary-grid dt {
  color: var(--text-secondary);
}

.summary-grid dd {
  margin: 0;
}

.summary .muted.small {
  margin-top: var(--sp-sm);
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 820px;
  padding: var(--sp-lg);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: var(--bg-input);
}

.chat-day {
  align-self: center;
  margin: 10px 0 var(--sp-xs);
  padding: 2px var(--sp-md);
  border-radius: var(--r-circle);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}

.chat-note {
  align-self: center;
  margin: var(--sp-sm) 0;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  text-align: center;
}

/* The reporter on the side "me" has in their own chat; the reported person opposite. */
.msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 72%;
  align-self: flex-start;
  align-items: flex-start;
  scroll-margin: 120px;
}

.msg-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.msg:focus {
  outline: none;
}

.msg:focus .bubble {
  box-shadow: 0 0 0 5px var(--warning-tint);
}

.msg-name {
  padding: 0 var(--sp-xs);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}

.msg-flag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 0 var(--sp-xs);
  color: var(--warning);
  font-size: var(--fs-xs);
}

.bubble {
  padding: var(--sp-sm) 14px;
  border-radius: 16px;
  background: var(--bg-white);
  color: var(--text-dark);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.msg-mine .bubble {
  background: var(--primary-dark);
  color: var(--text-white);
}

.is-flagged .bubble {
  outline: 2px solid var(--warning);
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble time {
  display: block;
  margin-top: 2px;
  text-align: end;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.msg-mine .bubble time {
  color: var(--overlay-text);
}

.bubble-media {
  padding: var(--sp-xs);
}

.bubble-media p {
  padding: 6px var(--sp-sm) 0;
}

.bubble-media time {
  padding: 0 var(--sp-sm) 2px;
}

.media-box {
  position: relative;
  display: block;
  width: 240px;
  max-width: 100%;
  padding: 0;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  background: var(--primary-dark);
  cursor: zoom-in;
}

.media-wait {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
}

.media-gone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  padding: var(--sp-xl) var(--sp-lg);
  border-radius: 12px;
  background: var(--bg-light);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  text-align: center;
}

/* ─── Reviews ─────────────────────────────────────────────────────── */

.rcard-place {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rcard-place strong {
  font-size: var(--fs-md);
  color: var(--primary-dark);
}

.rcard-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-md);
}

.stars {
  display: inline-flex;
  gap: 2px;
}

.star-on {
  color: var(--primary-dark);
}

.star-off {
  color: var(--mist-light);
}

/* ─── Students ────────────────────────────────────────────────────── */

.search {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 0 14px;
  border-radius: var(--r-circle);
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  color: var(--text-secondary);
}

.search:focus-within {
  border-color: var(--primary);
}

.search .input {
  border: none;
  background: transparent;
  padding: 0;
  outline: none;
}

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--overlay);
  opacity: 0.35;
}

.panel {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  z-index: 21;
  width: min(480px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--bg-light);
  box-shadow: var(--shadow-raised);
  animation: panel-in 0.18s ease-out;
}

/* Movement only, never opacity: if the animation doesn't run (background tab), the content is still visible. */
@keyframes panel-in {
  from {
    transform: translateY(8px);
  }
  to {
    transform: none;
  }
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: 18px var(--sp-xl);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
}

.panel-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--primary-dark);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-lg) var(--sp-xl);
}

.panel-foot {
  display: flex;
  justify-content: flex-end;
  padding: var(--sp-md) var(--sp-xl);
  background: var(--bg-white);
  border-top: 1px solid var(--border-light);
}

.dsection h3 {
  margin: 0 0 var(--sp-sm);
  font-size: var(--fs-sm);
  color: var(--primary-dark);
}

.dcard {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
}

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
}

.field + .field {
  border-top: 1px solid var(--border-light);
}

.field-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.field-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.field-value {
  color: var(--text-dark);
  overflow-wrap: anywhere;
}

.field-value.is-empty {
  color: var(--text-muted);
}

.field-copy {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  min-height: 36px;
  padding: 0 var(--sp-sm);
  border: none;
  border-radius: var(--r-sm);
  background: none;
  color: var(--primary-dark);
  font-size: var(--fs-xs);
  cursor: pointer;
}

.field-copy:hover {
  background: var(--bg-input);
}

.welcome {
  max-width: 640px;
}

.welcome p {
  margin: 0 0 var(--sp-sm);
}

/* ─── Forms ───────────────────────────────────────────────────────── */

.input-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--sp-md);
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  background: var(--bg-white);
  color: var(--text-dark);
  font-size: var(--fs-md);
}

.input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: var(--primary);
}

.input:disabled {
  background: var(--bg-light);
}

.input-code {
  text-align: center;
  letter-spacing: 0.4em;
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
}

.input-with-button {
  display: flex;
  gap: 6px;
}

.input-side {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 0 var(--sp-md);
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  background: var(--bg-white);
  color: var(--primary-dark);
  font-size: var(--fs-xs);
  cursor: pointer;
}

.form-error {
  margin: 0;
  color: var(--error);
}

/* ─── Sign-in ─────────────────────────────────────────────────────── */

.auth {
  display: flex;
  min-height: 100vh;
}

.auth-brand {
  width: 40%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-xl);
  padding: var(--sp-xxxl);
  background: linear-gradient(160deg, var(--bg-splash), var(--primary-dark));
  color: var(--text-white);
}

.auth-logo {
  width: 240px;
}

.auth-brand-text h1 {
  margin: 0 0 var(--sp-sm);
  font-size: var(--fs-xxl);
}

.auth-brand-text p {
  margin: 0;
  color: var(--text-white-soft);
}

.auth-main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-xxl);
}

.auth-top {
  position: absolute;
  top: var(--sp-lg);
  inset-inline-end: var(--sp-xl);
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-card h2 {
  margin: 0;
  font-size: var(--fs-xl);
  color: var(--primary-dark);
}

.steps {
  margin: 0;
  padding-inline-start: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  color: var(--text-body);
}

.qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 204px;
  padding: var(--sp-md);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
}

.qr-box img {
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
}

.secret {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.secret-input {
  font-family: var(--font-heading);
  font-size: var(--fs-sm);
  letter-spacing: 0.05em;
}

/* ─── Dialogs, media viewer, toasts ───────────────────────────────── */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-xl);
  background: var(--overlay);
}

.dialog {
  width: min(480px, 100%);
  /* A long text plus a reason box on a short screen (a phone with its keyboard open) scrolls inside the box. */
  max-height: 100%;
  overflow-y: auto;
  padding: var(--sp-xl);
  border-radius: var(--r-lg);
  background: var(--bg-white);
  box-shadow: var(--shadow-raised);
}

.dialog h2 {
  margin: 0 0 var(--sp-sm);
  font-size: var(--fs-lg);
  color: var(--primary-dark);
}

.dialog p {
  margin: 0 0 var(--sp-lg);
  color: var(--text-body);
}

.dialog .input-label {
  margin-bottom: var(--sp-lg);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-sm);
}

.dialog .btn-danger {
  background: var(--error);
  border-color: var(--error);
  color: var(--bg-white);
}

.dialog .btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: var(--bg-white);
}

.viewer {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
}

.viewer img,
.viewer video {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  background: var(--primary-dark);
}

.viewer-close {
  position: absolute;
  top: -16px;
  inset-inline-end: -16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-white);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-raised);
}

.viewer-failed {
  margin: 0;
  padding: var(--sp-xl);
  border-radius: 12px;
  background: var(--bg-white);
}

.toasts {
  position: fixed;
  bottom: var(--sp-xl);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  width: min(520px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--primary-dark);
  color: var(--text-white);
  box-shadow: var(--shadow-raised);
  animation: toast-in 0.16s ease-out;
}

.toast-error {
  background: var(--bg-white);
  color: var(--text-dark);
  border: 1px solid var(--border-light);
  border-inline-start: 4px solid var(--error);
}

.toast-error .icon {
  color: var(--error);
}

.toast-close {
  margin-inline-start: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  display: flex;
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
  }
  to {
    transform: none;
  }
}

.idle-warning {
  position: fixed;
  top: var(--sp-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--warning);
  background: var(--bg-white);
  color: var(--warning);
  box-shadow: var(--shadow-raised);
}

/* ─── Demo build only (the class is unused in production) ─────────── */

.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--warning);
  color: var(--bg-white);
  font-size: var(--fs-xs);
}

.demo-tag {
  padding: 0 var(--sp-sm);
  border-radius: 4px;
  background: var(--bg-white);
  color: var(--warning);
  font-family: var(--font-heading);
  letter-spacing: 0.08em;
}

.demo-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.demo-control select {
  border: none;
  border-radius: var(--r-sm);
  padding: 2px 6px;
}

.demo-btn {
  padding: 2px var(--sp-md);
  border: 1px solid var(--bg-white);
  border-radius: var(--r-circle);
  background: transparent;
  color: var(--bg-white);
  cursor: pointer;
}

.demo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Narrow windows ──────────────────────────────────────────────── */

@media (max-width: 900px) {
  .shell,
  .auth {
    flex-direction: column;
  }

  .side {
    width: auto;
    height: auto;
    position: static;
  }

  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .auth-brand {
    width: auto;
    max-width: none;
    padding: var(--sp-xl);
  }

  .auth-logo {
    width: 160px;
  }

  .topbar,
  .content {
    padding-inline: var(--sp-lg);
  }

  .radio-cards {
    grid-template-columns: 1fr;
  }

  .msg {
    max-width: 90%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .toast,
  .loading-bar::after {
    animation: none;
  }

  .spinner {
    animation-duration: 2s;
  }
}

/* catalog.css */
/* Phase 3, Track B1 (B2 extends): the catalog screens (src/screens/Universities.tsx, src/screens/catalog/*) and the
   Overview's content health card. Every class starts with cat- so nothing here touches another screen. Tokens only
   (constants/colors.ts via scripts/build.ts); logical properties so right-to-left and left-to-right lay out from one
   sheet. Narrow first: one column (the list, or the editor with «Back to the list»); a container 880 px or wider
   shows both side by side, as in Hazza's design. Nothing scrolls sideways at 375 px. */

.cat-screen {
  container-type: inline-size;
}

.cat-summary {
  margin: 0;
}

/* ─── List and editor side by side ─────────────────────────────────── */

.cat-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-lg);
  align-items: start;
}

.cat-split.has-editor .cat-list-pane,
.cat-split:not(.has-editor) .cat-editor-pane {
  display: none;
}

.cat-list-pane {
  padding: var(--sp-md);
  min-width: 0;
}

.cat-editor-pane {
  min-width: 0;
}

.cat-editor-empty {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

@container (min-width: 880px) {
  .cat-split {
    grid-template-columns: minmax(300px, 2fr) minmax(0, 3fr);
  }

  .cat-split.has-editor .cat-list-pane,
  .cat-split:not(.has-editor) .cat-editor-pane {
    display: block;
  }

  .cat-list-pane {
    position: sticky;
    top: var(--sp-md);
  }

  .cat-back {
    display: none;
  }
}

/* ─── The list ─────────────────────────────────────────────────────── */

.cat-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.cat-list-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  align-items: center;
}

.cat-search {
  flex: 1 1 180px;
  min-height: 40px;
  max-width: none;
}

.cat-city {
  flex: 0 1 150px;
  min-width: 0;
}

.cat-city .input {
  min-height: 40px;
  padding-block: 6px;
}

.cat-attention {
  min-height: 40px;
  padding-inline: var(--sp-md);
}

.cat-rows-head {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-sm) 4px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.cat-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.cat-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: var(--sp-sm);
  align-items: center;
  width: 100%;
  padding: 10px var(--sp-sm);
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dark);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.cat-row:hover {
  background: var(--bg-light);
}

.cat-row.is-selected {
  background: var(--bg-input);
  box-shadow: inset 3px 0 0 var(--primary-dark);
}

[dir='rtl'] .cat-row.is-selected {
  box-shadow: inset -3px 0 0 var(--primary-dark);
}

.cat-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.cat-row-name {
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.cat-row-city {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.cat-row-chips {
  gap: 4px;
}

.cat-row-chips .chip {
  white-space: normal;
}

.cat-none {
  margin: var(--sp-md) 0;
}

.cat-count {
  margin: 0;
  padding-inline: var(--sp-sm);
}

/* Narrow: the row stacks (name, then city and chips). */
@container (max-width: 520px) {
  .cat-rows-head {
    display: none;
  }

  .cat-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .cat-row-name {
    grid-column: 1 / -1;
  }
}

/* ─── The editor ───────────────────────────────────────────────────── */

.cat-editor {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  min-width: 0;
}

.cat-back {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-size: var(--fs-sm);
}

.cat-editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-sm) var(--sp-md);
}

.cat-editor-title {
  flex: 1 1 260px;
  min-width: 0;
}

.cat-editor-title h2 {
  margin: 0 0 2px;
  font-size: var(--fs-lg);
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.cat-history {
  margin: 0;
}

.cat-history .link {
  font-size: inherit;
}

.cat-warn {
  margin: 0;
}

.cat-editor-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  min-width: 0;
}

.cat-pair {
  align-items: start;
}

.cat-checked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-xs) var(--sp-md);
  padding-top: var(--sp-sm);
  border-top: 1px solid var(--border-light);
}

.cat-editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sp-sm);
}

.cat-editor-note,
.cat-studio-note {
  margin: 0;
}

/* Min-max amounts */
.cat-range {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-sm);
}

.cat-range .fi-label {
  margin-bottom: 2px;
}

/* Location */
.cat-location {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  min-width: 0;
}

.cat-bounds {
  margin: 0;
}

/* Logo: a seal like the app's (components/Seal.tsx): a white circle with a fine ring. */
.cat-logo {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.cat-logo .note {
  margin: 0;
}

.cat-logo .muted {
  margin: 0;
}

.cat-logo-row {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.cat-seal {
  position: relative;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-heading);
  color: var(--primary-dark);
}

.cat-seal img {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  object-fit: contain;
}

.cat-seal-emblem {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.cat-seal-busy {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
}

.cat-logo-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* History */
.cat-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.cat-history-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-white);
}

.cat-history-when {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.cat-history-ds {
  margin-inline-start: var(--sp-sm);
}

/* ─── Preview on phone ─────────────────────────────────────────────── */

.cat-preview {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  align-items: center;
}

.cat-preview .note,
.cat-preview .muted {
  margin: 0;
  align-self: stretch;
}

.cat-phone {
  width: 300px;
  max-width: 100%;
  border: 10px solid var(--primary-dark);
  border-radius: 36px;
  background: var(--primary-dark);
  overflow: hidden;
  box-shadow: var(--shadow-raised);
}

.cat-phone-screen {
  min-height: 460px;
  border-radius: 26px;
  background: var(--bg-white);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cat-phone-hero {
  min-height: 150px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: var(--sp-md);
  background: linear-gradient(var(--bg-splash), var(--primary-dark));
  color: var(--text-white);
}

.cat-phone-seal {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--primary-dark);
  font-family: var(--font-heading);
  font-size: var(--fs-xs);
}

.cat-phone-seal img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 50%;
}

.cat-phone-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-phone-title strong {
  font-family: var(--f-head);
  font-size: var(--fs-md);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cat-phone-title span {
  font-size: var(--fs-xs);
  color: var(--text-white-soft);
}

.cat-phone-globe {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-light);
}

.cat-phone-pills {
  display: flex;
  margin: var(--sp-md);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
}

.cat-phone-pills > div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  text-align: center;
}

.cat-phone-pills > div + div {
  border-inline-start: 1px solid var(--border-light);
}

.cat-phone-pills strong {
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  color: var(--primary-dark);
}

.cat-phone-pills span {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.cat-phone-about,
.cat-phone-empty {
  margin: 0 var(--sp-md) var(--sp-md);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-dark);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cat-phone-empty {
  color: var(--text-muted);
}

/* ─── Content health card (on the Overview) ────────────────────────── */

.cat-health {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  min-width: 0;
}

.cat-health-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px var(--sp-md);
}

.cat-health-head h2 {
  margin: 0;
}

.cat-health-head p {
  margin: 0;
}

.cat-health-table {
  display: flex;
  flex-direction: column;
}

.cat-health-row {
  display: grid;
  grid-template-columns: minmax(96px, 1.2fr) 40px minmax(84px, 0.8fr) minmax(0, 2.6fr) 44px;
  gap: var(--sp-sm);
  align-items: center;
  padding: var(--sp-sm) 0;
  border-top: 1px solid var(--border-light);
}

.cat-health-row.is-head {
  border-top: none;
  padding-top: 0;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.cat-health-name {
  color: var(--primary-dark);
  font-size: var(--fs-sm);
}

.cat-health-n {
  font-family: var(--font-heading);
}

.cat-health-row .chips .chip {
  white-space: normal;
}

.cat-health-open {
  text-align: end;
}

.cat-health-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
}

.cat-health-note {
  margin: 0;
}

/* Narrow card: each section is a small block (the name and «Open» on top, then labelled values). */
@container (max-width: 480px) {
  .cat-health-row.is-head {
    display: none;
  }

  .cat-health-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 4px var(--sp-sm);
  }

  .cat-health-row > [data-label] {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px var(--sp-sm);
  }

  .cat-health-row > [data-label]::before {
    content: attr(data-label);
    min-width: 72px;
    font-size: var(--fs-xs);
    color: var(--text-secondary);
  }

  /* The count sits on the name's line, then «Open». */
  .cat-health-row > .cat-health-n {
    grid-row: 1;
    grid-column: 2;
  }

  .cat-health-row > .cat-health-n::before {
    content: none;
  }

  .cat-health-open {
    grid-row: 1;
    grid-column: 3;
  }
}

/* The dataset note sticks to the top of a drawer (content.css); in the editor card it stays in place. */
.cat-editor .ct-dataset-note {
  position: static;
}

/* ─── Track B2: Places & map, Guides & checklists, the link check ───── */

.cat-tabs {
  min-width: 0;
  overflow-x: auto;
}

.cat-category {
  flex: 0 1 170px;
}

/* «Hide from app» sits at the start of the button row (Hazza's design), the saves at the end. */
.cat-hide {
  margin-inline-end: auto;
}

.cat-flags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm) var(--sp-lg);
}

/* A place's photos */
.cat-photos,
.cat-items,
.cat-toggles {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.cat-photos .muted,
.cat-items .muted {
  margin: 0;
}

.cat-photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-sm);
}

.cat-photo {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cat-photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: var(--bg-light);
}

.cat-photo-cover {
  position: absolute;
  inset-block-start: 6px;
  inset-inline-start: 6px;
}

.cat-photo-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Rows of inputs (facilities, links) */
.cat-item-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  padding: var(--sp-sm);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-light);
}

.cat-item-row > .btn {
  align-self: flex-end;
}

/* Toggle chips (categories, sponsors, cities) */
.cat-toggle-row {
  flex-wrap: wrap;
  gap: 6px;
}

.cat-toggle-row .pill {
  min-height: 34px;
}

.cat-toggles.has-error .cat-toggle-row {
  outline: 1px solid var(--error);
  outline-offset: 4px;
  border-radius: 10px;
}

/* «In the app:» highlights as tags */
.cat-tags {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-block-start: calc(-1 * var(--sp-xs));
}

.cat-tags .chips {
  margin: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.cat-tags .note {
  margin: 0;
}

/* Who sees a journey task */
.cat-more {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.cat-more > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-dark);
}

.cat-more[open] > summary {
  margin-block-end: var(--sp-sm);
}

.cat-more > * + * {
  margin-block-start: var(--sp-sm);
}

/* «Check link» */
.cat-link-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  min-width: 0;
}

.cat-linkcheck {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-xs) var(--sp-sm);
  margin: 0;
}

.cat-linkcheck > span {
  flex: 1 1 200px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.cat-linkcheck-ok {
  color: var(--success);
}

.cat-linkcheck-warning {
  color: var(--warning);
}

.cat-linkcheck-danger {
  color: var(--error);
}

/* A journey task on the phone (preview) */
.cat-task {
  gap: var(--sp-xs);
  padding: var(--sp-md);
}

.cat-task-title {
  font-family: var(--f-head);
  font-size: var(--fs-md);
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.cat-task-due {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.cat-task .cat-phone-about {
  margin: var(--sp-xs) 0;
}

.cat-task-h {
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  color: var(--primary-dark);
  margin-block-start: var(--sp-xs);
}

.cat-task-list {
  margin: 0;
  padding-inline-start: 1.3em;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-dark);
  overflow-wrap: anywhere;
}

.cat-task-link {
  font-size: var(--fs-sm);
  color: var(--primary);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

/* Narrow: the hide button gets its own line above the saves. */
@container (max-width: 520px) {
  .cat-hide {
    flex-basis: 100%;
  }

  .cat-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* content.css */
/* «محتوى التطبيق» screens (src/screens/People, Notices, Events, Suggestions and appContent.tsx): content from Sanity.
   Every class starts with ct- so nothing here touches another screen. Tokens only (constants/colors.ts via
   scripts/build.ts); logical properties so right-to-left and left-to-right lay out from one sheet. */

/* ─── Top bar and filters ─────────────────────────────────────────── */

.ct-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-sm);
}

.ct-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-md) var(--sp-lg);
}

.ct-filters .search {
  align-self: flex-end;
  min-height: 44px;
}

.ct-filter {
  min-width: 220px;
}

.ct-filters > .muted {
  align-self: center;
}

.ct-inline-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-sm);
}

.ct-banner-line {
  margin: 0;
}

.ct-banner-line + .ct-banner-line {
  margin-top: var(--sp-xs);
}

.ct-banner-actions {
  margin-top: var(--sp-sm);
}

/* Which dataset an editor or picker changes: on top while the drawer scrolls (opaque, so text doesn't show through).
   top: minus the drawer body's top padding, so it sticks to the very top edge with no gap above it. */
.ct-dataset-note {
  position: sticky;
  top: calc(-1 * var(--sp-lg));
  z-index: 2;
  margin: 0;
  font-size: var(--fs-xs);
  border: 1px solid var(--warning);
  background: linear-gradient(var(--warning-tint), var(--warning-tint)), var(--bg-white);
}

.ct-dataset-note.is-live {
  padding: 6px var(--sp-md);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--primary-dark);
}

/* ─── Chips ───────────────────────────────────────────────────────── */

.ct-chip-draft {
  background: var(--warning-tint);
  color: var(--warning);
  border: 1px dashed var(--warning);
}

/* Error red is too light for small text on white: dark text, red ring and dot. */
.ct-chip-danger,
.ct-chip-ok {
  gap: 6px;
  background: var(--bg-white);
  color: var(--text-dark);
  border: 1px solid var(--border-light);
}

.ct-chip-danger {
  border-color: var(--error);
}

.ct-chip-danger::before,
.ct-chip-ok::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--error);
}

.ct-chip-ok::before {
  background: var(--success);
}

/* ─── Lists ───────────────────────────────────────────────────────── */

.ct-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.ct-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--sp-md) var(--sp-lg);
}

.ct-main {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.ct-main > * {
  max-width: 100%;
}

.ct-title {
  font-size: var(--fs-md);
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.ct-row-actions {
  flex: 0 1 auto;
  align-self: center;
  justify-content: flex-end;
  padding-top: 0;
}

.ct-row-note {
  flex-basis: 100%;
}

.ct-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px var(--sp-md);
  margin: 0;
}

.ct-when {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--text-dark);
}

.ct-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ct-ext {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Order arrows (people): the two chevrons turned to point up and down, whatever the page direction. */
.ct-order {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
}

.ct-order-n {
  font-family: var(--font-heading);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.ct-order-btn {
  width: 32px;
  height: 32px;
}

.ct-order-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

:root .ct-order .ct-order-btn .ct-up,
:root .ct-order .ct-order-btn .ct-down {
  transform: rotate(90deg);
}

.ct-thumb {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-input);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-heading);
  font-size: var(--fs-sm);
  border: 1px solid var(--border-light);
}

.ct-thumb.is-round {
  border-radius: 50%;
}

.ct-thumb.is-small {
  width: 44px;
  height: 44px;
  font-size: var(--fs-xs);
}

.ct-thumb.is-wide {
  width: 112px;
  height: 84px;
  font-family: var(--f-head);
  font-size: var(--fs-xs);
  padding: var(--sp-xs);
}

.ct-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ─── Editor parts ────────────────────────────────────────────────── */

.ct-box {
  margin: 0;
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  min-width: 0;
}

.ct-box > legend {
  padding: 0 var(--sp-xs);
}

.ct-box > h3 {
  margin: 0;
}

.ct-box .muted {
  margin: 0;
}

.ct-checks,
.ct-unis,
.ct-image {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.ct-checks > legend,
.ct-unis > legend,
.ct-image > legend {
  margin-bottom: var(--sp-xs);
}

.ct-check-cell {
  align-self: end;
  padding-bottom: var(--sp-sm);
}

.ct-audience {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  margin: 0;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--primary-dark);
  font-size: var(--fs-xs);
  transition: opacity 0.2s;
}

.ct-audience .icon {
  flex: none;
  margin-top: 2px;
}

.ct-audience.ct-stale {
  opacity: 0.6;
}

.ct-coords {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

/* Photo picker */
.ct-image-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-lg);
}

.ct-image-box {
  position: relative;
  flex: none;
  width: 192px;
  height: 128px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ct-image-box.is-square {
  width: 144px;
  height: 144px;
}

.ct-image-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ct-image-busy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xs);
  background: var(--overlay);
  color: var(--text-white);
  font-size: var(--fs-xs);
}

.ct-image-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.ct-image-side .muted,
.ct-image-side .form-error {
  margin: 0;
}

/* Tutor packages */
.ct-pkg td {
  padding: var(--sp-sm) 10px;
}

.ct-pkg .fi-error {
  display: block;
  margin-top: 2px;
}

.ct-num {
  min-height: 38px;
  max-width: 130px;
  font-size: var(--fs-sm);
}

.ct-num.is-bad {
  border-color: var(--error);
}

/* University multi-pick */
.ct-picked {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ct-picked-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-block: 2px;
  padding-inline: 12px 4px;
  border-radius: var(--r-pill);
  background: var(--primary-dark);
  color: var(--text-white);
  font-size: var(--fs-xs);
}

.ct-picked-item button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-white);
  cursor: pointer;
}

.ct-picked-item button:hover {
  background: var(--overlay-light);
}

.ct-uni-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  background: var(--bg-white);
}

.ct-unis .search,
.ct-picker .search {
  max-width: none;
  min-height: 44px;
}

/* Account picker */
.ct-pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  overflow: hidden;
}

.ct-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-md) 14px;
}

.ct-pick-item + .ct-pick-item {
  border-top: 1px solid var(--border-light);
}

.ct-pick-main {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The linked account's photo in the person editor (the one the app shows). */
.ct-account-photo {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.ct-account-photo .muted {
  margin: 0;
}

/* ─── Suggestions ─────────────────────────────────────────────────── */

.ct-sugg {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ct-sugg .note {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ct-dataset-tag {
  margin-inline-start: auto;
  align-self: center;
}

/* ─── Narrow windows ──────────────────────────────────────────────── */

/* «اعرض الأقدم» under the events list: the latest-N line and the button, centred like the pager. */
.ct-older {
  align-items: center;
  justify-content: center;
  text-align: center;
}

@media (max-width: 720px) {
  .ct-image-row {
    flex-direction: column;
  }

  .ct-row-actions {
    flex-basis: 100%;
    justify-content: flex-start;
  }

  .ct-filter {
    min-width: 0;
    flex: 1 1 100%;
  }

  .ct-pick-item {
    flex-wrap: wrap;
  }

  .ct-pick-main {
    flex-basis: calc(100% - 44px - var(--sp-md));
  }
}

/* forms.css */
/* Phase 2 form parts (src/ui/forms.tsx): labelled inputs, bilingual pairs, tabs, drawer, dataset switch.
   Tokens only (constants/colors.ts via scripts/build.ts); logical properties for RTL and LTR. */

.fi {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  min-width: 0;
  position: relative;
}
.fi-label {
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  color: var(--text-dark);
  padding: 0;
}
.fi-req {
  color: var(--error);
}
.fi-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  display: block;
}
.fi-error {
  font-size: var(--fs-xs);
  color: var(--error);
}
.fi.has-error .input {
  border-color: var(--error);
}
.fi-count {
  align-self: flex-end;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.input-area {
  min-height: 88px;
  padding: var(--sp-sm) var(--sp-md);
  resize: vertical;
  line-height: 1.55;
  font-family: inherit;
}
.input-select {
  appearance: auto;
  padding-inline: var(--sp-md);
}
.fi-check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text-dark);
}
.fi-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary-dark);
  flex: none;
}
.fi-check.is-disabled {
  opacity: 0.55;
  cursor: default;
}

.bi {
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.bi > legend {
  margin-bottom: var(--sp-xs);
}
.bi-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-md) var(--sp-lg);
  align-items: start;
}
.form-grid > .span-2 {
  grid-column: 1 / -1;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--sp-lg);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  min-height: 40px;
}
.tab:hover {
  color: var(--primary-dark);
}
.tab.is-on {
  color: var(--primary-dark);
  border-bottom-color: var(--primary-dark);
}
.tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: var(--r-sm);
}
.tab-count {
  background: var(--primary-dark);
  color: var(--text-white);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  padding: 0 6px;
  min-width: 20px;
  text-align: center;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 40;
  display: flex;
  justify-content: flex-end;
}
.drawer {
  background: var(--bg-light);
  width: min(560px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-raised);
}
.drawer-wide {
  width: min(820px, 100%);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-lg) var(--sp-xl);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-white);
}
.drawer-head h2 {
  margin: 0;
  font-family: var(--f-head);
  font-size: var(--fs-lg);
  color: var(--text-dark);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-lg) var(--sp-xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}
.drawer-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  justify-content: flex-end;
  padding: var(--sp-md) var(--sp-xl);
  border-top: 1px solid var(--border-light);
  background: var(--bg-white);
}

.dataset {
  display: inline-flex;
  border: 1px solid var(--border-mid);
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--bg-white);
}
.dataset-btn {
  border: none;
  background: transparent;
  padding: 6px var(--sp-md);
  font-size: var(--fs-xs);
  font-family: var(--f-head);
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 34px;
}
.dataset-btn.is-on {
  background: var(--primary-dark);
  color: var(--text-white);
}
.dataset.is-dev {
  border-color: var(--warning);
}
.dataset.is-dev .dataset-btn.is-on {
  background: var(--warning);
  color: var(--text-dark);
}

@media (max-width: 720px) {
  .bi-row,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .drawer-head,
  .drawer-body,
  .drawer-foot {
    padding-inline: var(--sp-md);
  }
}

/* frame.css */
/* Phase 2 frame (track UI-A): the grouped menu and its drawer under 900 px, the overview, numbers, health, settings,
   team and log screens, the charts (src/ui/Chart.tsx) and the screen error box. Tokens only (constants/ via
   scripts/build.ts; the one derived colour is a tint of --error made with color-mix). Logical properties, so one
   stylesheet lays out right-to-left and left-to-right. Loaded after styles.css and forms.css (name order). */

/* ─── Menu: groups ────────────────────────────────────────────────── */

.side-nav {
  gap: var(--sp-md);
}

.side-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-group-title {
  padding: var(--sp-xs) 14px 2px;
  font-size: var(--fs-xs);
  color: var(--text-white-soft);
}

.side-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-sm);
}

.side-close,
.mbar,
.side-backdrop {
  display: none;
}

.skip-link {
  position: absolute;
  top: -80px;
  inset-inline-start: var(--sp-md);
  z-index: 90;
  padding: var(--sp-sm) 14px;
  border-radius: var(--r-pill);
  background: var(--bg-white);
  color: var(--primary-dark);
  font-family: var(--f-head);
  box-shadow: var(--shadow-raised);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--sp-md);
}

.topbar h1:focus:not(:focus-visible) {
  outline: none;
}

:root.menu-locked,
:root.menu-locked body {
  overflow: hidden;
}

/* ─── Menu: a drawer on narrow windows ────────────────────────────── */

@media (max-width: 900px) {
  .mbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-md);
    padding: var(--sp-sm) var(--sp-lg);
    background: linear-gradient(180deg, var(--bg-splash), var(--primary-dark));
    color: var(--text-white);
  }

  .mbar-logo {
    height: 26px;
    width: auto;
  }

  .mbar-menu {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-sm);
    min-height: 40px;
    padding: 0 14px;
    border-radius: var(--r-pill);
    border: 1px solid var(--overlay-border);
    background: transparent;
    color: var(--text-white);
    font-family: var(--f-head);
    cursor: pointer;
  }

  .mbar-menu:hover {
    background: var(--overlay-light);
  }

  .side {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 42;
    width: min(300px, 86vw);
    height: 100%;
    gap: var(--sp-lg);
    padding: var(--sp-lg);
    box-shadow: var(--shadow-raised);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }

  :root[dir='rtl'] .side {
    transform: translateX(100%);
  }

  :root .shell.menu-open .side {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease;
  }

  .side-nav {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .side-brand img {
    width: 120px;
  }

  .side-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--r-circle);
    border: 1px solid var(--overlay-border);
    background: transparent;
    color: var(--text-white);
    cursor: pointer;
  }

  .side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 41;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .shell.menu-open .side-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    padding-top: var(--sp-lg);
  }

  .topbar h1 {
    font-size: var(--fs-lg);
  }
}

/* ─── Shared bits of the phase-2 screens ──────────────────────────── */

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.h-section {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--primary-dark);
}

.card-title {
  margin: 0 0 var(--sp-sm);
  font-size: var(--fs-md);
  color: var(--primary-dark);
}

.more-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  align-self: flex-start;
  font-family: var(--f-head);
  text-decoration: none;
}

.more-link:hover {
  text-decoration: underline;
}

.card .more-link {
  margin-top: var(--sp-sm);
}

.link-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--primary-dark);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
  text-align: start;
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--error);
}

.is-stale {
  opacity: 0.55;
  transition: opacity 0.2s;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--sp-lg);
  align-items: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--sp-lg);
  align-items: start;
}

.banner-danger {
  border: 1px solid var(--error);
  border-inline-start-width: 4px;
  background: color-mix(in srgb, var(--error) 7%, var(--bg-white));
  color: var(--text-dark);
}

.banner-danger strong {
  color: var(--text-primary);
}

.screen-error {
  max-width: 560px;
  margin: 0 auto;
}

/* Filters: one row above what they scope. */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-sm) var(--sp-md);
}

.filters-end {
  margin-inline-start: auto;
}

.filters .fi {
  min-width: 140px;
}

.filters .pills {
  align-self: center;
}

/* ─── Stat tiles ──────────────────────────────────────────────────── */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 156px), 1fr));
  gap: var(--sp-md);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
  color: inherit;
  text-decoration: none;
}

.stat.is-link:hover {
  border-color: var(--primary);
}

.stat.is-attention {
  border-inline-start: 4px solid var(--warning);
}

.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: var(--fs-xxl);
  line-height: 1.25;
  color: var(--primary-dark);
}

.stat-delta,
.stat-hint {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.spark {
  display: block;
  width: 100%;
  height: 32px;
  margin-top: var(--sp-xs);
}

.spark svg {
  display: block;
  overflow: visible;
}

/* ─── Overview ────────────────────────────────────────────────────── */

.hello h2 {
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--primary-dark);
}

.hello {
  flex: 1;
  min-width: 240px;
}

.calm {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin: 0;
  padding: 10px var(--sp-md);
  border-radius: 10px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  color: var(--text-body);
}

.calm .icon {
  color: var(--success);
}

.alerts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--sp-md);
  border: 1px solid var(--border-light);
  border-inline-start-width: 4px;
  border-radius: 10px;
  background: var(--bg-white);
}

.alert > .icon {
  flex-shrink: 0;
}

.alert-danger {
  border-inline-start-color: var(--error);
}

.alert-danger > .icon {
  color: var(--error);
}

.alert-warning {
  border-inline-start-color: var(--warning);
}

.alert-warning > .icon {
  color: var(--warning);
}

.alert-info {
  border-inline-start-color: var(--primary);
}

.alert-info > .icon {
  color: var(--primary);
}

.alert-text {
  flex: 1;
  min-width: 0;
  color: var(--text-dark);
}

.alert-go {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  flex-shrink: 0;
  font-family: var(--f-head);
  text-decoration: none;
  white-space: nowrap;
}

.alert-go:hover {
  text-decoration: underline;
}

/* ─── Charts (ui/Chart.tsx) ───────────────────────────────────────── */

.chart-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  min-width: 0;
}

.chart {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  min-width: 0;
  margin: 0;
}

.chart-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chart-title {
  font-family: var(--f-head);
  font-size: var(--fs-md);
  color: var(--primary-dark);
}

.chart-sub {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.chart-none {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.chart-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs) var(--sp-md);
  margin: 0;
  padding: 0;
  font-size: var(--fs-xs);
  color: var(--text-body);
}

.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* A short stroke of the series colour (line key). */
.chart-key {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-key.chart-s1 {
  background: var(--primary-dark);
}

.chart-key.chart-s2 {
  background: var(--primary);
}

.chart-key.chart-s3 {
  background: var(--mist);
}

.chart-plot {
  position: relative;
  width: 100%;
  border-radius: 6px;
  touch-action: pan-y;
}

.chart-plot svg {
  display: block;
  overflow: visible;
}

.chart-grid {
  stroke: var(--border-light);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-tick {
  fill: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-cross {
  stroke: var(--text-muted);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-line.chart-s1 {
  stroke: var(--primary-dark);
}

.chart-line.chart-s2 {
  stroke: var(--primary);
}

.chart-line.chart-s3 {
  stroke: var(--mist);
}

.chart-area {
  stroke: none;
  opacity: 0.1;
}

.chart-area.chart-s1 {
  fill: var(--primary-dark);
}

.chart-dot {
  stroke: var(--bg-white);
  stroke-width: 2;
}

.chart-dot.chart-s1 {
  fill: var(--primary-dark);
}

.chart-dot.chart-s2 {
  fill: var(--primary);
}

.chart-dot.chart-s3 {
  fill: var(--mist);
}

.chart-value {
  fill: var(--text-dark);
  font-family: var(--font-heading);
  font-size: 12px;
}

.chart-bar.chart-s1 {
  fill: var(--primary);
}

.chart-bar.is-on {
  fill: var(--primary-dark);
}

.chart-tip {
  position: absolute;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-white);
  box-shadow: var(--shadow-raised);
  font-size: var(--fs-xs);
  white-space: nowrap;
  pointer-events: none;
}

.chart-tip-date {
  color: var(--text-secondary);
}

.chart-tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-tip-row strong {
  font-family: var(--font-heading);
  color: var(--text-primary);
}

.chart-tip-label {
  color: var(--text-secondary);
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  pointer-events: none;
}

.chart-table summary {
  width: fit-content;
  color: var(--primary-dark);
  font-size: var(--fs-xs);
  cursor: pointer;
}

.chart-table .table-wrap {
  margin-top: var(--sp-sm);
  max-height: 320px;
  overflow: auto;
  box-shadow: none;
}

.table-compact th,
.table-compact td {
  padding: 6px 10px;
  font-size: var(--fs-xs);
}

.table-compact tbody th {
  background: none;
  color: var(--text-dark);
  font-family: var(--f-body);
  white-space: normal;
  border-top: 1px solid var(--border-light);
}

.num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table th.num {
  text-align: end;
}

/* Ranked horizontal bars: name and number, then a thin bar (8px, one colour) on a lighter track. */
.barlist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.barlist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px var(--sp-sm);
}

.barlist-label {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-dark);
}

.barlist-num {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.barlist-num strong {
  font-family: var(--font-heading);
  color: var(--primary-dark);
}

.barlist-track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-input);
  overflow: hidden;
}

.barlist-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
}

.barlist-note {
  grid-column: 1 / -1;
}

/* ─── Health ──────────────────────────────────────────────────────── */

.checks {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  margin: 0;
  padding: 0;
}

/* Health: each server check with what it is for, and what to do when it is missing. */
.markers {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  margin: 0;
  padding: 0;
}

.marker {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.marker-fix {
  color: var(--text-dark);
}

.st-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  color: var(--text-dark);
}

.st-chip .icon {
  box-sizing: content-box;
  flex-shrink: 0;
  padding: 3px;
  border-radius: 50%;
  color: var(--text-white);
}

.st-ok .icon {
  background: var(--success);
}

.st-bad .icon {
  background: var(--error);
}

.st-warn .icon {
  background: var(--warning);
}

.st-off .icon {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.big-num {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--fs-xxl);
  line-height: 1.2;
  color: var(--primary-dark);
}

.jobs {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  margin: 0;
  padding: 0;
}

.job {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
}

.job.is-failing {
  border-inline-start: 4px solid var(--error);
}

.job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-sm);
}

.job-head strong {
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.job-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm) var(--sp-xl);
  margin: 0;
}

.job-facts dt {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.job-facts dd {
  margin: 0;
}

.job-error {
  display: block;
  margin: 0;
  padding: var(--sp-xs) 6px;
  border-radius: 6px;
  background: var(--bg-light);
  color: var(--text-body);
  font-family: var(--font-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ─── Settings ────────────────────────────────────────────────────── */

.settings .card > .muted {
  margin-bottom: var(--sp-md);
}

.lock-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
}

/* ─── Team ────────────────────────────────────────────────────────── */

.add-member {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) auto;
  align-items: start;
  gap: var(--sp-md);
  margin-top: var(--sp-md);
}

.add-member > .btn {
  margin-top: 25px;
}

.members {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  margin: 0;
  padding: 0;
}

.member {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.3fr);
  align-items: start;
  gap: var(--sp-md) var(--sp-xl);
  padding: var(--sp-lg) 18px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
}

.member-who {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  min-width: 0;
}

.member-who strong {
  color: var(--primary-dark);
}

.member-meta {
  display: grid;
  gap: var(--sp-xs);
  margin: 0;
  font-size: var(--fs-xs);
}

.member-meta div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.member-meta dt {
  color: var(--text-secondary);
}

.member-meta dd {
  margin: 0;
  color: var(--text-dark);
  overflow-wrap: anywhere;
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-sm) var(--sp-lg);
  min-width: 0;
}

.member-role {
  flex: 1 1 220px;
  max-width: 300px;
}

.member-actions > .actions {
  padding-top: 0;
}

/* ─── Log ─────────────────────────────────────────────────────────── */

.log-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  align-items: end;
}

.log-filters .fi {
  min-width: 0;
}

.log-filters > .btn {
  justify-self: start;
}

/* A table whose rows become small cards on a phone (each cell with its column name: data-label). */
@media (max-width: 720px) {
  .table-stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td,
  .table-stack tbody th {
    display: block;
    width: 100%;
  }

  .table-stack tr {
    padding: var(--sp-sm) 0;
    border-top: 1px solid var(--border-light);
  }

  .table-stack tbody tr:first-child {
    border-top: none;
  }

  .table-stack td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    justify-items: start;
    gap: var(--sp-sm);
    padding: var(--sp-xs) var(--sp-md);
    border-top: none;
    max-width: none;
  }

  .table-stack td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    padding-top: 2px;
  }

  .table-stack td.nowrap {
    white-space: normal;
  }

  /* A cell without a column name (a row's button): the whole width, from the reading start. */
  .table-stack td.stack-plain {
    display: block;
    text-align: start;
  }

  .table-stack td.stack-plain::before {
    content: none;
  }

  .log-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ─── Narrow windows ──────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .member {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .member-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .member,
  .add-member {
    grid-template-columns: minmax(0, 1fr);
  }

  .add-member > .btn {
    margin-top: 0;
    justify-self: start;
  }

  .filters {
    padding: var(--sp-md);
  }

  .filters-end {
    margin-inline-start: 0;
  }

  .stat-value {
    font-size: var(--fs-xl);
  }

  .alert {
    flex-wrap: wrap;
  }

  .alert-text {
    flex-basis: calc(100% - 40px);
  }

  .alert-go {
    margin-inline-start: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .side,
  .side-backdrop,
  .is-stale {
    transition: none;
  }
}

/* ═══ Phase 3, track A: the top bar, the Overview v3, recent changes, the readable log ═══════════════════════════
   ui/TopBar.tsx, ui/GlobalSearch.tsx, ui/AddNewMenu.tsx, ui/AvatarMenu.tsx, screens/Overview.tsx and
   screens/overview/*. Tokens only; logical properties; no sideways scroll at 375 px. */

/* ─── Top bar: search, «+ إضافة», the member's initials, then the title ─── */

.tb {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.tb-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  min-height: 44px;
}

.tb-fill {
  flex: 1;
}

.tb-end {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-inline-start: auto;
  flex-shrink: 0;
}

.tb-pop {
  position: relative;
}

.tb-add {
  min-height: 44px;
  gap: 6px;
}

.tb-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-circle);
  border: 2px solid var(--bg-white);
  background: var(--primary);
  color: var(--text-white);
  font-family: var(--font-heading);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.tb-avatar:hover {
  background: var(--primary-dark);
}

.tb-menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  z-index: 36;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 32px));
  padding: var(--sp-xs) 0;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  box-shadow: var(--shadow-raised);
}

.tb-item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  min-height: 44px;
  padding: 0 var(--sp-lg);
  border: none;
  background: none;
  color: var(--primary-dark);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.tb-item:hover,
.tb-item:focus-visible {
  background: var(--bg-input);
}

.tb-item:focus-visible {
  outline-offset: -2px;
}

.tb-me {
  display: flex;
  flex-direction: column;
  padding: var(--sp-sm) var(--sp-lg) var(--sp-md);
  margin-bottom: var(--sp-xs);
  border-bottom: 1px solid var(--border-light);
}

.tb-me-name {
  color: var(--primary-dark);
  font-family: var(--f-head);
  overflow-wrap: anywhere;
}

.tb-me-role {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}

/* The search box and its results. */
.gs {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 720px;
}

.gs-open {
  display: none;
}

.gs-field {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  height: 44px;
  padding: 0 var(--sp-md);
  border: 1px solid var(--border-light);
  border-radius: var(--r-pill);
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
  color: var(--text-secondary);
}

.gs-field:focus-within {
  border-color: var(--primary);
}

.gs-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-dark);
}

.gs-field input::placeholder {
  color: var(--text-secondary);
}

.gs-field input::-webkit-search-cancel-button {
  appearance: none;
}

.gs-clear {
  display: inline-flex;
  padding: 6px;
  border: none;
  border-radius: var(--r-circle);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.gs-clear:hover {
  background: var(--bg-input);
  color: var(--primary-dark);
}

.gs-panel {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 6px);
  z-index: 35;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: var(--sp-xs) 0;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  box-shadow: var(--shadow-raised);
}

.gs-group + .gs-group {
  margin-top: var(--sp-xs);
  padding-top: var(--sp-xs);
  border-top: 1px solid var(--border-light);
}

.gs-group-title {
  padding: var(--sp-xs) var(--sp-lg);
  color: var(--text-secondary);
  font-family: var(--f-head);
  font-size: var(--fs-xs);
}

.gs-hit {
  display: flex;
  flex-direction: column;
  padding: var(--sp-sm) var(--sp-lg);
  cursor: pointer;
}

.gs-hit.is-active,
.gs-hit:hover {
  background: var(--bg-input);
}

.gs-hit-title {
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.gs-hit-sub {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  overflow-wrap: anywhere;
}

.gs-note {
  margin: 0;
  padding: var(--sp-sm) var(--sp-lg);
  color: var(--text-secondary);
}

.gs-note-warn {
  color: var(--warning);
}

/* Under 640 px: a search button; open, the box covers the bar's row. «+ إضافة» shows its icon only. */
@media (max-width: 640px) {
  .gs {
    position: static;
    flex: 0 0 auto;
  }

  .gs-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-light);
    border-radius: var(--r-circle);
    background: var(--bg-white);
    color: var(--primary-dark);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
  }

  .gs-field {
    display: none;
  }

  .gs.is-expanded {
    position: absolute;
    inset: 0;
    z-index: 34;
  }

  .gs.is-expanded .gs-open {
    display: none;
  }

  .gs.is-expanded .gs-field {
    display: flex;
  }

  .tb-add-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .tb-add {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
}

/* ─── Overview v3 ─── */

.ov-headline {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--text-dark);
  font-size: var(--fs-md);
}

.chip-danger {
  background: var(--emergency-tint);
  color: var(--emergency);
}

.chip-calm {
  background: var(--bg-light);
  color: var(--text-secondary);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: var(--sp-md);
}

.kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-xs);
  min-width: 0;
  padding: var(--sp-lg) 18px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
  color: inherit;
  text-decoration: none;
}

.kpi.is-link:hover {
  border-color: var(--mist);
}

.kpi-label {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}

.kpi-value {
  color: var(--primary-dark);
  font-family: var(--font-heading);
  font-size: var(--fs-xxl);
  line-height: 1.2;
}

.kpi-chip {
  max-width: 100%;
  white-space: normal;
}

.kpi-note {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}

/* Two columns: content health and this week; recent changes and Ghanem. One column under 1000 px. */
.ov-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--sp-lg);
  align-items: start;
}

.ov-col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  min-width: 0;
}

.ov-col:empty {
  display: none;
}

/* A viewer has no side cards (no recent changes, no Ghanem gaps): the main cards take the whole width. The :has() rule
   (its own rule: a browser without :has() drops only it) covers any other time the side column ends up empty. */
.ov-cols-one {
  grid-template-columns: minmax(0, 1fr);
}

.ov-cols:has(> .ov-col-side:empty) {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 1000px) {
  .ov-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ov-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  min-width: 0;
}

.ov-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.card .ov-card-head h2 {
  margin: 0;
  font-size: var(--fs-md);
}

.ov-card-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.ov-week {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 118px), 1fr));
}

.ov-updated {
  display: block;
}

.ov-more-alerts {
  align-self: flex-start;
}

/* Recent changes: a line, when, and Undo / Sent / Undone / Can't be undone. */
.rc-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rc-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-md) 0;
  border-top: 1px solid var(--border-light);
}

.rc-row:first-child {
  border-top: none;
  padding-top: 0;
}

.rc-text {
  min-width: 0;
}

.rc-line {
  margin: 0;
  overflow-wrap: anywhere;
}

.rc-who {
  color: var(--primary-dark);
  font-family: var(--f-head);
}

.rc-name {
  color: var(--primary-dark);
}

.rc-end {
  flex-shrink: 0;
}

.rc-state {
  display: inline-block;
  padding-top: 6px;
  color: var(--primary-dark);
  font-size: var(--fs-xs);
}

.rc-state-muted {
  color: var(--text-secondary);
}

@media (max-width: 420px) {
  .rc-row {
    flex-direction: column;
    gap: var(--sp-xs);
  }
}

/* The log's Sanity names. */
.log-name {
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

/* inbox.css */
/*
 * The community safety inbox (track C, screens/Inbox.tsx and screens/inbox/*): the list and the open item side by
 * side on a wide screen, the item over the list on a phone. The app's tokens only; logical properties for RTL.
 */

.ib-over {
  margin: 0;
}

/* ─── List and item ───────────────────────────────────────────────── */

.ib-split {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  min-width: 0;
}

.ib-split.is-wide {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  align-items: start;
}

.ib-col-list,
.ib-col-detail {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  min-width: 0;
}

/* On a phone the item opens by scrolling to it: clear the sticky menu bar. */
.ib-col-detail {
  scroll-margin-top: 80px;
}

.ib-split.is-wide .ib-col-detail {
  position: sticky;
  top: var(--sp-lg);
}

.ib-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.ib-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
  color: var(--text-dark);
  text-align: start;
  font: inherit;
  cursor: pointer;
}

.ib-card:hover {
  border-color: var(--border-mid);
  background: var(--bg-light);
}

.ib-card.is-on {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 1px var(--primary-dark);
}

.ib-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-sm);
  min-width: 0;
}

.ib-place {
  color: var(--primary-dark);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.ib-excerpt {
  color: var(--text-dark);
  overflow-wrap: anywhere;
}

.ib-card .chips {
  min-width: 0;
}

.ib-card .chip {
  white-space: normal;
}

/* ─── The open item ───────────────────────────────────────────────── */

.ib-detail {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  min-width: 0;
}

.ib-back {
  align-self: flex-start;
}

.ib-author {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.ib-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--text-white);
  font-family: var(--f-head);
  font-size: var(--fs-md);
}

.ib-author-text {
  flex: 1 1 180px;
  min-width: 0;
}

.ib-author-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ib-author-meta {
  margin-top: 2px;
}

.ib-author-link {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--primary-dark);
  font: inherit;
  font-size: var(--fs-xs);
  text-decoration: underline;
  cursor: pointer;
}

.ib-where {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ib-where h2 {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.ib-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-md);
  border-radius: 10px;
  background: var(--bg-input);
  min-width: 0;
}

.ib-body .qcard-body {
  font-size: var(--fs-sm);
}

.ib-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-md);
  margin: 0;
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--border-light);
}

.ib-facts dt {
  font-family: var(--f-head);
  font-size: var(--fs-xs);
  color: var(--primary-dark);
}

.ib-facts dd {
  margin: 2px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-xs);
  overflow-wrap: anywhere;
}

.ib-flag {
  color: var(--warning);
}

/* ─── Decisions ───────────────────────────────────────────────────── */

.ib-decide {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.ib-decide h3 {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--primary-dark);
}

.ib-reason {
  max-width: 320px;
}

.ib-actions .btn {
  white-space: normal;
  text-align: center;
}

.ib-foot {
  margin: 0;
}

.ib-decided-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin: 0;
}

@media (max-width: 720px) {
  .ib-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .ib-reason {
    max-width: none;
  }

  .ib-actions .btn {
    flex: 1 1 100%;
  }
}

/* ─── Posts & stories (screens/Content.tsx, track C) ─────────────── */
/* More chips per card now (audience, city, event, year): they wrap, and the time beside them stays on screen. */
.ccard .qcard-head .chips {
  flex: 1 1 0;
  min-width: 0;
}

.ccard .qcard-head > .muted {
  flex: none;
}

/* insights.css */
/* Phase 3, track E (INSIGHTS): the Ghanem questions page (src/screens/GhanemQuestions.tsx), the Overview card
   «Answered without our guides» (src/screens/insights/GhanemGapsCard.tsx) and the Analytics notes (Numbers.tsx).
   Every class starts with gq- or nb- so nothing here touches another screen. Tokens only; logical properties so
   right-to-left and left-to-right lay out from one sheet; nothing wider than a 375 px phone. */

/* ─── Filters ─────────────────────────────────────────────────────── */

.gq-filters {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.gq-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-md);
}

.gq-filter {
  flex: 0 1 260px;
  min-width: 0;
}

/* ─── Topics ──────────────────────────────────────────────────────── */

.gq-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.gq-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--sp-md) var(--sp-lg);
}

.gq-main {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gq-topic {
  margin: 0;
  font-family: var(--f-head);
  font-size: var(--fs-md);
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.gq-other {
  margin: 0;
  overflow-wrap: anywhere;
}

.gq-meta {
  margin-top: 2px;
}

.gq-when {
  margin: 0;
}

.gq-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.gq-status.is-covered {
  color: var(--success);
}

.gq-actions {
  flex: 0 1 auto;
  align-self: center;
  justify-content: flex-end;
  padding-top: 0;
}

.gq-tiles {
  margin: 0;
}

/* ─── The log is off ──────────────────────────────────────────────── */

.gq-off {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  max-width: 760px;
}

.gq-off-head {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  color: var(--primary-dark);
}

.gq-off-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
}

.gq-off h3 {
  margin: var(--sp-sm) 0 0;
  font-size: var(--fs-md);
  color: var(--primary-dark);
}

.gq-off p {
  margin: 0;
}

.gq-off-steps {
  margin: 0;
  padding-inline-start: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ─── The Overview card ───────────────────────────────────────────── */

.gq-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  min-width: 0;
}

.gq-card-title {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--primary-dark);
}

.gq-card-sub {
  margin: 0;
}

.gq-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.gq-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px var(--sp-sm);
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border-light);
}

.gq-card-topic {
  flex: 1 1 200px;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-dark);
}

.gq-card-write {
  font-size: var(--fs-xs);
}

.gq-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  font-size: var(--fs-sm);
  color: var(--primary-dark);
}

/* ─── Analytics notes ─────────────────────────────────────────────── */

.nb-note {
  margin: var(--sp-sm) 0 0;
}

/* people.css */
/* Phase 2 community and people screens (track UI-B): the activity drawer, ban boxes, the content browser, chat-report
   decisions, grouped university requests, the students list filters and the student page with its answers editor.
   Tokens only (constants/colors.ts via scripts/build.ts); logical properties for RTL and LTR. */

/* ─── Names that open the activity drawer ─────────────────────────── */

.person-link {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary-dark);
  font: inherit;
  text-align: start;
  text-decoration: underline;
  text-decoration-color: var(--mist-border);
  text-underline-offset: 3px;
  cursor: pointer;
}
.person-link:hover {
  text-decoration-color: var(--primary-dark);
}
.person-link.is-strong {
  font-family: var(--f-head);
}

/* «افتح صفحة الطالب» is a link that looks like a button. */
.drawer-foot a.btn {
  text-decoration: none;
}

.row-link {
  color: inherit;
  text-decoration: none;
}
.row-link:hover {
  text-decoration: underline;
}

.text-warning {
  color: var(--warning);
}

.pre-wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.hint-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.hint-line .icon {
  flex: none;
  margin-top: 2px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.sub-title {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--primary-dark);
}

/* ─── Activity drawer ─────────────────────────────────────────────── */

.act-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-sm) var(--sp-md);
}

.act-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.act-section h3 {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--primary-dark);
}

.act-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-sm);
}
.act-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-md);
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}
.act-stat-n {
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
  color: var(--primary-dark);
  line-height: 1.2;
}
.act-stat-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.act-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
}
.act-item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  padding: 10px 14px;
}
.act-item + .act-item {
  border-top: 1px solid var(--border-light);
}
.act-item-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
}
.act-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}
.act-item-text {
  margin: 0;
  color: var(--text-dark);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Suspensions (community and chat) ────────────────────────────── */

.ban-box {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.ban-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-md) 14px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}
.ban-row.is-on {
  border-color: var(--warning);
  background: var(--warning-tint);
}
.ban-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ban-text strong {
  color: var(--primary-dark);
}
.ban-row.is-on .ban-text strong {
  color: var(--warning);
}

/* ─── Filters (content and students) ──────────────────────────────── */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-md);
}
.filter-row .search {
  min-width: 240px;
}
.filter-select {
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}
.filter-wide {
  flex: 1;
  max-width: 420px;
}
.filter-count {
  margin-inline-start: auto;
  padding-bottom: 10px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding-block: 0;
  padding-inline: var(--sp-md) 6px;
  border-radius: var(--r-circle);
  background: var(--primary-dark);
  color: var(--text-white);
  font-size: var(--fs-xs);
}
.filter-chip-x {
  width: 26px;
  height: 26px;
  border-radius: var(--r-circle);
  border: none;
  background: var(--overlay-light);
  color: var(--text-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ─── Content browser ─────────────────────────────────────────────── */

.ccard.is-removed {
  background: var(--bg-light);
}
.ccard.is-removed .qcard-body,
.ccard.is-removed .qcard-title {
  color: var(--text-secondary);
}
.ccard-counts:empty {
  display: none;
}
.ccard-last {
  margin: 0;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-body);
  font-size: var(--fs-xs);
}
.ccard-note {
  display: block;
  margin-top: 2px;
  color: var(--text-dark);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ─── Chat report decision ────────────────────────────────────────── */

.decision {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}
.decision h2 {
  margin: 0;
}
.outcome-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.decision-days {
  max-width: 280px;
}

/* ─── University requests ─────────────────────────────────────────── */

.req-table tbody.req-group td {
  background: var(--bg-light);
}
/* The group's head row: the university as typed, how many asked, «mark all». */
.req-table .req-head th {
  padding: var(--sp-sm) 14px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-light);
  color: var(--text-dark);
  font-size: var(--fs-sm);
  font-weight: 400;
  white-space: normal;
}
.req-table tbody + tbody .req-head th {
  border-top: 2px solid var(--border-light);
}
.req-head-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-xs) var(--sp-sm);
}
.req-variants {
  display: block;
  margin-top: var(--sp-xs);
}
.req-note-cell {
  min-width: 200px;
  max-width: 320px;
}
.req-note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--fs-xs);
  color: var(--text-body);
}
.req-note-edit {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}
.req-note-edit .actions {
  padding-top: 0;
}

/* ─── Student page ────────────────────────────────────────────────── */

.student-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
}
.student-id {
  display: flex;
  align-items: center;
  gap: var(--sp-lg);
  min-width: 0;
}
.student-id-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-xs);
  min-width: 0;
}
.student-id-text h2 {
  margin: 0;
  font-size: var(--fs-xl);
  color: var(--primary-dark);
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--r-circle);
  object-fit: cover;
  flex: none;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
}
.avatar-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
  color: var(--primary);
}
.avatar-small {
  width: 44px;
  height: 44px;
}
.photo-row {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-md);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-md);
}
.action-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  padding: var(--sp-md) 14px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}
.action-card strong {
  color: var(--primary-dark);
}
.action-card .actions {
  margin-top: auto;
  padding-top: var(--sp-sm);
}

.pending-phone {
  border-color: var(--warning);
  background: var(--warning-tint);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.pending-phone p {
  margin: 0;
}
.pending-phone strong {
  color: var(--warning);
}

.danger-card {
  border-color: var(--error);
}
.danger-card h2 {
  color: var(--error);
}
.danger-card p {
  margin: 0 0 var(--sp-md);
  color: var(--text-body);
}

/* ─── Answers editor ──────────────────────────────────────────────── */

.ae-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  padding-bottom: var(--sp-lg);
  border-bottom: 1px solid var(--border-light);
}
.ae-section h3 {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--primary-dark);
}
.ae-section .muted.small {
  margin: 0;
}
.ae-check {
  padding-top: 30px;
}
.ae-diff td {
  padding-block: 10px;
}
.ae-before {
  color: var(--text-secondary);
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}
.ae-after {
  color: var(--primary-dark);
  font-family: var(--f-head);
}

@media (max-width: 720px) {
  .outcome-cards {
    grid-template-columns: 1fr;
  }
  .student-head,
  .student-id {
    flex-direction: column;
    align-items: flex-start;
  }
  .ban-row,
  .act-item-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .ae-check {
    padding-top: 0;
  }
  .filter-count {
    margin-inline-start: 0;
  }
}

/* reach.css */
/* Phase 3, track D: Announcements (src/screens/Announcements.tsx, src/screens/reach/*). Tokens only (constants/ via
   scripts/build.ts); logical properties, so right-to-left and left-to-right lay out from the same rules. Two columns
   from 1100 px (the steps; the phone preview over «Sent before»), one column below; nothing wider than the screen at
   375 px. The phone preview mirrors the app's Home card (components/notices/NoticeCard.tsx) in the app's colours. */

/* ─── Layout ─────────────────────────────────────────────────────── */

.rc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  grid-template-areas:
    'steps preview'
    'steps sent';
  grid-template-rows: auto 1fr;
  gap: var(--sp-lg);
  align-items: start;
}
.rc-steps {
  grid-area: steps;
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  min-width: 0;
}
.rc-preview-area {
  grid-area: preview;
  min-width: 0;
}
.rc-sent-area {
  grid-area: sent;
  min-width: 0;
}
@media (max-width: 1100px) {
  .rc-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'steps'
      'preview'
      'sent';
    grid-template-rows: none;
  }
}

.rc-step {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  min-width: 0;
}
.rc-step > h2 {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--primary-dark);
}
.rc-dataset {
  margin: 0;
}
.rc-result p {
  margin: 0;
}
.rc-result .actions {
  padding-top: var(--sp-sm);
}

/* ─── Step 1: who ────────────────────────────────────────────────── */

.rc-audience {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  min-width: 0;
}
.rc-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.rc-fieldset > legend {
  margin-bottom: var(--sp-sm);
}
.rc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  align-items: center;
}
.rc-chips .pill {
  min-height: 36px;
}
.rc-chips .pill .icon {
  opacity: 0.8;
}
.rc-other {
  display: inline-flex;
}
.rc-other-select {
  min-height: 36px;
  width: auto;
  max-width: 100%;
  border-radius: var(--r-circle);
  font-size: var(--fs-sm);
  color: var(--primary-dark);
  background: var(--bg-white);
}
.rc-reach {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  margin: 0;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--primary-dark);
  font-size: var(--fs-sm);
  transition: opacity 0.2s;
}
.rc-reach .icon {
  flex: none;
  margin-top: 3px;
}
.rc-reach.is-stale {
  opacity: 0.6;
}
.rc-reach.is-empty {
  background: var(--warning-tint);
}

/* ─── Step 2: what ───────────────────────────────────────────────── */

.rc-more {
  border-top: 1px solid var(--border-light);
  padding-top: var(--sp-sm);
}
.rc-more > summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-family: var(--f-head);
  font-size: var(--fs-sm);
  padding: var(--sp-xs) 0;
}
.rc-more[open] {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

/* ─── Step 3: where and when, the buttons ────────────────────────── */

.rc-buttons {
  justify-content: flex-end;
  border-top: 1px solid var(--border-light);
  padding-top: var(--sp-md);
  margin-top: var(--sp-xs);
}
@media (max-width: 560px) {
  .rc-buttons {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ─── The phone preview ──────────────────────────────────────────── */

.rc-preview {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  background: var(--bg-input);
}
.rc-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}
.rc-preview-head h2 {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--primary-dark);
}
.rc-preview-head .pill {
  min-height: 30px;
  padding: 0 var(--sp-md);
  font-size: var(--fs-xs);
}
.rc-phone {
  align-self: center;
  width: 100%;
  max-width: 300px;
  padding: var(--sp-md);
  border: 6px solid var(--primary-dark);
  border-radius: 28px;
  background: var(--bg-light);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  text-align: start;
}
.rc-phone[lang='ar'] {
  font-family: var(--font-arabic);
}
.rc-phone[lang='en'] {
  font-family: var(--font-body);
}
.rc-phone-label {
  margin: var(--sp-xs) 0 0;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}
.rc-phone[lang='ar'] .rc-phone-label {
  letter-spacing: 0;
}
.rc-phone-note {
  margin: 0;
  padding: var(--sp-sm);
  border: 1px dashed var(--border-mid);
  border-radius: 12px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.rc-banner {
  display: flex;
  gap: var(--sp-sm);
  align-items: flex-start;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 16px;
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
}
.rc-appicon,
.rc-seal {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-dark);
  color: var(--text-white);
  font-family: var(--font-heading);
}
.rc-appicon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: var(--fs-sm);
}
.rc-banner-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.rc-banner-app {
  font-size: calc(var(--fs-xs) - 1px);
  color: var(--text-secondary);
}
.rc-banner-title {
  font-size: var(--fs-xs);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.rc-banner-body {
  font-size: var(--fs-xs);
  color: var(--text-body);
  white-space: pre-line;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The Home card (NoticeCard, portrait). */
.rc-card {
  display: flex;
  flex-direction: column;
  padding: var(--sp-lg);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  background: var(--bg-white);
  box-shadow: var(--shadow-soft);
  min-height: 280px;
}
.rc-card.is-urgent {
  border: 1.5px solid var(--warning);
}
.rc-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-sm);
}
.rc-seal {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: var(--fs-lg);
}
.rc-date {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 46px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  color: var(--primary-dark);
}
.rc-date-month {
  align-self: stretch;
  text-align: center;
  padding: 1px 6px;
  background: var(--primary-dark);
  color: var(--text-white);
  font-size: calc(var(--fs-xs) - 2px);
}
.rc-date.is-soon {
  border-color: var(--warning);
  color: var(--warning);
}
.rc-date.is-soon .rc-date-month {
  background: var(--warning);
}
.rc-date-day {
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
  line-height: 1.2;
}
.rc-card-source {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rc-card-source strong {
  font-size: var(--fs-xs);
  color: var(--text-dark);
}
.rc-card-source span {
  font-size: calc(var(--fs-xs) - 1px);
  color: var(--text-body);
}
.rc-card-chip {
  align-self: flex-start;
  margin-top: var(--sp-sm);
  padding: 2px 10px;
  border-radius: var(--r-circle);
  background: var(--bg-input);
  color: var(--primary-dark);
  font-size: calc(var(--fs-xs) - 1px);
}
.rc-card-title {
  margin: var(--sp-lg) 0 0;
  font-family: var(--f-head);
  font-size: var(--fs-md);
  line-height: 1.3;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rc-phone[lang='ar'] .rc-card-title {
  font-family: var(--font-arabic-bold);
}
.rc-phone[lang='en'] .rc-card-title {
  font-family: var(--font-heading);
}
.rc-card-summary {
  margin: var(--sp-sm) 0 0;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-body);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rc-card-foot {
  margin-top: auto;
  padding-top: var(--sp-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  font-size: var(--fs-xs);
  color: var(--primary-dark);
}
.rc-card-foot .is-soon {
  color: var(--warning);
}
.rc-card-read {
  color: var(--text-secondary);
}

/* ─── Sent before ────────────────────────────────────────────────── */

.rc-sent {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.rc-sent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
}
.rc-sent-head h2 {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--primary-dark);
}
.rc-sent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.rc-sent-row + .rc-sent-row {
  border-top: 1px solid var(--border-light);
}
.rc-sent-open {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-xs);
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.rc-sent-open:hover {
  background: var(--bg-light);
}
.rc-sent-row.is-current .rc-sent-open {
  background: var(--bg-input);
}
.rc-sent-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rc-sent-title {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.rc-sent-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-xs);
  flex: none;
  max-width: 45%;
}
.rc-sent-side .chips {
  justify-content: flex-end;
}
.rc-sent-count {
  font-size: var(--fs-sm);
  color: var(--primary-dark);
  white-space: nowrap;
}

/* system.css */
/* Phase 3, track F (System): the community limits on App settings and the builds in use on System health.
   Tokens only (src/styles.css and the app's constants). */

/* ─── App settings: community limits ──────────────────────────────── */

.limits {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

.limit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-xs) var(--sp-md);
  padding: var(--sp-md) 0;
  border-top: 1px solid var(--border-light);
}

.limit:first-child {
  border-top: none;
  padding-top: 0;
}

.limit-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.limit-text strong {
  color: var(--primary-dark);
}

.limit-edit {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.limit-input {
  inline-size: 5.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.limit-value {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-sm);
}

.limit-value strong {
  font-family: var(--font-heading);
  font-size: var(--fs-lg);
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.limit-msg {
  grid-column: 1 / -1;
  margin: 0;
}

@media (max-width: 560px) {
  .limit {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ─── System health: builds in use ────────────────────────────────── */

.build-summary {
  margin-bottom: var(--sp-md);
}

.build-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-xs) var(--sp-sm);
}
