/* QuestionWriter Writer — "Editorial Warm" (spec 2026-07-04-writer-reskin-foundation).
   Shared brand tokens are byte-identical to Storefront store.css (test-enforced by
   BrandTokenTests). Chrome tokens are writer-only: ink navbar/banners in both modes. */
:root {
    --paper: #FAF7F2;
    --panel: #FFFDF9;
    --ink: #1C1917;
    --muted: #78716C;
    --hairline: rgba(28, 25, 23, .12);
    --clay: #B4552D;
    --radius: 10px;
    --radius-sm: 8px;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    --chrome: #1C1917;
    --chrome-text: #FAF7F2;
    --chrome-muted: #A8A29E;
    --clay-soft: #E8B49B;
}

html, body {
    font-family: var(--font-ui);
}

a, .btn-link {
    color: var(--clay);
}

.table {
    background-color: var(--panel);
}

.table-btn {
    background-color: #009933;
    border-color: #009933;
    border-radius: 50%;
}

    .table-btn:hover, .table-btn:active {
        color: #fff;
        background-color: #00cc44 !important;
        border-color: #00cc44 !important;
    }

.quick-add-btn {
    font-size: 36px;
    position: absolute;
    right: 30px;
    top: 90px;
}

.btn-primary {
    color: #fff;
    background-color: var(--clay);
    border-color: var(--clay);
}

    .btn-primary:hover, .btn-primary:focus, .btn-primary:active {
        background-color: color-mix(in srgb, var(--clay) 85%, black) !important;
        border-color: color-mix(in srgb, var(--clay) 85%, black) !important;
        color: #fff;
    }

    /* Disabled primary buttons keep the clay scheme (muted) instead of Bootstrap's blue. */
    .btn-primary:disabled, .btn-primary.disabled {
        background-color: color-mix(in srgb, var(--clay) 45%, white) !important;
        border-color: color-mix(in srgb, var(--clay) 45%, white) !important;
        color: #fff !important;
        opacity: 1 !important;
    }

/* Bootstrap's compiled focus ring is its own blue (it lives in bootstrap.min.css,
   invisible to the retired-palette pin test). Re-accent all plain inputs to clay.
   No !important needed: bootstrap.min.css loads BEFORE site.css at equal specificity. */
.form-control:focus,
.form-select:focus {
    border-color: var(--clay);
    box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--clay) 25%, transparent);
}

/* Store convention: 44px touch targets on real buttons (grid icon buttons excluded). */
.btn:not(.btn-close):not(.table-btn):not(.screen-help-trigger),
.e-btn:not(.e-flat):not(.e-icon-only) {
    min-height: 44px;
}

app {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
}

.content {
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.modal-dialog-centered {
    min-height: calc(100% - 1rem);
}

/* ===== BASE SURFACES (dark mode flips the tokens; see dark-mode.css) ===== */
body {
    background-color: var(--paper) !important;
    color: var(--ink);
}

.text-muted-custom {
    color: var(--muted) !important;
}

/* ===== TOP NAVBAR ===== */
.top-navbar {
    z-index: 1030;
    background: var(--chrome);
    border-bottom: 1px solid rgba(250, 247, 242, .08);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.top-navbar .navbar-brand {
    color: var(--chrome-text);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    transition: color 0.2s ease;
}

.top-navbar .navbar-brand-icon {
    color: var(--clay-soft);
    font-size: 1.3rem;
    transition: text-shadow 0.2s ease, color 0.2s ease;
}

.top-navbar .navbar-brand:hover .navbar-brand-icon {
    color: var(--clay-soft);
    text-shadow: none;
}

.top-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.25);
}

.top-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Nav links */
.top-navbar .nav-link {
    color: var(--chrome-muted);
    padding: 0.5rem 0.75rem;
    transition: color 0.2s ease, border-color 0.2s ease;
    border-bottom: 3px solid transparent;
}

.top-navbar .nav-link:hover {
    color: var(--chrome-text);
}

