/* Global Base Styles */

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 20px;
    color: #222;
}

a {
    color: inherit;
}

/* Reusable Icon Button */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
}
.icon-btn:disabled {
    cursor: default;
    opacity: 0.4;
}

/* Minimal Flex Utilities */
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }

.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }

/* Muted Text Utility */
.muted {
    font-size: 12px;
    color: #666;
}

/* Key under a help or contacts chart that shows daily notes (chart-notes.js) */
.chart-notes-key {
    font-size: 12px;
    color: #666;
    margin: 4px 0 0;
}

/* Sufficiency Count Badge */
.suff-count {
    min-width: 18px;
    text-align: center;
    font-size: 12px;
    color: #555;
}

/* Clickable Utility */
.clickable { cursor: pointer; }

/* Admin Toggle Buttons */
.admin-toggle {
    background: none;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.admin-toggle:hover {
    background: #f2f4f7;
}

.admin-toggle.active {
    background: #e8f1ff;
}

.hidden {
    display: none;
}

/* Mode Toggle Pill (Competency Indicators) */
.mode-toggle-pill {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    background: #f2f2f2;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    color: #555;
    transition: background 0.15s ease;
}

.mode-toggle-pill:hover {
    background: #e6e6e6;
}

/* Admin → Competencies "Show inactive types" unchecked. !important because the
   rows set display:flex inline. .obs-keep: turned off during this visit. */
#competencies-panel.hide-inactive .observation-row.obs-inactive:not(.obs-keep) {
    display: none !important;
}

/* Competency set pills (Admin → Competencies, Reports). One is shown at a
   time; the active one uses the student page's selected-pill colors. */
