/* GuideMate dashboard — "The Study": a warm, refined academic app shell.
   Direction adapted from directionA.jsx; built on the Whetstone brand
   (Space Grotesk display, navy + gold), with Hanken Grotesk for UI text. */
:root {
    --gm-bg: #F6EFDD;
    --gm-surface: #FFFDF8;
    --gm-field: #FBF6EA;
    --gm-ink: #15263B;
    --gm-ink-2: #46566B;
    --gm-muted: #9A8F76;
    --gm-line: #E8DDC6;
    --gm-line-strong: #D9C79C;
    --gm-gold: #C39A4C;
    --gm-gold-ink: #A87E33;
    --gm-gold-soft: #F1E6CB;
    --gm-usage-navy: var(--navy-900, #0D1D36);
    --gm-on-ink: #F6EFDD;
    --gm-on-gold: #3A2C0C;
    --gm-danger: #aa2e25;
    --gm-success: #2f7d52;

    --gm-radius-card: 16px;
    --gm-radius-ctrl: 11px;
    --gm-radius-pill: 22px;

    --gm-sidebar-w: 250px;
    --gm-shadow-card: 0 1px 2px rgba(15, 29, 48, 0.04);
    --gm-shadow-hover: 0 14px 30px rgba(15, 29, 48, 0.10);
    --gm-shadow-pop: 0 18px 44px rgba(15, 29, 48, 0.14);

    --gm-font: "Hanken Grotesk", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    /* Display font is Space Grotesk. Deliberately NOT var(--font-heading, …):
       styles.css (loaded on every GuideMate page) defines --font-heading as
       Cormorant Garamond, so the indirection would win and re-serif the app. */
    --gm-display: "Space Grotesk", "Hanken Grotesk", sans-serif;
}

/* styles.css styles BARE h1–h4 with var(--font-heading) (Cormorant Garamond).
   Any GuideMate heading without its own font-family rule would silently pick
   that up — pin every heading on app pages to the display font instead. */
.gm-page h1, .gm-page h2, .gm-page h3, .gm-page h4,
.lc-page h1, .lc-page h2, .lc-page h3, .lc-page h4 {
    font-family: var(--gm-display);
}

/* The SIGN-IN moment keeps the Whetstone brand serif; only the app behind it
   (post login) speaks Space Grotesk. Redefining the token on the .gm-auth
   subtree flips every descendant that uses var(--gm-display) — headings,
   kicker, brand lockup — including bare h1–h4 via the pin rule above. */
.gm-auth {
    --gm-display: "Cormorant Garamond", serif;
}

.gm-page {
    min-height: 100vh;
    color: var(--gm-ink);
    font-family: var(--gm-font);
    /* Transparent so the iridescence WebGL layer shows on the login screen. */
    background: transparent;
}

/* Animated iridescence is the login moment only. */
body.gm-signed-in .iridescence-container {
    display: none;
}

/* ============ Global status toast ============ */
.gm-status {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 60;
    margin: 0;
    max-width: min(560px, calc(100% - 32px));
    padding: 11px 18px;
    border-radius: var(--gm-radius-pill);
    background: var(--gm-ink);
    color: var(--gm-on-ink);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--gm-shadow-pop);
    text-align: center;
}

.gm-status:empty {
    display: none;
}

.gm-status[data-tone="error"] {
    background: var(--gm-danger);
    color: #fff;
}

.gm-status[data-tone="success"] {
    background: var(--gm-success);
    color: #fff;
}

.gm-status[data-tone="warn"] {
    background: var(--gm-gold-ink);
    color: #fff;
}

/* ============ Shared bits ============ */
.gm-brand {
    display: inline-flex;
    align-items: center;
}

.gm-brand img {
    height: auto;
}

.gm-muted {
    color: var(--gm-muted);
}

.gm-ic {
    width: 1.2em;
    height: 1.2em;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gm-ic--gold {
    stroke: var(--gm-gold);
}

/* ============ Buttons ============ */
.gm-primary-button,
.gm-secondary-button,
.gm-ghost-button,
.gm-gold-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: var(--gm-radius-ctrl);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    transition: all 0.18s ease;
}

.gm-primary-button {
    background: var(--gm-ink);
    color: var(--gm-on-ink);
    box-shadow: 0 8px 20px rgba(21, 38, 59, 0.22);
}

.gm-primary-button:not(:disabled):hover {
    transform: translateY(-2px);
    background: #1d3550;
    box-shadow: 0 12px 26px rgba(21, 38, 59, 0.3);
}

.gm-secondary-button {
    background: var(--gm-surface);
    border-color: var(--gm-line);
    color: var(--gm-ink-2);
}

.gm-secondary-button:not(:disabled):hover {
    transform: translateY(-2px);
    border-color: var(--gm-line-strong);
    background: var(--gm-field);
    box-shadow: var(--gm-shadow-hover);
}

.gm-ghost-button {
    background: var(--gm-surface);
    border-color: var(--gm-line);
    color: var(--gm-ink-2);
    min-height: 40px;
    font-size: 0.88rem;
}

.gm-ghost-button:not(:disabled):hover {
    border-color: var(--gm-gold);
    color: var(--gm-gold-ink);
    background: var(--gm-gold-soft);
}

.gm-gold-button {
    background: var(--gm-gold);
    color: var(--gm-on-gold);
    min-height: 40px;
    font-size: 0.86rem;
}

.gm-gold-button:hover {
    transform: translateY(-2px);
    background: #b78d3f;
    box-shadow: 0 10px 22px rgba(195, 154, 76, 0.34);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.gm-icon-button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--gm-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s ease;
}

.gm-icon-button:hover {
    color: var(--gm-danger);
    background: rgba(170, 46, 37, 0.08);
}

/* ============ Kicker / headings ============ */
.gm-kicker {
    margin: 0 0 10px;
    color: var(--gm-gold-ink);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* ============ LOGIN (two-column sign-in) ============ */
.gm-auth {
    min-height: 100vh;
    background: var(--gm-bg);
}

.gm-signin {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr);
    min-height: 100vh;
}

/* Brand panel (navy) */
.gm-signin-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: clamp(40px, 5vw, 56px);
    background: #0F1D30;
    color: var(--gm-on-ink);
}

.gm-signin-arc {
    position: absolute;
    fill: none;
    pointer-events: none;
}

.gm-signin-arc circle {
    stroke-width: 1;
}

.gm-signin-arc--tr {
    right: -160px;
    top: -120px;
    width: 520px;
    height: 520px;
    opacity: 0.5;
}

.gm-signin-arc--tr circle {
    stroke: rgba(195, 154, 76, 0.2);
}

.gm-signin-arc--bl {
    left: -130px;
    bottom: -150px;
    width: 420px;
    height: 420px;
    opacity: 0.35;
}

.gm-signin-arc--bl circle {
    stroke: rgba(246, 239, 221, 0.12);
}

.gm-signin-pitch {
    position: relative;
    z-index: 1;
    margin: auto 0;
    padding: 40px 0;
    max-width: 460px;
}

.gm-signin-kicker {
    margin: 0 0 18px;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--gm-gold);
}

.gm-signin-pitch h1 {
    margin: 0;
    font-family: var(--gm-display);
    font-size: clamp(2.4rem, 3.4vw, 2.9rem);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.01em;
    color: var(--gm-on-ink);
}

.gm-signin-lead {
    margin: 18px 0 36px;
    font-size: 1rem;
    line-height: 1.65;
    color: rgba(246, 239, 221, 0.66);
}

.gm-signin-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.gm-signin-point {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.gm-signin-point-ic {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(195, 154, 76, 0.16);
    color: #E7C77E;
}

.gm-signin-point-ic svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gm-signin-point-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gm-on-ink);
}

.gm-signin-point-body {
    margin: 2px 0 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(246, 239, 221, 0.6);
}

.gm-signin-copyright {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 0.78rem;
    color: rgba(246, 239, 221, 0.45);
}

/* Form panel */
.gm-signin-panel {
    position: relative;
    display: flex;
    /* Top-align (below the corner logo) so the card sits high without overlapping it. */
    align-items: flex-start;
    justify-content: center;
    padding: 176px 40px 56px;
}

.gm-signin-topright {
    position: absolute;
    top: 28px;
    right: 36px;
    margin: 0;
    font-size: 0.86rem;
    color: var(--gm-ink-2);
    white-space: nowrap;
}

.gm-signin-topright a {
    color: var(--gm-gold-ink);
    font-weight: 700;
}

.gm-signin-card {
    width: 100%;
    max-width: 416px;
}

.gm-signin-panel-logo {
    position: absolute;
    top: -8px;
    left: 18px;
    z-index: 2;
}

.gm-signin-panel-logo img {
    width: 182px;
}

.gm-signin-card h2 {
    margin: 0;
    font-family: var(--gm-display);
    font-size: clamp(2rem, 3vw, 2.4rem);
    font-weight: 600;
    line-height: 1.08;
    color: var(--gm-ink);
}

.gm-signin-card-sub {
    margin: 10px 0 30px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--gm-ink-2);
}

/* Sign-in form */
.gm-signin-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.gm-field {
    display: block;
}

.gm-field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gm-muted);
}

.gm-field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.gm-field-head .gm-field-label {
    margin-bottom: 0;
}

.gm-field-link {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gm-gold-ink);
    cursor: pointer;
    white-space: nowrap;
}

.gm-field-link:hover {
    color: var(--gm-gold);
}

.gm-field-wrap {
    position: relative;
    display: block;
}

.gm-field-ic {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--gm-muted);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
    transition: stroke 0.15s ease;
}