.top-navbar .nav-link.active {
    color: var(--chrome-text) !important;
    border-bottom: 3px solid var(--clay);
    border-radius: 0;
}

/* Dropdown toggle arrow */
.top-navbar .dropdown-toggle::after {
    transition: transform 0.2s ease;
}

/* Dropdown menus - light mode */
.top-navbar .dropdown-menu {
    background-color: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    box-shadow: 0 0.5rem 1rem rgba(28, 25, 23, .12);
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: block;
    pointer-events: none;
    margin-top: 0;
}

.top-navbar .dropdown-menu.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.top-navbar .dropdown-item {
    padding: 0.5rem 1rem;
    color: var(--ink);
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.top-navbar .dropdown-item:hover,
.top-navbar .dropdown-item:focus {
    background-color: color-mix(in srgb, var(--clay) 8%, transparent);
    color: var(--clay);
    border-left-color: var(--clay);
}

.top-navbar .dropdown-item.active,
.top-navbar .dropdown-item:active {
    background-color: var(--clay);
    color: #ffffff;
    border-left-color: color-mix(in srgb, var(--clay) 80%, black);
}

.top-navbar .dropdown-item i {
    width: 1.25rem;
    margin-right: 0.25rem;
    color: var(--clay);
}

.top-navbar .dropdown-item:hover i,
.top-navbar .dropdown-item.active i {
    color: inherit;
}

/* Desktop hover is managed by Blazor @onmouseenter/@onmouseleave */

/* ===== NESTED FLYOUT SUBMENU =====
   Bootstrap 5 removed native nested-dropdown support. We re-enable it with a
   cascading flyout that opens to the right. The submenu <ul> is a DOM descendant
   of its parent <li>, so mouseleave on the outer dropdown doesn't fire when the
   pointer moves into the flyout (W3C mouseleave semantics). */
.top-navbar .dropdown-submenu {
    position: relative;
}

.top-navbar .dropdown-submenu > .dropdown-menu {
    top: 0;
    left: 100%;
    /* Slight overlap eliminates the 1px pointer gap between parent item and flyout */
    margin-top: -0.25rem;
    margin-left: 0.125rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
    min-width: 14rem;
}

/* Right-pointing caret replaces Bootstrap's default downward triangle */
.top-navbar .dropdown-submenu > .dropdown-toggle::after {
    content: "\25B8";
    float: right;
    border: none;
    margin-left: 0.5rem;
    margin-top: 0;
    vertical-align: baseline;
}

/* Mobile: the flyout can't fly out (no horizontal room), so stack inline under
   its parent. Matches the existing .mobile-nav-open .dropdown-menu rules. */
@media (max-width: 991.98px) {
    .navbar-collapse.mobile-nav-open .dropdown-submenu > .dropdown-menu {
        position: static !important;
        left: auto;
        margin: 0 0 0 1.25rem;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        min-width: 0;
    }
}

/* Right-side actions */
.navbar-right-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-right-actions .nav-text {
    font-size: 0.875rem;
}

/* ===== MOBILE OVERLAY (< 992px) ===== */
@media (max-width: 991.98px) {
    .navbar-collapse.mobile-nav-open {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--chrome);
        z-index: 1040;
        padding: 4rem 1.5rem 2rem;
        overflow-y: auto;
        animation: mobileNavSlideDown 0.3s ease;
    }

    .navbar-collapse.mobile-nav-open .nav-link {
        font-size: 1.2rem;
        padding: 0.75rem 0;
        color: var(--chrome-text);
        border-bottom: 1px solid rgba(250, 247, 242, .1);
    }

    .navbar-collapse.mobile-nav-open .nav-link.active {
        color: var(--clay-soft);
        border-bottom: 1px solid var(--clay);
    }

    .navbar-collapse.mobile-nav-open .dropdown-menu {
        position: static !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding-left: 1.5rem;
        opacity: 1;
        transform: none;
        pointer-events: auto;
        display: none;
    }

    .navbar-collapse.mobile-nav-open .dropdown-menu.show {
        display: block;
    }

    .navbar-collapse.mobile-nav-open .dropdown-item {
        padding: 0.6rem 0.5rem;
        font-size: 1.1rem;
        color: var(--chrome-muted);
    }

    .navbar-collapse.mobile-nav-open .dropdown-item i {
        color: var(--clay-soft);
    }

    .navbar-collapse.mobile-nav-open .navbar-right-actions {
        flex-direction: column;
        align-items: flex-start;
        margin-top: 1.5rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(250, 247, 242, .2);
        gap: 0.75rem;
    }
}

