/* BOS Awareness — minimal hand-written CSS */

:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #fafbfa;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --primary: #047857;
  --primary-hover: #065f46;
  --primary-soft: #ecfdf5;
  --primary-fg: #ffffff;
  --accent: #0d9488;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --success: #15803d;
  --success-soft: #dcfce7;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lifted: 0 4px 12px rgba(15, 23, 42, 0.08);
  --max-width: 1200px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

h1, h2, h3, h4 { line-height: 1.25; margin-top: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.85rem; margin-bottom: 0.5rem; font-weight: 700; }
h2 { font-size: 1.3rem; margin: 1.5rem 0 1rem; font-weight: 600; }
h3 { font-size: 1.05rem; margin: 1rem 0 0.5rem; font-weight: 600; }

p { margin: 0 0 1rem; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.05rem;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #10b981);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
}
.brand-sub { color: var(--text-muted); font-weight: 400; margin-left: 0.1rem; font-size: 0.85rem; }
nav { display: flex; gap: 0.25rem; align-items: center; }
.navlink {
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.93rem;
}
.navlink:hover { background: var(--bg); text-decoration: none; }
.navlink.active { background: var(--primary-soft); color: var(--primary); }
.navuser {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 0 0.5rem 0 0.75rem;
  border-left: 1px solid var(--border);
  margin-left: 0.35rem;
}
.navsep {
  display: inline-block;
  width: 1px;
  height: 1.4rem;
  background: var(--border);
  margin: 0 0.35rem;
  vertical-align: middle;
}