.gm-field-wrap input,
.gm-field-wrap select {
    width: 100%;
    border: 1px solid var(--gm-line);
    border-radius: 12px;
    background: var(--gm-surface);
    color: var(--gm-ink);
    font: inherit;
    padding: 14px 14px 14px 42px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Keep the native dropdown chevron so the field reads as a select. Native
   select rendering does not reliably honor the 42px icon inset inputs use,
   so selects carry no leading icon and use plain padding. */
.gm-field-wrap select {
    padding: 14px;
    cursor: pointer;
}

.gm-field-wrap:has(.gm-pw-toggle) input {
    padding-right: 64px;
}

.gm-field-wrap input:focus,
.gm-field-wrap select:focus {
    outline: none;
    border-color: var(--gm-gold);
    box-shadow: 0 0 0 3px rgba(195, 154, 76, 0.16);
}

.gm-field-wrap input::placeholder {
    color: var(--gm-muted);
}

.gm-field-wrap:focus-within .gm-field-ic {
    stroke: var(--gm-gold-ink);
}

.gm-pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    padding: 4px 6px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gm-gold-ink);
    cursor: pointer;
}

/* Remember me */
.gm-remember {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
}

.gm-remember input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.gm-remember-box {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    border-radius: 6px;
    border: 1px solid var(--gm-line-strong);
    background: var(--gm-surface);
    display: grid;
    place-items: center;
    transition: all 0.15s ease;
}

.gm-remember-box svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: #fff;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
}

.gm-remember input:checked + .gm-remember-box {
    background: var(--gm-gold);
    border-color: var(--gm-gold);
}

.gm-remember input:checked + .gm-remember-box svg {
    opacity: 1;
}

.gm-remember input:focus-visible + .gm-remember-box {
    box-shadow: 0 0 0 3px rgba(195, 154, 76, 0.22);
}

.gm-remember-text {
    font-size: 0.86rem;
    color: var(--gm-ink-2);
}

/* Submit */
.gm-signin-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 2px;
    padding: 15px;
    border: 0;
    border-radius: 12px;
    background: var(--gm-ink);
    color: var(--gm-on-ink);
    font: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.gm-signin-submit .gm-ic {
    width: 18px;
    height: 18px;
}

.gm-signin-submit:not(:disabled):hover {
    transform: translateY(-1px);
    background: #1d3550;
    box-shadow: 0 12px 26px rgba(15, 29, 48, 0.28);
}

.gm-signin-submit:disabled {
    cursor: default;
    opacity: 0.55;
}

/* Divider */
.gm-signin-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0;
}

.gm-signin-divider::before,
.gm-signin-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--gm-line);
}

.gm-signin-divider span {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--gm-muted);
}

/* Social */
.gm-social-auth {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.gm-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--gm-line);
    border-radius: 11px;
    background: var(--gm-surface);
    color: var(--gm-ink);
    font: inherit;
    font-weight: 600;
    font-size: 0.84rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gm-social-btn:hover {
    border-color: var(--gm-line-strong);
    background: var(--gm-field);
}

.gm-social-mark {
    flex-shrink: 0;
}

.gm-signin-note {
    margin: 28px 0 0;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--gm-muted);
    text-align: center;
}

/* ── Web sign-up + profile setup (plain text controls, no pills) ── */
.gm-link-btn {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--gm-ink);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}

.gm-link-btn:hover {
    color: var(--gm-gold-ink);
}

.gm-link-btn:focus-visible {
    outline: 2px solid rgba(195, 154, 76, 0.6);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Persistent pending-verification notice (the status toast auto-dismisses). */
.gm-verify-notice {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid rgba(195, 154, 76, 0.45);
    border-radius: 12px;
    background: var(--gm-gold-soft);
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--gm-ink);
}

.gm-verify-notice p {
    margin: 0 0 6px;
}

.gm-verify-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.gm-signup-note {
    margin: 2px 0 0;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--gm-muted);
    text-align: center;
}

.gm-setup-subjects {
    display: grid;
    gap: 6px;
}

.gm-setup-hint {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--gm-muted);
}

.gm-setup-subject-groups {
    display: grid;
    gap: 14px;
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 6px 4px 2px;
    border: 1px solid var(--gm-line);
    border-radius: 12px;
    background: var(--gm-surface);
}

.gm-setup-group {
    padding: 8px 10px 4px;
}

.gm-setup-group-title {
    margin: 0 0 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--gm-muted);
}

.gm-setup-subject {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 0;
    font-size: 0.88rem;
    color: var(--gm-ink);
    cursor: pointer;
}

.gm-setup-subject input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    accent-color: var(--gm-gold);
    cursor: pointer;
}

@media (max-width: 860px) {
    .gm-signin {
        grid-template-columns: 1fr;
    }

    .gm-signin-brand {
        display: none;
    }

    /* The logo PNG is a padded square (content centred inside ~15-20% transparent
       margin), so a left placement reads as an awkward indent. Centre it and let it
       read as an intentional brand mark; negative bottom margin trims the asset's
       built-in bottom padding so the page flows into the form. */
    .gm-signin-panel-logo {
        position: static;
        align-self: center;
        margin: 0 0 -6px;
    }

    .gm-signin-panel-logo img {
        width: 112px;
    }

    .gm-signin-topright {
        position: static;
        text-align: center;
        margin: 0 0 24px;
        white-space: normal;
    }

    /* Start content at the top (no vertical-centering dead space) with even rhythm. */
    .gm-signin-panel {
        padding: 22px 22px 40px;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .gm-signin-card {
        margin: 0;
    }
}

/* ============ Agent form ============ */
.gm-agent-form {
    display: grid;
    gap: 14px;
}

.gm-agent-form label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--gm-ink);
}

.gm-agent-form input,
.gm-agent-form textarea,
.gm-agent-form select {
    width: 100%;
    border: 1px solid var(--gm-line-strong);
    border-radius: var(--gm-radius-ctrl);
    background: var(--gm-field);
    color: var(--gm-ink);
    font: inherit;
    padding: 12px 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.gm-agent-form input:focus,
.gm-agent-form textarea:focus,
.gm-agent-form select:focus {
    outline: none;
    background: var(--gm-surface);
    border-color: var(--gm-gold);
    box-shadow: 0 0 0 3px rgba(195, 154, 76, 0.22);
}

/* Agent run-panel form: 2-column grid, uppercase gold labels, cream rounded fields */
.gm-agent-form {
    grid-template-columns: 1fr 1fr;
    gap: 18px 16px;
    align-items: start;
}

.gm-agent-form > label:has(textarea),
.gm-agent-form > label:has(input[type="file"]),
.gm-agent-form > .gm-run-button,
.gm-agent-form > .gm-result {
    grid-column: 1 / -1;
}

.gm-agent-form label {
    gap: 9px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gm-gold-ink);
}

.gm-agent-form label input,
.gm-agent-form label textarea,
.gm-agent-form label select {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    color: var(--gm-ink);
}

/* Choosable values + placeholders use the same refined treatment as the
   "View results" buttons: the UI sans (Hanken Grotesk) at a deliberate semibold
   weight — so they read as intentional, not a thin/plain system control. */
.gm-agent-form label select,
.gm-agent-form label input[type="file"] {
    font-family: var(--gm-font);
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: normal;
    color: var(--gm-ink-2);
}

.gm-agent-form label select option {
    font-family: var(--gm-font);
    font-weight: 600;
    color: var(--gm-ink);
}

.gm-agent-form label textarea::placeholder,
.gm-agent-form label input::placeholder {
    font-family: var(--gm-font);
    font-size: 1rem;
    font-weight: 600;
    font-style: normal;
    color: var(--gm-muted);
}

/* Style the native file button into a refined pill (kept in the UI sans). */
.gm-agent-form label input[type="file"]::file-selector-button {
    font-family: var(--gm-font);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--gm-ink-2);
    background: var(--gm-surface);
    border: 1px solid var(--gm-line-strong);
    border-radius: 9px;
    padding: 8px 14px;
    margin-right: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.gm-agent-form label input[type="file"]::file-selector-button:hover {
    border-color: var(--gm-gold);
    color: var(--gm-gold-ink);
    background: var(--gm-gold-soft);
}

.gm-agent-form input,
.gm-agent-form textarea,
.gm-agent-form select {
    border: 1px solid var(--gm-line);
    border-radius: 14px;
    background: var(--gm-field);
    padding: 17px 18px;
}

/* Selects: strip the native macOS chrome (arrow, system font/height) so they
   match the inputs exactly — spacious, regular weight, no dropdown arrow. */
.gm-agent-form select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none;
    cursor: pointer;
}

.gm-agent-form input::placeholder,
.gm-agent-form textarea::placeholder {
    color: var(--gm-muted);
}

.gm-agent-form input:focus,
.gm-agent-form textarea:focus,
.gm-agent-form select:focus {
    background: var(--gm-field);
    border-color: var(--gm-gold);
    box-shadow: 0 0 0 3px rgba(195, 154, 76, 0.22);
}

.gm-agent-form textarea {
    min-height: 150px;
    resize: vertical;
}

.gm-link-button {
    justify-self: start;
    border: 0;
    background: transparent;
    color: var(--gm-gold-ink);
    font: inherit;
    font-weight: 600;
    padding: 2px 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(195, 154, 76, 0.5);
}

.gm-link-button:hover {
    color: var(--gm-gold);
}

/* Run-agent submit: no fill, navy "blue contrast" text */
/* Multi-question count selector (Practice Question agent) */
.gm-count-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gm-count-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gm-ink-2);
}

.gm-count-seg {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-ctrl);
    background: var(--gm-field);
    width: max-content;
}

.gm-count-opt {
    min-width: 40px;
    height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--gm-ink-2);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease;
}

.gm-count-opt:hover {
    background: var(--gm-gold-soft);
}

.gm-count-opt.is-active {
    background: var(--gm-ink);
    color: var(--gm-on-ink);
}

.gm-count-hint {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gm-muted);
}

.gm-count-hint.is-short {
    color: var(--gm-danger);
}

.gm-run-button {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--gm-ink);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    transition: color 0.15s ease;
}