@keyframes mobileNavSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== DESKTOP LAYOUT ===== */
@media (min-width: 992px) {
    .main-content > .content {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
}

/* ===== LOGIN PAGE — paper + panel card (glassmorphism retired) ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px);
    background: var(--paper);
    margin: -1.1rem -1.5rem;
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--hairline);
    color: var(--ink);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    font-size: 3rem;
    color: var(--clay);
    margin-bottom: 0.75rem;
}

.login-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--ink);
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 0;
}

.login-card .form-label {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.login-card .input-group-text {
    background-color: var(--paper);
    border: 1px solid var(--hairline);
    color: var(--clay);
}

.login-card .form-control {
    background-color: var(--panel);
    border: 1px solid rgba(28, 25, 23, .25);
    color: var(--ink);
    padding: 0.6rem 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-card .form-control::placeholder {
    color: var(--muted);
}

.login-card .form-control:focus {
    background-color: var(--panel);
    border-color: var(--clay);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--clay) 25%, transparent);
    color: var(--ink);
}

.login-toggle-pw {
    background-color: var(--paper) !important;
    border: 1px solid rgba(28, 25, 23, .25) !important;
    color: var(--muted) !important;
}

.login-toggle-pw:hover {
    color: var(--clay) !important;
}

.login-card .form-check-label {
    color: var(--muted);
    font-size: 0.875rem;
}

/* Checked state for ALL Bootstrap checks/switches app-wide (login remember-me,
   Mark-for-Review switch, etc.) */
.form-check-input:checked {
    background-color: var(--clay);
    border-color: var(--clay);
}

.login-btn {
    background: var(--clay);
    color: #fff;
    border: none;
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.login-btn:hover {
    box-shadow: 0 4px 15px color-mix(in srgb, var(--clay) 40%, transparent);
    transform: translateY(-1px);
    color: #fff;
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--clay) 30%, transparent);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .login-card {
        padding: 1.75rem 1.5rem;
    }

    .login-icon {
        font-size: 2.5rem;
    }

    .login-title {
        font-size: 1.25rem;
    }

    .register-card {
        padding: 1.75rem 1.5rem;
    }
}

/* ===== REGISTER PAGE — paper + panel card ===== */
.register-page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: calc(100vh - 56px);
    background: var(--paper);
    margin: -1.1rem -1.5rem;
    padding: 2.5rem 1rem;
}

.register-card {
    width: 100%;
    max-width: 560px;
    padding: 2.5rem;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--hairline);
    color: var(--ink);
}

.register-card .login-brand .login-icon {
    color: var(--clay);
}

.register-card .login-brand .login-title {
    color: var(--ink);
}

.register-card .login-brand .login-subtitle {
    color: var(--muted);
}

.register-section {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--hairline);
}

.register-section-title {
    color: var(--clay);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0;
}

.register-card .form-label {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.register-card .form-control,
.register-card .form-select {
    background-color: var(--panel);
    border: 1px solid rgba(28, 25, 23, .25);
    color: var(--ink);
    padding: 0.6rem 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.register-card .form-control::placeholder {
    color: var(--muted);
}

.register-card .form-control:focus,
.register-card .form-select:focus {
    background-color: var(--panel);
    border-color: var(--clay);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--clay) 25%, transparent);
    color: var(--ink);
}

.register-card .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2378716C' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.register-card .form-select option {
    background-color: var(--panel);
    color: var(--ink);
}

