/* =====================================================================
   ViSense Learner Wellness Portal — Built by Vikele Solutions
   https://vikelesolutions.co.za
   ---------------------------------------------------------------------
   ViSense Learner Wellness Portal — design system
   ---------------------------------------------------------------------
   Aesthetic: "Editorial Almanac". Warm paper ground, deep ink navy,
   a single copper accent, and a serif display face paired with a clean
   grotesque for the working text. It reads like a well-set field
   journal rather than a generic SaaS dashboard — deliberately not the
   usual purple-gradient admin template.

   Everything is theme-token driven so a second accent (or a full dark
   mode) is a variable swap, not a rewrite.
   ===================================================================== */

/* ---- Fonts (self-hosted, no external calls) ---- */
:root {
  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---- Palette ---- */
:root {
  /* Paper & ink */
  --paper:      #efe9dc;   /* app background */
  --paper-2:    #e7e0cf;   /* sunk areas */
  --card:       #fbf8f1;   /* raised surfaces */
  --card-edge:  #ddd3bd;
  --ink:        #1f2a37;   /* primary text / brand navy */
  --ink-soft:   #3d4652;
  --ink-mute:   #6f6a5c;
  --ink-faint:  #928c7c;

  /* Accent — copper */
  --accent:     #b5643c;
  --accent-2:   #cf7a4e;
  --accent-ink: #7c3d21;
  --accent-wash:#f3e2d6;

  /* RAG */
  --green:   #3f7d5b;  --green-wash:  #dcebe0;  --green-ink:  #23503a;
  --amber:   #c68a2e;  --amber-wash:  #f5e7cc;  --amber-ink:  #8a5c14;
  --red:     #b0483f;  --red-wash:    #f2d9d5;  --red-ink:    #7c2c26;
  --muted:   #8b8577;  --muted-wash:  #e6e0d1;

  /* Feedback */
  --ok:    var(--green);
  --warn:  var(--amber);
  --err:   var(--red);
  --info:  #3a6079;

  /* Structure */
  --radius:      14px;
  --radius-sm:   9px;
  --radius-lg:   22px;
  --line:        #d8cfb8;
  --shadow-sm:   0 1px 2px rgba(31,42,55,.06), 0 1px 3px rgba(31,42,55,.05);
  --shadow-md:   0 4px 14px rgba(31,42,55,.09), 0 2px 6px rgba(31,42,55,.06);
  --shadow-lg:   0 18px 48px rgba(31,42,55,.16), 0 6px 16px rgba(31,42,55,.10);
  --shadow-in:   inset 0 1px 2px rgba(31,42,55,.10);

  --sidebar-w:   264px;
  --header-h:    68px;
  --ease:        cubic-bezier(.2,.7,.2,1);
}

/* Optional accent themes selectable in Settings */
:root[data-accent="teal"]   { --accent:#2f7d78; --accent-2:#3f978f; --accent-ink:#1e5450; --accent-wash:#d8eae7; }
:root[data-accent="plum"]   { --accent:#7d4b74; --accent-2:#9a6390; --accent-ink:#563350; --accent-wash:#ecdeea; }
:root[data-accent="forest"] { --accent:#4b7a3f; --accent-2:#5f9451; --accent-ink:#33522b; --accent-wash:#e0ecda; }
:root[data-accent="indigo"] { --accent:#41508e; --accent-2:#5a6ab0; --accent-ink:#2b3564; --accent-wash:#dfe2f0; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(181,100,60,.06), transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(31,42,55,.05), transparent 46%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); font-weight: 560; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
p { margin: 0 0 1em; }
small { font-size: .8rem; }
hr { border: none; border-top: 1px solid var(--line); margin: 1.4rem 0; }
::selection { background: var(--accent-wash); color: var(--accent-ink); }

/* =====================================================================
   Layout shell
   ===================================================================== */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(178deg, #212d3b 0%, #1a2430 100%);
  color: #cdd4dd;
  display: flex; flex-direction: column;
  border-right: 1px solid #11181f;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 22px 16px; }
.brand .mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  display: grid; place-items: center; color: #fff;
  font-family: var(--font-display); font-weight: 600; font-size: 20px;
  box-shadow: 0 4px 12px rgba(181,100,60,.4), var(--shadow-in);
}
.brand .brand-name { font-family: var(--font-display); font-size: 1.12rem; color: #fff; line-height: 1.1; letter-spacing: .01em; }
.brand .brand-sub  { font-size: .68rem; text-transform: uppercase; letter-spacing: .18em; color: #7f8a97; margin-top: 2px; }

.nav { flex: 1; overflow-y: auto; padding: 6px 12px 20px; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: #2c3846; border-radius: 8px; }
.nav-group { margin-top: 16px; }
.nav-group > .label { font-size: .64rem; text-transform: uppercase; letter-spacing: .16em; color: #6b7684; padding: 6px 12px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; margin: 1px 0;
  color: #b7c0cb; font-size: .9rem; font-weight: 480;
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.nav a .ico { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav a.is-active {
  background: linear-gradient(90deg, rgba(181,100,60,.24), rgba(181,100,60,.06));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--accent-2);
}
.nav a.is-active .ico { opacity: 1; color: var(--accent-2); }
.nav .badge-count { margin-left: auto; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 600; padding: 1px 7px; border-radius: 20px; }

.sidebar-foot { padding: 12px; border-top: 1px solid #2a3542; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 11px; transition: background .16s; }
.userchip:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.userchip .avatar { width: 34px; height: 34px; flex: none; }
.userchip .u-name { color: #fff; font-size: .85rem; font-weight: 520; line-height: 1.2; }
.userchip .u-role { color: #7f8a97; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; }

/* Main column */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 30px;
  background: rgba(251,248,241,.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--card-edge);
}
.topbar .crumbs { font-size: .82rem; color: var(--ink-mute); display: flex; align-items: center; gap: 8px; }
.topbar .crumbs .sep { color: var(--ink-faint); }
.topbar .page-h1 { font-family: var(--font-display); font-size: 1.28rem; color: var(--ink); margin: 0; }
.topbar .spacer { flex: 1; }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--ink); }

.content { padding: 30px; max-width: 1360px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .titles { min-width: 0; }
.page-head h1 { margin: 0; }
.page-head .lead { color: var(--ink-mute); margin: 4px 0 0; font-size: .95rem; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* =====================================================================
   Cards & surfaces
   ===================================================================== */
.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.card.pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: rgba(0,0,0,.015); border-radius: 0 0 var(--radius) var(--radius); }

.stack > * + * { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.section-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .16em; color: var(--ink-faint); font-weight: 600; margin-bottom: 10px; }

/* =====================================================================
   Stat tiles
   ===================================================================== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--card-edge); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::after { content:""; position:absolute; right:-30px; top:-30px; width:90px; height:90px; border-radius:50%; background: var(--accent-wash); opacity:.5; }
.stat .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-mute); font-weight: 600; position: relative; }
.stat .v { font-family: var(--font-display); font-size: 2.15rem; color: var(--ink); line-height: 1; margin: 8px 0 2px; position: relative; }
.stat .sub { font-size: .8rem; color: var(--ink-faint); position: relative; }
.stat.tone-green::after { background: var(--green-wash); }
.stat.tone-amber::after { background: var(--amber-wash); }
.stat.tone-red::after   { background: var(--red-wash); }
.stat.tone-green .v { color: var(--green-ink); } .stat.tone-amber .v { color: var(--amber-ink); } .stat.tone-red .v { color: var(--red-ink); }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  --b: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-size: .875rem; font-weight: 560;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s var(--ease), box-shadow .16s var(--ease), background .16s, border-color .16s;
  white-space: nowrap; line-height: 1.2; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: linear-gradient(160deg, var(--accent-2), var(--accent)); color: #fff; box-shadow: 0 2px 8px rgba(181,100,60,.32); }
.btn-primary:hover { box-shadow: 0 5px 16px rgba(181,100,60,.42); text-decoration: none; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #16202b; text-decoration: none; }
.btn-ghost { background: var(--card); border-color: var(--card-edge); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn-soft { background: var(--accent-wash); color: var(--accent-ink); }
.btn-soft:hover { background: #eed6c6; text-decoration: none; }
.btn-danger { background: var(--red); color: #fff; } .btn-danger:hover { background: var(--red-ink); text-decoration:none; }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: .95rem; }
.btn-block { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; border-right-width: 0; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; border-right-width: 1px; }

/* =====================================================================
   Forms
   ===================================================================== */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field .hint { font-size: .78rem; color: var(--ink-faint); margin-top: 5px; }
.req { color: var(--accent); }

.input, .select, .textarea, input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; font-family: inherit; font-size: .9rem; color: var(--ink);
  background: #fffdf8; border: 1px solid var(--card-edge); border-radius: 10px;
  padding: 10px 12px; transition: border-color .15s, box-shadow .15s, background .15s;
  box-shadow: var(--shadow-in);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash);
  background: #fff;
}
.input.err, input.err, select.err, textarea.err { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }
.field-error { color: var(--red-ink); font-size: .78rem; margin-top: 5px; display: flex; gap: 5px; align-items: center; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236f6a5c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; margin: 0 0 18px; }
legend { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); padding: 0 8px; }

.check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check .c-body .c-title { font-weight: 520; color: var(--ink); font-size: .88rem; }
.check .c-body .c-help { font-size: .78rem; color: var(--ink-faint); }

/* Toggle */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 42px; height: 24px; border-radius: 20px; background: var(--muted-wash); border: 1px solid var(--card-edge); transition: background .18s; position: relative; flex: none; }
.switch .track::after { content:""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .18s var(--ease); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* Segmented radios (allow / inherit / deny) */
.segment { display: inline-flex; border: 1px solid var(--card-edge); border-radius: 9px; overflow: hidden; background: #fffdf8; }
.segment label { padding: 5px 12px; font-size: .78rem; font-weight: 560; cursor: pointer; color: var(--ink-mute); transition: background .14s, color .14s; border-right: 1px solid var(--card-edge); }
.segment label:last-child { border-right: none; }
.segment input { position: absolute; opacity: 0; }
.segment input:checked + label { color: #fff; }
.segment .seg-allow input:checked + label { background: var(--green); }
.segment .seg-inherit input:checked + label { background: var(--muted); }
.segment .seg-deny input:checked + label { background: var(--red); }

/* =====================================================================
   Tables
   ===================================================================== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--card-edge); background: var(--card); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.data th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-mute); font-weight: 700; padding: 12px 16px; background: var(--paper-2); border-bottom: 1px solid var(--card-edge); white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--accent-wash); }
table.data tr.clickable { cursor: pointer; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: .82rem; }
table.data .shrink { width: 1%; white-space: nowrap; }
.table-foot { display:flex; align-items:center; justify-content:space-between; padding: 12px 16px; font-size:.82rem; color: var(--ink-mute); }

/* =====================================================================
   Badges, pills, RAG dots
   ===================================================================== */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 20px; letter-spacing: .01em; white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-wash); color: var(--green-ink); }
.badge-amber { background: var(--amber-wash); color: var(--amber-ink); }
.badge-red   { background: var(--red-wash);   color: var(--red-ink); }
.badge-muted { background: var(--muted-wash); color: var(--ink-mute); }
.badge-ink   { background: #dfe4ea; color: var(--ink); }
.badge-accent{ background: var(--accent-wash); color: var(--accent-ink); }
.badge-outline { background: transparent; border: 1px solid var(--card-edge); color: var(--ink-mute); }

.rag { display: inline-flex; align-items: center; gap: 7px; font-weight: 560; font-size: .82rem; }
.rag .rag-dot { width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0,0,0,.04); flex: none; }
.rag.green .rag-dot { background: var(--green); } .rag.green { color: var(--green-ink); }
.rag.amber .rag-dot { background: var(--amber); } .rag.amber { color: var(--amber-ink); }
.rag.red   .rag-dot { background: var(--red); }   .rag.red   { color: var(--red-ink); }
.rag.pending .rag-dot { background: var(--muted); } .rag.pending { color: var(--ink-mute); }

/* Avatar */
.avatar { border-radius: 50%; display: inline-grid; place-items: center; font-weight: 600; color: #fff; font-size: .8rem; flex: none; background: hsl(var(--h,20) 42% 46%); box-shadow: var(--shadow-sm); }
.avatar.sq { border-radius: 10px; }

/* Person cell */
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person .avatar { width: 36px; height: 36px; }
.person .p-name { font-weight: 560; color: var(--ink); line-height: 1.2; }
.person .p-sub { font-size: .76rem; color: var(--ink-faint); }

/* =====================================================================
   Flash / alerts
   ===================================================================== */
.flashes { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.flash { display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow-lg); border-left: 4px solid var(--info); animation: slidein .35s var(--ease); }
.flash .ico { flex: none; margin-top: 1px; }
.flash .f-msg { font-size: .88rem; color: var(--ink-soft); }
.flash button { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--ink-faint); padding: 2px; }
.flash.ok   { border-left-color: var(--green); } .flash.ok .ico { color: var(--green); }
.flash.warn { border-left-color: var(--amber); } .flash.warn .ico { color: var(--amber-ink); }
.flash.error{ border-left-color: var(--red); }   .flash.error .ico { color: var(--red); }
.flash.info { border-left-color: var(--info); }  .flash.info .ico { color: var(--info); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

.notice { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--card-edge); background: var(--card); display: flex; gap: 12px; align-items: flex-start; }
.notice.info { background: #e8f0f4; border-color: #cbdde6; color: #274a5c; }
.notice.warn { background: var(--amber-wash); border-color: #e6d2a6; color: var(--amber-ink); }
.notice.danger { background: var(--red-wash); border-color: #e6c2bd; color: var(--red-ink); }
.notice .ico { flex: none; }

/* =====================================================================
   Auth screens
   ===================================================================== */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-aside { position: relative; overflow: hidden; background: linear-gradient(160deg, #212d3b, #16202b); color: #e7e0cf; padding: 52px 56px; display: flex; flex-direction: column; }
.auth-aside::before { content:""; position:absolute; inset:0; background-image: radial-gradient(circle at 82% 12%, rgba(207,122,78,.32), transparent 40%), radial-gradient(circle at 5% 90%, rgba(63,125,91,.24), transparent 42%); }
.auth-aside .brand-lg { position: relative; display: flex; align-items: center; gap: 14px; }
.auth-aside .brand-lg .mark { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(145deg, var(--accent-2), var(--accent)); display: grid; place-items: center; font-family: var(--font-display); font-size: 26px; color: #fff; box-shadow: var(--shadow-md); }
.auth-aside .pitch { position: relative; margin-top: auto; }
.auth-aside .pitch h2 { color: #fff; font-size: 2.1rem; line-height: 1.1; max-width: 15ch; }
.auth-aside .pitch p { color: #b9c1cc; max-width: 40ch; }
.auth-aside .marks { position: relative; display: flex; gap: 22px; margin-top: 26px; }
.auth-aside .marks .m .n { font-family: var(--font-display); font-size: 1.5rem; color: var(--accent-2); }
.auth-aside .marks .m .l { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: #8b95a1; }

.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--paper); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.7rem; }
.auth-card .sub { color: var(--ink-mute); margin-bottom: 26px; }
.auth-foot { margin-top: 22px; font-size: .84rem; color: var(--ink-mute); text-align: center; }
.pw-meter { height: 6px; border-radius: 6px; background: var(--muted-wash); overflow: hidden; margin-top: 8px; }
.pw-meter i { display: block; height: 100%; width: 0; background: var(--red); transition: width .25s, background .25s; }

/* =====================================================================
   Misc utilities
   ===================================================================== */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.muted { color: var(--ink-mute); } .faint { color: var(--ink-faint); }
.mono { font-family: var(--font-mono); }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.tabnum { font-variant-numeric: tabular-nums; }
.divide > * + * { border-top: 1px solid var(--line); }
.pill-row { display: flex; flex-wrap: wrap; gap: 7px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: .88rem; }
.kv dt { color: var(--ink-mute); } .kv dd { margin: 0; color: var(--ink); font-weight: 500; }
.empty { text-align: center; padding: 46px 20px; color: var(--ink-faint); }
.empty .ico { width: 46px; height: 46px; opacity: .4; margin-bottom: 12px; }
.empty h3 { color: var(--ink-mute); }

/* Filter bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters .field { margin: 0; }
.filters .grow { flex: 1; min-width: 180px; }
.searchbox { position: relative; }
.searchbox .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.searchbox input { padding-left: 34px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--card-edge); margin-bottom: 22px; flex-wrap: wrap; }
.tabs a { padding: 10px 16px; font-size: .88rem; font-weight: 540; color: var(--ink-mute); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* Sparkline row of RAG cells */
.spark { display: inline-flex; gap: 3px; align-items: flex-end; height: 26px; }
.spark i { width: 8px; border-radius: 2px; background: var(--muted); opacity: .85; }
.spark i.green { background: var(--green); } .spark i.amber { background: var(--amber); } .spark i.red { background: var(--red); }

/* Progress ring */
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p)*1%), var(--muted-wash) 0); }
.ring .inner { width: 50px; height: 50px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-family: var(--font-display); font-size: .95rem; color: var(--ink); }

/* Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content:""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline .ev { position: relative; padding: 0 0 18px; }
.timeline .ev::before { content:""; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--accent); }
.timeline .ev .t { font-size: .76rem; color: var(--ink-faint); }
.timeline .ev .d { font-weight: 520; color: var(--ink); }

/* Rating chips */
.rating { display: inline-flex; gap: 4px; }
.rating .r { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: .8rem; font-weight: 600; background: var(--muted-wash); color: var(--ink-mute); }
.rating .r.on { background: var(--accent); color: #fff; }

/* Bar chart (trend) */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; }
.chart .col .bars { display: flex; flex-direction: column-reverse; border-radius: 5px 5px 0 0; overflow: hidden; min-height: 3px; }
.chart .col .bars span { display: block; }
.chart .col .bars .green { background: var(--green); } .chart .col .bars .amber { background: var(--amber); } .chart .col .bars .red { background: var(--red); }
.chart .col .lbl { text-align: center; font-size: .68rem; color: var(--ink-faint); margin-top: 6px; white-space: nowrap; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--card); border: 1px solid var(--card-edge); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: none; }
.dropdown.open .menu { display: block; animation: slidedown .16s var(--ease); }
@keyframes slidedown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dropdown .menu a, .dropdown .menu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: .86rem; color: var(--ink-soft); background: none; border: none; cursor: pointer; }
.dropdown .menu a:hover, .dropdown .menu button:hover { background: var(--accent-wash); color: var(--accent-ink); text-decoration: none; }
.dropdown .menu .sep { border-top: 1px solid var(--line); margin: 5px 0; }

/* Modal (dialog) */
dialog { border: none; border-radius: var(--radius-lg); padding: 0; box-shadow: var(--shadow-lg); max-width: 520px; width: calc(100% - 32px); background: var(--card); color: var(--ink-soft); }
dialog::backdrop { background: rgba(20,26,34,.5); backdrop-filter: blur(3px); }
dialog .card-head { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

/* Print */
@media print {
  .sidebar, .topbar, .page-head .actions, .filters, .no-print { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
  /* Attribution prints at the foot of every page of a report. */
  .content::after {
    content: "ViSense Learner Wellness Portal · Built by Vikele Solutions — vikelesolutions.co.za";
    display: block; margin-top: 18px; padding-top: 10px;
    border-top: 1px solid #ccc; font-size: 10px; color: #666; text-align: center;
  }
}

/* On-screen build credit that is generated from CSS content (not just markup),
   so it survives editing the HTML alone. */
.vikele-credit::after {
  content: "Built by Vikele Solutions";
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1080px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .span-3 { grid-column: span 2; }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content:""; position: fixed; inset: 0; background: rgba(20,26,34,.5); z-index: 35; }
  .hamburger { display: inline-flex; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 20px 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
}
