/* The admin dashboard: a Lessonsmith app bar with dropdown menus, an at-a-glance
   overview, and one section at a time below it ("All sections" shows them all). */
.ad-bar { position: sticky; top: 0; z-index: 20; background: linear-gradient(120deg, #0B2A22, #0E4D3E 55%, #137A5E); color: #FFFFFF; box-shadow: 0 4px 0 #F4C842, 0 10px 24px rgb(14 77 62 / .25); }
.ad-bar-row { max-width: 1680px; margin: 0 auto; padding: 8px clamp(12px, 2vw, 28px); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-brand { display: inline-flex; align-items: center; gap: 10px; color: #FFFFFF; text-decoration: none; font-family: var(--font-display); font-size: 1.25rem; margin-right: 6px; }
.ad-brand b { color: #F4C842; }
.ad-nav { order: 3; flex: 1 0 100%; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid rgb(255 255 255 / .14); }
.ad-menu { position: relative; }
.ad-top { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border-radius: 12px; border: 0; background: transparent; color: #FFFFFF; font-weight: 700; font-size: .98rem; position: relative; }
.ad-top:hover, .ad-top[aria-expanded="true"] { background: rgb(255 255 255 / .14); }
.ad-top[aria-current="page"], .ad-top.is-current { background: rgb(244 200 66 / .22); box-shadow: inset 0 -3px 0 #F4C842; }
.ad-top:focus-visible, .ad-drop button:focus-visible, .ad-btn:focus-visible, .ad-toggle:focus-visible { outline: 3px solid #F4C842; outline-offset: 2px; }
.ad-caret { font-size: .75rem; opacity: .8; }
.ad-dot { position: absolute; top: 6px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #F4C842; box-shadow: 0 0 0 2px #0E4D3E; }
.ad-drop { position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; margin: 0; padding: 6px; list-style: none; background: #FFFFFF; color: var(--ink); border-radius: 16px; box-shadow: 0 18px 40px rgb(14 77 62 / .25); border: 1px solid var(--line); z-index: 30; }
.ad-drop button { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 44px; text-align: left; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--deep); font-weight: 600; }
.ad-drop button:hover { background: var(--soft); }
.ad-badge { min-width: 22px; height: 22px; border-radius: 999px; background: #F4C842; color: #2B2200; font-size: .8rem; display: inline-grid; place-items: center; padding: 0 6px; }
.ad-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ad-find input { min-height: 40px; width: 150px; border-radius: 12px; border: 1px solid rgb(255 255 255 / .35); background: rgb(255 255 255 / .12); color: #FFFFFF; padding: 4px 10px; }
.ad-find input::placeholder { color: rgb(255 255 255 / .75); }
.ad-btn, .ad-toggle { display: inline-flex; align-items: center; min-height: 40px; padding: 4px 12px; border-radius: 12px; border: 1px solid rgb(255 255 255 / .35); background: transparent; color: #FFFFFF; font-weight: 600; text-decoration: none; font-size: .92rem; }
.ad-btn:hover, .ad-toggle:hover { background: rgb(255 255 255 / .14); }
.ad-toggle[aria-pressed="true"] { background: #F4C842; color: #2B2200; border-color: #F4C842; }
.ad-updated { font-size: .82rem; opacity: .8; font-family: var(--font-mono); }
.ad-main { max-width: 1680px; margin: 0 auto; padding: 18px clamp(12px, 2vw, 28px) 60px; }
.ad-main .rd-alert { display: none; }

/* The overview. */
.ad-overview { display: grid; gap: 14px; margin-bottom: 18px; }
.ad-ovhead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.ad-ovhead h2 { font-family: var(--font-display); font-size: 1.6rem; margin: 0; color: var(--deep); }
.ad-ovhead p { margin: 0; }
/* "What needs you": a card for each thing, in the site's card style. */
.ad-needs { list-style: none; margin: 14px 0 22px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.ad-needs > li { display: flex; }
.ad-need { position: relative; overflow: hidden; width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 16px 18px 14px 24px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: 0 8px 22px rgb(14 77 62 / .07); font: inherit; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.ad-need::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--mint); }
.ad-need.critical::before { background: #B3261E; }
.ad-need.warning::before { background: var(--chalk); }
.ad-need:not(:disabled):hover, .ad-need:focus-visible { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 14px 30px rgb(14 77 62 / .14); }
.ad-need:disabled { cursor: default; }
.ad-need-top { display: flex; align-items: center; gap: 8px; width: 100%; }
.ad-need-shape { font-size: 1rem; line-height: 1; color: var(--accent); }
.ad-need.critical .ad-need-shape { color: #B3261E; }
.ad-need.warning .ad-need-shape { color: #9A7400; }
.ad-need-word { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.ad-need.critical .ad-need-word { color: #8C1D18; }
.ad-need-cat { margin-left: auto; font-size: .78rem; font-weight: 700; color: var(--deep); background: var(--soft); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.ad-need-title { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.25; color: var(--deep); }
.ad-need-text { font-size: .95rem; line-height: 1.45; color: var(--muted); }
.ad-need-go { margin-top: auto; padding-top: 4px; font-weight: 800; font-size: .92rem; color: var(--accent); }
.ad-need.critical .ad-need-go { color: #8C1D18; }
.ad-need-morebox { align-items: center; }
.ad-need-more { min-height: 48px; padding: 10px 18px; border-radius: 999px; border: 2px dashed var(--line); background: transparent; font-weight: 800; color: var(--deep); cursor: pointer; }
.ad-need-more:hover { border-color: var(--accent); }
.ad-needs.clear { grid-template-columns: minmax(0, 1fr); }
.ad-clear { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-radius: 22px; background: linear-gradient(120deg, var(--soft), var(--surface)); border: 1px solid var(--mint); }
.ad-clear-tick { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #FFFFFF; font-weight: 800; box-shadow: 0 0 0 4px rgb(244 200 66 / .4); }
.ad-clear b { display: block; font-family: var(--font-display); font-size: 1.15rem; color: var(--deep); }
.ad-clear span { color: var(--muted); }
/* A key number that needs attention (for example a projected loss). */
.kpi.kpi-bad { border-color: #E8B4AF; box-shadow: inset 0 4px 0 #B3261E, 0 8px 22px rgb(179 38 30 / .08); }
.kpi.kpi-bad b { color: #8C1D18; }
.kpi.kpi-bad, .kpi.kpi-warn { position: relative; }
.kpi.kpi-warn { border-color: #EBD48A; box-shadow: inset 0 4px 0 var(--chalk), 0 8px 22px rgb(14 77 62 / .07); }
.kpi.kpi-warn .kpi-flag { color: #5A4500; background: #FFF6D6; }
.kpi-flag { position: absolute; top: 12px; right: 12px; font-size: .75rem; font-weight: 800; color: #8C1D18; background: #FDECEA; border-radius: 999px; padding: 2px 9px; }
.ad-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 0; }
.ad-kpis .kpi { padding: 12px 14px; border-radius: 18px; }
.ad-kpis .kpi b { font-size: 1.6rem; }
.ad-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ad-chart { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 14px 16px; box-shadow: 0 10px 26px rgb(14 77 62 / .06); min-width: 0; }
.ad-chart header h3 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; color: var(--deep); }
.ad-chart header p { margin: 2px 0 8px; font-size: .88rem; color: var(--muted); }
.ad-svg { width: 100%; height: auto; display: block; }
.ad-svg text { text-transform: none; letter-spacing: 0; font-size: 11px; fill: var(--muted); font-family: var(--font-body); }
.ad-svg .grid { stroke: var(--line); stroke-width: 1; }
.ad-svg .line { fill: none; stroke: #137A5E; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ad-svg .forecast { stroke: #137A5E; stroke-width: 2; stroke-dasharray: 6 5; opacity: .7; }
.ad-svg .ref { stroke: #C99A0E; stroke-width: 1.5; stroke-dasharray: 3 4; }
.ad-svg .c-reflabel { fill: #6B5200; font-weight: 700; }
.ad-svg .c-lbl { fill: var(--ink); font-weight: 700; font-size: 12px; }
.ad-svg .dot { fill: #137A5E; stroke: #FFFFFF; stroke-width: 2; }
.ad-svg .hit { fill: transparent; cursor: crosshair; }
.ad-svg .hit:hover, .ad-svg .hit:focus { fill: rgb(244 200 66 / .18); outline: none; }
.ad-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ad-bars li { display: grid; grid-template-columns: minmax(110px, 34%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .92rem; }
.ad-blabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.ad-btrack { position: relative; height: 16px; border-radius: 4px; background: transparent; }
.ad-btrack i { position: absolute; left: 0; top: 0; bottom: 0; background: #137A5E; border-radius: 0 4px 4px 0; z-index: 1; }
.ad-btrack em { position: absolute; left: 0; top: 0; bottom: 0; background: #E1F4EB; border-radius: 0 4px 4px 0; }
.ad-btrack:focus-visible { outline: 3px solid #F4C842; outline-offset: 2px; }
.ad-bars b { font-variant-numeric: tabular-nums; color: var(--ink); }
.ad-table { margin-top: 8px; font-size: .88rem; }
.ad-table summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 32px; }
.ad-table table { width: 100%; border-collapse: collapse; }
.ad-table th, .ad-table td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; }
.ad-tip { position: absolute; z-index: 50; max-width: 260px; background: #0B2A22; color: #FFFFFF; border-radius: 10px; padding: 8px 10px; font-size: .85rem; line-height: 1.4; pointer-events: none; box-shadow: 0 10px 24px rgb(0 0 0 / .25); }

/* One section at a time. */
.ad-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0 12px; padding: 12px 16px; border-radius: 18px; background: linear-gradient(120deg, var(--soft), #FFFFFF); border: 2px solid var(--mint); scroll-margin-top: 140px; }
.ad-detail-head h2 { margin: 0; font-family: var(--font-display); color: var(--deep); font-size: 1.4rem; }
.ad-detail-head .ad-btn { color: var(--deep); border-color: var(--line); background: #FFFFFF; }
.ad-panel { scroll-margin-top: 140px; }
.ad-panel.ad-current { box-shadow: 0 0 0 3px rgb(244 200 66 / .6), 0 12px 30px rgb(14 77 62 / .1); }
.ad-panel.card, .ad-panel .card { border-radius: 22px; }
body.ad-all .ad-panel.ad-current { box-shadow: none; }
body.ad-all .ad-panel::before { content: attr(data-name); display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); background: var(--soft); border-radius: 999px; padding: 2px 10px; margin-bottom: 6px; }

@media (max-width: 1200px) { .ad-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .ad-charts { grid-template-columns: minmax(0, 1fr); }
  .ad-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .ad-menu { position: static; }
  .ad-drop { left: 12px; right: 12px; top: auto; position: absolute; }
  .ad-tools { margin-left: 0; }
}
@media (max-width: 600px) {
  .ad-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-find input { width: 110px; }
  .ad-updated { display: none; }
  .ad-bars li { grid-template-columns: minmax(0, 1fr) auto; }
  .ad-bars .ad-btrack { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) { .ad-need { transition: none; } .ad-need:not(:disabled):hover, .ad-need:focus-visible { transform: none; } }
.ad-svg .col { fill: #137A5E; }
.ad-svg .col.now { fill: #2DBE8F; }
/* Feature status list (school dashboard). */
.ad-status { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ad-status li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.ad-status li:last-child { border-bottom: 0; }
.ad-status .on { font-weight: 700; color: var(--deep); background: var(--soft); border: 1px solid var(--mint); border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
.ad-status .off { font-weight: 700; color: var(--muted); border: 1px dashed var(--line); border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
.ad-status .todo { font-weight: 700; color: #2B2200; background: #FFF8DC; border: 1px solid #F4C842; border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
.ad-status button { all: unset; cursor: pointer; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.ad-status button:focus-visible { outline: 3px solid #F4C842; outline-offset: 2px; border-radius: 4px; }

/* Suspicious activity. */
.wt-flagbox { margin: 10px 0 16px; }
.wt-flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wt-flag { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 16px; border: 2px solid var(--chalk); background: #FFFBEA; font-weight: 600; }
.wt-flag.l2 { border-color: #B3261E; background: #FDECEA; }
.wt-clear { margin: 0; padding: 12px 16px; border-radius: 16px; border: 2px solid var(--mint); background: var(--soft); }
.wt-kinds th[scope="row"] { font-weight: 600; text-align: left; }
.wt-kinds .num { text-align: right; white-space: nowrap; }
.wt-kinds tr.wt-high { background: #FFFBEA; }
.wt-kinds tr.wt-high th { box-shadow: inset 4px 0 0 var(--chalk); }
.wt-tag { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #8C1D18; background: #FDECEA; border-radius: 999px; padding: 1px 8px; vertical-align: middle; }
.wt-spark { display: block; }
.wt-spark rect { fill: var(--accent); }
.wt-spark rect.zero { fill: var(--line); }
.wt-spark rect.today { fill: var(--chalk); stroke: #8A6A00; stroke-width: .8; }
.wt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.wt-grid h3 { margin: 0 0 8px; font-size: 1.05rem; }
.wt-grid .admin-table { width: 100%; }
.wt-grid code { overflow-wrap: anywhere; }
.wt-addr { margin-top: 14px; }
@media (max-width: 1100px) { .wt-grid { grid-template-columns: minmax(0, 1fr); } }
.wt-kinds tbody th { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 600; color: var(--ink); }
.wt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wt-grid > section:first-child { grid-column: 1 / -1; }
.wt-grid td code { white-space: nowrap; }
@media (max-width: 800px) { .wt-grid { grid-template-columns: minmax(0, 1fr); } .wt-grid td code { white-space: normal; } }
@media (max-width: 700px) {
  .wt-kinds thead { display: none; }
  .wt-kinds, .wt-kinds tbody { display: block; }
  .wt-kinds tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .wt-kinds th[scope="row"], .wt-kinds .wt-sparkcell { grid-column: 1 / -1; border: 0; padding: 0; }
  .wt-kinds td.num { text-align: left; border: 0; padding: 0; }
  .wt-kinds td.num::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted); }
  .wt-spark { width: 100%; height: 34px; }
}

/* Security check. */
.ad-btn.ad-sec { background: var(--chalk); color: var(--chalk-ink, #2B2200); border-color: var(--chalk); font-weight: 800; }
.sc-summary { display: flex; gap: 16px; align-items: center; padding: 16px 20px; border-radius: 22px; border: 2px solid var(--mint); background: var(--soft); margin: 12px 0; }
.sc-summary.warn { border-color: var(--chalk); background: #FFFBEA; }
.sc-summary.bad { border-color: #B3261E; background: #FDECEA; }
.sc-summary b { font-family: var(--font-display); font-size: 1.35rem; color: var(--deep); }
.sc-summary p { margin: 2px 0 0; }
.sc-big { font-size: 2.4rem; line-height: 1; }
.sc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sc-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.sc-item p { margin: 4px 0 0; color: var(--muted); }
.sc-shape { font-size: 1.15rem; line-height: 1.4; text-align: center; }
.sc-item.bad { border: 2px solid #B3261E; background: #FFF6F5; } .sc-item.bad .sc-shape { color: #B3261E; }
.sc-item.warn { border: 2px solid var(--chalk); background: #FFFDF2; } .sc-item.warn .sc-shape { color: #9A7400; }
.sc-item.info .sc-shape { color: var(--accent); }
.sc-item.ok { background: var(--bg); } .sc-item.ok .sc-shape { color: var(--accent); } .sc-item.ok b { font-weight: 600; }
.sc-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.sc-acts .small, .sc-acts .btn { min-height: 44px; }
.sc-emergency { margin-top: 18px; border: 2px solid #B3261E; border-radius: 20px; padding: 12px 16px; background: #FFF8F7; }
.sc-emergency summary { cursor: pointer; font-weight: 800; color: #8C1D18; min-height: 32px; }
.sc-em-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.sc-em { background: #FFFFFF; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.sc-em h3 { margin: 0 0 4px; font-size: 1.05rem; }
.sc-em button { min-height: 44px; }
@media (max-width: 900px) { .sc-em-grid { grid-template-columns: minmax(0, 1fr); } .sc-item { grid-template-columns: 24px minmax(0, 1fr); } .sc-acts { grid-column: 2; justify-content: flex-start; } }
.admin .sc-list, .sc-list { padding: 0 !important; margin: 0 !important; }
.sc-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.sc-check input { width: 22px; height: 22px; margin: 0; flex: none; }
/* The owner's own device. */
.wt-device { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; padding: 12px 16px; border-radius: 18px; border: 1px dashed var(--line); background: var(--bg); }
.wt-device.known { border: 2px solid var(--mint); background: var(--soft); }
.wt-device > span { font-weight: 800; color: var(--accent); font-size: 1.2rem; }
.wt-device p { flex: 1 1 320px; margin: 0; }
.wt-device button { min-height: 44px; }
.wt-you { font-size: .75rem; font-weight: 800; color: var(--deep); background: var(--chalk); border-radius: 999px; padding: 1px 8px; }