/* ===== MODERN DIALOGS ===== */
.modal-content {
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(28, 25, 23, .15);
    overflow: hidden;
}

.modal-header {
    background-color: var(--paper);
    border-bottom: 1px solid var(--hairline);
    padding: 1rem 1.25rem;
}

.modal-header .modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--clay);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    background-color: var(--paper);
    border-top: 1px solid var(--hairline);
}

/* ===== DASHBOARD PAGE (Index) ===== */
.dashboard-page {
    width: 100%;
}

/* Welcome banner — ink chrome panel (design option B) */
.dashboard-welcome {
    background: var(--chrome);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    color: var(--chrome-text);
}

.dashboard-welcome-icon {
    font-size: 2.5rem;
    color: var(--clay-soft);
}

.dashboard-welcome-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.dashboard-welcome-subtitle {
    font-size: 0.9rem;
    color: var(--chrome-muted);
    margin-bottom: 0;
}

/* Dashboard cards — flat panel + hairline (store card treatment; no shadow, no stripe) */
.dashboard-card {
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.dashboard-card-header {
    padding: 0.85rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background-color: transparent;
    border-bottom: 1px solid var(--hairline);
}

.dashboard-card-body {
    padding: 1.25rem;
}

.dashboard-card-body.p-0 {
    padding: 0;
}

/* Syncfusion grid inside dashboard card — remove double borders */
.dashboard-card .e-grid {
    border: none !important;
}

/* Mobile adjustments */
@media (max-width: 576px) {
    .dashboard-welcome {
        padding: 1.25rem 1.25rem;
    }

    .dashboard-welcome-icon {
        font-size: 2rem;
    }

    .dashboard-welcome-title {
        font-size: 1.25rem;
    }
}

/* ---- Screen Help drawer ---- */
.screen-help-trigger {
    border: none;
    background: transparent;
    color: inherit;
    padding: 0.15rem 0.4rem;
    font-size: 1.15rem;
    line-height: 1;
}
.screen-help-trigger:hover { opacity: 0.85; }

/* Solid, opaque drawer so the dimming backdrop never shows through and text
   stays high-contrast. Scoped to this sidebar via the CssClass on SfSidebar. */
.screen-help-sidebar.e-sidebar {
    background: var(--panel);
    color: var(--ink);
}

.screen-help-panel {
    height: 100%;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    background: var(--panel);
    color: var(--ink);
}
.screen-help-body { color: var(--ink); }
.screen-help-body a { color: var(--clay); }
.screen-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--hairline);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}
.screen-help-title { font-size: 1.25rem; margin: 0; }
.screen-help-body h1 { font-size: 1.4rem; margin-top: 0; }
.screen-help-body h2 { font-size: 1.15rem; margin-top: 1.25rem; }
.screen-help-body h3 { font-size: 1rem; margin-top: 1rem; }
.screen-help-body table { width: 100%; margin: 0.75rem 0; }
.screen-help-body td, .screen-help-body th {
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--hairline);
    vertical-align: top;
}
.screen-help-body code {
    background: color-mix(in srgb, var(--ink) 6%, transparent);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

/* ---- Syncfusion accent alignment (bounded; spec 2026-07-04 §4).
   Re-accents focus/active/selected states from Bootstrap blue to clay.
   The stock bootstrap5 Syncfusion theme stays loaded underneath. ---- */
.e-input-group.e-input-focus:not(.e-error),
.e-input-group.e-control-wrapper.e-input-focus:not(.e-error) {
    border-color: var(--clay) !important;
    box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--clay) 20%, transparent) !important;
}

/* !important throughout this section: Index.html loads the Syncfusion theme AFTER
   site.css, so equal-specificity accent rules lose on source order without it (the
   same reason dark-mode.css has always needed !important against .e-* styles). */
.e-dropdownbase .e-list-item.e-hover,
.e-popup.e-ddl .e-list-item.e-hover {
    background-color: color-mix(in srgb, var(--clay) 10%, transparent) !important;
    color: var(--ink) !important;
}

