/* Inter is self-hosted because the CSP sets font-src 'self' data:, which rules out Google Fonts.
   One variable file per subset covers every weight the portal uses, including the 650 that a
   static family cannot express. latin-ext is not optional here: ğ, ş and İ live in that range
   while ı sits in latin, so Turkish text needs both files. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

/* ── Design tokens ────────────────────────────────────────────────────────────
   Two layers. The raw palette is theme-independent; the semantic layer maps it
   onto roles, and only the semantic layer is used further down, so retheming
   means editing this block alone.

   Dark mode rides on light-dark(), which keeps both values in one declaration
   instead of a duplicated override block. It resolves against the element's
   computed color-scheme, and color-scheme inherits from :root — so flipping
   data-theme on <html> re-resolves every token at once. With no data-theme the
   portal follows the operating system. */

:root {
  color-scheme: light dark;

  /* Raw palette */
  --pt-blue-50: #eef3fd;
  --pt-blue-100: #dbe5fb;
  --pt-blue-300: #93b0f2;
  --pt-blue-400: #6b8eef;
  --pt-blue-500: #4a7ae4;
  --pt-blue-600: #2f5fd9;
  --pt-blue-700: #2447ad;
  --pt-blue-900: #1e3a8a;
  --pt-slate-50: #f8fafc;
  --pt-slate-100: #f1f5f9;
  --pt-slate-200: #e2e8f0;
  --pt-slate-400: #94a3b8;
  --pt-slate-500: #64748b;
  --pt-slate-700: #334155;
  --pt-slate-800: #1e293b;
  --pt-slate-900: #0f172a;
  --pt-slate-950: #0b1220;
  --pt-red-500: #d64545;
  --pt-red-600: #b33a3a;
  --pt-green-600: #15803d;
  --pt-amber-700: #8a6100;

  /* Semantic surfaces and text */
  --pt-bg: light-dark(#f0f3f8, #0b1220);
  --pt-surface: light-dark(#ffffff, #151d2e);
  --pt-surface-sunken: light-dark(#f8fafc, #101828);
  --pt-surface-hover: light-dark(#f1f5f9, #1c263a);
  --pt-surface-stripe: light-dark(#fafbfc, #182132);
  --pt-border: light-dark(#e2e8f0, #2a3650);
  --pt-border-strong: light-dark(#cbd5e1, #3a4763);
  --pt-text: light-dark(#0f172a, #e8edf7);
  --pt-text-muted: light-dark(#64748b, #94a3b8);
  --pt-text-on-accent: #ffffff;

  /* Semantic accents. Text and fills need different treatments in dark mode:
     link text is lightened so it reads against a dark surface, but a filled
     button must stay saturated or white label text loses contrast on it. */
  --pt-primary: light-dark(#2f5fd9, #7ea2f5);
  --pt-primary-dark: light-dark(#2447ad, #9ab8f8);
  --pt-accent-bg: light-dark(#2f5fd9, #3663c9);
  --pt-accent-bg-hover: light-dark(#2447ad, #3a68d0);
  --pt-primary-soft: light-dark(rgba(47, 95, 217, 0.1), rgba(126, 162, 245, 0.16));
  --pt-primary-ring: light-dark(rgba(47, 95, 217, 0.15), rgba(126, 162, 245, 0.25));
  --pt-danger: light-dark(#c62f2f, #f28b8b);
  --pt-danger-dark: light-dark(#b33a3a, #e06a6a);
  --pt-danger-bg: light-dark(#fdecec, rgba(214, 69, 69, 0.18));
  /* Same split as the primary accent: --pt-danger is lightened for text on a dark surface, so a
     filled destructive button needs its own saturated fill or its white label washes out. */
  --pt-danger-fill: light-dark(#c62f2f, #c0392f);
  --pt-danger-fill-hover: light-dark(#a82b2b, #a83228);
  --pt-danger-ring: light-dark(rgba(214, 69, 69, 0.22), rgba(242, 139, 139, 0.28));
  --pt-success: light-dark(#15803d, #5fca8a);
  --pt-success-bg: light-dark(#e8f6ef, rgba(21, 128, 61, 0.2));
  --pt-warning-bg: light-dark(#fff6e0, rgba(180, 130, 20, 0.22));
  --pt-warning-text: light-dark(#8a6100, #e8c37a);

  /* Type scale */
  --pt-text-xs: 0.72rem;
  --pt-text-sm: 0.8rem;
  --pt-text-base: 0.88rem;
  --pt-text-md: 0.92rem;
  --pt-text-lg: 1.02rem;
  --pt-text-xl: 1.3rem;
  --pt-text-2xl: 1.75rem;
  /* A metric readout has to outrank the page title next to it, which 2xl cannot do
     while the h1 already occupies that size. */
  --pt-text-3xl: 2.1rem;
  --pt-text-display: 2.6rem;

  /* Spacing scale */
  --pt-space-1: 4px;
  --pt-space-2: 8px;
  --pt-space-3: 12px;
  --pt-space-4: 16px;
  --pt-space-5: 20px;
  --pt-space-6: 24px;
  --pt-space-8: 32px;

  /* Elevation. Shadows are composed from a themed colour because a dark surface
     needs a much heavier shadow to read as raised at all.

     Two colours rather than one: a tight dark edge that reads as the contact shadow,
     and a wider soft layer for the ambient falloff. A single colour at a single blur
     radius is what makes a card look printed onto the page instead of resting on it,
     which is most of why the old surfaces read flat. */
  --pt-shadow-color: light-dark(rgba(15, 23, 42, 0.06), rgba(0, 0, 0, 0.4));
  --pt-shadow-color-strong: light-dark(rgba(15, 23, 42, 0.3), rgba(0, 0, 0, 0.6));
  --pt-shadow-edge: light-dark(rgba(15, 23, 42, 0.09), rgba(0, 0, 0, 0.55));
  --pt-shadow-xs: 0 1px 1px var(--pt-shadow-edge);
  --pt-shadow-sm: 0 1px 2px var(--pt-shadow-edge), 0 1px 3px var(--pt-shadow-color);
  --pt-shadow: 0 1px 2px var(--pt-shadow-edge), 0 3px 8px var(--pt-shadow-color);
  --pt-shadow-md: 0 1px 2px var(--pt-shadow-edge), 0 6px 16px var(--pt-shadow-color),
    0 14px 32px var(--pt-shadow-color);
  --pt-shadow-lg: 0 20px 50px var(--pt-shadow-color-strong);

  /* Stacking order, named so sticky headers and overlays cannot drift apart. */
  --pt-z-raised: 1;
  --pt-z-sticky: 10;
  --pt-z-topbar: 20;
  --pt-z-drawer: 40;
  --pt-z-overlay: 50;
  --pt-z-toast: 60;

  /* Density. A console is read by scanning down a column, and the 54px rows the
     portal had fit a third fewer records on a screen than the ~40px that data-heavy
     admin products settle on. */
  --pt-row-h: 40px;
  --pt-cell-py: 9px;
  --pt-cell-px: 14px;

  /* Status tones. Each is a text / background / border triplet so a badge, an alert
     and a chart series can all speak the same language, and so a new status only has
     to pick a tone rather than invent three colours.

     The background stays faint and the border carries the identity: at badge size a
     saturated fill turns a table into a row of traffic lights, which is exactly the
     look we are moving away from. Every text-on-background pair here clears 4.5:1. */
  --pt-tone-neutral-text: light-dark(#475569, #a9b6cc);
  --pt-tone-neutral-bg: light-dark(#f1f5f9, rgba(148, 163, 184, 0.14));
  --pt-tone-neutral-border: light-dark(#cbd5e1, rgba(148, 163, 184, 0.32));
  --pt-tone-info-text: light-dark(#2447ad, #93b0f2);
  --pt-tone-info-bg: light-dark(#eef3fd, rgba(47, 95, 217, 0.2));
  --pt-tone-info-border: light-dark(#c3d4f7, rgba(126, 162, 245, 0.36));
  --pt-tone-success-text: light-dark(#15803d, #5fca8a);
  --pt-tone-success-bg: light-dark(#e8f6ef, rgba(21, 128, 61, 0.2));
  --pt-tone-success-border: light-dark(#a8ddc0, rgba(95, 202, 138, 0.36));
  --pt-tone-warning-text: light-dark(#8a6100, #e8c37a);
  --pt-tone-warning-bg: light-dark(#fff6e0, rgba(180, 130, 20, 0.22));
  --pt-tone-warning-border: light-dark(#f0d9a0, rgba(232, 195, 122, 0.36));
  --pt-tone-danger-text: light-dark(#c62f2f, #f28b8b);
  --pt-tone-danger-bg: light-dark(#fdecec, rgba(214, 69, 69, 0.18));
  --pt-tone-danger-border: light-dark(#f2c0c0, rgba(242, 139, 139, 0.36));

  /* Categorical chart palette. Ordered by how often a series gets used rather than by
     hue, so a two-series chart is always blue/teal and never blue/blue-violet. Charts
     are drawn to canvas, so these are read through getComputedStyle at render time and
     re-read when the theme flips. */
  --pt-chart-1: light-dark(#2f5fd9, #6b8eef);
  --pt-chart-2: light-dark(#0d9488, #2dd4bf);
  --pt-chart-3: light-dark(#b45309, #fbbf24);
  --pt-chart-4: light-dark(#7c3aed, #a78bfa);
  --pt-chart-5: light-dark(#be185d, #f472b6);
  --pt-chart-grid: light-dark(rgba(15, 23, 42, 0.08), rgba(232, 237, 247, 0.1));
  --pt-chart-axis: light-dark(#64748b, #94a3b8);

  --pt-radius: 10px;
  --pt-radius-sm: 7px;
  --pt-radius-lg: 14px;
  --pt-sidebar-w: 248px;
  --pt-topbar-h: 60px;
}

[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--pt-bg);
  color: var(--pt-text);
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--pt-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Keyboard users land here first and can jump the whole sidebar, which is up to
   fifteen links when someone holds both the platform and institution roles. */
.pt-skip-link {
  position: absolute;
  left: var(--pt-space-2);
  top: var(--pt-space-2);
  z-index: var(--pt-z-toast);
  padding: 10px 16px;
  border-radius: var(--pt-radius-sm);
  background: var(--pt-accent-bg);
  color: var(--pt-text-on-accent);
  font-size: var(--pt-text-base);
  font-weight: 600;
  box-shadow: var(--pt-shadow-md);
  transform: translateY(-200%);
}

.pt-skip-link:focus {
  transform: translateY(0);
  text-decoration: none;
  color: var(--pt-text-on-accent);
}

/* Alpine is deferred, so anything it would hide with x-show is briefly visible first. x-cloak
   keeps it hidden until Alpine boots and strips the attribute. */
[x-cloak] { display: none !important; }

/* Visible to screen readers only. Not display:none, which would drop it from the
   accessibility tree along with the visual layout. */
.pt-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;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.pt-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Topbar ── */

/* Scope marker for the Alpine component that owns the drawer and the account menu. Declared with
   no layout of its own on purpose: the topbar's position:sticky and the .pt-shell flex row both
   have to behave exactly as they did before this wrapper existed. */
.pt-chrome { display: contents; }

.pt-topbar {
  background: var(--pt-surface);
  border-bottom: 1px solid var(--pt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  height: var(--pt-topbar-h);
  position: sticky;
  top: 0;
  z-index: var(--pt-z-topbar);
}

.pt-brand {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--pt-text);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.pt-brand:hover { text-decoration: none; color: var(--pt-text); }

.pt-brand-mark {
  width: 40px;
  height: 28px;
  display: block;
  flex-shrink: 0;
  --pt-mark-cap: light-dark(#1f3f95, #ffffff);
  --pt-mark-bar-top: light-dark(#2456c9, #ffffff);
  --pt-mark-bar-bottom: light-dark(#5fb4ee, #ffffff);
}

.pt-topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pt-culture-switch {
  display: flex;
  gap: 4px;
  background: var(--pt-bg);
  padding: 3px;
  border-radius: 8px;
}

.pt-culture-switch a {
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--pt-text-muted);
  text-decoration: none;
}

.pt-culture-switch a:hover { color: var(--pt-text); }

.pt-culture-switch a.active {
  background: var(--pt-accent-bg);
  color: var(--pt-text-on-accent);
}

/* Only useful once the sidebar collapses into a drawer. */
.pt-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-right: 4px;
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius-sm);
  background: var(--pt-surface);
  color: var(--pt-text);
  cursor: pointer;
  flex-shrink: 0;
}

.pt-nav-toggle:hover { background: var(--pt-surface-hover); }

.pt-topbar-left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.pt-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  font-family: inherit;
  color: var(--pt-text);
  cursor: pointer;
  max-width: 260px;
}

.pt-user-chip:hover { background: var(--pt-surface-hover); }
.pt-user-chip[aria-expanded="true"] { background: var(--pt-surface-hover); border-color: var(--pt-border); }

.pt-user-chip .pt-chevron {
  width: 14px;
  height: 14px;
  color: var(--pt-text-muted);
  flex-shrink: 0;
}

.pt-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pt-blue-600), var(--pt-blue-400));
  color: var(--pt-text-on-accent);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.pt-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.pt-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pt-text);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pt-user-role {
  font-size: 0.7rem;
  color: var(--pt-text-muted);
}

/* ── Shell / Sidebar ── */

.pt-shell {
  display: flex;
  min-height: calc(100vh - var(--pt-topbar-h));
}

.pt-sidebar {
  width: var(--pt-sidebar-w);
  flex-shrink: 0;
  background: var(--pt-surface);
  border-right: 1px solid var(--pt-border);
  padding: 12px 0 24px;
  position: sticky;
  top: var(--pt-topbar-h);
  height: calc(100vh - var(--pt-topbar-h));
  overflow-y: auto;
}

.pt-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.pt-nav-section {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pt-text-muted);
  padding: 14px 12px 6px;
}

.pt-nav a {
  color: var(--pt-text);
  padding: 9px 12px;
  font-size: 0.9rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.pt-nav a .pt-icon { color: var(--pt-text-muted); }

.pt-nav a:hover {
  background: var(--pt-bg);
  text-decoration: none;
}

.pt-nav a.active {
  background: var(--pt-primary-soft);
  color: var(--pt-primary);
  font-weight: 600;
}

.pt-nav a.active .pt-icon { color: var(--pt-primary); }

.pt-main {
  flex: 1;
  padding: 28px 32px 48px;
  max-width: 1280px;
  min-width: 0;
}

/* ── Page header ── */

.pt-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.pt-page-header h1 {
  font-size: var(--pt-text-2xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.2;
}

.pt-page-subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
}

/* A filter or range control belongs beside the page's primary action, not stacked above the
   content in a bar of its own. */
.pt-header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* A second line inside a table cell — the domain under an institution's name, the recording
   kind under a teacher's. Folding these in is what let the wide tables lose three columns
   instead of scrolling sideways. */
.pt-cell-sub {
  display: block;
  margin-top: 1px;
  font-size: var(--pt-text-xs);
  color: var(--pt-text-muted);
}

/* A link on the secondary line stays quiet until it is pointed at: two blue links stacked in
   one cell compete with each other and neither reads as the row's subject. */
.pt-cell-sub a { color: inherit; }
.pt-cell-sub a:hover { color: var(--pt-primary); text-decoration: underline; }

/* ── Auth ── */

.pt-auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, var(--pt-blue-900) 0%, var(--pt-blue-600) 45%, var(--pt-blue-300) 100%);
}

.pt-auth-shell {
  width: 100%;
  max-width: 420px;
  padding: var(--pt-space-5) var(--pt-space-4);
}

.pt-auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: var(--pt-space-4);
  color: var(--pt-blue-50);
  font-size: var(--pt-text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.pt-auth-brand-mark {
  width: 44px;
  height: 31px;
  display: block;
  flex-shrink: 0;
  --pt-mark-cap: #ffffff;
  --pt-mark-bar-top: #ffffff;
  --pt-mark-bar-bottom: #ffffff;
}

.pt-auth-card {
  background: var(--pt-surface);
  border-radius: var(--pt-radius-lg);
  box-shadow: var(--pt-shadow-lg);
  padding: 32px 36px;
  width: 100%;
  display: block;
}

.pt-auth-card h1 {
  font-size: 1.3rem;
  margin: 0 0 4px;
}

.pt-auth-card p.pt-subtitle {
  color: var(--pt-text-muted);
  margin: 0 0 24px;
  font-size: var(--pt-text-md);
}

.pt-auth-card form.pt-form { max-width: 100%; }

.pt-auth-footer {
  margin-top: var(--pt-space-4);
  text-align: center;
}

.pt-auth-footer p {
  margin: var(--pt-space-3) 0 0;
  font-size: var(--pt-text-xs);
  color: var(--pt-blue-100);
  line-height: 1.5;
}

/* On the gradient the neutral chrome colours have almost no contrast, so this variant is
   tinted against the blue instead of against a surface. */
.pt-culture-switch-invert {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.14);
}

.pt-culture-switch-invert a { color: var(--pt-blue-100); text-transform: none; }
.pt-culture-switch-invert a:hover { color: #fff; }

.pt-culture-switch-invert a.active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--pt-blue-700);
}

/* Anonymous pages outside the sign-in flow, e.g. the error page. */
.pt-plain {
  display: block;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px;
}

/* ── Cards / Stats ── */

.pt-card {
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.pt-card h2 {
  font-size: 1.02rem;
  font-weight: 650;
  margin: 0 0 14px;
}

.pt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pt-card-header h2 { margin: 0; }

.pt-card-header a {
  font-size: 0.85rem;
  font-weight: 600;
}

.pt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.pt-stat {
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  padding: 16px 18px;
  box-shadow: var(--pt-shadow);
  position: relative;
}

.pt-stat-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.pt-stat-link:hover {
  text-decoration: none;
  border-color: var(--pt-primary);
  box-shadow: 0 0 0 3px var(--pt-primary-ring);
}

.pt-stat-icon {
  color: var(--pt-primary);
  margin-bottom: 8px;
}

.pt-stat-icon .pt-icon {
  width: 20px;
  height: 20px;
}

.pt-stat .pt-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--pt-text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.pt-stat .pt-stat-label {
  font-size: 0.8rem;
  color: var(--pt-text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.pt-stat .pt-stat-meta {
  font-size: 0.72rem;
  color: var(--pt-text-muted);
  margin-top: 6px;
}

.pt-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 4px;
}

.pt-grid-2 > .pt-card { margin-bottom: 20px; }

/* ── Metrics ──────────────────────────────────────────────────────────────────
   Two tiers on purpose. The old dashboard gave six equal boxes to six numbers, so
   nothing was more important than anything else and a zero cost as much space as
   the headline figure. Primary metrics get a card with a trend; everything else
   collapses into one strip. */

.pt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.pt-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px 12px;
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow-sm);
  color: inherit;
}

a.pt-kpi { transition: border-color 0.12s ease, box-shadow 0.12s ease; }

a.pt-kpi:hover {
  text-decoration: none;
  border-color: var(--pt-border-strong);
  box-shadow: var(--pt-shadow);
}

.pt-kpi-label {
  font-size: var(--pt-text-xs);
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pt-text-muted);
}

.pt-kpi-figure {
  display: flex;
  align-items: baseline;
  gap: var(--pt-space-2);
  flex-wrap: wrap;
}

.pt-kpi-value {
  font-size: var(--pt-text-3xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.pt-kpi-unit { font-size: var(--pt-text-md); color: var(--pt-text-muted); font-weight: 550; }

/* The arrow is part of the text rather than a separate glyph so the direction survives
   with images off and reads correctly to a screen reader. */
.pt-kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--pt-text-xs);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--pt-text-muted);
}

.pt-kpi-delta-up { color: var(--pt-tone-success-text); }
.pt-kpi-delta-down { color: var(--pt-tone-danger-text); }

/* A KPI that is asking for attention, e.g. failed recordings above zero. */
.pt-kpi-alert { border-color: var(--pt-tone-danger-border); }
.pt-kpi-alert .pt-kpi-value { color: var(--pt-tone-danger-text); }

.pt-text-danger { color: var(--pt-tone-danger-text); }
.pt-text-warning { color: var(--pt-tone-warning-text); }
.pt-text-success { color: var(--pt-tone-success-text); }

.pt-kpi-foot {
  margin-top: auto;
  padding-top: 10px;
  font-size: var(--pt-text-xs);
  color: var(--pt-text-muted);
}

/* Secondary numbers: one row, hairline separated, no card each. */
.pt-metric-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  padding: 0;
  margin-bottom: 20px;
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow-sm);
  overflow: hidden;
}

.pt-metric {
  flex: 1 1 150px;
  display: flex;
  align-items: baseline;
  gap: var(--pt-space-2);
  padding: 12px 18px;
  border-right: 1px solid var(--pt-border);
  color: inherit;
}

.pt-metric:last-child { border-right: none; }
a.pt-metric:hover { text-decoration: none; background: var(--pt-surface-hover); }

/* Inside a card the strip is a row of the card, not a second card on top of it. */
.pt-metric-strip-flush {
  margin-bottom: 0;
  box-shadow: none;
}

.pt-metric-value {
  font-size: var(--pt-text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.pt-metric-label { font-size: var(--pt-text-sm); color: var(--pt-text-muted); }

/* A metric at zero is still worth showing — it is the difference between "none" and
   "not measured" — but it should not shout. */
.pt-metric-zero .pt-metric-value { color: var(--pt-text-muted); font-weight: 600; }

/* ── Charts ──────────────────────────────────────────────────────────────────
   Drawn with boxes and inline SVG instead of a charting library. A canvas has to be
   re-painted in JavaScript whenever the theme flips, and this portal has a theme
   switcher; a bar whose height is a percentage and whose colour is a custom property
   simply re-resolves. The labels also stay real text, so they scale with the user's
   font size and get translated with everything else. */

.pt-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  /* Cards size to their own content instead of stretching to the tallest in the row. A ranked
     list with three entries beside a full-height histogram would otherwise be mostly a large
     empty box, which looks like something failed to load. */
  align-items: start;
}

.pt-chart-grid > .pt-card { margin-bottom: 0; }
.pt-chart-wide { grid-column: 1 / -1; }

.pt-chart-empty {
  margin: 0;
  padding: 36px 0;
  text-align: center;
  color: var(--pt-text-muted);
  font-size: var(--pt-text-sm);
}

/* The y axis is a fixed column so that two charts side by side still line up their
   plots, even when one is counting single digits and the other thousands. */
.pt-chart-body {
  display: flex;
  gap: 10px;
  height: 200px;
}

.pt-chart-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  width: 3.2em;
  flex: none;
  font-size: var(--pt-text-xs);
  color: var(--pt-chart-axis);
  font-variant-numeric: tabular-nums;
  /* Half a line, so each label sits centred on its gridline rather than above it. */
  margin-block: -0.5em;
}

.pt-chart-plot {
  position: relative;
  flex: 1;
  min-width: 0;
}

.pt-chart-gridlines {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pt-chart-gridlines i {
  display: block;
  height: 1px;
  background: var(--pt-chart-grid);
}

/* The bottom line is the axis itself and carries a little more weight than the two
   reference lines above it. */
.pt-chart-gridlines i:last-child { background: var(--pt-border); }

.pt-columns {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
}

.pt-column {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: default;
}

.pt-column-bar {
  /* The gap between bars comes from the bar being narrower than its slot, not from a gap on
     the row: a fixed gap is invisible across seven bars and wider than the bars themselves
     across ninety. It has to be a width on the bar rather than padding on the slot, because
     percentage padding on a flex item resolves against the whole row — thirty slots at 14%
     each came to four times the container and pushed the chart into a horizontal scroll.
     A percentage width resolves against the slot, which is what was meant all along. */
  width: 82%;
  /* Five score bands across a wide card would otherwise each be a slab wider than it is
     tall, which reads as a block of colour rather than as a measurement. */
  max-width: 40px;
  /* A floor height so an empty day is still a visible tick on the axis: a literal
     zero leaves a hole that reads as missing data rather than as no activity. */
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--pt-chart-1);
  transition: opacity 0.12s ease;
}

.pt-column:hover .pt-column-bar { opacity: 0.72; }

.pt-chart-xaxis {
  display: flex;
  margin-top: 7px;
  /* Matches the y-axis gutter so the labels stay under their own columns. */
  padding-left: calc(3.2em + 10px);
  font-size: var(--pt-text-xs);
  color: var(--pt-chart-axis);
}

.pt-chart-xaxis span {
  flex: 1;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

/* ── Bar list ──
   A ranking, so the rows are a list and the label comes first: the reader is looking
   up a known institution, not scanning for the tallest bar. */
.pt-barlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.pt-barlist-row {
  display: grid;
  grid-template-columns: minmax(0, 8.5em) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: var(--pt-text-sm);
}

.pt-barlist-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--pt-text);
}

.pt-barlist-track {
  height: 8px;
  border-radius: 999px;
  background: var(--pt-surface-sunken);
  overflow: hidden;
}

.pt-barlist-bar {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  background: var(--pt-chart-1);
}

.pt-barlist-value {
  color: var(--pt-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Stacked bar + legend ──
   Used where a pie chart would otherwise appear. Shares are compared along a single
   line, which is easier to judge than arc length and survives a narrow card. */
.pt-stacked {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--pt-surface-sunken);
  gap: 2px;
}

.pt-stacked-seg {
  display: block;
  min-width: 3px;
  background: var(--pt-tone-fill, var(--pt-chart-1));
}

.pt-legend {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pt-legend-item {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  align-items: center;
  gap: 9px;
  font-size: var(--pt-text-sm);
}

.pt-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pt-tone-fill, var(--pt-chart-1));
}

.pt-legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pt-legend-value { font-weight: 600; font-variant-numeric: tabular-nums; }

.pt-legend-share {
  color: var(--pt-text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 3.4em;
  text-align: right;
}

/* Tone classes for chart marks. These set a solid fill rather than reusing the badge
   triplet, because a 12px segment needs the saturated colour to register at all. */
.pt-tone-info { --pt-tone-fill: var(--pt-chart-1); }
.pt-tone-success { --pt-tone-fill: light-dark(#15803d, #5fca8a); }
.pt-tone-warning { --pt-tone-fill: light-dark(#b45309, #e8c37a); }
.pt-tone-danger { --pt-tone-fill: light-dark(#c62f2f, #f28b8b); }
.pt-tone-neutral { --pt-tone-fill: light-dark(#94a3b8, #64748b); }

/* Standalone counterpart to table.pt-table .pt-num, for figures outside a table. */
span.pt-num { font-variant-numeric: tabular-nums; }

/* A trend line with no axes, no ticks and no interaction, sized to sit in a metric
   card under the figure it belongs to. */
.pt-sparkline {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 8px;
  overflow: visible;
}

.pt-sparkline-line {
  fill: none;
  stroke: var(--pt-chart-1);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.pt-sparkline-area { fill: var(--pt-primary-soft); stroke: none; }

/* ── Segmented control ──
   Used for the dashboard date range. A row of buttons would need four separate
   pressed states; one track with a sliding active surface reads as a single control. */
.pt-segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--pt-surface-sunken);
  border: 1px solid var(--pt-border);
  border-radius: 999px;
}

.pt-segmented a,
.pt-segmented button {
  padding: 5px 13px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--pt-text-muted);
  font: inherit;
  font-size: var(--pt-text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.pt-segmented a:hover,
.pt-segmented button:hover { color: var(--pt-text); text-decoration: none; }

.pt-segmented .active,
.pt-segmented [aria-current="true"] {
  background: var(--pt-surface);
  color: var(--pt-text);
  box-shadow: var(--pt-shadow-xs);
}

/* ── Tables ── */

table.pt-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--pt-surface);
}

table.pt-table th, table.pt-table td {
  padding: var(--pt-cell-py) var(--pt-cell-px);
  border-bottom: 1px solid var(--pt-border);
  text-align: left;
  font-size: var(--pt-text-base);
  vertical-align: middle;
  /* Lining figures throughout, not only in the columns marked .pt-num: a date column
     wobbles just as badly as a number column when the digits are proportional. */
  font-variant-numeric: tabular-nums;
}

table.pt-table th {
  color: var(--pt-text-muted);
  font-weight: 650;
  font-size: var(--pt-text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--pt-surface-sunken);
  position: sticky;
  top: 0;
  z-index: var(--pt-z-raised);
  white-space: nowrap;
}

/* No zebra striping. Alternating row fills are the loudest "admin template" signal
   there is, and with a hover state and a hairline they earn nothing: the eye already
   tracks the row it is on. */
table.pt-table tbody tr:hover { background: var(--pt-surface-hover); }
table.pt-table tbody tr:last-child td { border-bottom: none; }

table.pt-table th.pt-num,
table.pt-table td.pt-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pt-table-wrap {
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
  overflow-x: auto;
  max-height: 70vh;
}

.pt-card > .pt-table-wrap {
  border: none;
  box-shadow: none;
  border-radius: 0;
  margin: 0 -22px -20px;
}

.pt-empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--pt-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pt-empty .pt-icon {
  width: 32px;
  height: 32px;
  opacity: 0.45;
}

.pt-empty p { margin: 0; font-size: var(--pt-text-md); max-width: 44ch; }

.pt-empty .pt-empty-title {
  font-size: var(--pt-text-lg);
  font-weight: 650;
  color: var(--pt-text);
}

.pt-empty .pt-btn { margin-top: var(--pt-space-2); }

/* ── Forms ── */

form.pt-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 520px;
}

form.pt-form.pt-form-wide { max-width: 100%; }
form.pt-inline { display: inline; }

.pt-form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.pt-form-row > * { flex: 1; min-width: 180px; }

.pt-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.pt-field input[type="text"],
.pt-field input[type="email"],
.pt-field input[type="tel"],
.pt-field input[type="password"],
.pt-field input[type="number"],
.pt-field input[type="datetime-local"],
.pt-field input[type="date"],
.pt-field select,
.pt-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius-sm);
  font-size: var(--pt-text-md);
  background: var(--pt-surface);
  color: var(--pt-text);
}

.pt-field input:focus, .pt-field select:focus, .pt-field textarea:focus {
  outline: none;
  border-color: var(--pt-primary);
  box-shadow: 0 0 0 3px var(--pt-primary-ring);
}

.pt-field-help {
  margin: 5px 0 0;
  font-size: var(--pt-text-xs);
  color: var(--pt-text-muted);
}

.pt-input-reveal { position: relative; }

.pt-input-reveal input { padding-right: 42px; }

.pt-reveal-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--pt-radius-sm);
  background: none;
  color: var(--pt-text-muted);
  cursor: pointer;
}

.pt-reveal-btn:hover { color: var(--pt-text); }
.pt-reveal-btn[aria-pressed="true"] { color: var(--pt-primary); }
.pt-reveal-btn .pt-icon { width: 17px; height: 17px; }

.pt-invite-summary {
  padding: 14px 16px;
  margin-bottom: var(--pt-space-5);
  border-radius: var(--pt-radius);
  background: var(--pt-primary-soft);
}

.pt-invite-summary p { margin: 0; }

.pt-invite-summary .pt-invite-institution {
  font-size: var(--pt-text-lg);
  font-weight: 650;
}

.pt-invite-summary .pt-invite-email {
  font-size: var(--pt-text-base);
  color: var(--pt-text-muted);
  margin-bottom: 8px;
  word-break: break-all;
}

.pt-invite-summary .pt-muted { font-size: var(--pt-text-xs); line-height: 1.5; }

.pt-error-request-id code {
  user-select: all;
  font-size: var(--pt-text-xs);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--pt-surface-sunken);
}

.pt-field .field-validation-error, .text-danger {
  color: var(--pt-danger);
  font-size: 0.8rem;
  display: block;
  margin-top: 4px;
}

.pt-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pt-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--pt-space-2) var(--pt-space-4);
  margin: var(--pt-space-4) 0;
  padding: var(--pt-space-4);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
}

.pt-check-grid legend {
  padding: 0 var(--pt-space-2);
  font-size: var(--pt-text-xs);
  font-weight: 600;
  color: var(--pt-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pt-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Buttons / Badges / Alerts ── */

.pt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--pt-accent-bg);
  color: var(--pt-text-on-accent);
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.pt-btn:hover {
  background: var(--pt-accent-bg-hover);
  text-decoration: none;
  color: var(--pt-text-on-accent);
}

.pt-btn.pt-btn-secondary {
  background: var(--pt-surface);
  color: var(--pt-text);
  border-color: var(--pt-border);
}

.pt-btn.pt-btn-secondary:hover { background: var(--pt-bg); color: var(--pt-text); }

.pt-btn.pt-btn-danger { background: var(--pt-danger-fill); }
.pt-btn.pt-btn-danger:hover { background: var(--pt-danger-fill-hover); }

.pt-btn.pt-btn-sm { padding: 5px 10px; font-size: 0.78rem; }

/* Status badge. A leading dot carries the colour so the pill itself can stay quiet:
   colour alone would also fail anyone who cannot distinguish the hues, and the label
   is always present next to it. */
.pt-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 8px;
  border: 1px solid var(--pt-tone-neutral-border);
  border-radius: 999px;
  background: var(--pt-tone-neutral-bg);
  color: var(--pt-tone-neutral-text);
  font-size: var(--pt-text-xs);
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
}

.pt-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.pt-badge-success {
  background: var(--pt-tone-success-bg);
  border-color: var(--pt-tone-success-border);
  color: var(--pt-tone-success-text);
}

.pt-badge-danger {
  background: var(--pt-tone-danger-bg);
  border-color: var(--pt-tone-danger-border);
  color: var(--pt-tone-danger-text);
}

.pt-badge-warning {
  background: var(--pt-tone-warning-bg);
  border-color: var(--pt-tone-warning-border);
  color: var(--pt-tone-warning-text);
}

.pt-badge-info {
  background: var(--pt-tone-info-bg);
  border-color: var(--pt-tone-info-border);
  color: var(--pt-tone-info-text);
}

.pt-badge-muted,
.pt-badge-neutral {
  background: var(--pt-tone-neutral-bg);
  border-color: var(--pt-tone-neutral-border);
  color: var(--pt-tone-neutral-text);
}

/* For counts and labels that are not a status — a dot in front of "3 appeals" reads
   as a state the row is in, which it is not. */
.pt-badge-plain::before { display: none; }
.pt-badge-plain { padding-left: 9px; }

/* Diagnostic recording playback (platform admin only) */
.pt-listen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  background: var(--pt-surface);
  color: var(--pt-primary);
  cursor: pointer;
}

.pt-listen-btn:hover { background: var(--pt-primary-soft); }

.pt-listen-audio { width: 240px; height: 32px; vertical-align: middle; }

.pt-alert {
  padding: 12px 16px;
  border-radius: var(--pt-radius);
  margin-bottom: 16px;
  font-size: 0.88rem;
}

.pt-alert-success { background: var(--pt-success-bg); color: var(--pt-success); }
.pt-alert-danger { background: var(--pt-danger-bg); color: var(--pt-danger); }

.pt-alert-warning {
  background: var(--pt-tone-warning-bg);
  border: 1px solid var(--pt-tone-warning-border);
  color: var(--pt-tone-warning-text);
}

.pt-alert-info {
  background: var(--pt-tone-info-bg);
  border: 1px solid var(--pt-tone-info-border);
  color: var(--pt-tone-info-text);
}

.pt-alert code { font-size: var(--pt-text-xs); }

.pt-filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 16px;
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  padding: 14px 16px;
  box-shadow: var(--pt-shadow);
}

.pt-filter-bar .pt-field { margin-bottom: 0; min-width: 160px; }

/* A filter row inside a card: the card already provides the frame. */
.pt-filter-bar-flat {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin-top: 16px;
}

.pt-inline .pt-input-sm {
  width: 12rem;
  max-width: 100%;
  padding: 4px 8px;
  font-size: var(--pt-text-xs);
}

.pt-filter-actions {
  display: flex;
  align-items: center;
  gap: var(--pt-space-2);
}

/* htmx toggles .htmx-request on the hx-indicator element for the duration of the request. */
.pt-htmx-indicator {
  font-size: var(--pt-text-xs);
  color: var(--pt-text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.pt-htmx-indicator.htmx-request { opacity: 1; }

/* Dim the region being replaced so a slow filter does not look like nothing happened. */
.htmx-request.pt-card, .pt-card.htmx-request { opacity: 0.6; }

.pt-muted { color: var(--pt-text-muted); }

/* ── Pagination ── */

.pt-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--pt-text-muted);
}

.pt-pagination-actions {
  display: flex;
  gap: 8px;
}

/* The summary had no container styling, so a rejected form showed a bare bulleted list that did
   not read as an error at all. */
.validation-summary-errors {
  margin-bottom: var(--pt-space-4);
  padding: 12px 14px;
  border: 1px solid var(--pt-danger);
  border-left-width: 4px;
  border-radius: var(--pt-radius-sm);
  background: var(--pt-danger-bg);
}

.validation-summary-errors ul {
  margin: 0;
  padding-left: 18px;
  color: var(--pt-danger);
  font-size: var(--pt-text-md);
}

/* Rendered even when valid, which would otherwise leave an empty bordered box above the form. */
.validation-summary-valid { display: none; }

/* jQuery Validate marks the offending input, which until now looked identical to a valid one. */
.input-validation-error {
  border-color: var(--pt-danger) !important;
}

.input-validation-error:focus {
  outline-color: var(--pt-danger);
  box-shadow: 0 0 0 3px var(--pt-danger-ring);
}

/* ── Progress and score display ── */

/* Driven by --pt-progress-value (0-100) so the markup only carries a number and
   the colour decision stays in CSS. */
.pt-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--pt-surface-hover);
  overflow: hidden;
}

.pt-progress::after {
  content: "";
  display: block;
  height: 100%;
  width: calc(var(--pt-progress-value, 0) * 1%);
  border-radius: inherit;
  background: var(--pt-accent-bg);
  transition: width 0.3s ease;
}

.pt-progress.pt-progress-success::after { background: var(--pt-success); }
.pt-progress.pt-progress-warning::after { background: var(--pt-warning-text); }
.pt-progress.pt-progress-danger::after { background: var(--pt-danger); }

.pt-score-ring {
  --pt-ring-value: 0;
  --pt-ring-size: 116px;
  width: var(--pt-ring-size);
  height: var(--pt-ring-size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background:
    conic-gradient(var(--pt-accent-bg) calc(var(--pt-ring-value) * 1%), var(--pt-surface-hover) 0);
}

/* The inner disc punches the ring hollow; a mask would drop the label with it. */
.pt-score-ring::before {
  content: "";
  grid-area: 1 / 1;
  width: calc(var(--pt-ring-size) - 20px);
  height: calc(var(--pt-ring-size) - 20px);
  border-radius: 50%;
  background: var(--pt-surface);
}

.pt-score-ring-label {
  grid-area: 1 / 1;
  text-align: center;
  line-height: 1.15;
}

.pt-score-ring-value {
  display: block;
  font-size: var(--pt-text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.pt-score-ring-max {
  display: block;
  font-size: var(--pt-text-xs);
  color: var(--pt-text-muted);
  font-weight: 600;
}

.pt-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--pt-space-2);
  flex-shrink: 0;
}

.pt-score-caption {
  font-size: var(--pt-text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pt-text-muted);
}

/* ── Report detail ── */

.pt-report-summary {
  display: flex;
  align-items: center;
  gap: var(--pt-space-7);
  flex-wrap: wrap;
}

.pt-teacher-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--pt-space-4);
}

.pt-teacher-card .pt-actions { margin: 0; }

.pt-meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--pt-space-4);
  margin: 0;
  flex: 1;
  min-width: 220px;
}

.pt-meta-list dt {
  font-size: var(--pt-text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pt-text-muted);
}

.pt-meta-list dd {
  margin: 3px 0 0;
  font-size: var(--pt-text-md);
}

.pt-criterion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--pt-space-4);
}

.pt-criterion-card {
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  padding: 14px 16px;
  background: var(--pt-surface);
}

.pt-criterion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--pt-space-3);
  margin-bottom: 10px;
}

.pt-criterion-head h3 {
  margin: 0;
  font-size: var(--pt-text-base);
  font-weight: 650;
  line-height: 1.35;
}

.pt-criterion-meta {
  display: block;
  margin-top: 2px;
  font-size: var(--pt-text-xs);
  color: var(--pt-text-muted);
}

.pt-criterion-score {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.pt-criterion-score strong { font-size: var(--pt-text-xl); letter-spacing: -0.02em; }

.pt-indicator-list { margin: 14px 0 0; }

.pt-indicator-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--pt-space-3);
  padding: 5px 0;
  border-top: 1px solid var(--pt-border);
}

.pt-indicator-row dt {
  font-size: var(--pt-text-base);
  color: var(--pt-text-muted);
  min-width: 0;
}

.pt-indicator-row dd {
  margin: 0;
  font-size: var(--pt-text-base);
  font-weight: 600;
  text-align: right;
}

.pt-evidence { margin-top: 4px; }

.pt-evidence summary {
  cursor: pointer;
  font-size: var(--pt-text-xs);
  font-weight: 600;
  color: var(--pt-primary);
}

.pt-evidence ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
  font-weight: 400;
}

.pt-evidence li {
  padding: 6px 0;
  border-top: 1px solid var(--pt-border);
  font-size: var(--pt-text-xs);
}

.pt-evidence-time {
  display: inline-block;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
  color: var(--pt-text-muted);
}

.pt-evidence-quote { font-style: italic; }

.pt-comment-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pt-comment-list li {
  padding: 10px 0;
  border-top: 1px solid var(--pt-border);
}

.pt-comment-list li:first-child { border-top: none; padding-top: 0; }
.pt-comment-list p { margin: 0; }

.pt-comment-meta {
  font-size: var(--pt-text-xs);
  color: var(--pt-text-muted);
  margin-bottom: 3px;
}

/* ── Manual criterion entry ── */

.pt-manual-list { margin-top: var(--pt-space-4); }

.pt-manual-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: var(--pt-space-3);
  padding: 10px 0;
  border-top: 1px solid var(--pt-border);
}

.pt-manual-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: var(--pt-text-md);
  cursor: pointer;
}

.pt-manual-code {
  font-size: var(--pt-text-xs);
  font-weight: 700;
  color: var(--pt-text-muted);
  font-variant-numeric: tabular-nums;
}

.pt-manual-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pt-manual-input input {
  width: 74px;
  padding: 7px 10px;
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius-sm);
  background: var(--pt-surface);
  color: var(--pt-text);
  font-size: var(--pt-text-md);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pt-manual-input input:disabled {
  background: var(--pt-surface-sunken);
  color: var(--pt-text-muted);
}

.pt-manual-state {
  font-size: var(--pt-text-xs);
  text-align: right;
  min-width: 96px;
}

.pt-manual-footer {
  display: flex;
  align-items: center;
  gap: var(--pt-space-3);
  flex-wrap: wrap;
  margin-top: var(--pt-space-5);
}

.pt-manual-footer p { margin: 0; font-size: var(--pt-text-xs); max-width: 48ch; }

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

/* ── Copy to clipboard ── */

.pt-copy {
  display: inline-flex;
  align-items: center;
  gap: var(--pt-space-2);
  flex-wrap: wrap;
}

.pt-copy code {
  padding: 6px 12px;
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius-sm);
  background: var(--pt-surface);
  font-size: var(--pt-text-lg);
  font-weight: 650;
  letter-spacing: 0.12em;
  /* A double-click should grab the whole code, never a fragment of it. */
  user-select: all;
}

.pt-alert-title {
  margin: 0 0 var(--pt-space-2);
  font-weight: 650;
}

.pt-alert p:last-child { margin-bottom: 0; }

/* ── Skeleton ── */

.pt-skeleton {
  border-radius: var(--pt-radius-sm);
  background: linear-gradient(
    90deg,
    var(--pt-surface-hover) 25%,
    var(--pt-surface-stripe) 37%,
    var(--pt-surface-hover) 63%
  );
  background-size: 400% 100%;
  animation: pt-skeleton-shimmer 1.4s ease infinite;
}

.pt-skeleton-text {
  height: 0.8em;
  margin: 0.25em 0;
}

@keyframes pt-skeleton-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

/* ── Toast ── */

.pt-toast-stack {
  position: fixed;
  right: var(--pt-space-4);
  bottom: var(--pt-space-4);
  z-index: var(--pt-z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--pt-space-2);
  max-width: min(380px, calc(100vw - 2 * var(--pt-space-4)));
}

.pt-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--pt-space-3);
  padding: 12px 14px;
  border-radius: var(--pt-radius);
  border: 1px solid var(--pt-border);
  background: var(--pt-surface);
  box-shadow: var(--pt-shadow-md);
  font-size: var(--pt-text-base);
  animation: pt-toast-in 0.18s ease;
}

.pt-toast-success { border-left: 3px solid var(--pt-success); }
.pt-toast-danger { border-left: 3px solid var(--pt-danger); }

.pt-toast-body { flex: 1; min-width: 0; }
.pt-toast-title { font-weight: 650; }

.pt-toast-close {
  border: none;
  background: none;
  color: var(--pt-text-muted);
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

.pt-toast-close:hover { color: var(--pt-text); }

@keyframes pt-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Modal (native dialog) ── */

.pt-modal {
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius-lg);
  background: var(--pt-surface);
  color: var(--pt-text);
  box-shadow: var(--pt-shadow-lg);
  padding: 0;
  width: min(460px, calc(100vw - 2 * var(--pt-space-4)));
}

.pt-modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.pt-modal-header {
  padding: 18px 22px 0;
  font-size: var(--pt-text-lg);
  font-weight: 650;
}

.pt-modal-body {
  padding: 10px 22px 0;
  font-size: var(--pt-text-base);
  color: var(--pt-text-muted);
}

.pt-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--pt-space-2);
  padding: 18px 22px 20px;
}

/* ── Tabs ── */

.pt-tabs {
  display: flex;
  gap: var(--pt-space-1);
  border-bottom: 1px solid var(--pt-border);
  margin-bottom: var(--pt-space-5);
  overflow-x: auto;
}

.pt-tabs a, .pt-tabs button {
  border: none;
  background: none;
  cursor: pointer;
  padding: 9px 14px;
  font-size: var(--pt-text-base);
  font-weight: 600;
  color: var(--pt-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.pt-tabs a:hover, .pt-tabs button:hover { color: var(--pt-text); text-decoration: none; }

.pt-tabs [aria-selected="true"], .pt-tabs a.active {
  color: var(--pt-primary);
  border-bottom-color: var(--pt-primary);
}

/* ── Dropdown menu ── */

.pt-menu-wrap { position: relative; }

.pt-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  background: var(--pt-surface);
  box-shadow: var(--pt-shadow-md);
  z-index: var(--pt-z-overlay);
}

/* Repeats the identity because the chip's own label is hidden on narrow screens — a platform
   admin switching between accounts needs to see which one this is before hitting Logout. */
.pt-menu-header {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--pt-border);
  margin-bottom: 4px;
}

.pt-menu-header .pt-menu-header-name {
  display: block;
  font-size: var(--pt-text-base);
  font-weight: 650;
  word-break: break-all;
}

.pt-menu-header .pt-menu-header-role {
  display: block;
  font-size: var(--pt-text-xs);
  color: var(--pt-text-muted);
}

.pt-menu-label {
  font-size: var(--pt-text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pt-text-muted);
  padding: 8px 10px 4px;
}

.pt-menu-item {
  display: flex;
  align-items: center;
  gap: var(--pt-space-2);
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--pt-radius-sm);
  background: none;
  color: var(--pt-text);
  font-size: var(--pt-text-base);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.pt-menu-item:hover { background: var(--pt-surface-hover); text-decoration: none; color: var(--pt-text); }
.pt-menu-item[aria-checked="true"] { color: var(--pt-primary); font-weight: 600; }
.pt-menu-separator { height: 1px; background: var(--pt-border); margin: 6px 4px; }

.pt-logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  max-width: 320px;
  margin: var(--pt-space-3) 0;
  padding: var(--pt-space-3);
  border: 1px dashed var(--pt-border);
  border-radius: var(--pt-radius);
  background: var(--pt-surface);
}
.pt-logo-preview img { max-height: 80px; max-width: 100%; object-fit: contain; }

/* ── Responsive ── */

@media (max-width: 1100px) {
  .pt-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .pt-sidebar {
    width: 72px;
    padding: 10px 0;
  }

  .pt-nav { padding: 0 8px; }

  .pt-nav-section {
    font-size: 0;
    padding: 8px 0 4px;
    border-top: 1px solid var(--pt-border);
    margin-top: 4px;
  }

  .pt-nav-section:first-child {
    border-top: none;
    margin-top: 0;
  }

  .pt-nav a {
    justify-content: center;
    padding: 12px 8px;
  }

  .pt-nav a span { display: none; }

  .pt-nav a .pt-icon {
    width: 20px;
    height: 20px;
  }

  .pt-user-meta { display: none; }

  .pt-main { padding: 22px 18px 40px; }
}

/* The drawer and its overlay are driven by a class rather than x-show, because x-show writes an
   inline display that a media query cannot override. With a class, a resize while the drawer is
   open simply stops matching below and the desktop layout returns undimmed. */
.pt-overlay { display: none; }

@media (max-width: 768px) {
  /* The previous mobile treatment was a horizontal scroll strip, which breaks down badly:
     someone holding both the platform and institution roles has fifteen nav items, so most sat
     off-screen with no affordance that they existed. A drawer shows the whole list. */
  .pt-nav-toggle { display: inline-flex; }

  .pt-sidebar {
    position: fixed;
    top: var(--pt-topbar-h);
    bottom: 0;
    left: 0;
    width: min(288px, 82vw);
    padding: 12px 0 24px;
    z-index: var(--pt-z-drawer);
    box-shadow: var(--pt-shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .pt-sidebar.is-open { transform: translateX(0); }

  /* Undo the tablet icon rail: inside a drawer there is room for the labels. */
  .pt-nav { padding: 0 10px; }

  .pt-nav-section {
    font-size: 0.68rem;
    padding: 14px 12px 6px;
    border-top: none;
    margin-top: 0;
  }

  .pt-nav a {
    justify-content: flex-start;
    padding: 11px 12px;
    font-size: var(--pt-text-md);
  }

  .pt-nav a span { display: inline; }

  .pt-overlay.is-open {
    display: block;
    position: fixed;
    inset: var(--pt-topbar-h) 0 0 0;
    z-index: var(--pt-z-overlay);
    background: rgba(15, 23, 42, 0.45);
  }

  .pt-topbar { padding: 0 12px; }

  /* A ten-column table on a phone means horizontal scrolling with the row's identity scrolled
     out of view. Each row becomes a card instead, with the header text supplied per cell by
     data-label — which is why only tables that carry those attributes opt in. */
  .pt-table-cards thead { display: none; }

  .pt-table-cards, .pt-table-cards tbody, .pt-table-cards tr, .pt-table-cards td {
    display: block;
    width: auto;
  }

  .pt-table-cards tr {
    border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius);
    padding: 4px 12px;
    margin-bottom: var(--pt-space-3);
    background: var(--pt-surface);
  }

  .pt-table-cards td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--pt-space-3);
    padding: 7px 0;
    border-bottom: 1px solid var(--pt-border);
    text-align: right;
  }

  .pt-table-cards td:last-child { border-bottom: none; }

  /* The cell is a flex row here, so a second line would otherwise be pushed out beside the
     first one. Giving it the full basis drops it onto its own line under the value. */
  .pt-table-cards td { flex-wrap: wrap; }
  .pt-table-cards .pt-cell-sub { flex-basis: 100%; text-align: right; }

  .pt-table-cards td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: var(--pt-text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--pt-text-muted);
    text-align: left;
  }

  .pt-table-wrap { max-height: none; overflow-x: visible; }

  .pt-filter-bar .pt-field { min-width: 100%; }
}

@media (max-width: 640px) {
  .pt-report-summary { gap: var(--pt-space-4); }

  /* The label needs the full width once the number box and button no longer fit beside it. */
  .pt-manual-row {
    grid-template-columns: 1fr auto;
    row-gap: var(--pt-space-2);
  }

  .pt-manual-label { grid-column: 1 / -1; }
  .pt-manual-state { grid-column: 1 / -1; text-align: left; }
}

@media (max-width: 480px) {
  .pt-brand span { display: none; }
  .pt-main { padding: 18px 14px 36px; }
  .pt-menu { min-width: 240px; }
}

.pt-field textarea.pt-code-editor {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    tab-size: 2;
    white-space: pre;
    overflow: auto;
}

.pt-form.pt-form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--pt-space-3, 0.75rem);
}
.pt-form.pt-form-inline .pt-field { margin: 0; min-width: 11rem; }
.pt-form.pt-form-inline .pt-actions { margin: 0; }

.pt-divider {
    border: 0;
    border-top: 1px solid var(--pt-border, rgba(0, 0, 0, 0.08));
    margin: 1.25rem 0;
}

.pt-view-as-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: var(--pt-warning-bg, #fff4d6);
    color: var(--pt-warning, #7a5200);
    font-weight: 500;
}
.pt-view-as-banner form { margin: 0; }
.pt-view-as-locked { opacity: 0.6; }
.pt-view-as-locked button, .pt-view-as-locked input, .pt-view-as-locked select, .pt-view-as-locked textarea { cursor: not-allowed; }

.pt-link-button {
    margin-left: 0.75rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--pt-accent, currentColor);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