.gm-run-button::after {
    content: "→";
    transition: transform 0.15s ease;
}

.gm-run-button:not(:disabled):hover {
    color: var(--gm-gold-ink);
}

.gm-run-button:not(:disabled):hover::after {
    transform: translateX(3px);
}

/* ============ APP SHELL ============ */
.gm-app {
    display: flex;
    align-items: flex-start;
    min-height: 100vh;
    background: var(--gm-bg);
}

/* Mobile top bar + hamburger + drawer backdrop — hidden on desktop, activated in
   the responsive drawer block. */
.gm-topbar {
    display: none;
}

.gm-sidebar-backdrop {
    display: none;
}

.gm-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 1px solid var(--gm-line);
    border-radius: 12px;
    background: var(--gm-bg);
    color: var(--gm-ink);
    cursor: pointer;
}

.gm-nav-toggle .gm-ic {
    width: 22px;
    height: 22px;
}

.gm-topbar-logo {
    /* The wordmark PNG is a transparent-padded square, so at a small height the
       actual text is tiny. Scale it up so the wordmark is readable, then crop the
       transparent top/bottom padding with negative margins so the top bar stays
       compact. */
    height: 108px;
    width: auto;
    margin: -34px 0;
    flex-shrink: 0;
}

/* Sidebar */
.gm-sidebar {
    position: sticky;
    top: 0;
    align-self: stretch;
    width: var(--gm-sidebar-w);
    flex-shrink: 0;
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 26px 18px;
    /* Never clip the user row at the bottom on short windows. */
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    background: var(--gm-surface);
    border-right: 1px solid var(--gm-line);
}

.gm-sidebar-brand {
    width: 100%;
    justify-content: center;
    padding: 8px 0 2px;
}

.gm-sidebar-brand img {
    width: 168px;
}

.gm-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.gm-nav-label {
    margin: 0 0 8px;
    padding: 0 13px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gm-muted);
}

.gm-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    border-radius: 10px;
    color: var(--gm-ink-2);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.gm-nav-item .gm-ic {
    width: 19px;
    height: 19px;
}

.gm-nav-item span:nth-of-type(1) {
    flex: 1;
}

.gm-nav-item:not(.is-disabled):not(.is-active):hover {
    background: var(--gm-gold-soft);
    color: var(--gm-ink);
}

.gm-nav-item.is-active {
    background: var(--gm-ink);
    color: var(--gm-on-ink);
    font-weight: 600;
}

.gm-nav-item.is-disabled {
    cursor: default;
    opacity: 0.6;
}

.gm-nav-badge {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--gm-gold-ink);
    background: var(--gm-gold-soft);
    padding: 2px 8px;
    border-radius: 20px;
}

.gm-nav-badge:empty {
    display: none;
}

.gm-nav-item.is-active .gm-nav-badge {
    color: var(--gm-gold);
    background: rgba(255, 255, 255, 0.1);
}

.gm-sidebar-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Compact the sidebar on short viewports so everything fits without scroll. */
@media (max-height: 880px) {
    .gm-sidebar {
        gap: 14px;
        padding: 16px 18px;
    }

    .gm-sidebar-brand img {
        width: 126px;
    }

    .gm-nav-item {
        padding: 7px 13px;
    }

    .gm-upgrade {
        padding: 12px;
    }
}

.gm-upgrade {
    border: 1px solid var(--gm-line);
    border-radius: 14px;
    padding: 16px;
    background: var(--gm-field);
}

.gm-upgrade-title {
    font-family: var(--gm-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gm-ink);
}

.gm-upgrade p {
    margin: 6px 0 12px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--gm-ink-2);
}

.gm-upgrade .gm-gold-button {
    width: 100%;
}

.gm-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
}

.gm-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--gm-ink);
    color: var(--gm-on-ink);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.gm-user-meta {
    flex: 1;
    min-width: 0;
}

.gm-user-name,
.gm-user-email {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gm-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gm-ink);
}

.gm-user-email {
    font-size: 0.72rem;
    color: var(--gm-muted);
}

/* Main column */
.gm-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    /* Override the global `main { z-index: 1 }` from styles.css so it doesn't
       create a stacking context that traps the fixed run panel below the backdrop. */
    z-index: auto;
}

.gm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 34px;
    border-bottom: 1px solid var(--gm-line);
}

.gm-greeting {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gm-muted);
}

.gm-greeting:empty {
    display: none;
}

.gm-header-copy h1 {
    margin: 2px 0 0;
    font-family: var(--gm-display);
    font-size: clamp(1.7rem, 3vw, 2.1rem);
    font-weight: 600;
    line-height: 1;
    color: var(--gm-ink);
}

.gm-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.gm-credit-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 15px;
    border-radius: var(--gm-radius-ctrl);
    background: var(--gm-ink);
    color: var(--gm-on-ink);
    font-weight: 600;
    font-size: 0.9rem;
}

.gm-credit-pill strong {
    font-weight: 700;
}

.gm-content {
    padding: 26px 34px 56px;
}

/* ============ Stat row ============ */
.gm-stat-row {
    display: grid;
    /* Balance · Analyze Me · Credit usage — the chart keeps the widest slot
       (it was crunched when the center card held the 1.5fr column). */
    grid-template-columns: 1.1fr 1.1fr 1.5fr;
    gap: 16px;
    margin-bottom: 34px;
}

.gm-card {
    background: var(--gm-surface);
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-card);
    padding: 22px;
    box-shadow: var(--gm-shadow-card);
}

.gm-balance-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.gm-ring {
    position: relative;
    width: 118px;
    height: 118px;
    flex-shrink: 0;
}

.gm-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gm-ring-track,
.gm-ring-fill {
    fill: none;
    stroke-width: 9;
    stroke-linecap: round;
}

.gm-ring-track {
    stroke: var(--gm-line);
}

.gm-ring-fill {
    stroke: var(--gm-ink);
    stroke-dasharray: 263.894;
    stroke-dashoffset: 263.894;
    transition: stroke-dashoffset 0.7s ease;
}

.gm-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.gm-ring-center strong {
    font-family: var(--gm-font); /* was var(--gm-sans), which is undefined */
    font-size: 1.95rem;
    font-weight: 700;
    color: var(--gm-ink);
}

.gm-stat-label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gm-muted);
}

.gm-stat-sub {
    margin: 6px 0 0;
    font-size: 0.92rem;
    color: var(--gm-ink-2);
}

.gm-stat-sub strong {
    color: var(--gm-ink);
}

.gm-stat-foot {
    margin: 8px 0 0;
    font-size: 0.8rem;
    color: var(--gm-muted);
}

.gm-stat-foot strong {
    color: var(--gm-ink-2);
}

.gm-plan-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gm-plan-name {
    margin: 2px 0 10px;
    font-family: var(--gm-display);
    font-size: 1.9rem;
    font-weight: 600;
    text-transform: capitalize;
    color: var(--gm-ink);
}

.gm-plan-meter {
    display: flex;
    gap: 6px;
}

.gm-meter-seg {
    flex: 1;
    height: 6px;
    border-radius: 4px;
    background: var(--gm-line);
    transition: background 0.3s ease;
}

.gm-meter-seg.is-filled {
    background: var(--gm-gold);
}

/* ── Credit usage chart card ── */
.gm-usage-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.gm-usage-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.gm-usage-caption {
    margin: 0;
    font-size: 0.8rem;
    color: var(--gm-muted);
}

.gm-usage-caption strong {
    color: var(--gm-ink-2);
    font-weight: 700;
    text-transform: capitalize;
}

.gm-usage-chart {
    position: relative;
    flex: 1;
    min-height: 96px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gm-line);
    /* Faint grid: 8 columns × 4 rows, like a chart backdrop. */
    background:
        linear-gradient(90deg, var(--gm-line) 1px, transparent 1px 100%) 0 0 / calc(100% / 8) 100% repeat no-repeat,
        linear-gradient(180deg, var(--gm-line) 1px, transparent 1px 100%) 0 0 / 100% calc(100% / 4) no-repeat repeat;
}

.gm-usage-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Minimal y-axis ticks overlaid on the plotting band. Positions match the SVG's
   padY=10 in a 96-tall viewBox: max sits at ~10.4%, midpoint at 50%, zero at ~89.6%. */