.e-dropdownbase .e-list-item.e-active,
.e-dropdownbase .e-list-item.e-active.e-hover,
.e-popup.e-ddl .e-list-item.e-active,
.e-popup.e-ddl .e-list-item.e-active.e-hover {
    background-color: var(--clay) !important;
    color: #fff !important;
}

.e-grid .e-headercell {
    background-color: var(--paper) !important;
}

.e-grid td.e-active {
    background: color-mix(in srgb, var(--clay) 14%, transparent) !important;
}

.e-grid .e-row:hover .e-rowcell {
    background-color: color-mix(in srgb, var(--clay) 6%, transparent) !important;
}

.e-checkbox-wrapper .e-frame.e-check,
.e-checkbox-wrapper:hover .e-frame.e-check {
    background-color: var(--clay) !important;
    border-color: var(--clay) !important;
}

.e-switch-wrapper .e-switch-inner.e-switch-active,
.e-switch-wrapper:hover .e-switch-inner.e-switch-active .e-switch-on {
    background-color: var(--clay) !important;
    border-color: var(--clay) !important;
}

.e-pager .e-currentitem,
.e-pager .e-currentitem:hover {
    background: var(--clay) !important;
    color: #fff !important;
}

/* Syncfusion primary buttons (e-primary — e.g. the Auto Generate screens' Generate
   buttons) take their blue from the Syncfusion THEME, not this stylesheet, so the
   retired-palette pin test can't see it. Re-accent to clay. */
.e-btn.e-primary {
    background-color: var(--clay) !important;
    border-color: var(--clay) !important;
    color: #fff !important;
}

    .e-btn.e-primary:hover,
    .e-btn.e-primary:focus,
    .e-btn.e-primary:active {
        background-color: color-mix(in srgb, var(--clay) 85%, black) !important;
        border-color: color-mix(in srgb, var(--clay) 85%, black) !important;
        color: #fff !important;
    }

/* SfButton renders with .e-btn, whose theme default (gray) beats Bootstrap's
   .btn-primary/.btn-danger on source order — Save buttons rendered gray even
   before the reskin. Restore the intended semantic colors. */
.e-btn.btn-primary {
    background-color: var(--clay) !important;
    border-color: var(--clay) !important;
    color: #fff !important;
}

    .e-btn.btn-primary:hover,
    .e-btn.btn-primary:focus,
    .e-btn.btn-primary:active {
        background-color: color-mix(in srgb, var(--clay) 85%, black) !important;
        border-color: color-mix(in srgb, var(--clay) 85%, black) !important;
        color: #fff !important;
    }

.e-btn.btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #fff !important;
}

/* Question Overview filter bar: one compact row that wraps on narrow screens,
   with proportional widths echoing the grid (Question/Answer wide, Point/Seq/Review narrow). */
.qo-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.qo-filters > .qo-filter {
    flex: 1 1 140px;
    min-width: 120px;
}

.qo-filters > .qo-filter.qo-wide {
    flex: 2 1 200px;
    min-width: 180px;
}

.qo-filters > .qo-filter.qo-narrow {
    flex: 0 1 100px;
    min-width: 90px;
}

/* Hotkey cheat-sheet overlay (Alt + /) on the Add/Edit Question screen */
.hotkey-cheatsheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1055;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hotkey-cheatsheet {
    width: min(720px, 92vw);
    max-height: 85vh;
    overflow-y: auto;
    margin: 0;
}

/* Offline pack control in the Add/Edit Question banner (ink chrome, mode-constant) */
.pack-control {
    position: relative;
}

.pack-ghost-btn,
.pack-pill {
    background: transparent;
    border: 1px solid rgba(250, 247, 242, 0.4);
    color: var(--chrome-text);
    border-radius: 999px;
    padding: 0.25rem 0.85rem;
    font-size: 0.875rem;
    font-family: var(--font-ui);
    white-space: nowrap;
}

