/* Colour rules (Makerere DICTS guidelines: red #ff0000, green #009900, black).
   1. Neutrals carry the layout: black chrome, white surfaces, greys for text and lines.
   2. Green means "act here" or "you are here": primary buttons, links, active nav, focus,
      and the main series in charts.
   3. Red means "destructive" or "error": delete/deactivate buttons, error text, alerts,
      and a problem metric (e.g. failed sign-ins > 0).
   4. Status colours appear only on status badges (active / inactive).
   5. The pure brand colours appear decoratively in the top stripe and in charts
      (green, black, red + tints; red marks the problem series, e.g. missed meetings).
   Darker green/red shades keep text and buttons at WCAG AA contrast.
   Shape: square corners everywhere (no border-radius). */
:root {
  --mak-red: #ff0000;
  --mak-green: #009900;
  --mak-black: #000000;

  /* action (green) */
  --primary: #007a00;
  --primary-hover: #006100;
  /* destructive / error (red) */
  --danger: #c40000;
  --danger-hover: #a00000;
  --danger-soft: #fdeeee;
  /* status badges */
  --success-soft: #e8f3e8;
  --success-text: #005c00;

  /* neutrals */
  --text: #161616;
  --muted: #666666;
  --border: #e4e4e4;
  --surface: #ffffff;
  --page: #f5f5f5;
  --chrome: #111111;
  --chrome-raised: #232323;
  --chrome-text: #d9d9d9;
  --neutral-soft: #efefef;
  --stripe: #f7f7f7;
  --hover: #eeeeee;

  --radius: 0;
  --gap: 14px;
  --font: Verdana, Arial, Helvetica, sans-serif;
}

/* Base */
* { box-sizing: border-box; }
button, input, select, textarea { border-radius: 0; }
html { font-size: 13px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--page); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 6px; font-weight: bold; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Brand stripe: the only decorative use of the corporate colours */
.brand-stripe { height: 4px; background: linear-gradient(90deg, var(--mak-green) 0 33.3%, var(--mak-red) 33.3% 66.6%, var(--mak-black) 66.6%); }