.gm-usage-yaxis {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.gm-usage-tick {
    position: absolute;
    left: 6px;
    transform: translateY(-50%);
    font-size: 0.58rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: var(--gm-muted);
    opacity: 0.45;
}

.gm-usage-tick--top { top: 10.4%; }
.gm-usage-tick--mid { top: 50%; }
.gm-usage-tick--bottom { top: 89.6%; }

.gm-usage-foot {
    margin: 0;
    font-size: 0.7rem;
    color: var(--gm-muted);
    opacity: 0.8;
}

.gm-usage-area {
    fill: url(#gm-usage-grad);
}

.gm-usage-stroke {
    fill: none;
    stroke: var(--gm-usage-navy);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.gm-help-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.gm-help-title {
    margin: 4px 0 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gm-ink);
}

.gm-help-sub {
    margin: 0 0 6px;
    font-size: 0.85rem;
    color: var(--gm-ink-2);
    line-height: 1.5;
}

/* ============ Sections ============ */
.gm-section {
    margin-top: 34px;
    scroll-margin-top: 20px;
}

.gm-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.gm-section-heading h2 {
    margin: 0;
    font-family: var(--gm-display);
    font-size: clamp(1.6rem, 2.4vw, 2rem);
    font-weight: 600;
    color: var(--gm-ink);
}

/* Collapsible section toggle (the heading itself is the button) */
.gm-section-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.gm-chevron {
    width: 22px;
    height: 22px;
    color: var(--gm-muted);
    transition: transform 0.2s ease, color 0.15s ease;
}

.gm-section-toggle:hover .gm-chevron {
    color: var(--gm-gold-ink);
}

.gm-section.is-collapsed .gm-chevron {
    transform: rotate(-90deg);
}

.gm-section.is-collapsed .gm-section-heading {
    margin-bottom: 0;
}

/* Hide everything except the heading when collapsed */
.gm-section.is-collapsed > :not(.gm-section-heading) {
    display: none;
}

/* ============ Saved Notes ============ */
.gm-notes-heading {
    align-items: center;
}

.gm-notes-count {
    color: var(--gm-muted);
    font-size: 0.84rem;
    font-weight: 650;
}

.gm-notes-new {
    min-height: 38px;
}

.gm-notes-toolbar {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(130px, 0.8fr) minmax(200px, 1.4fr) auto auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 10px;
}

.gm-notes-filter {
    display: grid;
    gap: 6px;
    color: var(--gm-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.gm-notes-filter input,
.gm-notes-filter select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-ctrl);
    background: var(--gm-surface);
    color: var(--gm-ink);
    font: 500 0.92rem/1.2 var(--gm-font);
    padding: 0 12px;
    text-transform: none;
    letter-spacing: 0;
}

.gm-notes-filter input:focus,
.gm-notes-filter select:focus,
.gm-note-field input:focus,
.gm-note-field select:focus,
.gm-note-field textarea:focus {
    outline: none;
    border-color: var(--gm-gold);
    box-shadow: 0 0 0 3px rgba(195, 154, 76, 0.16);
}

.gm-notes-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    color: var(--gm-ink-2);
    font-size: 0.9rem;
    font-weight: 650;
    white-space: nowrap;
}

.gm-notes-status {
    margin: 0 0 12px;
    color: var(--gm-muted);
    font-size: 0.84rem;
}

.gm-notes-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.gm-note-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 210px;
    padding: 18px;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-card);
    background: var(--gm-surface);
    box-shadow: var(--gm-shadow-card);
}

.gm-note-card-top {
    display: grid;
    gap: 5px;
}

.gm-note-title {
    border: 0;
    background: transparent;
    color: var(--gm-ink);
    font: 700 1rem/1.25 var(--gm-font);
    text-align: left;
    padding: 0;
    cursor: pointer;
}

.gm-note-title:hover {
    color: var(--gm-gold-ink);
}

.gm-note-subject {
    color: var(--gm-gold-ink);
    font-size: 0.78rem;
    font-weight: 700;
}

.gm-note-preview {
    margin: 0;
    color: var(--gm-ink-2);
    font-size: 0.9rem;
    line-height: 1.55;
    cursor: pointer;
}

.gm-note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    color: var(--gm-muted);
    font-size: 0.75rem;
}

.gm-note-tag {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--gm-gold-soft);
    color: var(--gm-gold-ink);
    font-weight: 700;
}

.gm-note-actions {
    display: flex;
    gap: 10px;
    padding-top: 2px;
}

.gm-link-button {
    border: 0;
    background: transparent;
    color: var(--gm-gold-ink);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
}

.gm-link-button:hover {
    color: var(--gm-gold);
}

.gm-note-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 24px;
    border: 1.5px dashed var(--gm-line-strong);
    border-radius: var(--gm-radius-card);
    color: var(--gm-muted);
    text-align: center;
}

.gm-notes-load {
    margin-top: 14px;
}

.gm-note-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: grid;
    place-items: center;
    padding: clamp(16px, 4vw, 46px);
    background: rgba(15, 29, 48, 0.48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.gm-note-modal {
    width: min(820px, 100%);
    max-height: min(90vh, 900px);
    overflow: auto;
    border: 1px solid var(--gm-line);
    border-radius: 18px;
    background: var(--gm-surface);
    box-shadow: 0 40px 90px rgba(15, 29, 48, 0.4);
}

.gm-note-modal--small {
    width: min(420px, 100%);
    padding-bottom: 4px;
}

.gm-note-modal--small > .gm-note-modal-title {
    margin: 18px 22px 0;
}

.gm-note-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gm-line);
}

.gm-note-modal-title {
    margin: 0;
    font-family: var(--gm-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--gm-ink);
}

.gm-note-modal-body {
    margin: 14px 22px 0;
    color: var(--gm-ink-2);
    font-size: 0.95rem;
    line-height: 1.55;
}

/* ── Scanned-PDF → GuideMate Iris modal ── */
/* Cream card + minimal outline buttons, borrowing the Learning Center palette:
   display cream (--gm-bg #F6EFDD), control-panel navy (#0F1D30), gold (--gm-gold). */
.gm-note-modal.gm-iris-modal {
    width: min(560px, 100%); /* wider than --small so both buttons fit one row */
    background: var(--gm-bg);
    border: 1px solid var(--gm-line);
    box-shadow: 0 24px 64px rgba(15, 29, 48, 0.22);
}

.gm-iris-modal .gm-note-modal-title {
    margin: 22px 22px 0;
    color: var(--gm-ink);
}

.gm-iris-modal .gm-note-modal-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 22px;
}

.gm-iris-modal .gm-note-modal-actions > button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--gm-radius-ctrl);
    background: var(--gm-surface);
    color: #0F1D30; /* Learning Center control-panel navy */
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

/* Try another PDF — navy-blue border */
.gm-iris-modal .gm-iris-cancel {
    border: 1.5px solid #0F1D30;
}

.gm-iris-modal .gm-iris-cancel:hover {
    background: #0F1D30;
    color: var(--gm-bg);
}

/* Use GuideMate Iris — golden border */
.gm-iris-modal .gm-iris-go {
    border: 1.5px solid var(--gm-gold);
}

.gm-iris-modal .gm-iris-go:hover {
    background: var(--gm-gold-soft);
}

.gm-iris-modal .gm-iris-go:disabled {
    opacity: 0.5;
    cursor: default;
}

.gm-iris-modal .gm-iris-eye {
    flex: none;
}

.gm-note-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 22px 24px 24px;
}

.gm-note-modal--small .gm-note-field,
.gm-note-modal--small .gm-note-modal-actions {
    margin: 18px 22px;
}

.gm-note-field {
    display: grid;
    gap: 7px;
    color: var(--gm-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.gm-note-field--wide,
.gm-note-preview-pane,
.gm-note-modal-actions {
    grid-column: 1 / -1;
}

.gm-note-field input,
.gm-note-field select,
.gm-note-field textarea {
    width: 100%;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-ctrl);
    background: var(--gm-surface);
    color: var(--gm-ink);
    font: 500 0.95rem/1.45 var(--gm-font);
    padding: 11px 12px;
    text-transform: none;
    letter-spacing: 0;
}

.gm-note-field textarea {
    min-height: 220px;
    resize: vertical;
}

.gm-note-preview-pane {
    max-height: 220px;
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-ctrl);
    background: var(--gm-field);
    color: var(--gm-ink-2);
}

.gm-note-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.gm-note-danger {
    color: var(--gm-danger);
}

/* ── Notes: dashboard recents glance ── */
.gm-notes-heading-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* New note: navy outline + navy plus (site navy), same size as "Open all notes",
   no hover bounce (it's a ghost button). */
.gm-notes-heading-actions .gm-notes-new {
    border-color: var(--gm-ink);
    color: var(--gm-ink);
}

.gm-notes-heading-actions .gm-notes-new:not(:disabled):hover {
    background: var(--gm-ink);
    border-color: var(--gm-ink);
    color: var(--gm-on-ink);
}

/* Breathing room between the Notes recents and the Micromodules section. */
#gm-modules {
    margin-top: 88px;
}

.gm-notes-lead {
    margin: 0 0 14px;
    color: var(--gm-ink-2);
    font-size: 0.9rem;
}

/* Latest 2 saved notes as cards (same look as the Notes workspace). */
.gm-recent-notes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.gm-recent-card {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.gm-recent-card:hover {
    border-color: var(--gm-line-strong);
    box-shadow: 0 12px 30px rgba(15, 29, 48, 0.12);
    transform: translateY(-2px);
}

/* ── Notes page (notes.html) — built on the Learning Center shell (lc-*).
   These add the few notes-only pieces; --lc-* vars come from learning-center.css,
   which notes.html loads. ── */

/* Navy-panel textarea, matching lc-field inputs. */
.lc-field textarea {
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid var(--lc-navy-line);
    background: rgba(255, 255, 255, 0.06);
    color: var(--lc-on-navy);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.55;
    resize: vertical;
    min-height: 220px;
}

.lc-field textarea::placeholder { color: #7c8aa0; }
.lc-field textarea:focus { outline: none; border-color: var(--gm-gold); background: rgba(255, 255, 255, 0.1); }

/* Editor subject control sits in a span wrapper — make it fill the field. */
[data-note-subject-wrap] { display: block; }
[data-note-subject-wrap] input,
[data-note-subject-wrap] select { width: 100%; }

/* New note button: compact, with the plus icon. */
.nt-new {
    width: 100%;
    justify-content: center;
    padding: 11px 14px;
    font-size: 0.86rem;
    margin-bottom: 2px;
}

.nt-new .gm-ic { width: 16px; height: 16px; }

/* Brain-notes source switch (a real toggle, not a filter checkbox). */
.nt-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 0 8px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--lc-on-navy-dim);
    cursor: pointer;
}

.nt-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.nt-switch-track {
    position: relative;
    flex: 0 0 auto;
    width: 38px;
    height: 21px;
    border-radius: 999px;
    border: 1px solid var(--lc-navy-line);
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.nt-switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #f4ead8;
    transition: transform 0.2s ease;
}

.nt-switch input:checked ~ .nt-switch-track {
    background: var(--gm-gold);
    border-color: var(--gm-gold);
}

.nt-switch input:checked ~ .nt-switch-track::after {
    transform: translateX(17px);
    background: #15263B;
}

.nt-switch input:focus-visible ~ .nt-switch-track {
    outline: 2px solid rgba(195, 154, 76, 0.6);
    outline-offset: 2px;
}

