/* =====================================================================
   Accreditation Excellence Framework — project-local chrome
   ---------------------------------------------------------------------
   Educational Leadership & School Improvement Suite — Project #8.
   Layered ON TOP of the shared portfolio design-system.css.
   "Quality seal" identity (cyan-teal + bronze). Adds: QA workspace shell,
   quality-domain cards, standards explorer, readiness diagnostic, evidence
   tracker, gap analysis, compliance calendar, quality scorecards, dark mode.
   Vanilla CSS. Standards & evidence examples are illustrative.
   ===================================================================== */

:root {
  --aef-accent: #0e7490;        /* cyan-teal */
  --aef-accent-2: #b06a2c;      /* bronze */
  --aef-accent-dark: #0a5870;
  --aef-glow: rgba(14, 116, 144, 0.13);
  --aef-rail-w: 256px;
  --rag-green: #2f9e44; --rag-amber: #f08c00; --rag-red: #e03131;
}

/* ---------- Dark mode ---------- */
body.aef-dark {
  --navy: #0f2630; --navy-dark: #0a1c24; --navy-deep: #06121800;
  --navy-deep: #061218;
  --ink: #e6f1f4; --ink-soft: #97b6bf; --slate: #b2cbd2;
  --bg: #07151b; --bg-warm: #0b1c23;
  --surface: #0f2129; --surface-alt: #173039; --border: #244451;
  --shadow: rgba(0,0,0,0.45); --shadow-lg: rgba(0,0,0,0.62);
}
body.aef-dark { background: var(--bg); color: var(--ink); }
body.aef-dark .site-header { background: rgba(7,21,27,0.92); }
body.aef-dark .card, body.aef-dark .metric, body.aef-dark .app-rail, body.aef-dark .panel, body.aef-dark .domain-card,
body.aef-dark .comp-card, body.aef-dark .assess-card, body.aef-dark .scorecard, body.aef-dark .gen-output, body.aef-dark .ev-row { background: var(--surface); }
body.aef-dark .muted, body.aef-dark .m-label { color: var(--ink-soft); }
body.aef-dark .metric .m-num, body.aef-dark .card h3, body.aef-dark .card h4, body.aef-dark .scorecard .sc-num { color: #eef6f8; }
body.aef-dark input, body.aef-dark select, body.aef-dark textarea { background: #0a1820; color: var(--ink); border-color: var(--border); }
body.aef-dark .out-body { background: #0a1820; }
.theme-toggle { background: none; border: 1px solid var(--border); color: inherit; border-radius: 999px; width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; transition: .15s; }
.theme-toggle:hover { border-color: var(--aef-accent); color: var(--aef-accent); }

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--aef-rail-w) 1fr; gap: 1.6rem; max-width: 1340px; margin: 0 auto; padding: 1.6rem 1.2rem 3rem; align-items: start; }
.app-rail { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem; box-shadow: 0 6px 20px var(--shadow); max-height: calc(100vh - 110px); overflow-y: auto; }
.rail-brand { display: flex; align-items: center; gap: 0.55rem; padding: 0.3rem 0.5rem 0.8rem; border-bottom: 1px solid var(--border); margin-bottom: 0.6rem; }
.rail-brand .mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--aef-accent), var(--aef-accent-2)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 0.95rem; }
.rail-brand b { font-size: 0.84rem; color: var(--ink); }
.rail-group { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); padding: 0.8rem 0.6rem 0.3rem; }
.rail-link { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: 9px; color: var(--ink); text-decoration: none; font-size: 0.9rem; font-weight: 600; transition: .12s; }
.rail-link .ico { width: 20px; text-align: center; }
.rail-link:hover { background: var(--surface-alt); }
.rail-link.active { background: var(--aef-glow); color: var(--aef-accent-dark); }
body.aef-dark .rail-link.active { color: #6cc7dd; }

.app-main { min-width: 0; }
.app-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 1.2rem; }
.app-bar .crumb { color: var(--ink-soft); font-size: 0.9rem; } .app-bar .crumb b { color: var(--ink); }
.app-actions { display: flex; align-items: center; gap: 0.5rem; }