/* Shell */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: calc(100vh - 4px); }
.sidebar { background: var(--chrome); color: var(--chrome-text); padding: 14px 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 2px 6px 14px; }
.brand:hover { color: #fff; text-decoration: none; }
.brand img { height: 36px; width: auto; background: #fff; padding: 2px; }
.brand-name { font-weight: bold; font-size: 0.92rem; line-height: 1.2; }
.nav-group { margin: 14px 8px 4px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #8a8a8a; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; color: var(--chrome-text); border-left: 2px solid transparent; }
.nav-link:hover { background: var(--chrome-raised); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--chrome-raised); color: #fff; border-left-color: var(--primary); }
.sidebar-collapse-btn { display: none; }
.main { padding: 0 24px 32px; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 60; display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); margin-bottom: 18px; color: var(--muted); background: var(--page); }

/* Page header */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap); flex-wrap: wrap; margin-bottom: 16px; }
.page-header p { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Cards and grids */
.card { background: var(--surface); border: 1px solid var(--border); padding: 16px; margin-bottom: var(--gap); }
.card-sub { margin: -2px 0 12px; }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-aside { grid-template-columns: minmax(260px, 1fr) 2fr; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card-head .icon { color: var(--muted); }
.card-head-end { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Card holding a table: table flush to the card edges */
.card-table { padding: 0; overflow: hidden; }
.card-table > .card-head { padding: 12px 16px; margin: 0; }
.card-table .pagination { padding: 8px 16px; margin: 0; }

/* Icons (Lucide, drawn lean) */
.icon { width: 16px; height: 16px; flex: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; line-height: 1.2; padding: 7px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #bdbdbd; color: var(--text); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-link { border: 0; background: none; color: var(--primary); padding: 0; }
.btn-sm { padding: 4px 9px; font-size: 0.88rem; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn:focus-visible, .nav-link:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.inline-form { display: inline; margin: 0; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions > * + * { margin-left: 4px; }

/* Tables: dark header, compact zebra rows */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { text-align: left; padding: 6px 16px; vertical-align: middle; }
.table th { background: var(--chrome); color: #fff; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 10px; padding-bottom: 10px; white-space: nowrap; }
.table tbody tr:nth-child(even) td { background: var(--stripe); }
.table tbody tr:hover td { background: var(--hover); }
.table td > a { font-weight: bold; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* List toolbar: search, extra filters, rows, Filter */
.toolbar { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; padding: 10px; }
.search { flex: 1 1 320px; display: flex; align-items: center; border: 1px solid #cfcfcf; background: #fff; }
.search .icon { margin: 0 8px 0 10px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; padding: 8px 8px 8px 0; font: inherit; background: transparent; }
.search input:focus { outline: none; }
.search:focus-within, .input-group:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
.input-group { display: flex; align-items: stretch; border: 1px solid #cfcfcf; background: #fff; }
.input-group > span { display: flex; align-items: center; padding: 0 10px; color: var(--muted); background: var(--stripe); border-right: 1px solid #cfcfcf; }
.input-group select, .input-group input { border: 0; padding: 6px 8px; font: inherit; background: #fff; min-width: 90px; }
.input-group select:focus, .input-group input:focus { outline: none; }
.btn-dark { background: var(--chrome); border-color: var(--chrome); color: #fff; justify-content: center; min-width: 110px; }
.btn-dark:hover { background: var(--chrome-raised); border-color: var(--chrome-raised); color: #fff; }

/* Row actions menu (⋮) */
.col-actions { width: 1%; text-align: center; white-space: nowrap; }
.menu { display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #bdbdbd; background: var(--surface); color: var(--text); }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { background: var(--chrome); border-color: var(--chrome); color: #fff; }
.menu > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.menu-list { position: fixed; z-index: 50; min-width: 190px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14); padding: 4px 0; text-align: left; }
.menu-list form { margin: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.menu-item .icon { color: var(--muted); }
.menu-danger, .menu-danger .icon, .menu-danger:hover { color: var(--danger); }
.nowrap { white-space: nowrap; }

/* Badges */
.badge { display: inline-block; padding: 1px 7px; font-size: 0.8rem; font-weight: bold; background: var(--neutral-soft); color: var(--text); margin: 0 4px 2px 0; }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-hover); }
.badge-muted { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.badge-id { background: var(--chrome); color: #fff; font-size: 0.75rem; }

/* Forms */
.form { max-width: 640px; }
.field { margin-bottom: 12px; }
.field > label, .field legend { display: block; font-weight: bold; margin-bottom: 4px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=date], .field select, .field textarea {
  width: 100%; font: inherit; padding: 6px 8px; border: 1px solid #cfcfcf; background: #fff;
}
.field textarea { min-height: 72px; }
.field .help { color: var(--muted); font-size: 0.88rem; margin-top: 3px; }
.field-check { display: flex; gap: 6px; align-items: center; }
.field-check label { font-weight: normal; margin: 0; }
.field ul, .checks { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.field ul label { font-weight: normal; display: inline-flex; gap: 6px; align-items: center; }
.errors { color: var(--danger); margin: 3px 0 0; padding: 0; list-style: none; display: block !important; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: var(--gap); }
.filters .field { margin: 0; min-width: 150px; }
.filters .field .help { display: none; }
.page-header > .dashboard-period { margin: 0 0 0 auto; justify-content: flex-end; }
.dashboard-period .field { min-width: 140px; }
.form-actions { display: flex; gap: 8px; margin-top: 6px; }
@media (max-width: 900px) { .page-header > .dashboard-period { width: 100%; margin-left: 0; justify-content: flex-start; } }

/* Alerts */
.messages { list-style: none; padding: 0; margin: 0 0 var(--gap); }
.alert { padding: 8px 12px; margin-bottom: 6px; border: 1px solid var(--border); border-left: 3px solid var(--muted); background: var(--surface); }
.alert-success { border-left-color: var(--primary); }
.alert-error { border-left-color: var(--danger); background: var(--danger-soft); }

/* Description lists */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* Pagination */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }

/* Modal dialogs */
.modal { border: 0; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); }
.modal::backdrop { background: rgba(0, 0, 0, 0.5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--chrome); color: #fff; }
.modal-head h2 { margin: 0; }
.modal-close { background: none; border: 0; color: #fff; cursor: pointer; padding: 2px; display: inline-flex; }
.modal-body { padding: 16px; overflow-y: auto; max-height: calc(100vh - 120px); }
.modal .form { max-width: none; }

/* Dashboard */
.quick-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.quick-actions h2, .quick-actions p { margin: 0; }
.dash-top { display: grid; grid-template-columns: minmax(260px, 1fr) 3fr; gap: var(--gap); margin-bottom: var(--gap); align-items: stretch; }
.dash-top.no-hero { grid-template-columns: 1fr; }
.dash-top .stats { margin: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; }
/* Compact, uniform stat widgets: one-line label and caption, equal heights in a row */
.stats { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); grid-auto-rows: 1fr; margin-bottom: var(--gap); }
.stat { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; background: var(--surface); border: 1px solid var(--border); padding: 12px 14px; color: var(--text); }
.stat:hover { border-color: #bdbdbd; color: var(--text); text-decoration: none; }
.stat-label, .stat-caption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label { font-weight: bold; }
.stat-value { font-size: 1.6rem; font-weight: bold; line-height: 1.1; margin: 6px 0 4px; }
.stat-caption { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 1200px) { .dash-top .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-danger .stat-value { color: var(--danger); }
.hero-stat { background: var(--chrome); color: #fff; padding: 18px; display: flex; flex-direction: column; }
.hero-label { font-weight: bold; color: var(--chrome-text); }
.hero-value { font-size: 2.6rem; font-weight: bold; margin: 6px 0 auto; }
.hero-foot { display: flex; justify-content: space-between; gap: 12px; color: var(--chrome-text); margin: 18px 0 8px; font-size: 0.9rem; }
.meter { height: 6px; background: #3a3a3a; }
.meter span { display: block; height: 100%; background: #fff; }
.dash-charts { display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; gap: var(--gap); }
.dash-charts .card { margin: 0; }
.donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut svg { width: 180px; height: 180px; flex: none; }
.donut circle ~ circle { transition: stroke-width 0.15s; cursor: default; }
.donut circle ~ circle:hover { stroke-width: 14; }
.donut-value { font-size: 17px; font-weight: bold; fill: var(--text); }
.donut-label { font-size: 6.5px; fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.legend b { margin-left: auto; }
.swatch { width: 12px; height: 12px; flex: none; }
.trend { width: 100%; height: auto; display: block; }
/* Charts use the brand palette: green bars, black or red line (red = problem series). */
.trend-wrap { --line: #111111; }
.trend-danger { --line: #d81b1b; }
.trend .grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; }
.trend .axis { font-size: 11px; fill: var(--muted); }
.trend .bar { fill: url(#trend-bar); }
.trend .bar:hover { fill: var(--mak-green); }
.trend .bar-value { font-size: 10px; font-weight: bold; fill: var(--primary-hover); }
.trend .area { fill: url(#trend-area-dark); }
.trend-danger .trend .area { fill: url(#trend-area-danger); }
.trend .line { fill: none; stroke: var(--line); stroke-width: 2; stroke-linejoin: round; }
.trend .dot { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.chart-legend { list-style: none; display: flex; gap: 18px; margin: 6px 0 0; padding: 0; color: var(--muted); font-size: 0.88rem; }
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.monthly-status-legend { flex-wrap: wrap; gap: 10px 22px; }
.monthly-line-key { width: 20px; height: 3px; display: inline-block; flex: none; }
.key { width: 12px; height: 12px; display: inline-block; }
.key-bar { background: linear-gradient(#1fb81f, #007a00); }
.key-line { height: 3px; background: var(--line); }

/* Tag picker (multi-select with removable tags) */
.req { color: var(--danger); }
.tag-box { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; padding: 8px; background: var(--stripe); border: 1px solid var(--border); align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; background: var(--chrome); color: #fff; font-size: 0.88rem; }
.tag-box > .tag:not(:has(.tag-remove)), .perm-row .tag { padding-right: 9px; }
.tag-group { opacity: 0.7; }
.tag-remove { border: 0; background: none; color: #fff; cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 0 4px; }
.tag-remove:hover { color: #ffb3b3; }
.tag-search { display: flex; margin-top: 8px; }
.tag-search .search { flex: 1; border-right: 0; }
.tag-options { display: block !important; list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-top: 0; max-height: 260px; overflow-y: auto; }
.tag-options li { border-bottom: 1px solid var(--border); }
.tag-options li:last-child { border-bottom: 0; }
.tag-options label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer; font-weight: normal !important; margin: 0; }
.tag-options label:hover { background: var(--hover); }
.tag-options input { width: 16px; height: 16px; accent-color: var(--chrome); }
.tag-options .tag-group { color: var(--muted); opacity: 1; }
.tag-none { padding: 10px 12px; }
.perm-row { display: grid; grid-template-columns: 170px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.perm-row:last-child { border-bottom: 0; }
.perm-row > span:last-child { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-module { color: var(--muted); font-weight: bold; }

/* Segmented choice (radio buttons as square toggles) */
.segmented { display: flex; flex-wrap: wrap; }
.seg { position: relative; margin: 0 -1px -1px 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 6px 12px; border: 1px solid #cfcfcf; background: var(--surface); cursor: pointer; font-weight: normal; }
.seg input:checked + span { background: var(--chrome); border-color: var(--chrome); color: #fff; position: relative; z-index: 1; }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; position: relative; z-index: 2; }

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid #cfcfcf; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.chip b { font-weight: normal; color: var(--muted); }
.chip:hover { border-color: #9a9a9a; color: var(--text); text-decoration: none; }
.chip.active { background: var(--chrome); border-color: var(--chrome); color: #fff; }
.chip.active b { color: var(--chrome-text); }
.chip:disabled { opacity: 0.45; cursor: default; }
.presets { margin: -6px 0 var(--gap); }

/* People */
.avatar { width: 36px; height: 36px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--chrome); color: #fff; font-weight: bold; font-size: 0.85rem; letter-spacing: 0.04em; }
.pair { display: flex; align-items: center; gap: 12px; }
.pair-avatars { display: flex; }
.pair-avatars .avatar + .avatar { margin-left: -6px; background: var(--muted); border: 2px solid var(--page); }
.pair h1 { margin: 0; }
.pair p { margin: 2px 0 0; }

/* Participant home: mentorship cards */
.m-cards { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: var(--gap); }
.m-card { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.m-card-ended { opacity: 0.75; }
.m-card-head { display: flex; gap: 12px; align-items: center; }
.m-card-name { font-weight: bold; font-size: 1.05rem; }
.m-card-facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.m-card-facts div { padding: 8px 0; }
.m-card-facts div + div { padding-left: 12px; border-left: 1px solid var(--border); }
.m-card-facts dt { color: var(--muted); font-size: 0.85rem; }
.m-card-facts dd { margin: 0; font-weight: bold; }
.section-title { margin: 8px 0 10px; }
.empty-state { text-align: center; padding: 32px 16px; }

/* Summary strip */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); background: var(--surface); border: 1px solid var(--border); margin-bottom: var(--gap); }
.strip div { padding: 10px 14px; display: flex; flex-direction: column; }
.strip div + div { border-left: 1px solid var(--border); }
.strip span { color: var(--muted); font-size: 0.85rem; }
.strip b { font-size: 1.15rem; }

/* Timeline */
.tl-controls { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.tl-filter-groups { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 18px 24px; }
.tl-filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tl-filter-label { color: var(--muted); font-size: 0.75rem; font-weight: bold; text-transform: uppercase; letter-spacing: 0.05em; }
.tl-filter-group .chips { gap: 5px; }
.tl-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.tl-tools .search { flex: 1 1 280px; }
@media (max-width: 700px) {
  .tl-filter-groups { gap: 12px; }
  .tl-filter-group { width: 100%; }
}
.tl-month { margin-bottom: 6px; }
.tl-month-label { position: sticky; top: 0; z-index: 2; background: var(--page); padding: 8px 0; margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.tl-list { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.tl-list::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 12px 26px; }
.tl-node { position: absolute; left: -22px; top: 10px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 2px solid var(--muted); color: var(--muted); z-index: 1; }
.tl-completed .tl-node { border-color: var(--primary); color: var(--primary); }
.tl-scheduled .tl-node { border-style: dashed; }
.tl-missed .tl-node { border-color: var(--danger); color: var(--danger); }
.tl-cancelled .tl-node { border-color: #bdbdbd; color: #9a9a9a; }
.tl-card { background: var(--surface); border: 1px solid var(--border); padding: 10px 14px; transition: border-color 0.15s; }
.tl-card:hover { border-color: #bdbdbd; }
.tl-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.tl-when { color: var(--muted); font-size: 0.85rem; }
.tl-topic { font-weight: bold; font-size: 1.02rem; }
.tl-cancelled .tl-topic { text-decoration: line-through; color: var(--muted); }
.tl-meta { display: flex; align-items: center; gap: 6px; }
.tl-meta .badge { margin: 0; }
.tl-sub { font-size: 0.88rem; margin-top: 2px; }
.tl-details { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }
.tl-details summary { cursor: pointer; color: var(--primary); }
.tl-details p { margin: 8px 0 0; }
.tl-next { padding: 8px 10px; background: var(--stripe); border-left: 2px solid var(--primary); }

/* Breakdown tables */
.inline-meter { display: inline-block; width: 60px; height: 6px; background: var(--neutral-soft); vertical-align: middle; margin-right: 6px; }
.inline-meter span { display: block; height: 100%; background: var(--primary); }

/* Alert dialog (SweetAlert-style) */
.alert-dialog { border: 0; padding: 26px 26px 20px; width: min(440px, calc(100vw - 32px)); text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); border-top: 4px solid var(--chrome); }
.alert-dialog[data-tone="danger"] { border-top-color: var(--danger); }
.alert-dialog[data-tone="success"] { border-top-color: var(--primary); }
.alert-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.alert-icon { display: inline-flex; width: 56px; height: 56px; align-items: center; justify-content: center; border: 2px solid currentColor; color: var(--chrome); margin-bottom: 12px; }
.alert-icon .icon { width: 28px; height: 28px; }
.alert-dialog[data-tone="danger"] .alert-icon { color: var(--danger); }
.alert-dialog[data-tone="success"] .alert-icon { color: var(--primary); }
.alert-dialog h2 { font-size: 1.2rem; margin-bottom: 8px; }
.alert-body { color: var(--muted); text-align: left; }
.alert-body ul { margin: 8px 0 0; padding-left: 18px; }
.alert-body li { margin-bottom: 6px; color: var(--text); }
.alert-actions { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: var(--danger-hover); color: #fff; }
.alert-warning { border-left-color: var(--chrome); background: var(--stripe); }
.alert-warning ul { margin: 6px 0 8px; padding-left: 18px; }

/* Toasts */
.toasts { position: fixed; top: 52px; right: 14px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 28px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--chrome); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15); animation: toast-in 0.2s ease-out; transition: opacity 0.4s, transform 0.4s; }
.toast span { flex: 1; }
.toast-success { border-left-color: var(--primary); }
.toast-error { border-left-color: var(--danger); background: var(--danger-soft); }
.toast-out { opacity: 0; transform: translateX(20px); }
.toast-close { border: 0; background: none; font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--muted); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Reminders */
.reminders { list-style: none; margin: 0; padding: 0; }
.reminder { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.reminder:last-child { border-bottom: 0; }
.reminder-icon { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; border: 2px solid var(--muted); color: var(--muted); }
.reminder-danger .reminder-icon { border-color: var(--danger); color: var(--danger); }
.reminder-warning .reminder-icon { border-color: var(--chrome); color: var(--chrome); }
.reminder-success .reminder-icon { border-color: var(--primary); color: var(--primary); }
.reminder-text { flex: 1; display: flex; flex-direction: column; }
.reminder-empty { display: flex; gap: 8px; align-items: center; color: var(--primary); padding: 10px 0; }
.badge-warning { background: var(--chrome); color: #fff; }
.card-pad { padding: 0 16px; margin: -4px 0 10px; }
.grid-aside-wide { grid-template-columns: minmax(320px, 1.2fr) 1fr; align-items: start; }
.m-cards-narrow { grid-template-columns: 1fr; }

/* Sign-in */
.auth { min-height: calc(100vh - 4px); display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, rgba(17, 17, 17, 0.72), rgba(17, 17, 17, 0.45) 55%, rgba(0, 61, 0, 0.55)), url("../img/login-bg.jpg") 50% 40% / cover no-repeat, var(--chrome); }
.auth-panel { width: 100%; max-width: 400px; }
.auth-card { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); border: 0; border-top: 4px solid var(--primary); padding: 24px; }
.auth-foot { text-align: center; color: rgba(255, 255, 255, 0.85); margin: 14px 0 0; font-size: 0.88rem; letter-spacing: 0.03em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.auth-foot a { color: #fff; text-decoration: underline; }
.auth-card { width: 100%; }
.auth-card .brand { color: var(--text); justify-content: center; flex-direction: column; text-align: center; }
.auth-card .brand img { height: 64px; }

@media (max-width: 900px) {
  .shell, .dash-top, .dash-charts, .grid-aside, .grid-aside-wide { grid-template-columns: 1fr; }
  .main { padding: 0 16px 28px; }
}

/* Horizontal percentage bars (engagement by course/year) */
.hbars { list-style: none; margin: 0; padding: 0; }
.hbars li { display: grid; grid-template-columns: minmax(170px, 280px) 1fr 48px minmax(150px, 230px); gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.hbars li:last-child { border-bottom: 0; }
.hbar-label { font-weight: bold; }
.hbar-track { height: 14px; background: var(--neutral-soft); }
.hbar-fill { display: block; height: 100%; transition: width 0.4s ease-out; }
.hbar-good { background: linear-gradient(90deg, #1fb81f, #007a00); }
.hbar-mid { background: #ed8b00; }
.hbar-low { background: #d81b1b; }
.hbar-value { text-align: right; }
.hbar-note { font-size: 0.85rem; }
@media (max-width: 900px) { .hbars li { grid-template-columns: 1fr 48px; } .hbar-track { grid-column: 1 / -1; grid-row: 2; } .hbar-note { grid-column: 1 / -1; } }
.stack > .card { margin-bottom: var(--gap); }

/* System configuration */
.logo-preview { display: flex; align-items: center; justify-content: center; min-height: 120px; padding: 12px; background: #fff; border: 1px dashed var(--border); margin-bottom: 8px; }
.logo-preview img { max-width: 100%; max-height: 140px; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--page); padding: 12px 0; align-items: center; border-top: 1px solid var(--border); }
.auth-org { text-align: center; margin: -6px 0 14px; }
.field input[type=url], .field input[type=file] { width: 100%; font: inherit; padding: 6px 8px; border: 1px solid #cfcfcf; background: #fff; }
.sidebar .brand { flex-direction: column; align-items: stretch; gap: 8px; }
.sidebar .brand img { height: auto; max-height: 72px; width: 100%; object-fit: contain; background: #fff; padding: 6px; }
/* Wide screens: card sits in the open sky on the left so the reaching hands stay visible. */
@media (min-width: 1000px) {
  .auth { justify-items: start; padding-left: 8vw; }
}

/* Branded hero card: Makerere green with a large faint mortarboard behind the number */
.hero-stat { position: relative; overflow: hidden; }
.hero-stat > *:not(.hero-art) { position: relative; z-index: 1; }
.hero-green { background: linear-gradient(140deg, #0f9a0f 0%, #007a00 45%, #004d00 100%); }
.hero-green .hero-label, .hero-green .hero-foot { color: rgba(255, 255, 255, 0.88); }
.hero-green .meter { background: rgba(255, 255, 255, 0.25); }
.hero-art { position: absolute; right: -36px; bottom: -44px; color: #fff; opacity: 0.14; pointer-events: none; }
.hero-art .icon { width: 230px; height: 230px; stroke-width: 1.1; }

/* Stat card icon: large and faint in the background (like the hero mortarboard) */
.stat { position: relative; overflow: hidden; }
.stat > *:not(.stat-art) { position: relative; z-index: 1; }
.stat-art { position: absolute; right: -6px; bottom: -8px; color: var(--chrome); opacity: 0.07; pointer-events: none; transition: opacity 0.15s; }
.stat-art .icon { width: 60px; height: 60px; stroke-width: 1.3; }
.stat:hover .stat-art { opacity: 0.12; }
.stat-danger .stat-art { color: var(--danger); opacity: 0.12; }
.locked-note { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; padding: 10px 12px; background: var(--stripe); border-left: 3px solid var(--chrome); color: var(--muted); }
.locked-note .icon { flex: none; color: var(--chrome); margin-top: 2px; }
.auth-links { margin: 14px 0 0; text-align: center; font-size: 0.92rem; }

/* Side nav stays fixed while the page scrolls (scrolls on its own if taller than the screen) */
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; align-self: start; }
@media (min-width: 901px) {
  .sidebar-collapse-btn { display: inline-flex; }
  .shell { transition: grid-template-columns 0.2s ease; }
  .sidebar-collapsed .shell { grid-template-columns: 64px 1fr; }
  .sidebar-collapsed .sidebar { padding-right: 6px; padding-left: 6px; }
  .sidebar-collapsed .sidebar .brand { justify-content: center; padding-right: 0; padding-left: 0; }
  .sidebar-collapsed .sidebar .brand img { width: 40px; height: 40px; object-fit: contain; }
  .sidebar-collapsed .sidebar .brand-name,
  .sidebar-collapsed .sidebar .nav-group { display: none; }
  .sidebar-collapsed .sidebar .nav-link { justify-content: center; padding-right: 0; padding-left: 0; border-left-width: 0; }
  .sidebar-collapsed .sidebar .nav-link { cursor: pointer; }
  .sidebar-collapsed .sidebar .nav-link .icon { width: 20px; height: 20px; }
  .sidebar-collapsed .sidebar .nav-link span {
    display: block;
    position: fixed;
    z-index: 180;
    left: 62px;
    transform: translate(0, 0);
    width: max-content;
    max-width: 240px;
    padding: 7px 10px;
    border: 1px solid #3a3a3a;
    background: var(--chrome-raised);
    color: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
  }
  .sidebar-collapsed .sidebar .nav-link:hover span,
  .sidebar-collapsed .sidebar .nav-link:focus-visible span {
    opacity: 1;
    visibility: visible;
  }
}
/* Small screens: the sidebar becomes a drawer opened from the top bar */
@media (max-width: 900px) {
  .sidebar-collapse-btn { display: none !important; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: min(280px, 85vw); height: 100vh; z-index: 160; overflow-y: auto; transform: translateX(-100%); transition: transform 0.2s ease-out; box-shadow: 0 0 40px rgba(0, 0, 0, 0.35); }
  .drawer-open .sidebar { transform: none; }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, 0.5); }
  .drawer-open { overflow: hidden; }
  .topbar { justify-content: space-between; }
  .topbar-user { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (min-width: 901px) { .drawer-open-btn, .drawer-close, .drawer-backdrop { display: none !important; } }
.drawer-close { display: flex; margin-left: auto; background: none; border: 0; color: #fff; cursor: pointer; padding: 4px; }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
.steps { margin: 0; padding-left: 20px; line-height: 1.7; }

/* Loading overlay: translucent, square, brand colours */
.loading { position: fixed; inset: 0; z-index: 200; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; display: flex; align-items: center; justify-content: center; background: rgba(245, 245, 245, 0.6); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity 0.15s, visibility 0.15s; }
.loading:not([open]) { display: none; }
.loading::backdrop { background: transparent; }
.loading.is-on { opacity: 1; visibility: visible; }
.loading-box { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--chrome); color: #fff; font-weight: bold; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25); border-top: 3px solid var(--primary); }
.loading-bars { display: inline-flex; gap: 4px; align-items: flex-end; height: 18px; }
.loading-bars i { width: 5px; height: 100%; background: var(--mak-green); animation: loading-bar 0.9s ease-in-out infinite; }
.loading-bars i:nth-child(2) { background: var(--mak-red); animation-delay: 0.15s; }
.loading-bars i:nth-child(3) { background: #fff; animation-delay: 0.3s; }
@keyframes loading-bar { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .loading-bars i { animation: none; } }

/* Reports: compact two-column grid of sections */
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.report-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.report-col .card, .report-wide .dash-top { margin: 0; }
.report-wide { margin-bottom: var(--gap); }
.report-toolbar { padding: 8px 10px; gap: 5px; align-items: center; }
.report-toolbar .input-group { min-width: 0; }
.report-toolbar .input-group > span { padding-right: 6px; padding-left: 6px; font-size: 0.82rem; }
.report-toolbar .input-group select,
.report-toolbar .input-group input { min-width: 0; padding: 6px 5px; font-size: 0.82rem; }
.report-toolbar .input-group input[type="date"] { width: 124px; }
.report-toolbar .input-group select { width: 108px; }
.report-toolbar .btn-dark { min-width: 82px; padding-right: 9px; padding-left: 9px; }
.report-toolbar .chips { margin-left: 0; flex-wrap: nowrap; gap: 4px; }
.report-toolbar .chip { padding: 4px 6px; font-size: 0.78rem; white-space: nowrap; }
.report-toolbar .btn-link { flex: 0 0 auto; white-space: nowrap; font-size: 0.82rem; }
@media (max-width: 1500px) {
  .report-toolbar { flex-wrap: wrap; }
  .report-toolbar .chips { margin-left: auto; }
}
.report-split { display: flex; justify-content: center; margin-bottom: 10px; }
.report-split .donut svg { width: 140px; height: 140px; }
.status-counts { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 0; padding: 0; }
.status-counts li { display: flex; justify-content: space-between; gap: 10px; }
.report-grid .hbars li { grid-template-columns: minmax(150px, 220px) 1fr 44px; }
.report-grid .hbar-note { display: none; }
@media (max-width: 1100px) { .report-grid { grid-template-columns: 1fr; } }
.rate-chart .rate-good { fill: url(#rate-good); }
.rate-chart .rate-mid { fill: #ed8b00; }
.rate-chart .rate-low { fill: #d81b1b; }

/* Dashboard: mentor types, course and year charts side by side (narrow bars: no notes) */
.dash-charts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-charts-3 .monthly-chart-card { grid-column: 2 / -1; }
.dash-charts-3 .hbars li, .report-grid .hbars li { grid-template-columns: minmax(110px, 1fr) 1.3fr 44px; }
.dash-charts-3 .hbar-note { display: none; }
@media (max-width: 1200px) {
  .dash-charts-3 { grid-template-columns: 1fr 1fr; }
  .dash-charts-3 .monthly-chart-card { grid-column: 1 / -1; }
}
@media (max-width: 900px) { .dash-charts-3 { grid-template-columns: 1fr; } }
.table.breakdown { table-layout: auto; }
.table.breakdown th, .table.breakdown td { padding-left: 10px; padding-right: 10px; }
.table.breakdown .inline-meter { width: 36px; margin-right: 6px; }

/* Stacked met / not-met bars (engagement by course, year, group) */
.hbar-stack { display: flex; height: 18px; background: none; }
.hbar-met, .hbar-unmet { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; color: #fff; font-size: 0.75rem; font-weight: bold; }
.hbar-met { background: linear-gradient(90deg, #15966d, #006b4f); }
.hbar-unmet { background: #8b2f4b; }
.hbar-met + .hbar-unmet { border-left: 2px solid #fff; }
.key.hbar-met, .key.hbar-unmet { font-size: 0; }

/* Top bar account dropdown */
.topbar-spacer { flex: 1; }
.account-menu > summary.account-button { width: auto; height: auto; display: inline-flex; gap: 8px; align-items: center; padding: 4px 8px 4px 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.account-menu > summary.account-button:hover, .account-menu[open] > summary.account-button { background: var(--surface); border-color: #9a9a9a; color: var(--text); }
.account-menu .avatar { width: 28px; height: 28px; font-size: 0.75rem; }
.account-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: bold; }
.menu-head { display: flex; flex-direction: column; padding: 8px 14px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
@media (max-width: 600px) { .account-name { display: none; } }

/* Custom charts on saved reports */
.chart-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); margin-top: var(--gap); align-items: start; }
.chart-grid .card { margin: 0; }
.chart-grid .span-all { grid-column: 1 / -1; }
.chart-grid .width-third { grid-column: span 4; }
.chart-grid .width-half { grid-column: span 6; }
.chart-grid .width-two_thirds { grid-column: span 8; }
.chart-grid .width-three_quarters { grid-column: span 9; }
.chart-grid .card-table > .card-head { padding: 12px 16px; margin: 0; }
@media (max-width: 1100px) { .chart-grid { grid-template-columns: 1fr; } .chart-grid > section { grid-column: 1 / -1; } }

/* Top bar in the theme's black, edge to edge across the content area */
.topbar { background: var(--chrome); color: var(--chrome-text); border-bottom: 0; margin: 0 -24px 18px; padding: 8px 24px; }
.topbar .btn { background: var(--chrome-raised); border-color: #3a3a3a; color: #fff; }
.topbar .account-menu > summary.account-button { background: var(--chrome-raised); border-color: #3a3a3a; color: #fff; }
.topbar .account-menu > summary.account-button:hover, .topbar .account-menu[open] > summary.account-button { background: #333; border-color: #555; color: #fff; }
.topbar .account-menu .avatar { background: var(--primary); }
@media (max-width: 900px) { .topbar { margin: 0 -16px 16px; padding: 8px 16px; } }

/* Cards (and card-like panels) get a 2px radius; buttons, inputs, badges and tables stay square */
.card, .stat, .hero-stat, .tl-card, .m-card, .strip, .toolbar, .quick-actions, .menu-list, .modal, .alert-dialog, .toast, .loading-box { border-radius: 2px; }
.card-table { overflow: hidden; }
.trend { max-height: 300px; }  /* full-width cards: keep labels a normal size */

/* Slim scrollbars: ultra-thin, no track background (side nav, tables, modals, pickers) */
.sidebar, .table-wrap, .modal-body, .tag-options, .menu-list { scrollbar-width: thin; scrollbar-color: #8a8a8a transparent; }
.sidebar { scrollbar-color: #3a3a3a transparent; }
.sidebar::-webkit-scrollbar, .table-wrap::-webkit-scrollbar, .modal-body::-webkit-scrollbar, .tag-options::-webkit-scrollbar { width: 3px; height: 3px; }
.sidebar::-webkit-scrollbar-track, .table-wrap::-webkit-scrollbar-track, .modal-body::-webkit-scrollbar-track, .tag-options::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb, .tag-options::-webkit-scrollbar-thumb { background: #b0b0b0; }
.sidebar::-webkit-scrollbar-thumb { background: #3a3a3a; }
.sidebar:hover::-webkit-scrollbar-thumb { background: #5a5a5a; }

/* Chart-type switcher on custom charts */
.type-switch { display: inline-flex; margin: 0; }
.type-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid var(--border); margin-left: -1px; background: var(--surface); color: var(--muted); cursor: pointer; }
.type-btn:hover:not(:disabled) { color: var(--text); border-color: #9a9a9a; position: relative; }
.type-btn.active { background: var(--chrome); border-color: var(--chrome); color: #fff; cursor: default; }
.type-btn:disabled:not(.active) { opacity: 0.35; cursor: not-allowed; }
.type-btn .icon { width: 15px; height: 15px; }

/* Custom reports: back link, builder, gap-free chart grid */
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--text); }
.back-link svg { width: 16px; height: 16px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--muted); }
.icon-btn:hover { border-color: #cfcfcf; color: var(--primary); }
.icon-btn svg { width: 16px; height: 16px; }
.builder { max-width: none; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: var(--gap); align-items: start; }
.builder > .card { margin: 0; }
.builder > .messages { grid-column: 1 / -1; margin: 0; }
.metric-row { border: 1px solid var(--border, #e5e5e5); border-left: 3px solid var(--chrome); padding: 4px 14px 2px; margin: 0 0 12px; min-width: 0; }
.metric-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0; font-size: 13px; }
.metric-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.metric-look { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.metric-look .seg svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
@media (max-width: 1100px) { .builder { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .metric-fields, .metric-look { grid-template-columns: 1fr; } }
.chart-grid { align-items: stretch; grid-auto-flow: row dense; }  /* smaller charts fill open grid spaces */
.chart-grid > section > .card { height: 100%; }
.nav-link.active, .nav-link.active:hover { background: var(--mak-green); color: #fff; border-left-color: #fff; }

/* Report downloads: Download PDF prints just the report (choose "Save as PDF") */
.chart-image-btn { width: 30px; height: 30px; }
@media print {
  @page { margin: 12mm; }
  .shell { display: block; }
  .sidebar, .topbar, .drawer-backdrop, .back-link, .page-header .actions, .report-toolbar, .card-head-end, .messages, #modal { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
  .chart-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .chart-grid > section { break-inside: avoid; }
  .card { box-shadow: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Mobile table cards: each row becomes a card of "Label  value" lines (labels from static/js/table_cards.js) */
@media (max-width: 700px) {
  .card-table { background: none; border: 0; overflow: visible; }
  .card-table > .card-head { padding: 0 0 10px; }
  .table-wrap { overflow: visible; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table { background: none; }
  .table thead { display: none; }
  .table tbody tr { position: relative; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--mak-green); border-radius: 2px; padding: 10px 12px; margin-bottom: 10px; }
  .table tbody tr td, .table tbody tr:nth-child(even) td, .table tbody tr:hover td { background: none; }
  .table td { position: relative; padding: 4px 0 4px 38%; min-height: 26px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .table td::before { content: attr(data-label); position: absolute; left: 0; top: 6px; width: calc(38% - 10px); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
  .table td:not([data-label]), .table td.empty { padding-left: 0; }
  .table td:not([data-label])::before, .table td.col-actions::before { content: none; }
  .table td.col-actions { position: absolute; top: 6px; right: 6px; width: auto; padding: 0; display: block; }
  .table tbody tr:has(.col-actions) td:first-child { padding-right: 36px; }
  .table td.empty { text-align: center; }
  .table tbody tr:has(td.empty) { border-left-color: var(--border); }
}
.favicon-row { display: flex; align-items: center; gap: 10px; margin: 16px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Profile pictures */
img.avatar { object-fit: cover; padding: 0; background: var(--neutral-soft); }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 1.6rem; }
.avatar-current { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.crop-panel { margin: 4px 0 12px; }
.crop-stage { position: relative; width: min(280px, 100%); aspect-ratio: 1; overflow: hidden; background: #222; cursor: grab; touch-action: none; border-radius: 2px; }
.crop-stage:active { cursor: grabbing; }
.crop-stage:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.crop-stage img { position: absolute; top: 0; left: 0; transform-origin: 0 0; max-width: none; user-select: none; pointer-events: none; }
.crop-stage::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7); pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: 8px; width: min(280px, 100%); margin-top: 8px; color: var(--muted); }
.crop-zoom input { flex: 1; accent-color: var(--primary); }
.crop-zoom svg { width: 18px; height: 18px; }