.nt-switch:hover .nt-switch-text {
    color: var(--lc-on-navy);
}

/* Brain-note panel: read-only raw markdown. */
[data-brain-raw] {
    resize: vertical;
    min-height: 220px;
}

/* Favorites / archived toggles in the navy panel. */
.nt-checks { display: flex; gap: 20px; }

.nt-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--lc-on-navy-dim);
    cursor: pointer;
}

.nt-check input { width: 16px; height: 16px; accent-color: var(--gm-gold); }

/* Editor secondary actions (favorite / archive / delete). */
.nt-editor-actions { display: flex; gap: 10px; }

.nt-ghost {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--lc-navy-line);
    background: transparent;
    color: var(--lc-on-navy);
    font: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nt-ghost:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--gm-gold); color: var(--gm-gold); }
.nt-danger:hover { background: rgba(217, 119, 110, 0.1); border-color: #d9776e; color: #e8a59d; }

.nt-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gm-gold);
}

.nt-back .gm-ic { width: 14px; height: 14px; }
.nt-back:hover { text-decoration: underline; }

/* Display: list header + card grid. */
.nt-list-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 18px; }

.nt-list-title {
    margin: 0;
    font-family: var(--gm-display);
    font-weight: 600;
    font-size: clamp(1.6rem, 2.4vw, 2.1rem);
    color: var(--gm-ink);
}

.nt-count { color: var(--gm-muted); font-size: 0.82rem; font-weight: 700; }

.nt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.nt-card { cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease; }
.nt-card:hover { border-color: var(--gm-line-strong); box-shadow: 0 12px 30px rgba(15, 29, 48, 0.12); transform: translateY(-2px); }
.nt-card:focus-visible { outline: 2px solid var(--gm-gold); outline-offset: 2px; }

.nt-loadmore { display: block; margin: 20px auto 0; }

/* ============ Agents ============ */
.gm-agent-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

/* "More agents soon" placeholder tile */
.gm-agent-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 100%;
    padding: 24px;
    border: 1.5px dashed var(--gm-line-strong);
    border-radius: var(--gm-radius-card);
    color: var(--gm-muted);
    text-align: center;
}

.gm-agent-soon-icon {
    width: 26px;
    height: 26px;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239A8F76' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
}

.gm-agent-soon-text {
    font-size: 0.95rem;
    font-weight: 600;
}

/* The grid wrapper holds the card button and its (fixed) slide-over panel. */
.gm-agent-card {
    display: flex;
}

/* ── Subject-wise agents (conversational coaches) ──────────────────────────
   A distinct editorial card: gold eyebrow → serif title → blurb → meta → CTA.
   The serif title (Cormorant) gives the Literature coach a voice the STEM
   number-chip tiles don't have — the subject-grounded signature. */
.gm-subject-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.gm-agent-card--link { display: flex; }
.gm-agent-card--link .gm-agent-summary,
.gm-subject-summary {
    text-decoration: none;
    align-items: flex-start;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
/* A faint gold arc in the corner — echoes the Learning Center's control panel. */
.gm-subject-summary::after {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 1px solid var(--gm-line-strong);
    opacity: 0.5;
    pointer-events: none;
}
.gm-subject-summary:hover {
    transform: translateY(-2px);
    box-shadow: var(--gm-shadow-hover);
    border-color: var(--gm-line-strong);
}
.gm-subject-eyebrow {
    font-size: 0.64rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--gm-gold-ink);
}
.gm-subject-name {
    margin: 0;
    font-family: var(--gm-display-serif, "Cormorant Garamond", serif);
    font-size: 1.7rem;
    line-height: 1.05;
    font-weight: 600;
    color: var(--gm-ink);
    max-width: 15ch;
}
.gm-subject-blurb {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--gm-ink-2);
}
.gm-subject-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 2px;
}
.gm-subject-cost {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gm-gold-ink);
}
.gm-subject-run { color: var(--gm-gold-ink); font-weight: 600; margin-top: 4px; }

/* Card tile (the clickable button in the grid) */
.gm-agent-summary {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    background: var(--gm-surface);
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-card);
    box-shadow: var(--gm-shadow-card);
    padding: 20px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.gm-agent-summary:hover {
    transform: translateY(-2px);
    border-color: var(--gm-line-strong);
    box-shadow: var(--gm-shadow-hover);
}

.gm-agent-top {
    display: flex;
    align-items: center;
    gap: 13px;
}

.gm-agent-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    background-color: var(--gm-gold-soft);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 22px 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23A87E33' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v4M12 17v4M3 12h4M17 12h4'/%3E%3Cpath d='M12 7.5l1.6 2.9L16.5 12l-2.9 1.6L12 16.5l-1.6-2.9L7.5 12z'/%3E%3C/svg%3E");
}

.gm-agent-head {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gm-agent-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gm-ink);
}

.gm-agent-tag {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gm-muted);
}

.gm-agent-cost {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 20px;
    color: var(--gm-gold-ink);
    background: var(--gm-gold-soft);
    font-size: 0.82rem;
    font-weight: 700;
}

.gm-agent-cost::before {
    content: "";
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A87E33' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v10M14.5 9.3c0-1-1.1-1.8-2.5-1.8s-2.5.8-2.5 1.8 1.1 1.6 2.5 1.6 2.5.7 2.5 1.7-1.1 1.8-2.5 1.8-2.5-.8-2.5-1.8'/%3E%3C/svg%3E");
}

.gm-agent-blurb {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.55;
    color: var(--gm-ink-2);
}

.gm-agent-powered {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gm-gold-ink);
}
.gm-agent-powered::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gm-gold);
}

.gm-agent-run {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--gm-muted);
    transition: color 0.15s ease;
}

.gm-agent-run::after {
    content: "→";
    transition: transform 0.15s ease;
}

.gm-agent-summary:hover .gm-agent-run {
    color: var(--gm-gold-ink);
}

.gm-agent-summary:hover .gm-agent-run::after {
    transform: translateX(3px);
}

/* Slide-over run panel */
.gm-agent-backdrop {
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(15, 29, 48, 0.32);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

body.gm-panel-open {
    overflow: hidden;
}

.gm-agent-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 70;
    width: min(460px, 100%);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--gm-surface);
    border-left: 1px solid var(--gm-line);
    box-shadow: -24px 0 60px rgba(15, 29, 48, 0.18);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s linear 0.3s;
}

.gm-agent-card.is-open .gm-agent-panel {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s;
}

.gm-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 26px;
    border-bottom: 1px solid var(--gm-line);
}

.gm-panel-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.gm-panel-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 14px;
    background-color: var(--gm-gold-soft);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A87E33' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M15.5 8.5l-2.2 5.3-5.3 2.2 2.2-5.3z'/%3E%3C/svg%3E");
}

/* Per-agent Iconoir icons matching the app's tool set (guidemate_icon.dart):
   IA = clipboard-check, EE = doc-magnifying-glass, PQ = chat-bubble-question,
   coach = quote-message. Applied to both the card and panel icon chips. */
.gm-agent-icon[data-agent-ic="ia"],
.gm-panel-icon[data-agent-ic="ia"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A87E33' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.5 4H6C4.89543 4 4 4.89543 4 6V20C4 21.1046 4.89543 22 6 22H12'/%3E%3Cpath d='M15.5 4H18C19.1046 4 20 4.89543 20 6V15'/%3E%3Cpath d='M8 6.4V4.5C8 4.22386 8.22386 4 8.5 4C8.77614 4 9.00422 3.77604 9.05152 3.50398C9.19968 2.65171 9.77399 1 12 1C14.226 1 14.8003 2.65171 14.9485 3.50398C14.9958 3.77604 15.2239 4 15.5 4C15.7761 4 16 4.22386 16 4.5V6.4C16 6.73137 15.7314 7 15.4 7H8.6C8.26863 7 8 6.73137 8 6.4Z'/%3E%3Cpath d='M15.5 20.5L17.5 22.5L22.5 17.5'/%3E%3C/svg%3E");
}

.gm-agent-icon[data-agent-ic="ee"],
.gm-panel-icon[data-agent-ic="ee"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A87E33' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 20.5L22 22'/%3E%3Cpath d='M15 18C15 19.6569 16.3431 21 18 21C18.8299 21 19.581 20.663 20.1241 20.1185C20.6654 19.5758 21 18.827 21 18C21 16.3431 19.6569 15 18 15C16.3431 15 15 16.3431 15 18Z'/%3E%3Cpath d='M20 12V5.74853C20 5.5894 19.9368 5.43679 19.8243 5.32426L16.6757 2.17574C16.5632 2.06321 16.4106 2 16.2515 2H4.6C4.26863 2 4 2.26863 4 2.6V21.4C4 21.7314 4.26863 22 4.6 22H11'/%3E%3Cpath d='M16 2V5.4C16 5.73137 16.2686 6 16.6 6H20'/%3E%3C/svg%3E");
}

.gm-agent-icon[data-agent-ic="pq"],
.gm-panel-icon[data-agent-ic="pq"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A87E33' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 9C9 5.49997 14.5 5.5 14.5 9C14.5 11.5 12 10.9999 12 13.9999'/%3E%3Cpath d='M12 18.01L12.01 17.9989'/%3E%3Cpath d='M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 13.8214 2.48697 15.5291 3.33782 17L2.5 21.5L7 20.6622C8.47087 21.513 10.1786 22 12 22Z'/%3E%3C/svg%3E");
}