.tool-head { margin-bottom: 1.2rem; }
.tool-head h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0.2rem 0; }
.tool-head .lead { color: var(--ink-soft); max-width: 70ch; }
.tool-badge { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--aef-glow); color: var(--aef-accent-dark); font-weight: 700; font-size: 0.78rem; padding: 0.25rem 0.8rem; border-radius: 999px; }
body.aef-dark .tool-badge { color: #6cc7dd; }

/* ---------- Quality domain cards ---------- */
.domain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 1.2rem; }
.domain-card { background: var(--surface); border: 1px solid var(--border); border-top: 5px solid var(--aef-accent); border-radius: var(--radius); padding: 1.4rem; box-shadow: 0 5px 16px var(--shadow); transition: transform .16s, box-shadow .16s; }
.domain-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px var(--shadow-lg); }
.domain-card .d-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; background: var(--aef-glow); margin-bottom: 0.7rem; }
.domain-card.d1 { border-top-color: #0e7490; } .domain-card.d2 { border-top-color: #245e8c; } .domain-card.d3 { border-top-color: #2f9e44; } .domain-card.d4 { border-top-color: #7048e8; } .domain-card.d5 { border-top-color: var(--aef-accent-2); } .domain-card.d6 { border-top-color: #2f9e8f; }
.domain-card h3 { margin: 0.2rem 0 0.4rem; }

/* ---------- Standards explorer ---------- */
.comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 1rem; }
.comp-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--aef-accent-2); border-radius: var(--radius-sm); padding: 1rem 1.1rem; box-shadow: 0 3px 12px var(--shadow); cursor: pointer; transition: .14s; }
.comp-card:hover { transform: translateX(3px); border-left-color: var(--aef-accent); }
.comp-card h4 { margin: 0 0 0.3rem; } .comp-card .c-meta { font-size: 0.78rem; color: var(--ink-soft); }
.comp-detail { display: none; padding: 0.7rem 0 0.2rem; } .comp-detail.open { display: block; animation: fadeUp .25s ease both; }

/* ---------- Readiness diagnostic ---------- */
.assess-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: 0 4px 14px var(--shadow); margin-bottom: 1rem; }
.assess-item { padding: 0.8rem 0; border-bottom: 1px solid var(--border); } .assess-item:last-child { border-bottom: none; }
.assess-item p { margin: 0 0 0.5rem; font-weight: 600; }
.likert { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.likert button { border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 0.4rem 0.8rem; font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; transition: .12s; }
.likert button:hover { border-color: var(--aef-accent); } .likert button.on { background: var(--aef-accent); border-color: var(--aef-accent); color: #fff; }
.assess-result { display: none; } .assess-result.show { display: block; animation: fadeUp .3s ease both; }

/* ---------- Evidence tracker ---------- */
.ev-add { display: grid; grid-template-columns: 1fr 1fr 150px auto; gap: 0.6rem; align-items: end; }
.ev-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.55rem; }
.ev-row { display: flex; align-items: center; gap: 0.8rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--aef-accent); border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; box-shadow: 0 3px 10px var(--shadow); }
.ev-row.complete { border-left-color: var(--rag-green); } .ev-row.progress { border-left-color: var(--rag-amber); } .ev-row.notstarted { border-left-color: var(--ink-soft); }
.ev-row .e-body { flex: 1; min-width: 0; } .ev-row .e-body b { display: block; } .ev-row .e-body small { color: var(--ink-soft); }
.ev-row .e-del { border: none; background: none; cursor: pointer; color: var(--rag-red); font-weight: 800; }

