/* ==========================================================================
   ATS Skills Hub — visual system ported from Workshop Quality Audit (EmiratesSkills)
   Plain CSS variables + component classes. No build step, no CSS framework.
   ========================================================================== */

:root {
  /* Brand palette (fixed) */
  --color-primary-light: #00658f;
  --color-blue: #0084ad;
  --color-blue-light: #00bbe6;
  --color-green: #b8db55;
  --color-red: #e34123;
  --color-yellow: #fee300;
  --color-gold: #ae7e30;
  --chart-1: #045884;

  /* Semantic tokens — light */
  --background: #f7f7f8;
  --foreground: #1a1c23;
  --card: #ffffff;
  --card-foreground: #1a1c23;
  --popover: #ffffff;
  --primary: #003764;
  --primary-foreground: #fafafa;
  --secondary: #f1f2f4;
  --secondary-foreground: #2a2d36;
  --muted: #f1f2f4;
  --muted-foreground: #6b7280;
  --accent: #f1f2f4;
  --accent-foreground: #2a2d36;
  --destructive: #991b1b;
  --destructive-foreground: #ffffff;
  --warning: #fef08a;
  --warning-foreground: #a16207;
  --success: #bbf7d0;
  --success-foreground: #15803d;
  --border: #e5e7eb;
  --input: #e5e7eb;
  --ring: #a1a1aa;
  --table-head: #fafafb;

  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --header-h: 64px;
  --sidebar-w: 252px;

  /* Schedule-cell palette */
  --slot-class-bg: #e9ecef;      --slot-class-fg: #495057;
  --slot-training-bg: #d1e7dd;   --slot-training-fg: #0f5132;
  --slot-pending-bg: #fff3cd;    --slot-pending-fg: #664d03;
  --slot-blocked-bg: #f8d7da;    --slot-blocked-fg: #842029;
  --slot-not-approved-bg: #f5c2c7; --slot-not-approved-fg: #842029;
}

* { box-sizing: border-box; border-color: var(--border); }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Noto Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--color-primary-light); text-decoration: underline; }
a.plain, a.plain:hover { color: inherit; text-decoration: none; }
input, select, button, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ---- Brand stripe ------------------------------------------------------- */
.brand-stripe { display: grid; grid-template-columns: repeat(4, 1fr); height: 4px; width: 100%; flex: none; }
.brand-stripe > span:nth-child(1) { background: var(--primary); }
.brand-stripe > span:nth-child(2) { background: var(--color-blue); }
.brand-stripe > span:nth-child(3) { background: var(--color-red); }
.brand-stripe > span:nth-child(4) { background: var(--color-yellow); }

