/* Educational Living add-on. Two looks, both from the NEW ADDON the user started:
   1. the menu/login card (brand header, white card, pill buttons)
   2. the dashboard (soft blue gradient, panels, KPI cards with traffic-light dots, tables, modal) */
:root {
  --brand-blue: #A50050;   /* EL primary (name kept from the NEW ADDON) */
  --brand-green: #333333;  /* accent / hover */
  --light-bg: #F4F6FA;
  --bg: #dfe9f5; --panel: #f5f8fc; --card: #ffffff; --card-hover: #f0f6ff;
  --text: #0f2a4f; --muted: #5e7aa3;
  --green: #1fbf75; --red: #ef4444; --amber: #f59e0b; --grey: #808080;
  --ring: rgba(0,97,162,.25); --shadow: 0 4px 14px rgba(0,0,0,.08); --radius: 14px;
  --tint-green: color-mix(in srgb, var(--green) 12%, white);
  --tint-red: color-mix(in srgb, var(--red) 10%, white);
  --tint-amber: color-mix(in srgb, var(--amber) 12%, white);
  --tint-grey: color-mix(in srgb, var(--grey) 12%, white);
  --ring-amber: color-mix(in srgb, var(--amber) 22%, transparent);
}
* { box-sizing: border-box; }

/* ---------- 1. menu / login card ---------- */
body.menu { background: var(--light-bg); min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #333; padding: 140px 16px 0; margin: 0; }
.menu .header { position: fixed; top: 0; left: 0; width: 100%; background: var(--brand-blue); padding: .75rem 2rem 1.25rem;
  display: flex; flex-direction: column; align-items: center; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 1000; }
.menu .header img { max-height: 60px; margin-bottom: .5rem; }
.menu .header h2 { color: #fff; font-weight: 700; margin: 0; font-size: 1.5rem; }
.menu .card { border: none; border-radius: 1rem; padding: 0; min-height: 0; cursor: default; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.1); max-width: 520px; width: 100%; background: #fff; animation: fadeIn .8s ease; }
.menu .card:hover { background: #fff; transform: none; }
.menu .card::before { display: none; }
.menu .card-header { background: var(--brand-blue); color: #fff; padding: 2rem 1.5rem; text-align: center; }
.menu .card-header h3 { margin: 0; font-weight: 700; font-size: 1.5rem; }
.menu .card-body { padding: 2rem; text-align: center; }
.bookmark-btn { display: block; width: 100%; margin: .5rem 0; padding: .9rem 1rem; font-weight: 600; border: none; border-radius: 50px;
  background: var(--brand-blue); color: #fff; text-decoration: none; transition: all .3s ease; font-size: 1rem; cursor: pointer; }
.bookmark-btn:hover { background: var(--brand-green); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,.1); }
.bookmark-btn small { display: block; font-weight: 400; opacity: .85; font-size: .8rem; }
.menu footer { text-align: center; color: #666; font-size: .9rem; margin: 2rem auto; width: 100%; }
.menu hr { border: 0; border-top: 1px solid #eee; margin: 1rem 0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 2. dashboard pages ---------- */
body.dash { margin: 0; background: linear-gradient(180deg, #eaf2fb 0%, #dfe9f5 100%); color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; min-height: 100vh; }
.dash a { color: var(--brand-blue); }
.wrap { margin: 30px auto; padding: 0 clamp(14px, 4vw, 48px); max-width: 1500px; }
.dash h1 { font-size: 28px; margin: 0 0 8px; padding-right: 90px; }
.dash h2 { font-size: 1.15em; margin: 0 0 12px; }
.brand-logo { position: absolute; top: 12px; right: clamp(14px, 4vw, 48px); height: 60px; width: auto; z-index: 40; filter: drop-shadow(0 2px 6px rgba(0,0,0,.15)); }
@media (max-width: 640px) { .brand-logo { height: 36px; } }
.topbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.topbar .spacer { flex: 1; }
.crumbs { padding-right: 84px; min-height: 40px; }
.crumbs a { text-decoration: none; font-weight: 600; }
@media (max-width: 640px) { .crumbs { padding-right: 48px; } }
.pill { font-size: 12px; color: var(--muted); border: 1px solid rgba(0,0,0,.1); padding: 4px 9px; border-radius: 20px; background: rgba(255,255,255,.5); white-space: nowrap; }
.pill.green { color: #0d6b41; border-color: color-mix(in srgb, var(--green) 45%, white); background: var(--tint-green); }
.pill.red { color: #a11d1d; border-color: color-mix(in srgb, var(--red) 40%, white); background: var(--tint-red); }
.pill.amber { color: #8a5300; border-color: color-mix(in srgb, var(--amber) 45%, white); background: var(--tint-amber); }
.row { background: var(--panel); border: 1px solid rgba(0,0,0,.05); border-radius: var(--radius); padding: 22px 24px 26px; margin-bottom: 24px; box-shadow: var(--shadow); }
.row-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.row-title { font-weight: 600; font-size: 1.4em; letter-spacing: .3px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid rgba(0,0,0,.05); border-radius: 12px; padding: 16px; cursor: pointer; transition: .15s ease;
  position: relative; overflow: hidden; min-height: 98px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.card:hover { background: var(--card-hover); transform: translateY(-2px); }
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; border-radius: 12px 0 0 12px; opacity: .9; }
.card:has(.status-green)::before { background: var(--green); }
.card:has(.status-red)::before { background: var(--red); }
.card:has(.status-amber) { background: var(--tint-amber); border-color: color-mix(in srgb, var(--amber) 28%, rgba(0,0,0,.05)); box-shadow: var(--shadow), 0 0 0 4px var(--ring-amber); }
.card:has(.status-amber)::before { background: var(--amber); }
.card:has(.status-grey) { background: var(--tint-grey); }
.card:has(.status-grey)::before { background: var(--grey); }
.card.active { outline: 3px solid var(--brand-blue); }
.kpi-name { font-size: 15px; font-weight: 600; text-align: center; margin-bottom: 10px; }
.kpi-value { font-size: 36px; font-weight: 700; text-align: center; letter-spacing: .5px; }
.kpi-caption { color: var(--muted); font-size: 12px; text-align: center; margin-top: 4px; }
.status-dot { position: absolute; right: 12px; top: 20px; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(0,0,0,.08); }
.status-green { background: var(--green); } .status-red { background: var(--red); } .status-amber { background: var(--amber); } .status-grey { background: var(--grey); }
.btn { appearance: none; border: 1px solid rgba(0,0,0,.1); color: var(--text); background: var(--card); padding: 9px 12px; border-radius: 12px;
  cursor: pointer; font-weight: 600; box-shadow: var(--shadow); text-decoration: none; display: inline-block; font-size: 14px; font-family: inherit; }
.btn:hover { box-shadow: 0 0 0 4px var(--ring); }
.btn.primary { background: var(--brand-blue); color: #fff; border-color: transparent; }
.btn.primary:hover { background: var(--brand-green); }
.btn.danger { color: #a11d1d; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.tbl { margin-top: 8px; width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { border-bottom: 1px solid rgba(0,0,0,.05); padding: 10px 8px; text-align: left; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 700; position: sticky; top: 0; background: var(--panel); }
.tbl tr:hover td { background: rgba(0,0,0,.02); }
.tbl-wrap { overflow-x: auto; }
.empty { color: var(--muted); padding: 14px 0; }
.filter { padding: 7px 12px; border: 1px solid rgba(0,0,0,.15); border-radius: 8px; font-size: 14px; min-width: 220px; background: var(--card); color: var(--text); font-family: inherit; }
.filter:focus, .dash input:focus, .dash select:focus, .dash textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-weight: 600; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; color: var(--muted); }
.dash input[type=text], .dash input[type=number], .dash input[type=email], .dash input[type=date], .dash input[type=tel], .dash select, .dash textarea {
  padding: 8px 10px; border: 1px solid rgba(0,0,0,.15); border-radius: 8px; font: inherit; font-size: 14px; background: #fff; color: var(--text); }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.flash.ok { background: var(--tint-green); color: #0d6b41; border: 1px solid color-mix(in srgb, var(--green) 40%, white); }
.flash.err { background: var(--tint-red); color: #a11d1d; border: 1px solid color-mix(in srgb, var(--red) 40%, white); }
.flash.warn { background: var(--tint-amber); color: #8a5300; border: 1px solid color-mix(in srgb, var(--amber) 45%, white); }
.answers h3 { font-size: 1em; margin: 18px 0 6px; color: var(--brand-blue); }
.answers .tbl td:first-child { width: 45%; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.sig-img { max-width: 260px; border: 1px solid rgba(0,0,0,.1); border-radius: 8px; background: #fff; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 20px; text-decoration: none; font-weight: 600; background: rgba(255,255,255,.6); border: 1px solid rgba(0,0,0,.08); }
.tabs a.on { background: var(--brand-blue); color: #fff; }
/* modal (dashboard drill-down) */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; align-items: center; justify-content: center; padding: 24px; z-index: 50; backdrop-filter: blur(6px); }
.modal.open { display: flex; }
.modal-card { background: var(--panel); border: 1px solid rgba(0,0,0,.08); border-radius: 20px; width: min(1100px, 95vw); max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid rgba(0,0,0,.08); flex-wrap: wrap; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 0 16px 18px; overflow: auto; }
.modal-actions { margin-left: auto; }
#appLoader { position: fixed; inset: 0; background: rgba(255,255,255,.85); display: none; align-items: center; justify-content: center; z-index: 80; }
#appLoader.open { display: flex; }
.loader-box { background: var(--card); border: 1px solid rgba(0,0,0,.06); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; font-weight: 600; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(0,0,0,.15); border-top-color: rgba(0,0,0,.55); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .menu .card { animation: none; } }
/* trainer section form fields (shared with the enrolment form renderer) */
.el-grid { display: flex; flex-wrap: wrap; gap: 0 16px; }
.el-field { width: 100%; margin-bottom: 14px; }
.el-half { width: calc(50% - 8px); }
@media (max-width: 640px) { .el-half { width: 100%; } }
.el-field > label, .el-field legend { display: block; font-weight: 600; margin-bottom: 5px; }
.el-field input[type=text], .el-field input[type=email], .el-field input[type=tel], .el-field input[type=date], .el-field select, .el-field textarea { width: 100%; }
.el-field fieldset { border: 0; padding: 0; margin: 0; }
.el-choice { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid rgba(0,0,0,.1); border-radius: 10px; margin-bottom: 6px; background: #fff; cursor: pointer; font-weight: 400; }
.el-choice input { margin-top: 3px; accent-color: var(--brand-blue); }
.el-help { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.el-err { display: block; color: #a11d1d; font-weight: 600; font-size: 13px; margin-top: 3px; }
.el-req { color: var(--brand-blue); }
.el-sig { position: relative; border: 2px dashed rgba(0,0,0,.2); border-radius: 10px; background: #fff; }
.el-sig canvas { display: block; width: 100%; height: 160px; touch-action: none; }
.el-sig .el-link { position: absolute; right: 10px; top: 8px; }
.el-link { background: none; border: 0; color: var(--brand-blue); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.el-file { color: #0d6b41; margin: 4px 0; }
[hidden] { display: none !important; }
/* Students overview */
details.org { background: var(--card); border: 1px solid rgba(0,0,0,.06); border-radius: 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
details.org > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; color: var(--brand-blue); }
.org-body { padding: 0 16px 8px; }
.student-card { border-top: 1px solid rgba(0,0,0,.08); padding: 12px 0; break-inside: avoid; }
.student-card h3 { margin: 0 0 6px; font-size: 1.02em; }
.student-card .sub { margin: 10px 0 4px; }
.student-card .summary { margin-bottom: 6px; }
.student-card ul { margin: 4px 0 8px 18px; padding: 0; }
.student-card table.bands { max-width: 620px; }
.student-card table.bands th, .student-card table.bands td { text-align: center; }
.student-card .open { margin: 8px 0 4px; }
.student-card .open.none { color: #a11d1d; font-weight: 700; }
details.units > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
mark { background: #ffe58a; border-radius: 3px; padding: 0 2px; }
@media print {
  body.dash { background: #fff; }
  .no-print, .crumbs, .brand-logo { display: none !important; }
  .row { box-shadow: none; border: 0; background: #fff; padding: 0; }
  details.org { box-shadow: none; border: 0; break-before: page; }
  details.org > summary { list-style: none; font-size: 1.2em; padding-left: 0; }
  .org-body { padding: 0; }
}
/* Bulk updates */
.progress { height: 12px; background: rgba(0,0,0,.08); border-radius: 8px; overflow: hidden; margin-bottom: 6px; }
.progress-bar { height: 100%; background: var(--green); transition: width .3s; }
.row-head form { margin: 0; }