.pack-ghost-btn:hover:not(:disabled),
.pack-pill:hover:not(:disabled) {
    border-color: var(--clay-soft);
    color: #fff;
}

.pack-ghost-btn:disabled,
.pack-pill:disabled {
    opacity: 0.6;
}

.pack-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 18px rgba(28, 25, 23, 0.18);
    min-width: 160px;
    z-index: 1050;
    overflow: hidden;
}

.pack-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 0.5rem 0.9rem;
    color: var(--ink);
    font-size: 0.875rem;
    font-family: var(--font-ui);
}

.pack-menu button:hover {
    background: rgba(180, 85, 45, 0.12);
}

/* ===== Mobile foundation (spec 2026-07-05-writer-mobile-foundation) ===== */

/* Grids scroll inside their own card; the page body never scrolls sideways.
   :has() is fine here — the writer app is Chrome/Edge-only (reskin spec). */
.dashboard-card-body:has(.e-grid) {
    overflow-x: auto;
}

@media (max-width: 480px) {
    /* Filter cells stack full-width (Question Overview + Add Question dup grid). */
    .qo-filters > .qo-filter,
    .qo-filters > .qo-filter.qo-wide,
    .qo-filters > .qo-filter.qo-narrow {
        flex: 1 1 100%;
        min-width: 100%;
    }

    /* Banner cluster (title + pack pill + badges + help icon) wraps instead of
       overflowing; the pill drops to its own line when it must. */
    .dashboard-welcome > .d-flex {
        flex-wrap: wrap;
    }
}

/* Bootstrap's alert-info kept its legacy blue through the reskin (it lives in
   compiled bootstrap.min.css, invisible to the retired-palette pin test). Restyle
   to the Editorial Warm language; token-driven so dark mode flips automatically.
   alert-danger/-warning keep their semantic colors (reskin keep-list). */
.alert-info {
    background-color: color-mix(in srgb, var(--clay) 8%, var(--panel));
    border-color: color-mix(in srgb, var(--clay) 25%, var(--panel));
    color: var(--ink);
}

/* ===== Phone-first write loop (spec 2026-07-05-phone-first-write-loop) ===== */

/* Scan-line question cards (user-selected option A) */
.qcard {
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
}

.qchip {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.05rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--clay) 10%, var(--panel));
    color: color-mix(in srgb, var(--clay) 70%, var(--ink));
    margin-right: 0.25rem;
}

.qchip-ref {
    background: var(--chrome);
    color: var(--chrome-text);
}

.qcard-question {
    font-size: 0.875rem;
    line-height: 1.35;
    margin: 0.35rem 0 0.1rem;
    color: var(--ink);
}

.qcard-answer {
    font-size: 0.8rem;
    color: var(--muted);
}

.qcard-actions {
    float: right;
    display: flex;
    gap: 0.35rem;
}

.qcard-act {
    background: none;
    border: 1px solid var(--hairline);
    border-radius: 6px;
    color: var(--clay);
    padding: 0.15rem 0.5rem;
    min-height: 32px;
}

    .qcard-act:disabled {
        color: var(--muted);
        opacity: 0.6;
    }

.qcard-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Filters (n) pill row above the card list */
.filter-pill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.filter-pill {
    border: 1px solid var(--clay);
    color: var(--clay);
    background: var(--panel);
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
}

.filter-pill-count {
    font-size: 0.8rem;
    color: var(--muted);
}

/* Bottom sheet (user-selected pattern) */
.filter-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1052;
}

.filter-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1053;
    background: var(--panel);
    border-top: 2px solid var(--clay);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 24px rgba(28, 25, 23, 0.25);
    padding: 1rem 1rem 1.25rem;
    max-height: 75vh;
    overflow-y: auto;
}

.filter-sheet-done {
    width: 100%;
    margin-top: 0.5rem;
    background: var(--clay);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    font-size: 0.9rem;
    min-height: 44px;
}

/* Pack loading spinners — clay, not Bootstrap's legacy blue (pin-tested). */
.spinner-clay {
    color: var(--clay);
}