.main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.flash-info { background: #e0f2fe; color: #0c4a6e; }
.flash-success { background: #dcfce7; color: #14532d; }
.flash-error { background: #fee2e2; color: #7f1d1d; }
.flash-warn { background: #fef3c7; color: #78350f; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.93rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); color: white; border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #991b1b; color: white; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-ghost { background: transparent; border: 1px solid transparent; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; border-radius: var(--radius-sm); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card h2 { margin-top: 0; }

.hero { padding: 2rem 0; }
.lead { font-size: 1.1rem; color: var(--text-muted); }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: 0.9rem; }
.stat-sub { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.25rem; }

/* Tiles with a coloured square icon on the left, value+label on the right.
   Used on the learner overview to mirror typical LMS dashboards. */
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: var(--shadow);
  position: relative;
}
.tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: white;
}
.tile-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.tile-icon.t-progress { background: #f97316; }
.tile-icon.t-todo { background: #2563eb; }
.tile-icon.t-overdue { background: #dc2626; }
.tile-icon.t-done { background: #10b981; }
.tile-body { display: flex; flex-direction: column; min-width: 0; }
.tile-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.tile-label { color: var(--text-muted); font-size: 0.88rem; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill-success { background: var(--success-soft); color: #14532d; border-color: #bbf7d0; }
.pill-danger { background: var(--danger-soft); color: #7f1d1d; border-color: #fecaca; }
.pill-warn { background: var(--warn-soft); color: #78350f; border-color: #fde68a; }
.pill-info { background: var(--info-soft); color: #1e3a8a; border-color: #bfdbfe; }
.pill-primary { background: var(--primary-soft); color: var(--primary-hover); border-color: #a7f3d0; }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
table th, table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table th { font-weight: 600; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
table tr:hover { background: var(--bg); }
/* Long email addresses are common in column 1 of admin tables.
   Allow them to break at @ / . so they don't push the row wider than the
   container. */
table td a, table td .email { word-break: break-word; overflow-wrap: anywhere; }
/* Multiple status / role pills in one cell should stack on a second
   line instead of forcing the column wider. */
.pill-stack { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.form { display: flex; flex-direction: column; gap: 1rem; }
.form-row { display: flex; flex-direction: column; gap: 0.35rem; }
.form-row label { font-weight: 500; font-size: 0.9rem; }
.form-row input:not([type="checkbox"]):not([type="radio"]),
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
}
.form-row input[type="checkbox"],
.form-row input[type="radio"] {
  width: auto;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.form-row textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; min-height: 200px; }
.form-actions { display: flex; gap: 0.5rem; }
.form-help { color: var(--text-muted); font-size: 0.85rem; }

.user-picker-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}
.user-picker {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.user-picker-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-weight: 400;
}
.user-picker-row:last-child { border-bottom: none; }
.user-picker-row:hover { background: var(--bg); }
.user-picker-row input[type="checkbox"] {
  margin-top: 0.25rem;
  flex: 0 0 auto;
}
.user-picker-main { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.user-picker-name { font-weight: 500; color: var(--text); }
.user-picker-meta { color: var(--text-muted); font-size: 0.85rem; }
.user-picker-row.is-hidden { display: none; }
.is-hidden { display: none !important; }

/* <details> block used for the per-template landing overrides on the
   skabelon-form. Wrapping it in card chrome makes it visually distinct
   from the always-visible fields above. */
.landing-overrides {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.landing-overrides > summary {
  cursor: pointer;
  padding: 0.5rem 0;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.landing-overrides > summary::-webkit-details-marker { display: none; }
.landing-overrides > summary::before {
  content: "▸";
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.landing-overrides[open] > summary::before { transform: rotate(90deg); }
.landing-overrides > .form-row,
.landing-overrides > p { margin-top: 0.75rem; }

.empty {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}
.empty-title { font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }

/* Course player */
.player {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 100px);
  gap: 0;
}
.player-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.75rem 1rem;
}
.player-frame {
  flex: 1;
  border: 1px solid var(--border);
  border-top: none;
  background: white;
  width: 100%;
  min-height: 600px;
}
.player-footer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.module-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.module-list a {
  background: var(--bg);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
  border: 1px solid var(--border);
}
.module-list a.current { background: var(--primary); color: white; border-color: var(--primary); }
.module-list a.done { background: #dcfce7; border-color: #bbf7d0; color: #14532d; }

.progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.4rem;
}
.progress-bar > div {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}

/* Learner course cards. Subtle hover lift and a coloured top accent so
   you can scan status at a glance without reading the pill. */
.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.05s ease, border-color 0.15s ease;
}
.course-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border);
}
.course-card:hover {
  box-shadow: var(--shadow-lifted);
  border-color: var(--border-strong);
  text-decoration: none;
}
.course-card.is-required::before { background: var(--danger); }
.course-card.is-overdue::before { background: var(--danger); }
.course-card.is-optional::before { background: var(--info); }
.course-card.is-done::before { background: var(--success); }
.course-card.is-progress::before { background: #f97316; }

.course-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.course-card-title { font-size: 1.05rem; font-weight: 600; margin: 0; line-height: 1.3; }
.course-card-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.course-card-meta span { display: inline-flex; align-items: center; gap: 0.25rem; }
.course-card-progress { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.25rem; }
.course-card-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Section header used above grouped course lists */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.75rem 0 0.85rem;
}
.section-head h2 { margin: 0; font-size: 1.15rem; }
.section-head-count { color: var(--text-muted); font-size: 0.85rem; }

/* /training: main column + qualification sidebar */
.learner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1rem;
}
@media (max-width: 1000px) {
  .learner-layout { grid-template-columns: 1fr; }
}
.learner-main { min-width: 0; }
.learner-side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 5rem; }
.learner-side .card { margin-bottom: 0; }

/* Donut chart used for qualification + path progress */
.donut { position: relative; display: inline-block; }
.donut-lg { width: 160px; height: 160px; }
.donut-sm { width: 56px; height: 56px; }
.donut svg { width: 100%; height: 100%; transform-origin: center; }
.donut .donut-track { stroke: var(--bg); }
.donut .donut-fill { stroke: var(--primary); transition: stroke-dasharray 0.4s ease; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.donut-pct { font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1; }
.donut-sm .donut-pct { font-size: 0.85rem; }
.donut-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Qualification card on /training sidebar */
.qualification { text-align: center; }
.qualification-title { margin: 0 0 0.75rem; }
.qualification-meta {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Compact list of enrolled paths under the qualification donut */
.path-list { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 0.75rem; }
.path-item { display: flex; flex-direction: column; gap: 0.3rem; }
.path-item-row { display: flex; align-items: center; gap: 0.6rem; }
.path-item-info { flex: 1; min-width: 0; }
.path-item-title {
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.path-item-meta { color: var(--text-muted); font-size: 0.8rem; }
.path-item-pct { font-weight: 700; font-size: 0.92rem; color: var(--primary); flex: 0 0 auto; }

/* Module list on a course overview — numbered cards with status pill. */
.module-stack { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.module-stack-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.module-stack-item.is-done { background: var(--success-soft); border-color: #bbf7d0; }
.module-stack-item.is-progress { background: var(--warn-soft); border-color: #fde68a; }
.module-stack-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.module-stack-item.is-done .module-stack-marker {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.module-stack-item.is-progress .module-stack-marker {
  background: #f97316;
  color: white;
  border-color: #f97316;
}
.module-stack-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.module-stack-title { font-weight: 600; color: var(--text); }
.module-stack-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); flex-wrap: wrap; }

.landing-card {
  max-width: 640px;
  margin: 2rem auto;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.landing-card h1 { font-size: 2rem; margin-bottom: 1rem; }
.landing-card .red-flags {
  background: var(--warn-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.landing-card .red-flags h3 { margin-top: 0; }

/* Welcome hero used on the public landing and the logged-out home page. */
.welcome {
  background: linear-gradient(135deg, var(--primary) 0%, #10b981 100%);
  color: white;
  padding: 3rem 2rem;
  border-radius: var(--radius);
  margin: 1rem 0 1.5rem;
  position: relative;
  overflow: hidden;
}
.welcome h1 { font-size: 2.1rem; color: white; margin: 0 0 0.5rem; }
.welcome p { color: rgba(255, 255, 255, 0.9); font-size: 1.05rem; max-width: 600px; }
.welcome .btn { background: white; color: var(--primary); border-color: white; font-weight: 600; }
.welcome .btn:hover { background: var(--primary-soft); color: var(--primary-hover); }

.muted { color: var(--text-muted); }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; background: var(--bg); padding: 0 0.3rem; border-radius: 4px; font-size: 0.9em; }
pre { background: var(--bg); padding: 1rem; border-radius: var(--radius); overflow-x: auto; }

/* Admin layout: persistent sidebar + content */
.admin-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 800px) {
  .admin-layout { grid-template-columns: 1fr; }
}

.admin-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  position: sticky;
  top: 1rem;
}
.admin-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem 0.5rem;
}
.admin-nav { display: flex; flex-direction: column; gap: 0.1rem; }
.admin-nav-group {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.85rem 0.5rem 0.25rem;
}
.admin-nav-link {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.92rem;
  border: 1px solid transparent;
}
.admin-nav-link:hover { background: var(--bg); text-decoration: none; }
.admin-nav-link.active {
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 500;
}
.admin-nav-link.active:hover { background: var(--primary); color: var(--primary-fg); }

.admin-main { min-width: 0; }

/* Standard page-header for every admin list / detail page.
   Replaces ad-hoc spread+h1 markup so action placement is consistent. */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.page-header h1 { margin: 0 0 0.15rem; }
.page-header-meta { color: var(--text-muted); font-size: 0.9rem; }
.page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: block;
}
.breadcrumb a { color: var(--text-muted); }