.gm-agent-icon[data-agent-ic="coach"],
.gm-panel-icon[data-agent-ic="coach"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A87E33' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 20.2895V5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V15C21 16.1046 20.1046 17 19 17H7.96125C7.35368 17 6.77906 17.2762 6.39951 17.7506L4.06852 20.6643C3.71421 21.1072 3 20.8567 3 20.2895Z'/%3E%3Cpath d='M10.5 10H8.5C7.94772 10 7.5 9.55228 7.5 9V8C7.5 7.44772 7.94772 7 8.5 7H9.5C10.0523 7 10.5 7.44772 10.5 8V10ZM10.5 10C10.5 11 9.5 12 8.5 13'/%3E%3Cpath d='M16.5 10H14.5C13.9477 10 13.5 9.55228 13.5 9V8C13.5 7.44772 13.9477 7 14.5 7H15.5C16.0523 7 16.5 7.44772 16.5 8V10ZM16.5 10C16.5 11 15.5 12 14.5 13'/%3E%3C/svg%3E");
}

.gm-panel-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.gm-panel-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gm-gold-ink);
}

.gm-panel-title {
    margin: 0;
    font-family: var(--gm-display);
    font-size: 1.85rem;
    font-weight: 600;
    line-height: 1.05;
    color: var(--gm-ink);
}

.gm-panel-close {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: var(--gm-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s ease;
}

.gm-panel-close:hover {
    color: var(--gm-gold-ink);
}

.gm-panel-desc {
    margin: 0 0 22px;
    color: var(--gm-ink-2);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
}

.gm-agent-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px 24px 28px;
}

/* Saved recent results inside the run panel */
.gm-recent:empty {
    display: none;
}

.gm-recent {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gm-line);
}

.gm-recent-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gm-recent-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gm-muted);
}

.gm-recent-clear {
    padding: 0;
}

.gm-recent-item {
    justify-content: flex-start;
}

.gm-result {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-ctrl);
    background: var(--gm-field);
    color: var(--gm-ink);
    white-space: pre-wrap;
}

/* ── "IB knowledge at work" thinking animation ── */
.gm-thinking {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 2px 0;
    white-space: normal;
}

.gm-thinking-head {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--gm-ink-2);
}

.gm-thinking-line {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 30px;
}

.gm-thinking-line.is-in {
    animation: gmThinkIn 0.45s ease both;
}

@keyframes gmThinkIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.gm-thinking-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    color: var(--gm-gold-ink);
    background: var(--gm-gold-soft);
    animation: gmThinkPulse 1.7s ease-in-out infinite;
}

.gm-thinking-icon .gm-ic {
    width: 17px;
    height: 17px;
}

@keyframes gmThinkPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(195, 154, 76, 0.35); }
    50% { box-shadow: 0 0 0 7px rgba(195, 154, 76, 0); }
}

.gm-thinking-text {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--gm-ink);
}

.gm-thinking-bar {
    position: relative;
    height: 4px;
    border-radius: 3px;
    background: var(--gm-line);
    overflow: hidden;
}

.gm-thinking-bar span {
    position: absolute;
    top: 0;
    left: -40%;
    height: 100%;
    width: 40%;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, var(--gm-gold), transparent);
    animation: gmThinkSweep 1.4s ease-in-out infinite;
}

@keyframes gmThinkSweep {
    0% { left: -40%; }
    100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .gm-thinking-line.is-in,
    .gm-thinking-icon,
    .gm-thinking-bar span {
        animation: none;
    }
}

/* ── Essay scores: band level + qualitative feedback per criterion ── */
.gm-scores {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
}

.gm-score-overall {
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-card);
    background: var(--gm-field);
    padding: 16px 18px;
}

.gm-score-overall-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.gm-scores .gm-score-summary {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--gm-ink-2);
}

.gm-score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 0;
}

.gm-score {
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-card);
    padding: 14px 16px;
    background: var(--gm-surface);
}

.gm-score-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.gm-score-label {
    color: var(--gm-ink);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.gm-score-band {
    align-self: flex-start;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gm-gold-ink);
    background: var(--gm-gold-soft);
    padding: 3px 10px;
    border-radius: 20px;
}

.gm-scores .gm-score-feedback {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--gm-ink-2);
}

.gm-score-advisor {
    border: 1px solid rgba(195, 154, 76, 0.4);
    background: rgba(195, 154, 76, 0.08);
    border-radius: var(--gm-radius-card);
    padding: 14px 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--gm-ink-2);
}

.gm-score-advisor-label {
    color: var(--gm-gold-ink);
    font-weight: 800;
}

.gm-result-done {
    margin: 0 0 10px;
    font-weight: 600;
    color: var(--gm-success);
}

/* ============ Agent output modal ============ */
.gm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: clamp(16px, 4vw, 48px);
    background: rgba(15, 29, 48, 0.46);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.gm-modal {
    display: flex;
    flex-direction: column;
    width: min(860px, 100%);
    max-height: min(88vh, 920px);
    background: var(--gm-surface);
    border: 1px solid var(--gm-line);
    border-radius: 18px;
    box-shadow: 0 40px 90px rgba(15, 29, 48, 0.4);
    overflow: hidden;
}

.gm-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 26px;
    border-bottom: 1px solid var(--gm-line);
}

.gm-modal-title {
    margin: 0;
    font-family: var(--gm-display);
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--gm-ink);
}

.gm-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.gm-modal-copy {
    min-height: 36px;
    padding: 0 14px;
}

.gm-modal-save {
    min-height: 36px;
    padding: 0 14px;
}

.gm-modal-copy.is-copied {
    border-color: var(--gm-success);
    color: var(--gm-success);
    background: rgba(47, 125, 82, 0.08);
}

/* Multi-question tab strip (batch result modal) */
.gm-modal-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 30px 0;
    border-bottom: 1px solid var(--gm-line);
    flex-wrap: wrap;
}

.gm-modal-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--gm-muted);
    font: inherit;
    font-weight: 650;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.14s ease, border-color 0.14s ease;
}

.gm-modal-tab:hover {
    color: var(--gm-ink-2);
}

.gm-modal-tab.is-active {
    color: var(--gm-ink);
    border-bottom-color: var(--gm-gold);
}

.gm-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--gm-muted);
}

.gm-tab-dot--ok {
    background: var(--gm-success);
}

.gm-tab-dot--warn {
    background: var(--gm-gold-ink);
}

.gm-tab-dot--load {
    background: var(--gm-muted);
}

.gm-tab-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 0;
}

.gm-tab-status-msg {
    margin: 0;
    color: var(--gm-ink-2);
    font-size: 0.95rem;
    line-height: 1.6;
}

.gm-modal-body {
    padding: 24px 30px 32px;
    overflow-y: auto;
    color: var(--gm-ink-2);
    line-height: 1.7;
}

.gm-modal-disclaimer {
    margin: 22px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--gm-line);
    font-size: 0.74rem;
    line-height: 1.5;
    color: var(--gm-muted);
}

/* Markdown typography */
.gm-markdown > :first-child {
    margin-top: 0;
}

.gm-markdown h1,
.gm-markdown h2,
.gm-markdown h3,
.gm-markdown h4,
.gm-markdown h5,
.gm-markdown h6 {
    font-family: var(--gm-display);
    color: var(--gm-ink);
    line-height: 1.2;
    margin: 1.4em 0 0.5em;
}

.gm-markdown h1 {
    font-size: 1.9rem;
}

.gm-markdown h2 {
    font-size: 1.6rem;
}

.gm-markdown h3 {
    font-size: 1.32rem;
}

.gm-markdown h4 {
    font-size: 1.12rem;
}

.gm-markdown h5,
.gm-markdown h6 {
    font-size: 1rem;
}

.gm-markdown p {
    margin: 0 0 0.9em;
}

.gm-markdown ul,
.gm-markdown ol {
    margin: 0 0 0.9em;
    padding-left: 1.5em;
}

.gm-markdown li {
    margin: 0.25em 0;
}

.gm-markdown li::marker {
    color: var(--gm-gold-ink);
}

.gm-markdown strong {
    color: var(--gm-ink);
    font-weight: 700;
}

.gm-markdown em {
    font-style: italic;
}

.gm-markdown a {
    color: var(--gm-gold-ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gm-markdown code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--gm-field);
    border: 1px solid var(--gm-line);
    border-radius: 6px;
    padding: 0.1em 0.4em;
}

.gm-markdown pre {
    background: var(--gm-field);
    border: 1px solid var(--gm-line);
    border-radius: 12px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 0 0 0.9em;
}

.gm-markdown pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: 0.86rem;
}

.gm-markdown blockquote {
    margin: 0 0 0.9em;
    padding: 4px 16px;
    border-left: 3px solid var(--gm-gold);
    color: var(--gm-ink-2);
    background: rgba(195, 154, 76, 0.07);
    border-radius: 0 8px 8px 0;
}

.gm-markdown hr {
    border: 0;
    border-top: 1px solid var(--gm-line);
    margin: 1.4em 0;
}

.gm-markdown .gm-table-wrap {
    overflow-x: auto;
    margin: 0 0 1.2em;
}

.gm-markdown .gm-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.94em;
}

.gm-markdown .gm-table th,
.gm-markdown .gm-table td {
    border: 1px solid var(--gm-line);
    padding: 7px 11px;
    text-align: left;
    vertical-align: top;
}

.gm-markdown .gm-table thead th {
    background: var(--gm-gold-soft);
    color: var(--gm-gold-ink);
    font-weight: 700;
}

.gm-markdown .gm-scores {
    margin-bottom: 1.4em;
}

.gm-markdown .katex-display {
    margin: 0.8em 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0;
}

@media (max-width: 600px) {
    .gm-modal-body {
        padding: 18px 18px 24px;
    }

    .gm-modal-title {
        font-size: 1.4rem;
    }
}

/* ============ Micromodules ============ */
.gm-module-list {
    min-height: 60px;
    color: var(--gm-ink-2);
}

/* Micromodules section header: title + PRO pill + subject search */
.gm-mm-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.gm-mm-pro {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--gm-gold-ink);
    background: var(--gm-gold-soft);
    padding: 3px 9px;
    border-radius: 20px;
}