/* ---- App shell ---------------------------------------------------------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  height: var(--header-h); flex: none;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem;
}
.app-header .brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 600; color: #fff; text-decoration: none; }
.app-header .brand-logo { height: 30px; width: auto; display: block; }
.app-header .brand-divider { width: 1px; height: 26px; background: rgba(255,255,255,0.25); }
.app-header .spacer { flex: 1; }
.app-header .welcome { color: rgba(255,255,255,0.9); font-size: 0.875rem; }
.app-header .scope-pill {
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.8125rem; white-space: nowrap;
}
.app-header .role-pill { background: #fff; color: var(--primary); border-radius: 999px; padding: .15rem .55rem; font-size: .72rem; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 0.6rem; }

.app-body { flex: 1; display: flex; align-items: stretch; min-height: 0; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--card); border-right: 1px solid var(--border);
  padding: 1rem .75rem; display: flex; flex-direction: column; gap: 1.1rem;
}
.sidebar .nav-section { display: flex; flex-direction: column; gap: .5rem; }
.sidebar .nav-section-title { text-transform: uppercase; letter-spacing: .09em; font-size: .75rem; font-weight: 700; color: var(--primary); padding: 0 .6rem .4rem; border-bottom: 1px solid var(--border); }
.sidebar .nav-group { display: flex; flex-direction: column; gap: .15rem; }
.sidebar .nav-heading { text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; font-weight: 600; color: var(--muted-foreground); padding: .1rem .6rem .2rem; }
.sidebar .nav-item {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-md);
  font-size: .875rem; font-weight: 500; color: var(--secondary-foreground); text-decoration: none; transition: background .15s;
}
.sidebar .nav-item i { font-size: 1rem; opacity: .85; }
.sidebar .nav-item:hover { background: var(--muted); color: var(--secondary-foreground); }
.sidebar .nav-item.is-active { background: var(--primary); color: #fff; }
.sidebar .nav-count { margin-left: auto; background: var(--warning); color: var(--warning-foreground); border-radius: 999px; padding: .05rem .45rem; font-size: .7rem; font-weight: 700; }
.sidebar .sidebar-foot { margin-top: auto; font-size: .75rem; color: var(--muted-foreground); padding: .6rem; line-height: 1.4; }

main.app-main { flex: 1; min-width: 0; padding: 1.5rem 1.5rem 3rem; display: flex; flex-direction: column; gap: 1.25rem; }
footer.app-footer { text-align: center; color: var(--muted-foreground); font-size: 0.8125rem; padding: 1.25rem; }

/* Mobile hamburger + drawer */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; background: transparent; border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-md); cursor: pointer; padding: 0 10px;
}
.nav-toggle span { display: block; height: 2px; background: #fff; border-radius: 2px; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: none; z-index: 60; }
.drawer-backdrop.is-open { display: block; }
.drawer {
  position: absolute; top: 0; right: 0; height: 100%; width: 280px; max-width: 82%;
  background: var(--card); box-shadow: -6px 0 20px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; padding: 1rem 1.1rem; overflow: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.drawer-user { font-weight: 600; }
.drawer-close { background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted-foreground); }
.drawer-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.drawer-nav a { padding: 0.6rem 0.6rem; border-radius: var(--radius-md); font-weight: 500; color: var(--foreground); display: flex; gap: .6rem; align-items: center; }
.drawer-nav a:hover { background: var(--muted); text-decoration: none; }
.drawer-nav .nav-heading { text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; font-weight: 600; color: var(--muted-foreground); padding: .5rem .6rem .1rem; }
.drawer-nav .nav-section-title { text-transform: uppercase; letter-spacing: .09em; font-size: .75rem; font-weight: 700; color: var(--primary); padding: .9rem .6rem .35rem; border-bottom: 1px solid var(--border); margin-bottom: .2rem; }
.drawer-logout { margin-top: auto; padding-top: 1rem; }

/* ---- Typography helpers ------------------------------------------------- */
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; font-weight: 600; color: var(--muted-foreground); }
.eyebrow-strong { font-weight: 700; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; line-height: 1.25; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-sub { font-size: 0.875rem; color: var(--muted-foreground); }
.muted { color: var(--muted-foreground); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.8125rem; }
.text-xxs { font-size: 0.75rem; }
.text-destructive { color: var(--destructive); }
.text-success { color: var(--success-foreground); }
.text-warning { color: var(--warning-foreground); }
.text-red { color: var(--color-red); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.strong { color: var(--foreground); font-weight: 600; }
.break-all { word-break: break-all; }
.max-52 { max-width: 52ch; }

/* ---- Page header row ---------------------------------------------------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head.align-start { align-items: flex-start; }
.page-head .actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  height: 2.25rem; padding: 0 0.9rem; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 0.875rem; font-weight: 500; cursor: pointer; box-shadow: var(--shadow-xs);
  background: var(--secondary); color: var(--secondary-foreground);
  transition: background .15s, opacity .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(0.97); text-decoration: none; color: inherit; }
.btn:disabled, .btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { color: var(--primary-foreground); }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn-destructive:hover { color: #fff; }
.btn-success { background: var(--success); color: var(--success-foreground); font-weight: 600; }
.btn-success:hover { color: var(--success-foreground); }
.btn-warning { background: var(--warning); color: var(--warning-foreground); font-weight: 600; }
.btn-warning:hover { color: var(--warning-foreground); }
.btn-pdf { background: var(--destructive); color: #fff; font-weight: 600; }
.btn-pdf:hover { color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--primary); box-shadow: none; }
.btn-outline:hover { background: var(--muted); color: var(--primary); }
.btn-outline-plain { background: transparent; border-color: var(--border); color: var(--foreground); box-shadow: none; }
.btn-outline-plain:hover { background: var(--muted); }
.btn-outline-danger { background: #fff; border-color: #fecaca; color: var(--destructive); box-shadow: none; }
.btn-outline-danger:hover { background: #fef2f2; color: var(--destructive); }
.btn-outline-white { background: transparent; border-color: rgba(255,255,255,0.25); color: #fff; box-shadow: none; }
.btn-outline-white:hover { color: #fff; background: rgba(255,255,255,.08); }
.btn-ghost { background: transparent; box-shadow: none; color: var(--foreground); }
.btn-link { background: transparent; box-shadow: none; color: var(--primary); padding: 0; height: auto; }
.btn-sm { height: 2rem; padding: 0 0.7rem; font-size: 0.8125rem; }
.btn-xs { height: 1.75rem; padding: 0 .5rem; font-size: .78rem; }
.btn-lg { height: 2.5rem; padding: 0 1.25rem; }
.btn-icon { width: 2rem; height: 2rem; padding: 0; }
.btn-block { width: 100%; }
.btn-white { background: #fff; color: var(--foreground); }

/* ---- Cards -------------------------------------------------------------- */
.card { background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.card-body { padding: 1.25rem; }
.card-body-sm { padding: .85rem 1.25rem; }
.card-header { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.card-header-sm { padding: .85rem 1rem; }
.card-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.card-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--border); font-size: .8125rem; color: var(--muted-foreground); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.card-section-label { padding: .85rem 1.25rem .25rem; text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; font-weight: 700; color: var(--muted-foreground); }
.card-empty { padding: 2.5rem 1.25rem; text-align: center; color: var(--muted-foreground); font-size: .875rem; }
.card-empty i { font-size: 2rem; display: block; margin-bottom: .5rem; }
.card-accent { border-top: 4px solid var(--primary); }

/* KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.kpi { display: block; background: var(--card); border: 1px solid var(--border); border-top: 4px solid var(--primary); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 1.1rem 1.25rem; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.kpi:hover { border-color: var(--primary); box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08); transform: translateY(-1px); color: inherit; text-decoration: none; }
/* The same tile for a profile that may not open the page behind it: a number, not a door. */
.kpi.is-static { cursor: default; }
.kpi.is-static:hover { border-color: var(--border); box-shadow: var(--shadow-xs); transform: none; }
.kpi .kpi-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; color: var(--muted-foreground); }
.kpi .kpi-value { font-size: 1.9rem; font-weight: 700; margin-top: 0.35rem; line-height: 1.1; }

/* ---- Pills / badges ----------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.pill-success { background: var(--success); color: var(--success-foreground); }
.pill-warning { background: var(--warning); color: var(--warning-foreground); }
.pill-danger { background: #fecaca; color: var(--destructive); }
.pill-muted { background: var(--muted); color: var(--muted-foreground); }
.pill-outline { background: transparent; border: 1px solid var(--border); color: var(--muted-foreground); }
.pill-primary { background: var(--primary); color: #fff; }
.pill-info { background: #e0f2fe; color: #075985; }
.pill-lg { padding: .25rem .7rem; font-size: .8125rem; }
.pill-xs { font-size: .68rem; padding: .1rem .45rem; }
.day-pill { display: inline-block; padding: .05rem .45rem; border-radius: 999px; font-size: .68rem; font-weight: 600; border: 1px solid var(--border); background: var(--table-head); color: var(--muted-foreground); }
.day-pill.is-on { background: var(--success); color: var(--success-foreground); border-color: var(--success); }

/* Class colour chip */
.class-chip { display: inline-block; padding: .15rem .5rem; border-radius: 6px; font-weight: 600; font-size: .8rem; text-decoration: none; transition: all .12s; white-space: nowrap; }
a.class-chip:hover { text-decoration: none; filter: brightness(1.05); }
.class-chip-lg { font-size: 1.15rem; padding: .15rem .6rem; }

/* ---- Alerts ------------------------------------------------------------- */
.alert { display: flex; gap: 0.6rem; align-items: center; padding: 0.85rem 1rem; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--card); font-size: 0.875rem; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-destructive, .alert-danger { background: #fef2f2; border-color: #fecaca; color: var(--destructive); }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--success-foreground); }
.alert-info { background: var(--card); }
.alert .alert-body { flex: 1; }
.alert .alert-close { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; opacity: .6; font-size: 1.1rem; line-height: 1; }

/* ---- Forms -------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field + .field, .stack .field { margin-bottom: 0; }
label.label, .label { font-size: 0.8125rem; font-weight: 500; }
.label-strong { font-weight: 600; }
.label .opt { color: var(--muted-foreground); font-weight: 400; }
.input, .select, .textarea {
  width: 100%; height: 2.25rem; padding: 0 0.7rem; border: 1px solid var(--input); border-radius: var(--radius-md);
  background: var(--card); box-shadow: var(--shadow-xs); font: inherit; color: inherit;
}
.select { padding-right: 1.8rem; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .6rem center; }
.textarea { height: auto; min-height: 5rem; padding: 0.5rem 0.7rem; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--ring); outline-offset: 1px; border-color: var(--ring); }
.input[readonly], .input:disabled, .select:disabled { background: var(--background); color: var(--muted-foreground); box-shadow: none; }
.input-sm, .select-sm { height: 2rem; padding-top: 0; padding-bottom: 0; font-size: .875rem; }
.input-xs, .select-xs { height: 1.9rem; font-size: .8125rem; padding: 0 .5rem; }
.select-sm { padding-right: 1.6rem; }
.select-xs { padding-right: 1.5rem; background-position: right .4rem center; }
.w-auto { width: auto; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .toggle-eye { position: absolute; right: 0.5rem; background: none; border: none; cursor: pointer; color: var(--muted-foreground); padding: 0.25rem; }
.hint { font-size: 0.8125rem; color: var(--muted-foreground); line-height: 1.35; }
.req { color: var(--color-red); }
input[type="color"].input { padding: .15rem; width: 3rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .875rem; cursor: pointer; }
.check input { width: 1rem; height: 1rem; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .85rem; align-items: end; }
.form-grid-wide { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-section { display: flex; flex-direction: column; gap: .6rem; }
.form-section + .form-section { margin-top: 1.25rem; }

/* Toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; font-size: .8125rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 2rem; height: 1.1rem; border-radius: 999px; background: #d5d8dd; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: .85rem; height: .85rem; border-radius: 999px; background: #fff; transition: left .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { left: 1.05rem; }
.switch input:disabled + .track { opacity: .6; cursor: not-allowed; }

/* Filter bar */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; align-items: end; padding: 1rem 1.25rem; }
.filter-bar .field { gap: .25rem; }
.filter-bar .label { font-size: .75rem; }

/* Dropzone */
.dropzone { border: 1px dashed #cbd0d8; background: var(--table-head); border-radius: var(--radius-md); padding: 1.25rem; text-align: center; font-size: .875rem; color: var(--muted-foreground); position: relative; cursor: pointer; }
.dropzone i { font-size: 1.6rem; display: block; margin-bottom: .35rem; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone .file-name { color: var(--foreground); font-weight: 500; margin-top: .25rem; }

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap-bordered { border: 1px solid var(--border); border-radius: var(--radius-md); }
.table-scroll { max-height: 70vh; overflow: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.table thead th { background: var(--table-head); text-align: left; font-weight: 600; padding: 0.6rem 0.85rem; color: var(--muted-foreground); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
table.table tbody td { padding: 0.55rem 0.85rem; border-top: 1px solid var(--border); vertical-align: middle; }
table.table tbody tr:hover { background: color-mix(in srgb, var(--muted) 25%, transparent); }
table.table.table-compact tbody td { padding: .45rem .85rem; font-size: .8125rem; }
table.table .secondary { font-size: .8125rem; color: var(--muted-foreground); }
table.table tr.is-muted td { color: var(--muted-foreground); }
table.table tr.is-warning { background: #fffbeb; }
table.table tr.is-danger { background: #fef2f2; }
table.table th.right, table.table td.right { text-align: right; }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }
.link { color: var(--primary); font-weight: 500; }
.link-strong { color: var(--primary); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ---- Tabs (segmented) --------------------------------------------------- */
.tabs { display: inline-flex; gap: 0.25rem; background: var(--muted); padding: 0.25rem; border-radius: var(--radius-md); }
.tabs a, .tabs button { padding: 0.35rem 0.8rem; border-radius: var(--radius-sm); font-size: 0.8125rem; font-weight: 500; color: var(--muted-foreground); border: none; background: transparent; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--foreground); text-decoration: none; }
.tabs a.is-active, .tabs button.is-active { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-xs); }

/* ---- Legend ------------------------------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8125rem; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend .swatch { width: 16px; height: 16px; border-radius: 3px; display: inline-block; }
.legend-bar { padding: .6rem 1.25rem; border-bottom: 1px solid var(--border); }

/* ---- Layout utilities --------------------------------------------------- */
.row { display: flex; align-items: center; gap: 0.75rem; }
.row-sm { gap: .5rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.row-start { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: 0.5rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1.25rem; }
.grid { display: grid; gap: 1.25rem; align-items: start; }
.grid > *, .kpi-grid > *, .stack > *, .stack-lg > * { min-width: 0; }
.grid-380 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid-340 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-400 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.grid-520 { grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); }
.grid-560 { grid-template-columns: repeat(auto-fit, minmax(560px, 1fr)); }
.grid-5-7 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.grid-4-8 { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
.grid-roster { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
.grid-pages { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
.flex-wrap { flex-wrap: wrap; }
.ml-auto { margin-left: auto; }
.hidden { display: none !important; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.gap-sm { gap: .5rem; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; font-size: .875rem; margin: 0; }
.dl dt { color: var(--muted-foreground); font-weight: 500; }
.dl dd { margin: 0; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem 1rem; border-top: 1px solid var(--muted); font-size: .875rem; }
.list-item:first-child { border-top: none; }
.list-item.is-muted { color: var(--muted-foreground); }
.list-scroll { max-height: 460px; overflow: auto; }
.pages-list .page-item { display: block; padding: .6rem .9rem; border-top: 1px solid var(--muted); color: inherit; text-decoration: none; }
.pages-list .page-item:hover { background: var(--muted); text-decoration: none; }
.pages-list .page-item.is-active { background: var(--primary); color: #fff; }
.pages-list .page-item.is-active .muted { color: rgba(255,255,255,.75); }
.pages-list .page-item:first-child { border-top: none; }

/* Roster (registrations) */
.roster { max-height: 620px; overflow: auto; }
.roster .student-row { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; padding: .6rem 1rem; border-bottom: 1px solid var(--muted); cursor: pointer; color: inherit; text-decoration: none; }
.roster .student-row:hover { background: var(--muted); text-decoration: none; color: inherit; }
.roster .student-row.is-active { background: #eaf2f8; }
.roster .student-row .name { font-weight: 600; font-size: .875rem; }
.roster .student-row .meta { font-size: .78rem; color: var(--muted-foreground); }

/* Palette swatch buttons */
.swatches { display: flex; flex-wrap: wrap; gap: .25rem; }
.swatches button { width: 22px; height: 22px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; padding: 0; }

/* Two lists of different lengths on one row: same height, each scrolling in its own card, so a
   short list does not leave the row half empty. The head and the foot stay put while it scrolls. */
.grid-stretch { align-items: stretch; }
.card.is-equal { display: flex; flex-direction: column; }
.card.is-equal > .table-wrap { flex: 1; min-height: 0; overflow: auto; max-height: 24rem; }
/* A card with nothing to list still has to fill the row: its message sits in the middle of it. */
.card.is-equal > .card-body { flex: 1; }
.card.is-equal > .table-wrap .table thead th { position: sticky; top: 0; z-index: 2; background: var(--table-head); }

/* A student handed back by the Skills Hub: enough to recognise them and one click to act. */
.returned-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); font-size: .78rem; color: var(--foreground); }
.returned-chip:hover { border-color: var(--primary); box-shadow: 0 0 0 2px rgb(0 132 173 / .12); }
.returned-chip .dot { width: .55rem; height: .55rem; border-radius: 50%; flex: none; }
.returned-chip .muted { font-size: .72rem; }

/* ---- Master: the filters stay in reach on a page that is one long list of classes ---- */
.master-bar { position: sticky; top: 0; z-index: 25; background: var(--background); padding: .7rem 0;
  margin-top: -.5rem; transition: box-shadow .15s ease, border-color .15s ease; border-bottom: 1px solid transparent; }
.master-bar.is-stuck { border-bottom-color: var(--border); box-shadow: 0 10px 14px -12px rgb(0 0 0 / .45); }
.master-class { scroll-margin-top: 5.5rem; }

/* ---- Weekly schedule grid ----------------------------------------------- */
.schedule { table-layout: fixed; width: 100%; min-width: 860px; border-collapse: collapse; }
.schedule th, .schedule td { border: 1px solid var(--border); }
.schedule thead th { text-align: center; padding: .55rem .7rem; font-size: .75rem; font-weight: 600; color: var(--muted-foreground); background: var(--table-head); }
.schedule thead th.period-col, .schedule tbody th { text-align: left; }
.schedule .period-col { width: 190px; }
.schedule tbody th { font-weight: 400; font-size: .8125rem; padding: .4rem .7rem; background: var(--card); }
.schedule td.slot { height: 56px; text-align: center; vertical-align: middle; font-weight: 600; font-size: .82rem; position: relative; }
.schedule td.slot small, .schedule td.slot .detail { display: block; font-weight: 400; font-size: .7rem; opacity: .85; }
/* A released period is two facts: what it became, and whose approval it carries. */
.schedule td.slot .state-label { display: block; line-height: 1.25; }
.schedule td.slot .approval-note { display: block; font-weight: 400; font-size: .705rem; line-height: 1.3; opacity: .95; }
.schedule td.slot .approval-note:empty { display: none; }
.schedule:not(.schedule-compact) td.slot { height: auto; min-height: 58px; padding: .35rem .45rem; }
.schedule td.slot .approval-icon { position: absolute; top: 4px; right: 6px; font-size: .85rem; }
.schedule td.slot.clickable { cursor: pointer; }
.schedule td.slot.clickable:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.schedule-compact { min-width: 520px; }
.schedule-compact .period-col { width: 150px; }
.schedule-compact thead th { padding: .4rem .6rem; font-size: .7rem; }
.schedule-compact tbody th { font-size: .72rem; padding: .3rem .6rem; }
.schedule-compact td.slot { height: auto; min-height: 34px; padding: .3rem .35rem; font-size: .72rem; }
.schedule-compact td.slot .approval-icon { position: static; font-size: .7rem; margin-left: .2rem; vertical-align: -1px; }
.schedule-compact td.slot .approval-note { font-size: .66rem; }
.schedule-compact td.slot .seat-chip { font-size: .64rem; padding: 0 .3rem; }
.slot-class { background: var(--slot-class-bg); color: var(--slot-class-fg); }
.slot-training { background: var(--slot-training-bg); color: var(--slot-training-fg); }
.slot-pending { background: var(--slot-pending-bg); color: var(--slot-pending-fg); }
.slot-blocked { background: var(--slot-blocked-bg); color: var(--slot-blocked-fg); }
.slot-not_approved { background: var(--slot-not-approved-bg); color: var(--slot-not-approved-fg); }
.icon-approved { color: var(--success-foreground); }
.icon-pending { color: var(--warning-foreground); }
.icon-review { color: var(--color-red); }

/* ---- Subject timetable grid --------------------------------------------- */
.timetable { table-layout: fixed; width: 100%; min-width: 860px; border-collapse: collapse; }
.timetable th, .timetable td { border: 1px solid var(--border); }
.timetable thead th { text-align: center; padding: .55rem .7rem; font-size: .75rem; font-weight: 600; color: var(--muted-foreground); background: var(--table-head); }
.timetable thead th.period-col { text-align: left; width: 170px; }
.timetable tbody th { text-align: left; font-weight: 400; font-size: .8125rem; padding: .4rem .7rem; background: var(--card); }
.timetable tbody th .time { display: block; font-size: .75rem; color: var(--muted-foreground); }
.timetable tr.is-break th, .timetable tr.is-break td { background: var(--muted); }
.timetable td.cell { height: 62px; font-size: .78rem; text-align: center; vertical-align: middle; padding: .25rem .35rem; }
.timetable td.cell.editable { cursor: pointer; }
.timetable td.cell.editable:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.timetable .subj { font-weight: 700; }
.timetable .teacher { display: block; color: var(--muted-foreground); font-size: .7rem; }
.timetable .split { display: flex; gap: 2px; justify-content: center; }
.timetable .split > div { flex: 1; border-left: 1px dashed #ced4da; padding: 0 2px; }
.timetable .split > div:first-child { border-left: 0; }

/* ---- Toasts ------------------------------------------------------------- */
.toast-box { position: fixed; bottom: 1rem; right: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 80; }
.toast { background: var(--foreground); color: #fff; padding: .6rem .9rem; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: .875rem; display: flex; gap: .75rem; align-items: center; animation: toast-in .15s ease-out; max-width: 380px; }
.toast-success { background: var(--success-foreground); }
.toast-warning { background: var(--warning); color: var(--warning-foreground); }
.toast-danger { background: var(--destructive); }
.toast button { background: none; border: none; color: inherit; cursor: pointer; opacity: .7; font-size: 1.1rem; line-height: 1; margin-left: auto; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Dialog ------------------------------------------------------------- */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.dialog-backdrop.is-open { display: flex; }
.dialog { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; padding: 1.25rem; display: flex; flex-direction: column; gap: .85rem; }
.dialog h3 { margin: 0; font-size: 1.05rem; }
.dialog .dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* ==========================================================================
   Login split layout
   ========================================================================== */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 55% 45%; }
.login-left { background: var(--primary); color: #fff; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 3rem; }
.login-brand { text-align: center; max-width: 80%; position: relative; z-index: 1; }
.login-logo { width: 100%; max-width: 460px; height: auto; display: block; margin: 0 auto; }
.login-subtitle { margin-top: 1.25rem; font-size: 1.15rem; font-weight: 600; color: #fff; display: flex; align-items: center; justify-content: center; gap: .5rem; }
.beta { background: var(--color-yellow); color: #1a1c23; font-weight: 700; font-size: 0.7rem; padding: 0.15rem 0.55rem; border-radius: 999px; letter-spacing: .03em; }
.login-left .cube-pattern { position: absolute; bottom: 0; left: 0; width: min(300px, 38%); height: auto; pointer-events: none; opacity: .85; z-index: 0; }
.login-right { background: #fff; position: relative; display: flex; flex-direction: column; }
.login-form { max-width: 380px; margin: auto; width: 100%; padding: 2rem 2.5rem; }
.login-heading { font-size: 1.9rem; font-weight: 700; margin: 0 0 .75rem; color: var(--foreground); }
.login-rule { border: none; border-top: 1px solid var(--border); margin: 0 0 1.5rem; }
.login-form .field { margin-bottom: .9rem; }
.login-foot { margin-top: 1.5rem; font-size: .8125rem; color: var(--muted-foreground); }
@media (max-width: 800px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-left { min-height: 300px; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .grid-5-7, .grid-4-8, .grid-roster, .grid-pages { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }
  .app-header { padding: 0 0.9rem; gap: 0.6rem; }
  .brand-title, .brand-divider, .app-header .scope-pill { display: none; }
  .brand-logo { height: 26px; }
  .header-actions { display: none; }
  .nav-toggle { display: flex; }
  .sidebar { display: none; }
  main.app-main { padding: 1rem 0.9rem 2.5rem; gap: 1rem; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .kpi-value { font-size: 1.55rem; }
  .row-between, .card-header { flex-wrap: wrap; gap: 0.6rem; }
  .tabs { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .grid-380, .grid-340, .grid-400, .grid-520, .grid-560 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Skills Hub labs — occupancy meters and weekly seat board
   ========================================================================== */
.kpi .kpi-hint { color: var(--muted-foreground); font-size: .8125rem; margin-top: .3rem; }

.meter-row + .meter-row { margin-top: .85rem; }
.meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.meter-head .label { font-size: .8125rem; color: var(--muted-foreground); margin: 0; }
.meter-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.meter { height: .5rem; border-radius: 999px; background: var(--muted); overflow: hidden; margin-top: .35rem; }
.meter > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

.student-row.is-blocked .name { color: var(--destructive); }
th.is-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.is-sortable:hover { color: var(--primary); }
th.is-sortable::after { content: "↕"; opacity: .35; margin-left: .25rem; font-size: .8em; }
th.is-sortable.is-asc::after { content: "↑"; opacity: 1; }
th.is-sortable.is-desc::after { content: "↓"; opacity: 1; }

/* Who is expected in the lab, period by period: a name, not a number. */
.seat-chips { display: flex; flex-wrap: wrap; gap: .2rem; justify-content: center; margin-top: .25rem; }
.seat-chip { display: inline-block; max-width: 100%; padding: .05rem .34rem; border-radius: 999px; font-size: .68rem;
    font-weight: 600; line-height: 1.5; background: var(--primary); color: #fff; border: 1px solid transparent; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; cursor: help; }
.seat-chip.is-missing { background: var(--destructive); color: #fff; }
.seat-chip.is-missing::before { content: "\F623"; font-family: bootstrap-icons; margin-right: .18rem; font-weight: 400; }
.seat-chip.is-removed { background: transparent; color: var(--muted-foreground); border-color: var(--border); text-decoration: line-through; }
.seat-chip.is-clash { background: transparent; color: var(--destructive); border-color: var(--destructive); }
.seat-chip.is-empty { background: transparent; color: var(--warning-foreground); border-color: var(--warning-foreground); font-weight: 500; }
.slot-booked { display: inline-flex; align-items: center; gap: .15rem; margin-left: .3rem; padding: 0 .3rem; border-radius: 999px; font-size: .68rem; font-weight: 700; background: var(--primary); color: #fff; vertical-align: 1px; }
.slot-booked i { font-size: .7rem; }
.slot-booked.is-empty { background: transparent; color: var(--warning-foreground); border: 1px solid var(--warning-foreground); }
.slot-booked.is-clash { background: var(--destructive); }

.is-saving { opacity: .55; transition: opacity .1s; }

.lab-card { display: flex; flex-direction: column; height: 100%; }
.lab-card .card-header { align-items: flex-start; gap: .5rem; min-height: 5.8rem; }
.lab-card .card-footer { margin-top: auto; }
.lab-card .card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lab-card .lab-card-room { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.lab-card .card-body { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; }
.lab-card .lab-card-skills { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lab-card .lab-card-title { min-width: 0; }
.lab-card .card-title { font-size: .95rem; line-height: 1.25; overflow-wrap: anywhere; }
.lab-card .card-header .row { flex: none; }

.setup-row { display: flex; flex-direction: column; gap: .3rem; width: 100%; }
.setup-row-fields { display: flex; gap: .3rem; }
.setup-row-fields .input { flex: 1 1 0; min-width: 0; }
.setup-row-tools { display: flex; align-items: center; gap: .35rem; }
.setup-row-tools .select-xs { flex: 1 1 auto; min-width: 0; }
.setup-row-tools .pill { flex: none; }

.lab-skill-row { display: flex; align-items: center; justify-content: space-between; gap: .35rem; font-size: .8125rem; padding: .1rem 0; }
.lab-skill-row form { margin: 0; }
.lab-skill-add { display: flex; align-items: flex-start; gap: .3rem; margin-top: .3rem; }
.lab-skill-add .select-xs { height: auto; min-width: 13rem; flex: 1; padding: .2rem .3rem; background-image: none; }

.lab-swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; border: 1px solid var(--border); background: var(--muted); vertical-align: -1px; margin-right: .25rem; }
.lab-swatch.lab-m { background: rgba(0,132,173,.14); border-color: var(--color-blue); }
.lab-swatch.lab-f { background: rgba(174,126,48,.18); border-color: var(--color-gold); }
.legend { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }

.lab-grid { width: 100%; border-collapse: separate; border-spacing: 4px; }
.lab-grid th, .lab-grid td { vertical-align: top; }
.lab-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .4rem .5rem; font-size: .78rem; font-weight: 600; color: var(--muted-foreground); text-align: center; }
.lab-grid thead th.is-today { background: var(--primary); border-color: var(--primary); color: #fff; }
.lab-grid th.lab-rail { width: 92px; min-width: 92px; text-align: left; background: transparent; border: 0; border-right: 3px solid var(--border); border-radius: 0; padding: .3rem .5rem .3rem 0; }
.lab-grid tbody th.lab-rail .time { font-size: .95rem; font-weight: 600; line-height: 1.15; }
.lab-grid tbody th.lab-rail .time.to { color: var(--muted-foreground); }
.lab-grid tbody th.lab-rail .lbl { font-size: .7rem; font-weight: 600; color: var(--muted-foreground); margin-top: .2rem; }
.lab-grid tr.is-break th.lab-rail { border-right-style: dashed; }
.lab-grid tr.is-break th.lab-rail .lbl { color: var(--color-gold); }
.lab-grid tr.is-now th.lab-rail { border-right-color: var(--primary); }
.lab-grid tr.is-now th.lab-rail .time, .lab-grid tr.is-now th.lab-rail .lbl { color: var(--primary); }
.lab-grid tbody td { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; min-width: 150px; }
.lab-grid tbody td.is-today { border-color: #b9c6d4; }
.lab-grid tr.is-now td { background: #eef4f9; border-color: #8fa9c2; }
.lab-cell { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 4px; }
.lab-desk { display: grid; gap: 3px; align-content: start; }
.lab-seat { display: flex; align-items: center; gap: .25rem; width: 100%; min-height: 26px; padding: .1rem .3rem; border-radius: 5px; border: 1px solid var(--border); background: var(--background); font: inherit; font-size: .72rem; text-align: left; color: var(--muted-foreground); overflow: hidden; }
button.lab-seat { cursor: pointer; }
button.lab-seat:hover { border-color: var(--primary); }
.lab-seat .n { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-seat .t { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; border-radius: 3px; font-size: .62rem; font-weight: 700; color: #fff; background: #9ca3af; }
.lab-seat.lab-m { background: rgba(0,132,173,.12); border-color: var(--color-blue); color: var(--foreground); }
.lab-seat.lab-m .t { background: var(--color-blue); }
.lab-seat.lab-f { background: rgba(174,126,48,.18); border-color: var(--color-gold); color: var(--foreground); }
.lab-seat.lab-f .t { background: var(--color-gold); }
.lab-seat.lab-x { background: var(--muted); border-color: var(--muted-foreground); color: var(--foreground); }

/* ==========================================================================
   Student area (no login): my training week
   ========================================================================== */
.portal { min-height: 100vh; display: flex; flex-direction: column; background: var(--background); }
.portal-head { display: flex; align-items: center; gap: 1rem; background: var(--primary); color: #fff; padding: .7rem 1.25rem; }
.portal-head .spacer { flex: 1; }
.portal-main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 1.25rem 1.25rem 2.5rem; }

.portal-swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; border: 1px solid var(--border); background: var(--card); vertical-align: -1px; margin-right: .25rem; }
.portal-swatch.is-go { background: var(--success); border-color: var(--success-foreground); }
.portal-swatch.is-no_session { background: var(--warning); border-color: var(--warning-foreground); }
.portal-swatch.is-conflict { background: #fecaca; border-color: var(--destructive); }
.portal-swatch.is-at_school { background: #dbeafe; border-color: var(--color-blue); }
.portal-swatch.is-class { background: var(--muted); border-color: var(--border); }
.portal-swatch.is-blocked { background: repeating-linear-gradient(45deg, var(--muted), var(--muted) 3px, #fff 3px, #fff 6px); }

.portal-grid { width: 100%; border-collapse: separate; border-spacing: 4px; }
.portal-grid th, .portal-grid td { vertical-align: top; }
.portal-grid thead th { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .45rem .5rem; font-size: .8rem; font-weight: 600; color: var(--muted-foreground); text-align: center; }
.portal-grid thead th.is-today { background: var(--primary); border-color: var(--primary); color: #fff; }
.portal-grid th.rail { width: 120px; min-width: 120px; text-align: left; background: transparent; border: 0; border-right: 3px solid var(--border); border-radius: 0; padding: .3rem .5rem .3rem 0; }
.portal-grid th.rail .time { font-size: .85rem; font-weight: 600; }
.portal-grid th.rail .lbl { font-size: .72rem; font-weight: 600; color: var(--muted-foreground); }
.portal-grid tr.is-break th.rail { border-right-style: dashed; }
.portal-grid tr.is-break th.rail .lbl { color: var(--color-gold); }
.portal-grid td.cell { min-width: 130px; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.portal-grid td.cell.is-today { box-shadow: inset 0 0 0 1px #b9c6d4; }
.portal-grid td.cell .lab { font-size: .82rem; font-weight: 700; line-height: 1.25; }
.portal-grid td.cell .meta { font-size: .72rem; color: var(--muted-foreground); line-height: 1.3; }
.portal-grid td.is-go { background: var(--success); border-color: var(--success-foreground); }
.portal-grid td.is-go .lab, .portal-grid td.is-go .meta { color: var(--success-foreground); }
.portal-grid td.is-no_session { background: var(--warning); border-color: var(--warning-foreground); }
.portal-grid td.is-no_session .lab, .portal-grid td.is-no_session .meta { color: var(--warning-foreground); }
.portal-grid td.is-at_school { background: #dbeafe; border-color: var(--color-blue); }
.portal-grid td.is-at_school .lab, .portal-grid td.is-at_school .meta { color: #0b4a63; }
.portal-grid td.is-conflict { background: #fecaca; border-color: var(--destructive); }
.portal-grid td.is-conflict .lab, .portal-grid td.is-conflict .meta { color: var(--destructive); }
.portal-grid td.is-blocked { background: repeating-linear-gradient(45deg, var(--muted), var(--muted) 4px, #fff 4px, #fff 8px); }

@media (max-width: 720px) {
  .portal-main { padding: 1rem .9rem 2rem; }
  .portal-grid td.cell { min-width: 108px; }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  .app-header, .sidebar, footer.app-footer, .no-print, .alert, .brand-stripe, .toast-box { display: none !important; }
  main.app-main { padding: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none !important; border: 1px solid var(--border) !important; }
  .page-break { page-break-after: always; }
}

/* ── How it works: the flow diagrams and the steps under them (decision 161) ─────────── */
:root { --flow-trainer: #4d7c0f; --flow-student: #0e7490; --flow-line: #94a3b8; }
.flow-scroll { overflow-x: auto; }
.flow-svg { width: 100%; min-width: 760px; height: auto; display: block; }
.flow-svg .flow-actor { font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.flow-svg .flow-text { font-size: 13px; fill: var(--foreground); }
.flow-svg .flow-label { font-size: 11px; font-weight: 600; fill: var(--muted-foreground); }
.flow-svg .flow-box rect { filter: drop-shadow(0 1px 1px rgb(0 0 0 / .04)); }
.flow-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 600;
  color: var(--chip); border: 1px solid var(--chip); border-radius: 999px; padding: .12rem .55rem; }
.flow-chip::before { content: ''; width: .5rem; height: .5rem; border-radius: 50%; background: var(--chip); }
.flow-num { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; background: var(--primary); color: #fff; font-size: .8rem; margin-right: .5rem; }
.flow-note { display: flex; gap: .6rem; align-items: flex-start; margin-top: .9rem; padding: .7rem .9rem;
  background: var(--muted); border-radius: var(--radius, 8px); font-size: .85rem; line-height: 1.5; }
.flow-note .bi { color: var(--primary); margin-top: .1rem; }
.flow-steps { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .6rem; }
.flow-steps li { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; line-height: 1.5; }
.flow-dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--chip); flex: none; margin-top: .4rem; }