.comp-set-pill {
    padding: 4px 14px;
    font-size: 13px;
    background: #f2f2f2;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    color: #555;
    transition: background 0.15s ease, color 0.15s ease;
}
.comp-set-pill:hover { background: #e6e6e6; }
.comp-set-pill.active {
    background: #e8f1ff;
    border-color: #bcd4f6;
    color: #1565c0;
    font-weight: 600;
}

/* A period's competency set on its Admin → Periods row */
.period-set-btn {
    background: none;
    border: none;
    padding: 0 4px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    white-space: nowrap;
}
.period-set-btn:hover { color: #555; text-decoration: underline; }

/* Grayscale edit icons (Admin consistency with student detail page) */
.icon-btn.area-edit-btn,
.icon-btn.obs-edit-btn,
.icon-btn.ind-edit-btn,
.icon-btn.period-edit-btn {
    filter: grayscale(100%);
    opacity: 0.75;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.icon-btn.area-edit-btn:hover,
.icon-btn.obs-edit-btn:hover,
.icon-btn.ind-edit-btn:hover,
.icon-btn.period-edit-btn:hover {
    filter: none;
    opacity: 1;
}

/* Competency report container (enables vertical + horizontal scroll) */
.competency-report-container {
    width: 100%;
    max-width: 960px;
    max-height: 60vh;
    overflow: auto;
}

/* Sticky header for competency reports */
.competency-report-table thead tr:first-child th {
    position: sticky;
    top: 0;
    z-index: 3;
}

/* Second header row (used in the all-competencies view) */
.competency-report-table thead tr:nth-child(2) th {
    position: sticky;
    top: 28px; /* offset just below first header row */
    z-index: 3;
}

/* Stat row (mean/median per column) is the last header row: row 2 in the single-competency
   tables, row 3 in the all-competencies observations table. Offsets follow the header rows above. */
.competency-report-table thead tr:nth-child(2) td {
    position: sticky;
    top: 28px;
    z-index: 3;
}
.competency-report-table thead tr:nth-child(3) td {
    position: sticky;
    top: 56px;
    z-index: 3;
}

/* Row hover + selection highlighting for competency tables */
.competency-report-table tbody tr:hover td {
    background-color: #f0f7ff !important;
}

.competency-report-table tbody tr.row-selected td {
    background-color: #e2ecff !important;
}

.competency-report-table tbody tr.row-selected:hover td {
    background-color: #e2ecff !important;
}

/* Click-to-sort headers (static/js/table-sort.js). The arrow sits in the
   right padding of narrow count columns so it never widens them; the sticky
   th is the positioning context. */
table[data-sortable] th[data-sort-col] {
    cursor: pointer;
    user-select: none;
}
.sort-arrow {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 7px;
    color: #bbb;
}
table[data-sortable] th[data-sort-col="name"] .sort-arrow {
    position: static;
    transform: none;
    margin-left: 4px;
    vertical-align: middle;
}

/* SortableJS drag ghost */
.sortable-ghost {
    opacity: 0.35;
    background: #e8f1ff;
    border-radius: 6px;
}

/* Shared Action Buttons */
.btn-primary {
    background: #4f7096;
    color: #fff;
    border: none;
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-primary:hover {
    background: #3e5f82;
}

.btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-secondary:hover {
    background: #f3f4f6;
}

/* Artifact row action icons (rename / delete) */
.artifact-icon-btn {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    opacity: 0.5;
    transition: opacity 0.15s ease;
    vertical-align: middle;
}

.artifact-icon-btn:hover,
.artifact-icon-btn:focus {
    opacity: 1;
}

/* Admin Artifacts Panel */
.artifact-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

/* Student detail and dashboard 📜: a small drop zone above the artifact list. */
.artifact-dropzone-compact { padding: 8px 10px; font-size: 12px; margin-bottom: 8px; }

.artifact-dropzone.dragover {
    border-color: #4f7096;
    background: #eef3f9;
    color: #4f7096;
}

.artifact-pending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.artifact-remove-all-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #c62828;
    font-size: 12px;
    padding: 0;
}

.artifact-remove-all-btn:hover {
    text-decoration: underline;
}

.artifact-pending-list {
    list-style: none;
    margin: 4px 0 0 0;
    padding: 0;
    font-size: 13px;
}

.artifact-pending-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    color: #555;
}

.artifact-remove-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    font-size: 12px;
    padding: 0 2px;
}

.artifact-remove-file-btn:hover {
    color: #c62828;
}

.artifact-pending-empty {
    color: #bbb;
    font-size: 12px;
    font-style: italic;
}

/* ── Teacher page header (title left, _header_right.html right) ───────── */
/* space-between (not an auto margin) keeps .hdr-right on the right while it
   fits beside the title, and starts it at the left, under the title, once it
   wraps onto its own line. */
.page-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px 12px;
    margin-bottom: 10px;
}
.page-head > h1,
.page-head > h2 { margin: 0; }
.hdr-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.page-head > .hdr-right { margin-left: 0; }
.hdr-right .icon-btn {
    background: none;
    border: none;
    padding: 5px 7px;
    cursor: pointer;
    font-size: 16px;
    border-radius: 7px;
    opacity: 0.6;
    line-height: 1;
    transition: background 0.15s, opacity 0.15s;
}
.hdr-right .icon-btn:hover { background: #e9ecef; opacity: 1; }
.hdr-right .icon-btn.is-current { opacity: 0.9; }
/* Account switcher (⇄, shared access): a small menu under the icon, styled
   like the dashboard's period switcher. Capped to the viewport width so it
   never scrolls the page sideways on a phone. */
.acct-switcher-wrap { position: relative; display: inline-block; }
.acct-switcher-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
    background: #fff; border: 1px solid #e0e0e0; border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.13); padding: 5px;
    min-width: 200px; max-width: min(320px, calc(100vw - 32px));
    visibility: hidden; opacity: 0; transform: translateY(-6px) scale(0.97);
    transition: opacity 0.13s, transform 0.13s, visibility 0.13s; pointer-events: none;
}
.acct-switcher-menu.open { visibility: visible; opacity: 1; transform: none; pointer-events: auto; }
.acct-switcher-item {
    display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px;
    text-decoration: none; color: #333; font-size: 14px; font-weight: 500;
}
.acct-switcher-item:hover { background: #f0f4ff; }
.acct-switcher-item.current { background: #e8f0fe; color: #1a56db; }
.acct-text { min-width: 0; overflow-wrap: anywhere; }
.acct-sub { display: block; font-size: 12px; font-weight: 400; color: #888; }
.acct-check { margin-left: auto; font-size: 13px; }
/* Admin → System settings: one card (.card, from the panel-page styles) per
   screen the settings change, each setting with a one-line gray description
   under its label. Each field saves on its own, with its result beside the
   label (same look as the /sysadmin/ Configuration panel). */
.settings-form { display: flex; flex-direction: column; }
.settings-form .setting-status { margin-left: 8px; font-size: 12px; color: #6b7280; }
.settings-form .setting-status.ok  { color: #166534; }
.settings-form .setting-status.err { color: #991b1b; }
.settings-form input.is-error { border-color: #dc2626; outline-color: #dc2626; }
.settings-group { display: flex; flex-direction: column; gap: 12px; }
.settings-group h4 { margin: 0; font-size: 12px; font-weight: 600; color: #6b7280;
                     text-transform: uppercase; letter-spacing: 0.04em; }
.settings-field { display: flex; flex-direction: column; gap: 4px; }
.settings-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.settings-check > input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }
.settings-check > span { display: flex; flex-direction: column; gap: 2px; }
.settings-label { font-size: 14px; color: #222; }
.settings-help { font-size: 12px; color: #6b7280; line-height: 1.4; }
.settings-text { width: 100%; box-sizing: border-box; padding: 6px; }
.settings-number { width: 56px; padding: 2px 4px; margin: 0 2px; }
.settings-number:disabled { opacity: 0.5; }
.settings-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.settings-color { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.settings-link { background: none; border: none; padding: 0; font: inherit; font-size: 12px;
                 color: #1565c0; text-decoration: underline; cursor: pointer; }

/* Rendered changelog markdown (sysadmin Changelog panel, teacher Change Log
   modal): compact headings and lists so an entry reads as notes, not a page. */
.changelog-body { font-size: 14px; line-height: 1.5; color: #333; overflow-wrap: anywhere; }
.changelog-body > :first-child { margin-top: 0; }
.changelog-body > :last-child { margin-bottom: 0; }
.changelog-body h1, .changelog-body h2, .changelog-body h3 { font-size: 15px; margin: 10px 0 4px; }
.changelog-body p { margin: 0 0 8px; }
.changelog-body ul, .changelog-body ol { margin: 0 0 8px; padding-left: 20px; }
.changelog-body code { background: #f3f4f6; padding: 1px 4px; border-radius: 3px; font-size: 13px; }
.changelog-body pre { background: #f3f4f6; padding: 8px; border-radius: 4px; overflow-x: auto; }
.changelog-body pre code { background: none; padding: 0; }
.changelog-body table { border-collapse: collapse; margin: 0 0 8px; }
.changelog-body th, .changelog-body td { border: 1px solid #e5e7eb; padding: 4px 8px; }
/* Small text link beside the Admin → System title. */
.changelog-link {
    position: relative;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 12px;
    font-weight: 400;
    color: #1565c0;
    text-decoration: underline;
    cursor: pointer;
}

/* Sysadmin status dots (_header_right.html): one column on the icon's upper
   right, so they clearly belong to that icon rather than its neighbours.
   Order in the markup is order on screen (red alerts first), and hidden dots
   take no space, so the column stays packed at the top. Three fit beside a
   header icon. The white ring keeps them readable over the emoji. */
.status-dot-host { position: relative; display: inline-flex; }
.status-dots {
    position: absolute;
    top: 1px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    pointer-events: none;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    box-shadow: 0 0 0 1.5px #fff;
}
.status-dot[hidden] { display: none; }
.status-dot-alert    { background: #dc2626; }
.status-dot-feedback { background: #16a34a; }
/* Blue so a teacher's "new changelog" dot never reads as a sysadmin alert. */
.status-dot-new      { background: #2563eb; }
/* Amber: an archived period is in its deletion warning (the same amber as the
   archived row and the banner). */
.status-dot-retention { background: #d97706; }
/* Tabs and the Change Log link that carry dots anchor them. */
.admin-toggle, .changelog-link { position: relative; }
.changelog-link .status-dots { top: -4px; right: -9px; }
.hdr-right .live-time {
    font-size: 13px;
    color: #9ca3af;
    white-space: nowrap;
}

/* ── Artifact content ─────────────────────────────────────────────────── */
.artifact-text {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.45;
}
/* Fixed layout: an auto-layout table grows to fit a wide image or frame, so
   max-width/width: 100% would never constrain them. Column widths come from
   the first row; the actions column is fixed and the title column takes the
   rest, so the colspan=2 content row always spans the full panel. */
.artifact-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.artifact-table .artifact-actions { width: 72px; }
.artifact-table .artifact-title-text { overflow-wrap: anywhere; }
/* File-type icon before each title: grey and faded so it doesn't compete
   with the title; the tooltip names the type. */
.artifact-type-icon {
    display: inline-block;
    margin-right: 4px;
    filter: grayscale(1);
    opacity: 0.55;
    cursor: help;
}

/* Images: natural size, shrunk to the panel width when larger. */
.artifact-image-link { display: inline-block; max-width: 100%; cursor: zoom-in; }
.artifact-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}
/* PDF: full panel width, open-in-new-tab link underneath. */
.artifact-pdf { display: block; width: 100%; cursor: default; }
.artifact-pdf-frame {
    display: block;
    width: 100%;
    height: 80vh;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fff;
}
.artifact-pdf-open { display: block; margin-top: 6px; font-size: 12px; }

/* ── Panel pages (Admin, /sysadmin/) ─────────────────────────────────────
   A light gray page with content in full-width white cards. The card edges
   frame the space, so room left inside a card reads as intended rather than
   leftover. A page opts in with {% block body_class %}panel-page{% endblock %}.
   Scoped because .card also names the dashboard's check-in cards. :where()
   keeps each rule at single-class specificity, so a page's own rules (e.g.
   .feedback-item's padding) still adjust these by coming later. Keep this at
   the end of the file so it follows the base .page-head rule. */
body.panel-page { margin: 0; padding: 24px 28px; background: #f8f9fa; color: #1f2937; }
:where(.panel-page) .page-head { margin-bottom: 24px; }
:where(.panel-page) .page-head h1 { font-size: 20px; font-weight: 700; }
:where(.panel-page) .panel-nav { padding-bottom: 8px; border-bottom: 1px solid #e5e5e5; margin-bottom: 15px; }
:where(.panel-page) .card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 20px;
}
:where(.panel-page) .card h2 { font-size: 15px; font-weight: 700; margin: 0 0 14px 0; color: #374151; }
/* Title plus anything that belongs beside it (Admin's Change Log link). */
:where(.panel-page) .page-title-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
:where(.panel-page) .page-title-row h1 { margin: 0; }
/* Admin panels: the card spans the page, but everything inside shares one
   width. Admin content is "name … actions" rows, and at full width a name
   would sit far from its icons. */
:where(.panel-page) .admin-panel.card > *,
:where(.panel-page) .settings-group > * { max-width: 680px; }
/* A save the server refused on a full-page form post. Fixed text from the
   template, shown once above the panel it concerns. */
.admin-error {
    color: #b71c1c;
    background: #fdecea;
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 10px;
    font-size: 13px;
    max-width: 680px;
}
/* Admin → Periods student rows: name, then group chips and the + picker. The
   cell wraps so chips drop to the next line on a narrow screen. */
.guests-card .guest-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-top: 1px solid #f0f0f0; }
.guests-card .guest-main { flex: 1 1 180px; min-width: 0; }
.guests-card .guest-name { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.guests-card .guest-email { color: #888; font-size: 11px; overflow-wrap: anywhere; }
.guests-card .guest-seen { color: #888; font-size: 12px; }
.guests-card .guest-edit { display: flex; gap: 6px; align-items: center; }
.guests-card .guest-edit input { flex: 1; min-width: 0; padding: 4px; }
.guests-archived { font-size: 12px; color: #888; margin: 0 0 6px; overflow-wrap: anywhere; }
.roster-row-main { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; flex: 1 1 140px; }
.group-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.group-chip {
    display: inline-flex; align-items: center; gap: 3px; max-width: 100%;
    padding: 0 7px; border-radius: 10px; background: #eef0f3; color: #555;
    font-size: 11px; line-height: 18px; overflow-wrap: anywhere;
}
.group-chip-x, .group-add-btn {
    background: none; border: none; cursor: pointer; color: #888; padding: 0; font-size: 13px; line-height: 18px;
}
.group-chip-x:hover, .group-add-btn:hover { color: #222; }
/* Admin → Groups members view: period menu, count line, checklist in columns
   (one column on a phone). */
.group-members { flex: 1 1 100%; min-width: 0; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eee; }
.group-members select { max-width: 100%; padding: 4px; }
.group-members-count { color: #888; font-size: 12px; margin: 6px 0; }
.group-members-note { color: #888; font-size: 12px; margin-top: 6px; }
.group-members-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: 4px 12px; }
.group-members-list label { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.group-members-list label.staged { opacity: 0.6; }
.group-add-btn {
    width: 18px; height: 18px; border: 1px dashed #bbb; border-radius: 50%; text-align: center; font-size: 12px; line-height: 15px;
}
.group-menu {
    position: fixed; z-index: 1000; display: flex; flex-direction: column; min-width: 120px;
    max-width: calc(100vw - 32px); max-height: 50vh; overflow-y: auto;
    background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.group-menu button {
    background: none; border: none; cursor: pointer; text-align: left; padding: 5px 8px;
    border-radius: 4px; font-size: 13px; color: #333; overflow-wrap: anywhere;
}
.group-menu button:hover, .group-menu button:focus { background: #eef0f3; outline: none; }
/* Admin → Periods archived list. Each row shows when the period will be
   deleted; inside the warning window the row and date turn amber (the same
   amber as the sysadmin inactive flag) and Keep another year appears. */
.archived-row {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 5px 8px; border: 1px solid #f0e8d0; border-radius: 4px; margin-bottom: 4px;
    background: #fffbf2; opacity: 0.85;
}
.archived-row.retention-warning { opacity: 1; background: #fffbeb; border-color: #fcd34d; }
.retention-date { font-size: 11px; color: #9ca3af; margin-top: 2px; }
.retention-warning .retention-date { color: #b45309; font-weight: 600; }
.archived-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.archived-actions .btn-secondary { padding: 3px 10px; font-size: 12px; }
/* Above the page on Admin, Reports and student pages while a period is due.
   Not dismissible: it goes when the periods are kept or deleted. */
.retention-banner {
    max-width: 1100px; margin: 10px auto 0; padding: 8px 14px;
    background: #fffbeb; border: 1px solid #fcd34d; border-radius: 6px;
    color: #92400e; font-size: 14px; line-height: 1.4;
}
.retention-banner a { color: #92400e; font-weight: 600; }
/* After the fact: gray, not amber, since nothing is left to decide. */
.retention-notice { background: #f3f4f6; border-color: #d1d5db; color: #374151;
                    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.retention-notice .btn-secondary { padding: 3px 12px; font-size: 13px; margin-left: auto; }
.archived-download { text-decoration: none; filter: grayscale(100%); opacity: 0.55; }
.archived-download:hover { filter: none; opacity: 0.9; }

/* ── Guide (❓, static/js/guide.js; DESIGN.md "Teacher Guide") ─────────── */
.hdr-right .icon-btn.guide-active { opacity: 1; background: #dbeafe; }
/* Picking: every tagged area shows a faint outline (a tablet has no hover),
   the innermost one under the pointer a solid one. Disabled controls take
   pointer events again so a tap on them reaches the guide. */
body.guide-picking, body.guide-picking * { cursor: help !important; }
/* A faint blue page while picking, the color of the active ❓ and the
   outlines. !important because pages set their own body background. */
body.guide-picking { background-color: #eef4ff !important; }
body.guide-picking [data-guide] { outline: 1px dashed #60a5fa; outline-offset: 2px; }
body.guide-picking [data-guide]:hover:not(:has([data-guide]:hover)) { outline: 2px solid #3b82f6; }
body.guide-picking [data-guide]:disabled { pointer-events: auto; }
/* Says what picking is for and how to leave it. Takes no pointer events,
   so a tap on it is a tap on the page under it. Below the drawer. */
#guide-hint {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    z-index: 8990; pointer-events: none;
    background: #1e3a8a; color: #fff; font-size: 14px;
    padding: 8px 16px; border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2); white-space: nowrap;
}

/* The drawer covers the right edge instead of pushing the page, so a live
   dashboard doesn't reflow. No backdrop: the page stays usable. */
#guide-drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 380px; max-width: 100%;
    z-index: 9000;
    display: flex; flex-direction: column;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform 0.18s, visibility 0.18s;
}
#guide-drawer.open { transform: none; visibility: visible; }
html.is-impersonating #guide-drawer { top: 40px; }
.guide-drawer-head {
    display: flex; align-items: center; gap: 2px;
    padding: 10px 10px 10px 16px;
    border-bottom: 1px solid #e5e7eb;
}
.guide-drawer-title {
    flex: 1; min-width: 0;
    font-weight: 600; font-size: 15px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.guide-drawer-head .icon-btn {
    font-size: 16px; line-height: 1; padding: 5px 7px; border-radius: 7px;
    color: inherit; text-decoration: none; opacity: 0.65;
}
.guide-drawer-head .icon-btn:hover { background: #e9ecef; opacity: 1; }
.guide-drawer-body { position: relative; flex: 1; overflow-y: auto; padding: 4px 18px 28px; }

.guide-body { font-size: 14px; line-height: 1.55; color: #222; }
.guide-body h2 { font-size: 15px; margin: 22px 0 6px; }
.guide-body h3 { font-size: 14px; margin: 16px 0 4px; }
.guide-body h2, .guide-body h3 { border-radius: 4px; transition: background 0.6s; }
.guide-body .guide-flash { background: #fef9c3; }
.guide-body p, .guide-body ul, .guide-body ol { margin: 6px 0; }
.guide-body ul, .guide-body ol { padding-left: 22px; }
.guide-body a { color: #1a73e8; }
/* A blockquote is the guide's one callout style: a rule worth not missing. */
.guide-body blockquote {
    margin: 12px 0; padding: 8px 12px;
    background: #eff6ff; border-left: 3px solid #3b82f6; border-radius: 4px;
}
.guide-body blockquote p { margin: 0; }
.guide-body table { border-collapse: collapse; margin: 8px 0; }
.guide-body th, .guide-body td { border: 1px solid #e5e7eb; padding: 4px 8px; text-align: left; vertical-align: top; }
.guide-body code { background: #f3f4f6; padding: 1px 4px; border-radius: 4px; font-size: 13px; }
.guide-page .guide-body { max-width: 70ch; }
.guide-crumb { margin: 0 0 8px; font-size: 13px; }
.guide-crumb a { color: #1a73e8; }
.guide-drawer-head .icon-btn.guide-active { opacity: 1; background: #dbeafe; }

/* Section headings with a visible control on the page get 📍 and show it
   when tapped (guide.js locate()). The outline fades, so it can't stay on. */
.guide-body .guide-locatable { cursor: pointer; }
.guide-body .guide-locatable:hover { background: #f1f5f9; }
.guide-pin { font-size: 12px; margin-left: 6px; opacity: 0.75; }
.guide-locate {
    outline: 3px solid #facc15 !important;
    outline-offset: 3px;
    animation: guide-locate-fade 2.2s ease-out forwards;
}
@keyframes guide-locate-fade {
    0%, 55% { outline-color: #facc15; }
    100% { outline-color: rgba(250, 204, 21, 0); }
}