.gm-mm-search {
    position: relative;
    display: flex;
    align-items: center;
    width: min(280px, 100%);
}

.gm-mm-search .gm-ic {
    position: absolute;
    left: 13px;
    width: 17px;
    height: 17px;
    color: var(--gm-muted);
    pointer-events: none;
}

.gm-mm-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius-ctrl);
    background: var(--gm-surface);
    font: inherit;
    font-size: 0.9rem;
    color: var(--gm-ink);
}

.gm-mm-search input:focus {
    outline: none;
    border-color: var(--gm-gold);
    box-shadow: 0 0 0 3px rgba(195, 154, 76, 0.14);
}

.gm-mm-search input:disabled {
    opacity: 0.5;
}

.gm-mm-sub {
    margin: 6px 0 18px;
    font-size: 0.9rem;
    color: var(--gm-muted);
}

.gm-locked-overlay {
    display: grid;
    place-items: center;
    min-height: 120px;
    border: 1.5px dashed var(--gm-line-strong);
    border-radius: var(--gm-radius-card);
    color: var(--gm-muted);
    text-align: center;
    background: rgba(195, 154, 76, 0.06);
    padding: 20px;
}

/* ════════ Micromodules library (revamp) ════════ */

/* Concentric gold rings (used in the slide-over panel header) */
.gm-mm-rings {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    pointer-events: none;
}

/* ── Filter chips ── */
.gm-mm-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.gm-mm-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gm-muted);
    margin-right: 2px;
}

.gm-mm-filter-label .gm-ic {
    width: 15px;
    height: 15px;
}

.gm-mm-chip {
    padding: 7px 14px;
    border-radius: 20px;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--gm-line);
    background: var(--gm-surface);
    color: var(--gm-ink-2);
    transition: all 0.14s ease;
}

.gm-mm-chip:hover {
    border-color: var(--gm-line-strong);
}

.gm-mm-chip.is-active {
    background: var(--gm-ink);
    border-color: var(--gm-ink);
    color: var(--gm-on-ink);
}

/* ── Group sections ── */
.gm-mm-groups {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.gm-mm-group-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.gm-mm-group-title {
    margin: 0;
    font-family: var(--gm-display);
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.gm-mm-group-line {
    height: 1px;
    flex: 1;
    background: var(--gm-line);
}

.gm-mm-group-meta {
    font-size: 0.78rem;
    color: var(--gm-muted);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.gm-mm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 18px;
}

/* ── Subject card ── */
.gm-mm-card {
    display: flex;
    flex-direction: column;
    background: var(--gm-surface);
    border: 1px solid var(--gm-line);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--gm-shadow-card);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.gm-mm-card:hover {
    border-color: var(--gm-line-strong);
    box-shadow: var(--gm-shadow-hover);
    transform: translateY(-2px);
}

.gm-mm-card-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.gm-mm-card-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 13px;
    background: var(--gm-ink);
    color: #E7C77E;
    display: grid;
    place-items: center;
}

.gm-mm-card-icon .gm-ic {
    width: 24px;
    height: 24px;
}

.gm-mm-card-titles {
    flex: 1;
    min-width: 0;
}

.gm-mm-card-title {
    font-family: var(--gm-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--gm-ink);
    line-height: 1.15;
}

.gm-mm-card-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.gm-mm-card-levels {
    font-size: 0.72rem;
    color: var(--gm-muted);
    font-weight: 600;
}

.gm-mm-card-divider {
    height: 1px;
    background: var(--gm-line);
    margin: 16px 0 8px;
}

.gm-mm-levels {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ── Level row ── */
.gm-mm-level {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
    background: transparent;
    border: none;
    border-radius: 10px;
    padding: 11px 12px;
    transition: background 0.14s ease;
}

.gm-mm-level:hover {
    background: var(--gm-field);
}

.gm-mm-level-badge {
    flex-shrink: 0;
    width: 40px;
    height: 26px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    background: var(--gm-gold-soft);
    color: var(--gm-gold-ink);
}

.gm-mm-level-badge.is-hl {
    background: var(--gm-ink);
    color: var(--gm-on-ink);
}

.gm-mm-level-count {
    flex: 1;
    font-size: 0.85rem;
    color: var(--gm-ink-2);
    font-weight: 600;
}

.gm-mm-level-go {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--gm-muted);
    transition: all 0.14s ease;
}

.gm-mm-level-go .gm-ic {
    width: 16px;
    height: 16px;
}

.gm-mm-level:hover .gm-mm-level-go {
    background: var(--gm-ink);
    color: var(--gm-on-ink);
}

.gm-mm-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--gm-muted);
}

/* ── Slide-over audio player ── */
.gm-mm-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 95;
}

.gm-mm-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 29, 48, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: gmMmFade 0.2s ease;
}

.gm-mm-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(480px, 100%);
    display: flex;
    flex-direction: column;
    background: var(--gm-surface);
    border-left: 1px solid var(--gm-line);
    box-shadow: -30px 0 60px rgba(15, 29, 48, 0.18);
    animation: gmMmSlide 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes gmMmFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes gmMmSlide {
    from { transform: translateX(30px); opacity: 0.6; }
    to { transform: translateX(0); opacity: 1; }
}

/* Mobile: the panel becomes a bottom sheet that slides up. */
@keyframes gmMmSlideUp {
    from { transform: translateY(24px); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}

.gm-mm-panel-head {
    position: relative;
    overflow: hidden;
    padding: 34px 30px 30px;
    /* Darker brand navy (matches the sign-in / hero panels) so the gold
       concentric rings read more strongly against it. */
    background: #0F1D30;
    color: var(--gm-on-ink);
    border-bottom: 1px solid var(--gm-line);
}

/* Stack header content above the rings — but exclude the close button so it keeps
   its own absolute top-right positioning (this rule is more specific otherwise). */
.gm-mm-panel-head > *:not(.gm-mm-rings):not(.gm-mm-panel-close) {
    position: relative;
    z-index: 1;
}

.gm-mm-panel-close {
    position: absolute;
    top: 18px;
    right: 20px;
    z-index: 2;
    border: none;
    background: rgba(246, 239, 221, 0.1);
    color: var(--gm-on-ink);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: grid;
    place-items: center;
}

.gm-mm-panel-close:hover {
    background: rgba(246, 239, 221, 0.2);
}

.gm-mm-panel-close .gm-ic {
    width: 18px;
    height: 18px;
}

.gm-mm-panel-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.64rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #E7C77E;
    font-weight: 700;
}

.gm-mm-panel-eyebrow .gm-ic {
    width: 14px;
    height: 14px;
}

.gm-mm-panel-title {
    margin: 10px 0 0;
    font-family: var(--gm-display);
    font-size: 1.95rem;
    font-weight: 600;
    line-height: 1.12;
    max-width: 380px;
    /* Gold (matching the eyebrow) so the subject reads clearly on the navy. */
    color: #E7C77E;
}

.gm-mm-panel-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.gm-mm-panel-count {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(246, 239, 221, 0.85);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.gm-mm-panel-list {
    flex: 1;
    overflow: auto;
    padding: 12px 16px;
}

/* ── Panel section landing (Documents / Videos / Criterion explainers / Audio) ── */
/* The section-landing view is all navy (full-bleed navy cards on a navy body);
   the drilled-in module view keeps the cream sheet. */
.gm-mm-panel--sections {
    background: #0F1D30;
}

.gm-mm-panel--sections .gm-mm-panel-head {
    border-bottom-color: #1d3046;
}

.gm-mm-cat-lead {
    margin: 4px 12px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gm-muted);
}

.gm-mm-panel--sections .gm-mm-cat-lead {
    color: rgba(246, 239, 221, 0.55);
}

/* Navy full-bleed section cards with a gold/cream sweep that enters from the
   right edge on hover (the sweep is a ::before layer slid in via transform). */
.gm-mm-cat {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 14px;
    width: calc(100% + 32px);
    margin: 0 -16px;
    text-align: left;
    padding: 18px 22px;
    border: none;
    border-radius: 0;
    background: #0F1D30;
    cursor: pointer;
    font: inherit;
}

/* Joined sections: no gaps, just a subtle navy divider between adjacent cards. */
.gm-mm-cat + .gm-mm-cat {
    border-top: 1px solid #1d3046;
}

.gm-mm-cat::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: var(--gm-bg);
    transform: translateX(101%);
    transition: transform 0.42s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}

.gm-mm-cat:hover::before,
.gm-mm-cat:focus-visible::before {
    transform: translateX(0);
}

.gm-mm-cat:focus-visible {
    outline: none;
}

.gm-mm-cat > * {
    position: relative;
    z-index: 1;
}

.gm-mm-cat-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--gm-gold);
    background: rgba(195, 154, 76, 0.16);
    border: 1px solid rgba(195, 154, 76, 0.28);
    transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.gm-mm-cat-icon .gm-ic {
    width: 18px;
    height: 18px;
}

.gm-mm-cat-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.gm-mm-cat-label {
    font-family: var(--gm-display);
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--gm-on-ink);
    line-height: 1.2;
    transition: color 0.3s ease;
}

.gm-mm-cat-meta {
    font-size: 0.78rem;
    color: rgba(246, 239, 221, 0.62);
    transition: color 0.3s ease;
}

.gm-mm-cat-go {
    flex-shrink: 0;
    color: var(--gm-gold);
    opacity: 0.7;
    transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease;
}

.gm-mm-cat-go .gm-ic {
    width: 16px;
    height: 16px;
}

/* Once the cream sweep is underneath, flip the content to navy/ink for contrast. */
.gm-mm-cat:hover .gm-mm-cat-label,
.gm-mm-cat:focus-visible .gm-mm-cat-label {
    color: var(--gm-ink);
}

.gm-mm-cat:hover .gm-mm-cat-meta,
.gm-mm-cat:focus-visible .gm-mm-cat-meta {
    color: var(--gm-ink-2);
}