/* ---------- Gauge / scorecards / bars ---------- */
.gauge { width: 170px; height: 170px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; background: conic-gradient(var(--aef-accent) calc(var(--val,70) * 1%), var(--surface-alt) 0); }
.gauge .hole { width: 124px; height: 124px; background: var(--surface); border-radius: 50%; display: grid; place-items: center; text-align: center; }
.gauge .hole b { font-family: var(--font-head); font-size: 2rem; color: var(--navy); display: block; line-height: 1; } .gauge .hole small { font-size: 0.72rem; color: var(--ink-soft); }
body.aef-dark .gauge .hole b { color: #eef6f8; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 1.1rem; }
.scorecard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: 0 5px 16px var(--shadow); border-top: 4px solid var(--aef-accent); }
.scorecard.green { border-top-color: var(--rag-green); } .scorecard.amber { border-top-color: var(--rag-amber); } .scorecard.red { border-top-color: var(--rag-red); }
.scorecard .sc-label { font-size: 0.82rem; color: var(--ink-soft); font-weight: 700; }
.scorecard .sc-num { font-family: var(--font-head); font-size: 2.1rem; color: var(--navy); line-height: 1.05; margin: 0.2rem 0; }
.scorecard .sc-trend { font-size: 0.82rem; font-weight: 700; } .sc-trend.up { color: var(--rag-green); } .sc-trend.down { color: var(--rag-red); } .sc-trend.flat { color: var(--ink-soft); }
body.aef-dark .scorecard .sc-num { color: #eef6f8; }
.barlist { display: flex; flex-direction: column; gap: 0.6rem; }
.barlist .row { display: grid; grid-template-columns: 200px 1fr 46px; align-items: center; gap: 0.6rem; font-size: 0.86rem; }
.barlist .track { background: var(--surface-alt); border-radius: 999px; height: 14px; overflow: hidden; }
.barlist .fill { height: 100%; background: linear-gradient(90deg, var(--aef-accent-2), var(--aef-accent)); border-radius: 999px; }
.tl-pill { display: inline-block; font-size: 0.72rem; font-weight: 800; padding: 0.12rem 0.6rem; border-radius: 999px; }
.tl-pill.green { background: #e6f5ea; color: #1f7a34; } .tl-pill.amber { background: #fdf0db; color: #b56a00; } .tl-pill.red { background: #fbe4e4; color: #b32020; } .tl-pill.bronze { background: #f3e8da; color: #8a531e; }
body.aef-dark .tl-pill.green { background: rgba(47,158,68,.18); color: #69db7c; } body.aef-dark .tl-pill.amber { background: rgba(240,140,0,.18); color: #ffc078; } body.aef-dark .tl-pill.red { background: rgba(224,49,49,.18); color: #ff8787; }

/* ---------- Drill / timeline / journey / calendar ---------- */
.drill-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0.2rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.drill-row:hover { background: var(--surface-alt); } .drill-row .chev { transition: transform .18s; color: var(--ink-soft); } .drill-row.open .chev { transform: rotate(90deg); }
.drill-panel { display: none; padding: 0.6rem 0.2rem 1rem; } .drill-panel.open { display: block; animation: fadeUp .25s ease both; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 1.1rem 1.2rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--aef-accent); border: 2px solid var(--surface); }
.timeline li.done::before { background: var(--rag-green); } .timeline li.now::before { background: var(--aef-accent-2); }
.timeline .t-when { font-size: 0.78rem; color: var(--ink-soft); font-weight: 700; }
.journey { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.journey .j-stage { flex: 1; min-width: 140px; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--aef-accent-2); border-radius: var(--radius-sm); padding: 0.9rem; }
.journey .j-stage .n { font-family: var(--font-head); color: var(--aef-accent); font-size: 1.1rem; }

/* ---------- Fields / planner ---------- */
.field { margin-bottom: 1rem; } .field > label { display: block; font-weight: 700; font-size: 0.88rem; margin-bottom: 0.35rem; }
.field input, .field select, .field textarea { width: 100%; padding: 0.6rem 0.75rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font: inherit; background: var(--surface); color: var(--ink); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--aef-accent); box-shadow: 0 0 0 3px var(--aef-glow); }
.field textarea { min-height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.saved-note { font-size: 0.78rem; color: var(--rag-green); font-weight: 700; }

/* ---------- Generator output ---------- */
.gen-output { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 280px; }
.out-toolbar { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-alt); } .out-toolbar .ai-pill { margin-right: auto; }
.out-btn { border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 0.35rem 0.75rem; font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: .12s; }
.out-btn:hover { border-color: var(--aef-accent); color: var(--aef-accent); }
.out-body { padding: 1.3rem; overflow-y: auto; flex: 1; line-height: 1.6; } .out-body h4 { color: var(--aef-accent-dark); }
body.aef-dark .out-body h4 { color: #6cc7dd; }

/* ---------- Research / pill / stat / tool grid ---------- */
.research { border-left: 5px solid var(--aef-accent-2); background: #f6efe6; border-radius: var(--radius-sm); padding: 1rem 1.2rem; }
body.aef-dark .research { background: rgba(176,106,44,0.12); }
.research .tag { display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--aef-accent-2); }
.ai-pill { display: inline-flex; align-items: center; gap: 0.4rem; background: linear-gradient(135deg, var(--aef-accent), var(--aef-accent-2)); color: #fff; padding: 0.25rem 0.8rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 1rem; margin: 1.2rem 0; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: 0 4px 14px var(--shadow); border-left: 4px solid var(--aef-accent); }
.stat-tile .s-num { font-family: var(--font-head); font-size: 1.8rem; color: var(--ink); line-height: 1.1; } .stat-tile .s-label { font-size: 0.82rem; color: var(--ink-soft); font-weight: 600; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: 1.1rem; }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; box-shadow: 0 5px 16px var(--shadow); text-decoration: none; color: inherit; display: block; transition: transform .16s, box-shadow .16s; }
.tool-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px var(--shadow-lg); }
.tool-card .t-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; background: var(--aef-glow); margin-bottom: 0.7rem; }
.tool-card h4 { margin: 0 0 0.3rem; } .tool-card p { color: var(--ink-soft); font-size: 0.9rem; margin: 0; }
.tool-card .t-go { display: inline-block; margin-top: 0.7rem; color: var(--aef-accent); font-weight: 700; font-size: 0.88rem; }
.lib-item { display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 0.6rem; }
.lib-item .l-ico { font-size: 1.3rem; } .lib-item .l-body { flex: 1; min-width: 0; } .lib-item .l-body b { display: block; } .lib-item .l-body small { color: var(--ink-soft); }
.lib-item .l-tag { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--surface-alt); color: var(--ink-soft); }

