:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #667068;
  --line: #dfe5e0;
  --soft: #f4f7f4;
  --panel: #ffffff;
  --accent: #1f6b4f;
  --accent-dark: #154b38;
  --warning: #8a5a12;
  --danger: #8b2d2d;
  --shadow: 0 12px 36px rgba(24, 49, 37, 0.08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: #eef3ef; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.5; }
.tiny { font-size: 11px; line-height: 1.45; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--accent); }

.topbar { min-height: 88px; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.topbar h1 { margin: 2px 0 0; font-size: 23px; letter-spacing: -.02em; }
.status-stack { text-align: right; display: grid; gap: 5px; justify-items: end; }
.badge { border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 750; }
.badge.warning { background: #fff3d9; color: var(--warning); }
.badge.success { background: #e2f3e9; color: #215b3d; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.login-shell { min-height: calc(100vh - 160px); display: grid; place-items: center; padding: 36px 18px; }
.login-card { width: min(100%, 460px); padding: 30px; }
.login-card h2 { margin: 6px 0 8px; font-size: 28px; letter-spacing: -.025em; }
.setup-note { margin: 18px 0 0; }
.inline-error { color: var(--danger); margin: 12px 0 0; font-size: 13px; }

.workspace { max-width: 1480px; margin: 0 auto; padding: 28px; display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 24px; align-items: start; }
.workspace-sidebar { position: sticky; top: 116px; display: grid; gap: 14px; }
.school-card { padding: 20px; box-shadow: none; }
.school-card h2 { margin: 5px 0 3px; font-size: 18px; letter-spacing: -.015em; }
.profile-mini-status { margin-top: 14px; padding: 9px 10px; border-radius: 10px; background: var(--soft); color: var(--muted); font-size: 11px; }
.workspace-nav { display: grid; gap: 6px; }
.nav-button { display: grid; gap: 2px; text-align: left; width: 100%; padding: 12px 13px; border-radius: 11px; border: 1px solid transparent; background: transparent; color: var(--ink); }
.nav-button span { font-weight: 760; }
.nav-button small { color: var(--muted); }
.nav-button:hover { background: rgba(255,255,255,.65); }
.nav-button.active { background: #fff; border-color: var(--line); box-shadow: 0 5px 18px rgba(24,49,37,.05); }
.sidebar-signout { justify-self: start; margin-left: 10px; }
.workspace-main { min-width: 0; }
.view-panel { display: grid; gap: 18px; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h2 { margin: 4px 0 5px; }
.ask-heading h2 { font-size: 30px; letter-spacing: -.03em; }
.corpus-pill { background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.ask-card, .answer-card, .error-card, .profile-hero, .profile-section, .onboarding-card { padding: 26px; }
.profile-nudge { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 17px; border: 1px solid #d7dfd8; border-radius: 14px; background: #f8faf8; }
.profile-nudge p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

label { display: grid; gap: 7px; font-size: 12px; font-weight: 750; color: #3d4941; margin-top: 14px; }
input, select, textarea { width: 100%; border: 1px solid #cbd5cd; background: #fff; color: var(--ink); border-radius: 10px; padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,107,79,.11); }
textarea { resize: vertical; min-height: 190px; font-size: 16px; line-height: 1.6; margin-top: 4px; }
.controls { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.controls label { margin-top: 0; }
.ask-actions { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-top: 16px; }
.ask-actions p { max-width: 660px; margin: 0; }

button.primary, button.secondary { border-radius: 10px; padding: 10px 14px; font-weight: 750; border: 1px solid transparent; }
button.primary { background: var(--accent); color: #fff; min-width: 130px; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.secondary { background: var(--soft); color: var(--ink); border-color: var(--line); }
button.secondary:hover:not(:disabled) { background: #e9efea; }
button.full { width: 100%; margin-top: 16px; }
.text-button { border: 0; background: transparent; color: var(--accent-dark); font: inherit; font-size: 12px; font-weight: 750; padding: 4px 0; }
.text-button:hover { text-decoration: underline; }
.danger-text { color: var(--danger); }

.error-card { border-color: #e4b7b7; background: #fff7f7; color: var(--danger); box-shadow: none; }
.answer-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.answer-text { line-height: 1.68; font-size: 16px; margin-top: 16px; }
.answer-text p { margin: 0 0 13px; }
.answer-text p:last-child { margin-bottom: 0; }
.answer-text .pai-markdown-list { margin: 0; padding-left: 24px; }
.answer-text .pai-markdown-list li { margin: 0 0 12px; padding-left: 3px; }
.answer-text strong { font-weight: 800; }
.answer-text code { padding: 1px 5px; background: var(--soft); border-radius: 5px; font-size: .92em; }
.answer-text a { color: var(--accent-dark); font-weight: 700; }
.answer-section { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; }
.answer-section h3 { margin: 0 0 9px; font-size: 15px; }
.answer-section ul { margin: 8px 0 0; padding-left: 21px; }
.answer-section li { margin: 7px 0; line-height: 1.5; }
.sources-list { display: grid; gap: 8px; margin-top: 13px; }
.source-row { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; background: var(--soft); border-radius: 9px; }
.source-row a { color: var(--accent-dark); font-weight: 700; text-decoration-thickness: 1px; }
.trace { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }
.trace > summary { cursor: pointer; color: var(--accent-dark); font-size: 13px; font-weight: 800; }
.trace pre { overflow: auto; background: #17211b; color: #eef5f0; border-radius: 10px; padding: 14px; font-size: 11px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.trace-intro { margin: 10px 0 10px; max-width: 900px; }
.trace-actions { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.trace-actions button { min-width: auto; padding: 7px 10px; font-size: 11px; }
.trace-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0 16px; }
.trace-fact { min-width: 0; display: grid; gap: 3px; padding: 9px 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 9px; }
.trace-fact strong { font-size: 11px; overflow-wrap: anywhere; }
.trace-section { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 13px; }
.trace-section > summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 750; margin-bottom: 10px; }
.trace-section h4 { margin: 0 0 10px; font-size: 13px; }
.trace-contract-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.trace-call { display: grid; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; margin-top: 10px; }
.trace-query-label { margin: 4px 0 -2px; }
.trace-query-list { margin: 0; padding-left: 20px; font-size: 12px; line-height: 1.45; }
.trace-result { display: grid; gap: 6px; padding: 11px; border-radius: 9px; background: #fff; border: 1px solid var(--line); }
.trace-result-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.trace-result-top strong { font-size: 12px; line-height: 1.4; }
.trace-result-top a { font-size: 11px; flex-shrink: 0; }
.trace-result-meta { margin: 0; overflow-wrap: anywhere; }
.trace-chunk { margin: 0; max-height: 260px; }
.trace-result-attributes summary { cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 700; }
.trace-citation { display: grid; gap: 3px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); margin-top: 7px; }
.trace-citation strong { font-size: 12px; }
@media (max-width: 980px) {
  .trace-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .trace-summary, .trace-contract-meta { grid-template-columns: 1fr; }
  .trace-result-top { flex-direction: column; }
}

.profile-hero { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 32px; align-items: start; }
.profile-hero h2 { margin: 5px 0 8px; font-size: 28px; letter-spacing: -.025em; }
.profile-hero p { max-width: 760px; line-height: 1.55; }
.profile-progress-wrap { padding: 16px; background: var(--soft); border-radius: 13px; }
.profile-progress-wrap strong { display: block; margin-bottom: 9px; }
.progress-track { width: 100%; height: 8px; border-radius: 999px; background: #dce5de; overflow: hidden; margin-bottom: 8px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s ease; }
.onboarding-card { border-color: #cbdcca; background: #f8fbf8; box-shadow: none; }
.onboarding-card h3 { margin: 5px 0 7px; }
.guided-review-heading { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; margin-bottom:18px; }
.profile-review-step { max-width:760px; }
.profile-review-card { border:1px solid var(--line); border-radius:14px; background:#fff; padding:22px; }
.profile-review-card h4, .profile-review-complete h4 { margin:10px 0 6px; font-size:21px; }
.profile-review-meta { display:flex; gap:6px; flex-wrap:wrap; }
.profile-review-prompt { margin:18px 0 8px; font-size:13px; font-weight:750; }
.profile-suggested-value { padding:16px 18px; border:1px solid #cbdcca; border-radius:12px; background:var(--soft); font-size:18px; font-weight:750; overflow-wrap:anywhere; }
.profile-review-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:16px; }
.profile-review-actions .primary { width:auto; }
.profile-correction { display:grid; gap:10px; margin-top:18px; padding-top:18px; border-top:1px solid var(--line); }
.profile-review-complete { padding:8px 0 2px; }
.profile-manage-details { padding:0; overflow:hidden; }
.profile-manage-details > summary { cursor:pointer; padding:20px 24px; font-weight:800; }
.profile-manage-details > summary::marker { color:var(--accent); }
.profile-manage-details > p { margin:0; padding:0 24px 16px; }
.profile-sections { display:grid; gap:0; border-top:1px solid var(--line); }
.profile-section { padding:22px 24px; border-top:1px solid var(--line); }
.profile-section:first-child { border-top:0; }
.profile-section-heading { margin-bottom:2px; }
.profile-section-heading h3 { margin:0; font-size:18px; }
.profile-field { display:grid; grid-template-columns:minmax(200px,.75fr) minmax(320px,1.25fr); gap:24px; padding:20px 0; border-top:1px solid var(--line); }
.profile-field:first-of-type { border-top:0; }
.profile-field-copy strong { font-size:14px; }
.profile-field-copy p { margin:7px 0 0; max-width:430px; }
.field-badges { display:flex; flex-wrap:wrap; gap:5px; margin-top:7px; }
.mini-badge { border-radius:999px; padding:3px 7px; font-size:9px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.mini-badge.essential { background:#e2f3e9; color:#215b3d; }
.mini-badge.recommended { background:#fff3d9; color:var(--warning); }
.mini-badge.optional, .mini-badge.neutral { background:#edf0ed; color:#5e685f; }
.mini-badge.warning { background:#fff3d9; color:var(--warning); }
.mini-badge.confirmed { background:#e2f3e9; color:#215b3d; }
.profile-editor.simplified { display:grid; grid-template-columns:minmax(150px,1fr); gap:9px; align-items:start; }
.profile-actions { display:flex; gap:12px; align-items:center; }

footer { max-width: 1480px; margin: 0 auto; padding: 0 28px 28px; color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .topbar { padding: 16px 18px; position: static; }
  .workspace { grid-template-columns: 1fr; padding: 18px; }
  .workspace-sidebar { position: static; grid-template-columns: 1fr; }
  .workspace-nav { grid-template-columns: 1fr 1fr; }
  .profile-hero { grid-template-columns: 1fr; }
  .profile-field { grid-template-columns: 1fr; gap: 10px; }
  .controls { grid-template-columns: 1fr; }
  .ask-actions, .profile-nudge { align-items: stretch; flex-direction: column; }
  button.primary { width: 100%; }
  .status-stack { display: none; }
}
@media (max-width: 620px) {
  .workspace-nav { grid-template-columns: 1fr; }
  .profile-review-actions { align-items:stretch; flex-direction:column; }
  .profile-review-actions button { width:100%; }
}

.today-hero { padding: 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.today-hero h2 { margin: 5px 0 8px; font-size: 30px; letter-spacing: -.03em; }
.today-hero p { max-width: 720px; line-height: 1.55; }
.today-summary { display: grid; grid-template-columns: repeat(4, minmax(76px, 1fr)); gap: 0; min-width: 360px; padding: 6px 8px; background: var(--soft); border-radius: 12px; }
.today-summary > div { padding: 8px 12px; display: grid; gap: 1px; text-align: center; }
.today-summary > div + div { border-left: 1px solid var(--line); }
.today-summary strong { font-size: 18px; line-height: 1.1; }
.today-summary span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; font-weight: 750; }
.today-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.today-panel { padding: 22px; box-shadow: none; }
.today-panel h3 { margin: 5px 0 8px; font-size: 18px; }
.today-list-heading { align-items:center; }
.today-list-heading .today-inline-action { flex-shrink:0; }
.today-day-grid { margin-top: 10px; }
.today-day-column { min-width: 0; }
.today-day-column + .today-day-column { border-left: 1px solid var(--line); padding-left: 18px; }
.compact-heading { margin-bottom: 10px; }
.agenda-list, .task-list, .upcoming-list { display: grid; gap: 8px; }
.agenda-row, .task-row { display: grid; align-items: start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.agenda-row:first-child, .task-row:first-child { border-top: 0; }
.agenda-row { grid-template-columns: 72px minmax(0, 1fr) auto; }
.agenda-time { color: var(--accent-dark); font-size: 11px; font-weight: 800; padding-top: 2px; }
.agenda-copy, .task-copy { display: grid; gap: 3px; min-width: 0; }
.agenda-copy p, .task-copy p { margin: 4px 0 0; }
.task-row { grid-template-columns: 28px minmax(0, 1fr) auto; }
.task-check { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; border: 1px solid #b8c6bc; background: #fff; color: transparent; font-size: 12px; }
.task-check:hover { color: var(--accent); border-color: var(--accent); }
.task-row.overdue { background: #fff8f6; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 9px; }
.overdue-text { color: var(--danger); font-weight: 700; }
.empty-state { margin: 10px 0; padding: 12px; background: var(--soft); border-radius: 10px; }
.compact-form { display: grid; gap: 9px; }
.compact-form label { margin-top: 0; }
.compact-form textarea { min-height: 78px; font-size: 13px; line-height: 1.45; }
.compact-form button { justify-self: start; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upcoming-list .agenda-row, .upcoming-list .task-row { grid-template-columns: 145px 72px minmax(0,1fr) auto; }
.upcoming-list .task-row { grid-template-columns: 145px 28px minmax(0,1fr) auto; }
.upcoming-date { color: var(--muted); font-size: 11px; font-weight: 700; padding-top: 2px; }

@media (max-width: 980px) {
  .today-hero { flex-direction: column; }
  .today-summary { width: 100%; min-width: 0; }
  .today-grid { grid-template-columns: 1fr; }
  .today-day-column + .today-day-column { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 16px; }
  .workspace-nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .today-summary { grid-template-columns: 1fr; }
  .today-summary > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .form-row { grid-template-columns: 1fr; }
  .agenda-row, .upcoming-list .agenda-row { grid-template-columns: 65px minmax(0,1fr); }
  .agenda-row > .text-button, .upcoming-list .agenda-row > .text-button { grid-column: 2; justify-self: start; }
  .upcoming-list .upcoming-date { grid-column: 1 / -1; }
  .task-row, .upcoming-list .task-row { grid-template-columns: 28px minmax(0,1fr); }
  .task-row > .text-button, .upcoming-list .task-row > .text-button { grid-column: 2; justify-self: start; }
}

.today-briefing-panel { display: grid; gap: 14px; }
.today-briefing-heading { align-items: flex-start; gap: 22px; }
.today-briefing-heading > div:first-child { max-width: 760px; }
.today-briefing-actions { display: flex; align-items: end; gap: 10px; flex-shrink: 0; }
.compact-select { margin: 0; min-width: 110px; font-size: 11px; color: var(--muted); }
.compact-select select { margin-top: 4px; }
.today-briefing-result { display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; }
.today-briefing-answer { margin: 0; white-space: pre-wrap; line-height: 1.6; }
.briefing-subsection { display: grid; gap: 8px; }
.briefing-subsection ul { margin: 0; padding-left: 20px; }
.today-proposals { display: grid; gap: 9px; }
.today-proposal { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); }
.today-proposal-copy { display: grid; gap: 4px; min-width: 0; }
.proposal-kind { color: var(--accent-dark); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.error-text { color: var(--danger); }
@media (max-width: 700px) {
  .today-briefing-heading, .today-briefing-actions, .today-proposal { align-items: stretch; flex-direction: column; }
  .today-briefing-actions button { width: 100%; }
}

/* School Library */
.library-hero,
.library-panel { margin-bottom: 1rem; padding:24px; }
.library-hero { display:flex; justify-content:space-between; gap:1.5rem; align-items:flex-start; }
.library-hero h2,
.library-panel h3 { margin:5px 0 8px; }
.library-hero p:last-child,
.library-panel > p:last-child { margin-bottom:0; }
.library-summary { display:flex; flex-direction:column; align-items:flex-end; gap:.25rem; white-space:nowrap; }
.library-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.library-upload-panel { border-color:#cfded2; background:#fbfdfb; }
.library-upload-form { align-items:flex-end; }
.library-search-panel > summary { cursor:pointer; font-weight:800; }
.library-search-panel[open] > summary { margin-bottom:12px; }
#library-pai-count { align-self:flex-end; }
.library-documents,
.library-search-results { display:flex; flex-direction:column; gap:.75rem; }
.library-document-row,
.library-search-result { border:1px solid var(--border, #d9dde3); border-radius:12px; padding:.85rem 1rem; background:var(--surface-soft, #fafbfc); }
.library-document-row { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; }
.library-document-copy { display:flex; flex-direction:column; gap:.2rem; min-width:0; }
.library-document-copy strong { overflow-wrap:anywhere; }
.library-search-result p { margin:.45rem 0 0; white-space:pre-wrap; }
#library-file { width:100%; }
@media (max-width: 850px) {
  .library-grid { grid-template-columns:1fr; }
  .library-hero { flex-direction:column; }
  .library-summary { align-items:flex-start; }
}

/* School Library Privacy Workbench */
.library-document-actions { display:flex; align-items:center; gap:.75rem; flex-wrap:wrap; }
.privacy-workbench { padding:24px; }
.privacy-status-stack { display:flex; gap:.5rem; flex-wrap:wrap; justify-content:flex-end; }
.privacy-promise { margin: 0 0 18px; padding: 12px 14px; border-radius: 10px; background:#f2f7f3; border:1px solid #cfded2; font-size:13px; line-height:1.5; }
.privacy-compare { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.privacy-column-heading { display:flex; justify-content:space-between; gap:12px; align-items:baseline; margin-bottom:7px; }
.privacy-document-text { margin:0; min-height:320px; max-height:560px; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; padding:14px; border:1px solid var(--line); border-radius:10px; background:#fbfcfb; font:12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; user-select:text; }
.privacy-controls-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:18px; }
.privacy-rule-box, .privacy-receipt-box { padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--soft); }
.privacy-rule-box h4, .privacy-receipt-box h4 { margin:5px 0 12px; }
.privacy-rule-box label { display:grid; gap:5px; margin-top:9px; font-size:12px; font-weight:700; }
.privacy-receipt-row { display:flex; justify-content:space-between; gap:16px; padding:7px 0; border-top:1px solid #dde5df; font-size:12px; }
.privacy-receipt-row:first-child { border-top:0; }
.privacy-receipt-row span { color:var(--muted); }
.privacy-rules { display:grid; gap:7px; margin-top:10px; }
.privacy-rule-row { display:grid; gap:2px; padding:8px 10px; border-radius:8px; background:#fff; border:1px solid var(--line); font-size:12px; }
.privacy-rule-row span { overflow-wrap:anywhere; }
.privacy-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:18px; }
.privacy-projection-preview { background:#f7fbf8; border-color:#cfded2; }
.privacy-secondary-details { margin-top:14px; border:1px solid var(--line); border-radius:12px; background:var(--soft); padding:0 14px; }
.privacy-secondary-details > summary { cursor:pointer; font-weight:800; padding:13px 0; }
.privacy-secondary-details[open] { padding-bottom:14px; }
.privacy-secondary-details .privacy-rule-box,
.privacy-secondary-details .privacy-receipt-box { border:0; padding:0; background:transparent; }
.privacy-inline-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:12px; }
.privacy-workbench.embedded { padding:0; margin-top:14px; border:0; box-shadow:none; background:transparent; }
.privacy-workbench.embedded .privacy-compare { grid-template-columns:1fr; }
.privacy-workbench.embedded .privacy-source-column { display:none; }
@media (max-width: 980px) {
  .privacy-compare, .privacy-controls-grid { grid-template-columns:1fr; }
  .privacy-status-stack { justify-content:flex-start; }
}

/* Today developments + source controls (Radar is infrastructure inside Today) */
.today-developments-panel { display:grid; gap:12px; }
.today-developments-heading { align-items:flex-start; margin-bottom:0; }
.today-developments-heading > div:first-child { max-width:760px; }
.today-developments-heading p:last-child { margin:6px 0 0; }
.today-developments-meta { display:flex; flex-wrap:wrap; gap:10px 18px; padding-bottom:2px; }
.today-radar-items { margin-top:2px; }
.radar-actions { display:grid; justify-items:end; gap:7px; min-width:180px; }
.radar-items { display:grid; gap:12px; }
.radar-item { border:1px solid var(--line); border-radius:12px; padding:15px 16px; background:#fbfcfb; }
.radar-item-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.radar-item-heading h4 { margin:7px 0 0; font-size:16px; line-height:1.35; }
.radar-summary { margin:11px 0 7px; line-height:1.55; white-space:pre-wrap; }
.radar-item-meta { display:flex; flex-wrap:wrap; align-items:center; gap:10px; color:var(--muted); font-size:11px; margin-top:10px; }
.radar-item-sources { display:flex; flex-wrap:wrap; gap:7px; }
.radar-item-sources a { font-size:11px; }
.radar-scan-footprint { line-height:1.45; }
.mini-badge.warning { background:#fff1d7; color:#8a5a14; }

.today-manage-panel { padding:0; overflow:hidden; }
.today-manage-panel > summary { cursor:pointer; list-style:none; padding:18px 22px; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.today-manage-panel > summary::-webkit-details-marker { display:none; }
.today-manage-panel > summary::after { content:'+'; color:var(--accent-dark); font-size:22px; line-height:1; font-weight:500; }
.today-manage-panel[open] > summary::after { content:'–'; }
.today-manage-panel > summary span { display:grid; gap:3px; }
.today-manage-panel > summary small { color:var(--muted); font-weight:500; }
.today-manage-content { border-top:1px solid var(--line); padding:22px; display:grid; gap:20px; }
.today-subpanel { min-width:0; padding:18px; border:1px solid var(--line); border-radius:12px; background:var(--soft); }
.today-subpanel h3 { margin:5px 0 12px; }
.planner-save-status { display:grid; gap:3px; margin-top:12px; padding:11px 12px; border:1px solid #c8ddce; border-radius:10px; background:#f0f8f2; color:#215b3d; font-size:12px; line-height:1.45; }
.planner-save-status span { color:#496055; }
.planner-save-status.error { border-color:#e4b7b7; background:#fff7f7; color:var(--danger); }
.planner-save-status.error span { color:var(--danger); }
.today-source-settings { border:1px solid var(--line); border-radius:12px; background:#fbfcfb; overflow:hidden; }
.today-source-settings > summary { cursor:pointer; padding:14px 16px; display:flex; justify-content:space-between; gap:16px; align-items:center; }
.today-source-settings-content { border-top:1px solid var(--line); padding:16px; }
.radar-sources { display:grid; gap:14px; margin-top:14px; }
.radar-source-group { display:grid; gap:6px; padding:12px 0; border-top:1px solid var(--line); }
.radar-source-group:first-child { border-top:0; }
.radar-source-group > strong { font-size:12px; }
.radar-source-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.radar-source-row label { display:flex; align-items:center; gap:9px; margin:0; font-size:12px; font-weight:600; }
.radar-source-row input[type="checkbox"] { width:16px; height:16px; margin:0; }
.radar-source-form { margin-top:18px; padding-top:16px; border-top:1px solid var(--line); }

@media (max-width: 980px) {
  .radar-actions { justify-items:start; }
}
@media (max-width: 760px) {
  .radar-item-heading { flex-direction:column; }
  .radar-actions, .radar-actions button { width:100%; }
  .today-developments-heading { flex-direction:column; }
  .today-manage-panel > summary, .today-source-settings > summary { align-items:flex-start; }
  .today-list-heading { align-items:flex-start; }
}

/* Pilot access + admin */
.access-links { display:flex; gap:.55rem; align-items:center; margin-top:.9rem; font-size:.9rem; }
.access-card { width:min(620px, 100%); }
.access-lookup-row { align-items:end; }
.access-school-match { margin:1rem 0; padding:1rem; border:1px solid var(--border); border-radius:12px; background:var(--surface-soft, #f7f7f5); white-space:pre-line; }
.admin-shell { width:min(1040px, calc(100% - 2rem)); margin:2rem auto; }
.admin-console { display:grid; gap:1rem; }
.admin-applications { display:grid; gap:.8rem; }
.admin-application { border:1px solid var(--border); border-radius:12px; padding:1rem; }
.admin-registry-card { margin-top:.25rem; }
.admin-invite-result { display:grid; gap:.7rem; }
.invite-link-code { display:block; overflow-wrap:anywhere; padding:.75rem; border-radius:10px; background:var(--surface-soft, #f7f7f5); }
@media (max-width: 720px) {
  .admin-shell { width:min(100% - 1rem, 1040px); margin:.5rem auto; }
  .access-lookup-row { grid-template-columns:1fr; }
}

/* Ask PAI product hierarchy */
.ask-card textarea { min-height: 145px; }
.ask-context-note { margin-top: 12px; padding: 10px 12px; border: 1px solid #d7e1da; border-radius: 10px; background: #f7faf8; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ask-settings { margin-top: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ask-settings > summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 2px; font-size: 12px; font-weight: 800; color: var(--accent-dark); }
.ask-settings > summary::marker { color: var(--accent); }
.ask-settings .controls { margin: 0 0 14px; }
.answer-context { margin: 4px 0 0; }
.answer-actions { display: flex; justify-content: flex-end; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 700px) {
  .ask-settings > summary { align-items: flex-start; flex-direction: column; gap: 4px; }
  .answer-topline { align-items: flex-start; flex-direction: column; }
  .answer-actions button { width: 100%; }
}

/* Ask PAI conversation */
.ask-conversation-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 2px 0 10px; border-bottom: 1px solid var(--line); }
.ask-conversation { display: grid; gap: 18px; max-height: min(62vh, 720px); overflow-y: auto; padding: 22px 8px 8px 0; }
.conversation-message { min-width: 0; }
.conversation-message-topline { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 7px; }
.conversation-message-topline strong { font-size: 12px; letter-spacing: .02em; }
.principal-message { justify-self: end; width: min(78%, 760px); padding: 13px 15px; border-radius: 15px 15px 4px 15px; background: var(--soft); border: 1px solid var(--line); }
.principal-message .conversation-message-topline { margin-bottom: 5px; }
.conversation-principal-text { white-space: pre-wrap; line-height: 1.58; font-size: 15px; }
.pai-message { width: min(100%, 980px); padding: 4px 2px 18px; border-bottom: 1px solid var(--line); }
.pai-message:last-child { border-bottom: 0; }
.conversation-answer-text { margin-top: 0; }
.conversation-answer-section { margin-top: 18px; padding-top: 14px; }

.conversation-evidence { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 11px; }
.conversation-evidence > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 700; list-style-position: inside; }
.conversation-evidence > summary:hover { color: var(--ink); }
.conversation-evidence-meta { font-weight: 600; }
.conversation-evidence-body { padding: 10px 0 2px 18px; color: var(--muted); font-size: 13px; }
.conversation-evidence-summary { margin: 0; padding-left: 19px; }
.conversation-evidence-summary li { margin: 5px 0; line-height: 1.5; }
.conversation-evidence-sources { margin-top: 10px; gap: 5px; }
.conversation-evidence .source-row { padding: 7px 9px; background: #fbfcfb; border: 1px solid var(--line); }
.conversation-evidence .source-row a { color: var(--ink); font-weight: 650; text-decoration-color: #aab5ad; }
.ask-composer { margin-top: 16px; padding-top: 18px; border-top: 1px solid var(--line); }
.ask-composer textarea { margin-top: 0; }
.ask-settings-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) {
  .principal-message { width: 92%; }
  .conversation-message-topline { align-items: flex-start; flex-direction: column; gap: 3px; }
  .ask-conversation-toolbar { align-items: flex-start; }
  .ask-settings-controls { grid-template-columns: 1fr; }
}

/* Ask PAI recent conversations */
.ask-history { margin: 14px 0 10px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; }
.ask-history > summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 13px; font-size: 12px; font-weight: 800; color: var(--accent-dark); }
.ask-history-list { display: grid; gap: 4px; padding: 0 8px 8px; }
.ask-history-empty { margin: 3px 5px 7px; }
.ask-history-item { display: grid; gap: 3px; width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; text-align: left; color: inherit; cursor: pointer; }
.ask-history-item:hover { background: var(--soft); }
.ask-history-item.active { border-color: var(--line); background: var(--soft); }
.ask-history-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.ask-history-meta { display: block; }
@media (max-width: 700px) {
  .ask-history > summary { align-items: flex-start; }
}
.ask-history-item:disabled { cursor: default; opacity: .65; }
.library-ocr-note { color:#52645a; }


/* Privacy review: make local protection actions visible and reassuring. */
.privacy-protection-status {
  min-height: 1.35rem;
  margin: .65rem 0 0;
  font-weight: 650;
}

.privacy-applied-box {
  margin-top: 1rem;
}

.privacy-applied-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .65rem;
}

.privacy-applied-heading p {
  margin: .2rem 0 0;
}

.privacy-rules:empty::before {
  content: "No extra protections added yet.";
  display: block;
  font-size: .82rem;
  opacity: .7;
}


/* contextual-private-detail-review-v1 */
.privacy-selection-popover {
  position: fixed;
  z-index: 1000;
  width: min(340px, calc(100vw - 20px));
  padding: .8rem;
  border: 1px solid rgba(20, 30, 45, .18);
  border-radius: .8rem;
  background: var(--surface, #fff);
  box-shadow: 0 12px 35px rgba(20, 30, 45, .18);
}

.privacy-selection-popover[hidden] {
  display: none;
}

.privacy-selection-title {
  display: block;
  margin-bottom: .55rem;
}

.privacy-selection-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.privacy-selection-kind {
  padding: .42rem .62rem;
}

.privacy-selection-kind.selected,
.privacy-selection-kind[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(43, 105, 74, .12);
  font-weight: 800;
}

.privacy-selection-scope,
.privacy-selection-identity {
  display: grid;
  gap: .38rem;
  margin: .7rem 0 .5rem;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  font-size: .86rem;
}

.privacy-selection-identity.hidden { display:none; }

.privacy-selection-scope legend,
.privacy-selection-identity legend {
  padding: 0 .2rem;
  font-size: .76rem;
  font-weight: 800;
  color: var(--muted);
}

.privacy-selection-scope label,
.privacy-selection-identity label {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
  font-weight: 600;
}

.privacy-selection-scope input[type="radio"],
.privacy-selection-identity input[type="radio"] {
  width: auto;
  min-width: 0;
  margin: 0;
  flex: 0 0 auto;
}

.privacy-selection-status {
  display: block;
  min-height: 1.25rem;
  margin: .25rem 0 .45rem;
}

.privacy-selection-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 1.8rem;
}

.privacy-projection-token {
  padding: 0 .18em;
  border: 1px solid #c8ddce;
  border-radius: .28rem;
  background: #e8f5eb;
  color: inherit;
  font-weight: 800;
}

/* School Library OCR review */
.ocr-review-text { min-height:260px; }
.ocr-reviewed-text-heading { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin:0 0 8px; }
.ocr-reviewed-text-heading p { margin:3px 0 0; max-width:760px; }
.ocr-review-text mark { padding:1px 3px; border-radius:4px; background:#fff1b8; color:inherit; border-bottom:2px solid #c68a18; }
.ocr-review-text mark.accepted { background:#e8f5eb; border-bottom-color:#4f8a5c; }
.ocr-review-text mark.rejected { background:#f3f4f5; border-bottom-color:#8a9299; text-decoration:line-through; text-decoration-thickness:1px; }
.ocr-review-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; margin-top:16px; }
.ocr-review-corrections, .ocr-review-warnings { display:grid; gap:9px; margin-top:10px; }
.ocr-correction-row, .ocr-warning-row { display:grid; gap:7px; padding:10px 11px; border:1px solid var(--line); border-radius:9px; background:#fff; }
.ocr-correction-source { margin:0; }
.ocr-correction-source strong { color:var(--ink); }
.ocr-correction-comparison { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.ocr-correction-value { display:grid; gap:4px; padding:10px 11px; border:1px solid var(--line); border-radius:8px; background:var(--surface-soft, #f7f8f9); }
.ocr-correction-value-label { font-size:11px; font-weight:800; letter-spacing:.01em; color:var(--muted); }
.ocr-correction-value code { font:700 14px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space:pre-wrap; overflow-wrap:anywhere; }
.ocr-correction-found code { color:#744b4b; }
.ocr-correction-replacement { border-color:#c8ddce; background:#f5faf6; }
.ocr-correction-replacement code { color:#245f32; }
.ocr-correction-scope { display:grid; gap:5px; max-width:520px; }
.ocr-correction-scope-label { font-size:12px; font-weight:800; color:var(--ink); }
.ocr-correction-scope select { width:100%; }
.ocr-correction-actions { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.ocr-warning-row strong { font-size:12px; }
.ocr-warning-row span { white-space:pre-wrap; overflow-wrap:anywhere; }
.ocr-warning-row.advisory { background:var(--surface-soft, #f7f8f9); }
.ocr-warning-editor { width:100%; font:12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ocr-original-link { text-align:center; }
.ocr-warning-context { margin:0; padding:8px 9px; border-radius:8px; background:var(--surface-soft, #f7f8f9); font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
.ocr-warning-context mark { padding:1px 3px; border-radius:4px; background:#fff1b8; color:inherit; font-weight:800; }
.ocr-warning-locate { justify-self:start; }
.ocr-scan-viewer { display:grid; gap:9px; margin:10px 0 12px; padding:10px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft, #f7f8f9); }
.ocr-scan-viewer-heading { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.ocr-scan-viewer-heading p { margin:3px 0 0; }
.ocr-scan-viewer-actions { display:flex; gap:7px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.ocr-scan-viewer-actions .secondary { min-width:36px; padding:7px 10px; }
.ocr-scan-frame { max-height:68vh; overflow:auto; border:1px solid var(--line); border-radius:8px; background:#ecefed; }
.ocr-scan-canvas { position:relative; width:100%; min-width:100%; transform-origin:top left; }
.ocr-scan-frame img { display:block; width:100%; height:auto; }
.ocr-scan-highlight { position:absolute; pointer-events:none; border:3px solid #b36b00; background:rgba(255, 207, 92, .22); border-radius:4px; box-shadow:0 0 0 2px rgba(255,255,255,.8); }
.ocr-privacy-stage { margin-top:16px; background:#f7fbf8; border-color:#cfded2; }
.ocr-privacy-stage-heading { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin-bottom:12px; }
.ocr-privacy-stage-heading p { margin:4px 0 0; max-width:760px; }
.ocr-privacy-slot:empty { display:none; }
@media (max-width: 980px) {
  .ocr-review-grid { grid-template-columns:1fr; }
  .ocr-reviewed-text-heading, .ocr-privacy-stage-heading, .ocr-scan-viewer-heading { flex-direction:column; }
  .ocr-correction-comparison { grid-template-columns:1fr; }
  .ocr-scan-viewer-actions { justify-content:flex-start; }
}

.ocr-review-items { display:grid; gap:12px; }
.ocr-review-advisory { margin:4px 0 0; }

/* Digital leadership proof */
.digital-hero { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; }
.digital-summary { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.digital-panel { display:grid; gap:12px; }
.digital-steps { margin:0; padding-left:1.35rem; display:grid; gap:7px; }
.digital-evidence-list { display:grid; gap:9px; }
.digital-evidence-row { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; padding:11px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft, #f7f8f9); }
.digital-evidence-row p { margin:6px 0 0; white-space:pre-wrap; }
.digital-evidence-form { display:grid; grid-template-columns:minmax(150px, .35fr) minmax(0, 1fr) auto; gap:10px; align-items:end; }
.digital-date-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.digital-pai-panel { background:#fbfcff; }
.digital-pai-actions { display:flex; gap:10px; align-items:end; flex-wrap:wrap; }
.digital-pai-result { display:grid; gap:12px; }
.digital-pai-result > p { white-space:pre-wrap; }
.digital-official-basis { display:grid; gap:12px; padding-top:12px; }
.digital-basis-row { padding:10px 0; border-top:1px solid var(--line); }
.digital-basis-row:first-child { border-top:0; }
.digital-basis-row p { margin:4px 0 0; }
@media (max-width: 900px) {
  .digital-hero { flex-direction:column; }
  .digital-summary { justify-content:flex-start; }
  .digital-evidence-form { grid-template-columns:1fr; }
  .digital-date-grid { grid-template-columns:1fr; }
}

/* Administrator Corpus lifecycle */
.admin-tabs { display:flex; gap:.45rem; padding:.25rem; border:1px solid var(--border); border-radius:12px; width:max-content; background:var(--surface-soft, #f7f7f5); }
.admin-tab { border:0; background:transparent; border-radius:9px; padding:.65rem .9rem; font-weight:700; cursor:pointer; }
.admin-tab.active { background:var(--surface, #fff); box-shadow:0 1px 3px rgba(0,0,0,.08); }
.admin-panel { display:grid; gap:1rem; }
.admin-panel > .card { padding:1rem; }
.admin-corpus-hero { display:grid; gap:.8rem; }
.admin-corpus-summary { white-space:pre-line; line-height:1.65; }
.admin-corpus-intake-grid, .admin-corpus-review-grid, .admin-corpus-judgement-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:.85rem; margin:1rem 0; }
.admin-corpus-judgement-grid { grid-template-columns:1fr; }
.admin-corpus-review { margin-top:1rem; padding:1rem; border:1px solid var(--border); border-radius:12px; background:var(--surface-soft, #f7f7f5); }
.admin-corpus-review-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; }
.admin-corpus-done { display:grid; gap:.35rem; margin-top:1rem; padding-top:.9rem; border-top:1px solid var(--line); }
.admin-corpus-done strong { font-weight:800; }
.admin-corpus-done p { margin:0; }
.admin-corpus-done button { justify-self:start; margin-top:.25rem; }
.admin-corpus-test-actions { display:flex; gap:.8rem; align-items:end; margin-top:.8rem; }
.admin-corpus-test-result { margin-top:1rem; padding-top:1rem; border-top:1px solid var(--border); }
.admin-corpus-source-row { padding:.55rem 0; border-bottom:1px solid var(--border); }
.admin-corpus-source-row:last-child { border-bottom:0; }
@media (max-width: 720px) {
  .admin-tabs { width:100%; }
  .admin-tab { flex:1; }
  .admin-corpus-intake-grid, .admin-corpus-review-grid { grid-template-columns:1fr; }
  .admin-corpus-review-heading, .admin-corpus-test-actions { align-items:stretch; flex-direction:column; }
}