.gm-mm-cat:hover .gm-mm-cat-icon,
.gm-mm-cat:focus-visible .gm-mm-cat-icon {
    color: var(--gm-gold-ink);
    background: rgba(15, 29, 48, 0.08);
    border-color: rgba(15, 29, 48, 0.18);
}

.gm-mm-cat:hover .gm-mm-cat-go,
.gm-mm-cat:focus-visible .gm-mm-cat-go {
    opacity: 1;
    transform: translateX(4px);
    color: var(--gm-gold-ink);
}

.gm-mm-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 2px 12px 6px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gm-gold-ink);
}

.gm-mm-back .gm-ic {
    width: 14px;
    height: 14px;
    transform: rotate(180deg);
}

.gm-mm-back:hover {
    text-decoration: underline;
}

.gm-mm-cat-heading {
    margin: 6px 12px 10px;
    font-family: var(--gm-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gm-ink);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gm-line);
}

.gm-mm-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px;
    border-radius: 12px;
    transition: background 0.15s ease;
}

.gm-mm-row.is-playing {
    background: var(--gm-gold-soft);
}

.gm-mm-row-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    background: var(--gm-field);
    color: var(--gm-gold-ink);
    text-decoration: none;
    transition: all 0.15s ease;
}

.gm-mm-row-btn:hover {
    background: var(--gm-gold-soft);
}

.gm-mm-row.is-playing .gm-mm-row-btn {
    background: var(--gm-ink);
    color: var(--gm-on-ink);
}

.gm-mm-row-btn.is-disabled {
    opacity: 0.5;
    cursor: default;
}

.gm-mm-row-btn .gm-ic {
    width: 15px;
    height: 15px;
}

.gm-mm-row-body {
    flex: 1;
    min-width: 0;
}

.gm-mm-row-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--gm-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gm-mm-row-num {
    color: var(--gm-muted);
    font-variant-numeric: tabular-nums;
    margin-right: 8px;
}

.gm-mm-row-sub {
    font-size: 0.76rem;
    color: var(--gm-muted);
    margin-top: 2px;
}

.gm-mm-row-status.is-active {
    color: var(--gm-gold-ink);
    font-weight: 700;
}

.gm-mm-panel-foot {
    padding: 16px 26px;
    border-top: 1px solid var(--gm-line);
    background: var(--gm-field);
}

.gm-mm-panel-start {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    background: var(--gm-ink);
    color: var(--gm-on-ink);
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.gm-mm-panel-start:hover:not(:disabled) {
    background: #1d3550;
}

.gm-mm-panel-start .gm-ic {
    width: 15px;
    height: 15px;
}

/* Filled play triangles (override the global stroke-only icon styling) */
.gm-mm-row-btn .gm-ic path[d^="M8 5v14l11-7z"],
.gm-mm-panel-start .gm-ic path[d^="M8 5v14l11-7z"] {
    fill: currentColor;
    stroke: none;
}

@media (max-width: 720px) {
    .gm-mm-grid {
        grid-template-columns: 1fr;
    }
}

.gm-debug-card {
    margin-top: 14px;
    padding: 14px;
    border-radius: var(--gm-radius-ctrl);
    color: var(--gm-danger);
    background: var(--gm-surface);
    border: 1px solid rgba(170, 46, 37, 0.24);
    white-space: pre-wrap;
}

[data-state="signed-out"][hidden],
[data-state="signed-in"][hidden],
[hidden] {
    display: none !important;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
    .gm-stat-row {
        grid-template-columns: 1fr 1fr;
    }

    .gm-balance-card {
        grid-column: 1 / -1;
    }

    .gm-agent-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gm-notes-toolbar,
    .gm-notes-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    /* Mobile top bar holding the hamburger (only shown at this width). */
    .gm-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        position: sticky;
        top: 0;
        z-index: 60;
        background: var(--gm-surface);
        border-bottom: 1px solid var(--gm-line);
    }

    /* Sidebar collapses into an off-canvas drawer that slides in from the left. */
    .gm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100%;
        width: min(286px, 84vw);
        flex-direction: column;
        align-items: stretch;
        gap: 22px;
        padding: 22px 16px;
        border-right: 1px solid var(--gm-line);
        border-bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
        z-index: 210;
        overflow-y: auto;
        box-shadow: 24px 0 60px rgba(15, 29, 48, 0.18);
    }

    body.gm-nav-open .gm-sidebar {
        transform: translateX(0);
    }

    .gm-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 29, 48, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 200;
    }

    body.gm-nav-open .gm-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .gm-header,
    .gm-content {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 600px) {
    .gm-stat-row,
    .gm-agent-grid,
    .gm-notes-toolbar,
    .gm-notes-list,
    .gm-note-form,
    .gm-social-auth {
        grid-template-columns: 1fr;
    }

    .gm-notes-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .gm-notes-filter--search,
    .gm-note-field--wide,
    .gm-note-preview-pane,
    .gm-note-modal-actions {
        grid-column: auto;
    }

    .gm-note-modal-actions {
        justify-content: stretch;
    }

    .gm-note-modal-actions > button {
        flex: 1 1 auto;
    }

    .gm-balance-card {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .gm-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .gm-module-item {
        grid-template-columns: 1fr;
    }

    /* Never allow sideways scrolling on phones. Use `clip` (not `hidden`): `hidden`
       forces overflow-y to compute as `auto`, turning these into nested scroll
       containers, which breaks the mobile address-bar collapse and leaves a white
       strip at the bottom. `clip` clips horizontally with no scroll-container side
       effect. */
    .gm-app,
    .gm-auth {
        overflow-x: clip;
    }

    .gm-agent-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Group headers were forcing a single non-wrapping row wider than the screen. */
    .gm-mm-group-head {
        flex-wrap: wrap;
    }

    .gm-mm-group-title,
    .gm-mm-group-meta {
        white-space: normal;
    }

    /* Micromodule panel → bottom sheet sized to its content (kills the big empty
       area below the section cards on a full-height slide-over). */
    .gm-mm-panel {
        width: 100%;
        top: auto;
        bottom: 0;
        height: auto;
        max-height: 86vh;
        border-left: 0;
        border-top: 1px solid var(--gm-line);
        border-radius: 18px 18px 0 0;
        overflow: hidden;
        animation: gmMmSlideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .gm-mm-panel-head {
        border-radius: 18px 18px 0 0;
        padding: 24px 22px 20px;
        border-bottom: 1px solid #1d3046;
    }

    /* Cohesive navy sheet: drop the cream body + padding gaps that read as stray
       white lines between the navy header and the navy section cards. */
    .gm-mm-panel-list {
        background: #0F1D30;
        padding: 0;
    }

    .gm-mm-cat-lead {
        margin: 18px 22px 8px;
        color: rgba(246, 239, 221, 0.55);
    }

    .gm-mm-cat {
        width: 100%;
        margin: 0;
    }

    .gm-mm-row-title {
        color: #E7C77E;
    }
}

/* ── Analyze Me stat-row card (center slot; replaced the Need-a-hand card) ── */
.gm-analyze-card {
    background: linear-gradient(135deg, rgba(195, 154, 76, 0.10), rgba(195, 154, 76, 0.02)), var(--gm-surface);
    border-color: var(--gm-line-strong);
}
.gm-analyze-card .gm-help-title { display: inline-flex; align-items: center; gap: 9px; }
.gm-analyze-ic { width: 21px; height: 21px; color: var(--gm-gold-ink); flex: none; }
.gm-analyze-go { margin-top: 10px; align-self: flex-start; color: var(--gm-gold-ink); font-size: 1.05rem; font-weight: 700; }
.gm-analyze-go:hover { color: var(--gm-gold); }
.gm-analyze-go:hover::after { transform: translateX(4px); }

/* ============ Flagship — Whetstone Learning Center band ============ */
.gm-flagship {
    position: relative;
    overflow: hidden;
    background: var(--gm-usage-navy);
    border-radius: var(--gm-radius-card);
    padding: clamp(26px, 4vw, 44px);
    color: var(--gm-on-ink);
}
.gm-flagship-arc {
    position: absolute;
    top: -130px;
    right: -110px;
    width: 400px;
    height: 400px;
    pointer-events: none;
}
.gm-flagship-arc circle { fill: none; stroke: var(--gm-gold); stroke-width: 1; opacity: 0.28; }
.gm-flagship-body { position: relative; max-width: 860px; }
.gm-flagship-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gm-gold);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.gm-flagship-tag .gm-ic { width: 15px; height: 15px; stroke: var(--gm-gold); }
.gm-flagship-title {
    margin: 16px 0 8px;
    font-family: var(--gm-display);
    font-size: clamp(1.7rem, 3.4vw, 2.4rem);
    font-weight: 700;
    color: var(--gm-on-ink);
}
.gm-flagship-lead {
    margin: 0 0 24px;
    max-width: 58ch;
    font-size: 0.98rem;
    line-height: 1.6;
    color: rgba(246, 239, 221, 0.78);
}
.gm-flagship-steps {
    list-style: none;
    margin: 0 0 26px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}
.gm-flagship-step { display: flex; gap: 11px; align-items: flex-start; }
.gm-flagship-step-num {
    font-family: var(--gm-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gm-gold);
    line-height: 1.35;
}
.gm-flagship-step strong { display: block; font-size: 0.92rem; color: var(--gm-on-ink); margin-bottom: 3px; }
.gm-flagship-step p { margin: 0; font-size: 0.8rem; line-height: 1.5; color: rgba(246, 239, 221, 0.62); }
.gm-flagship-cta { color: var(--gm-gold); font-size: 0.92rem; }
.gm-flagship-cta:hover { color: #E9D9AE; }
.gm-flagship-cta:hover::after { transform: translateX(3px); }
@media (max-width: 900px) { .gm-flagship-steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .gm-flagship-steps { grid-template-columns: 1fr; } }