/* ---------- Command palette + FAB + toasts ---------- */
.cmdk { position: fixed; inset: 0; background: rgba(7,21,27,0.55); backdrop-filter: blur(3px); z-index: 200; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdk.open { display: flex; }
.cmdk-box { width: min(640px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 30px 70px rgba(0,0,0,0.45); overflow: hidden; animation: fadeUp .18s ease both; }
.cmdk-input { width: 100%; border: none; border-bottom: 1px solid var(--border); padding: 1.1rem 1.2rem; font: inherit; font-size: 1.05rem; background: var(--surface); color: var(--ink); } .cmdk-input:focus { outline: none; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 0.5rem; }
.cmdk-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.8rem; border-radius: 9px; cursor: pointer; text-decoration: none; color: var(--ink); }
.cmdk-item .ico { width: 22px; text-align: center; } .cmdk-item small { margin-left: auto; color: var(--ink-soft); font-size: 0.78rem; }
.cmdk-item.active, .cmdk-item:hover { background: var(--aef-glow); }
.cmdk-empty { padding: 1.2rem; color: var(--ink-soft); text-align: center; }
.fab { position: fixed; right: 22px; bottom: 22px; z-index: 150; width: 58px; height: 58px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--aef-accent), var(--aef-accent-2)); color: #fff; font-size: 1.4rem; cursor: pointer; box-shadow: 0 12px 28px var(--aef-glow), 0 6px 16px rgba(0,0,0,0.2); transition: transform .15s; }
.fab:hover { transform: scale(1.07) rotate(8deg); }
.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: var(--navy); color: #fff; padding: 0.7rem 1.1rem; border-radius: 10px; box-shadow: 0 10px 26px rgba(0,0,0,0.3); font-weight: 600; font-size: 0.9rem; animation: fadeUp .25s ease both; }
.toast.ok { background: var(--rag-green); } .toast.info { background: var(--aef-accent); }
.kbd { display: inline-block; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 0.05rem 0.45rem; font-family: var(--font-head); font-size: 0.78rem; background: var(--surface-alt); color: var(--ink-soft); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-rail { position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 0.2rem 0.8rem; }
  .rail-group { grid-column: 1 / -1; }
}
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } .barlist .row { grid-template-columns: 120px 1fr 40px; } .ev-add { grid-template-columns: 1fr; } }
