/**
 * SeedQuest critical UI and owned-page overlay.
 *
 * This stylesheet is loaded synchronously from the official downstream head
 * hook. Base geometry and branding must not depend on JavaScript.
 */

:root {
    --sq-overlay-ready: 1;
    --sq-page-background: #eef2f7;
    --sq-surface: #ffffff;
    --sq-surface-muted: #f8fafc;
    --sq-text: #334155;
    --sq-text-strong: #0f172a;
    --sq-text-muted: #64748b;
    --sq-line: #dbe3ee;
    --sq-blue: #0096df;
    --sq-blue-dark: #0369a1;
    --sq-green: #71c900;
    --sq-radius: 10px;
    --sq-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
    --sq-content-max: 1920px;
}

html {
    min-width: min(320px, 100%);
    max-width: 100%;
    scrollbar-gutter: stable;
    background: var(--sq-page-background);
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

body {
    max-width: 100%;
    min-height: 100vh;
    margin: 0;
    padding-top: 52px !important;
    color: var(--sq-text);
    background: var(--sq-page-background);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif !important;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: normal;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    -webkit-font-smoothing: antialiased;
}

/* Bootstrap compensates disappearing scrollbars inline; the root gutter owns it. */
body.modal-open {
    padding-right: 0 !important;
}

body *,
body *::before,
body *::after {
    box-sizing: border-box;
}

p,
li,
label,
legend,
button,
input,
select,
textarea,
th,
td,
.navbar,
.navbar a,
.dropdown-menu a {
    word-break: normal;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

a {
    color: var(--sq-blue-dark);
    text-underline-offset: 2px;
}

a:hover,
a:focus {
    color: #075985;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid rgba(0, 150, 223, 0.35) !important;
    outline-offset: 2px;
}

/* Use the full working width instead of the legacy centered 8/12 column. */
#outercontainer {
    width: min(calc(100% - clamp(24px, 4vw, 72px)), var(--sq-content-max)) !important;
    max-width: var(--sq-content-max) !important;
    margin-right: auto !important;
    margin-left: auto !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
}

/* The official shell nests the working row in a padded Bootstrap container. */
#wrapper.container-fluid {
    width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
}

#main_row {
    width: 100%;
    margin-right: 0 !important;
    margin-left: 0 !important;
}

#main_row > [class*="col-"] {
    min-width: 0;
}

#main_row > .col-md-1.col-lg-1.col-xl-2 {
    display: none !important;
}

#main_row > .col-sm-12.col-md-10.col-lg-10.col-xl-8 {
    float: none !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
}

/* The official toolbar remains authoritative; only its presentation changes. */
.navbar-fixed-top.navbar-default {
    min-height: 52px !important;
    margin: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    border-radius: 0 !important;
    background: var(--sq-surface) !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08) !important;
}

.navbar-fixed-top > .container-fluid {
    width: min(100%, var(--sq-content-max));
    min-height: 52px;
    margin-right: auto;
    margin-left: auto;
    padding-right: clamp(12px, 2vw, 32px);
    padding-left: clamp(12px, 2vw, 32px);
}

.navbar-fixed-top .navbar-header {
    min-height: 52px;
}

.navbar-fixed-top .navbar-brand {
    display: inline-flex;
    align-items: center;
    width: 133px;
    height: 52px;
    margin: 0 !important;
    padding: 10px 12px !important;
}

.navbar-fixed-top .sq-brand-logo {
    display: block;
    width: 109px !important;
    min-width: 109px;
    max-width: 109px !important;
    height: 32px !important;
    object-fit: contain;
}

.navbar-fixed-top .sq-dashboard-shortcut {
    display: inline-flex;
    float: left;
    align-items: center;
    gap: 6px;
    height: 52px;
    min-height: 52px;
    padding: 0 9px;
    color: #475569 !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 22px;
    text-decoration: none !important;
    white-space: nowrap;
}

.navbar-fixed-top .sq-dashboard-shortcut:hover,
.navbar-fixed-top .sq-dashboard-shortcut:focus {
    color: var(--sq-blue-dark) !important;
    background: #f1f5f9 !important;
}

.navbar-default .navbar-nav > li > a {
    min-height: 52px;
    padding: 15px 10px !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 22px !important;
    white-space: nowrap;
}

.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus,
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
    color: var(--sq-blue-dark) !important;
    background: #f1f5f9 !important;
}

.navbar-fixed-top .navbar-toggle {
    min-width: 44px;
    min-height: 44px;
    margin-top: 4px;
    margin-bottom: 4px;
    border-color: var(--sq-line);
}

.navbar-fixed-top .navbar-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 1px;
    background: var(--sq-text-strong);
}

.navbar-fixed-top .navbar-toggle .icon-bar + .icon-bar {
    margin-top: 4px;
}

.navbar-fixed-top .dropdown-menu {
    max-width: min(360px, calc(100vw - 24px));
    border: 1px solid var(--sq-line);
    border-radius: 8px;
    box-shadow: var(--sq-shadow);
}

.navbar-fixed-top .dropdown-menu > li > a {
    min-height: 44px !important;
    padding: 11px 12px !important;
    overflow-wrap: break-word;
    white-space: normal;
}

#pagetitle {
    margin: 14px 0 22px !important;
    padding: 0 0 10px !important;
    border-bottom: 2px solid rgba(0, 150, 223, 0.18);
    text-align: left !important;
}

#pagetitle_h3,
#pagetitle h1,
#pagetitle h2,
#pagetitle h3 {
    max-width: 100%;
    margin: 0 !important;
    color: var(--sq-text-strong) !important;
    font-size: clamp(22px, 2vw, 28px) !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    overflow-wrap: break-word;
    word-break: normal;
    text-align: left !important;
}

.well,
.panel,
.modal-content {
    border: 1px solid var(--sq-line) !important;
    border-radius: var(--sq-radius) !important;
    background: var(--sq-surface) !important;
    box-shadow: var(--sq-shadow) !important;
}

.well {
    max-width: 100%;
    padding: 18px !important;
}

.infosectionhead,
.infosectionhead_empty,
.sub_infosectionhead,
.sub_infosectionhead_empty {
    width: 100% !important;
    max-width: 100% !important;
    border-color: var(--sq-line) !important;
    background: #eaf5fb !important;
}

.infosectiontitle,
.infosectiontitle_empty,
.sub_infosectiontitle,
.sub_infosectiontitle_empty,
.infosectionsubtitle,
.infosectionsubtitle_empty,
.sub_infosectionsubtitle,
.sub_infosectionsubtitle_empty {
    color: var(--sq-text-strong) !important;
    line-height: 1.35 !important;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal !important;
}

.table-responsive,
.dataTables_scrollBody,
.sq-table-viewport {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > table,
.dataTables_scrollBody > table,
.sq-table-viewport > table {
    max-width: none;
}

.form-control,
.btn,
.input-group {
    max-width: 100%;
}

.modal-dialog {
    max-width: calc(100vw - 24px);
    margin-right: auto;
    margin-left: auto;
}

#pagefooter.navbar-default,
#footer {
    border-color: var(--sq-line) !important;
    background: var(--sq-surface-muted) !important;
    color: var(--sq-text-muted) !important;
    box-shadow: none !important;
}

@media (max-width: 767px) {
    #outercontainer {
        width: calc(100% - 24px) !important;
    }

    .navbar-fixed-top .navbar-collapse {
        position: absolute;
        top: 52px;
        right: 0;
        left: 0;
        max-height: calc(100vh - 52px) !important;
        margin: 0 !important;
        padding: 8px 12px 14px !important;
        overflow-y: auto !important;
        border-top: 1px solid var(--sq-line) !important;
        background: var(--sq-surface) !important;
        box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16) !important;
    }

    .navbar-fixed-top .navbar-collapse .navbar-nav {
        margin-right: 0;
        margin-left: 0;
    }

    .navbar-fixed-top .navbar-nav > li > a {
        min-height: 44px;
        padding: 11px 12px !important;
    }

    .navbar-fixed-top .navbar-nav .open > .dropdown-menu {
        width: 100%;
        max-width: 100%;
        padding: 4px 0 !important;
    }
}

@media (min-width: 768px) {
    .navbar-fixed-top .navbar-nav > .dropdown > .dropdown-menu {
        width: max-content;
        min-width: 260px;
        max-width: min(300px, calc(100vw - 24px));
        margin-top: 0;
        padding: 3px 0 !important;
        overflow: visible;
    }

    .navbar-fixed-top .dropdown-menu > li > a {
        min-height: 24px !important;
        padding: 3px 12px !important;
        font-size: 13px !important;
        line-height: 18px !important;
        overflow-wrap: normal;
        white-space: nowrap;
    }

    .navbar-fixed-top .dropdown-menu > .divider {
        margin: 2px 0;
    }

    .navbar-fixed-top .dropdown-menu > .dropdown-header {
        padding: 3px 12px;
        font-size: 12px;
        line-height: 18px;
    }

    .navbar-fixed-top .dropdown:focus-within > .dropdown-menu {
        display: block;
        margin-top: 0;
    }
}

@media (max-width: 359px) {
    .navbar-fixed-top .sq-dashboard-shortcut {
        gap: 0;
        padding-right: 6px;
        padding-left: 6px;
    }

    .navbar-fixed-top .sq-dashboard-shortcut .glyphicon {
        display: none;
    }
}

/*
 * BreedBase renders the authenticated search form on the server, then replaces
 * the narrow Login placeholder with the full account controls over AJAX. Keep
 * both boxes at their final size so that replacement cannot reflow the toolbar.
 * Guest pages have no #toolbar_search_form and therefore remain untouched.
 */
/* AUTHENTICATED_TOOLBAR_RESERVATION_START */
.navbar-fixed-top #login_button_html_div #navbar_profile {
    max-width: 82px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (min-width: 768px) and (max-width: 1028px) {
    .navbar-fixed-top .navbar-right:has(#toolbar_search_form) {
        width: 386px;
        min-width: 386px;
    }

    .navbar-fixed-top .navbar-right:has(#toolbar_search_form) #login_button_html_div {
        display: block;
        width: 316px;
        min-width: 316px;
        height: 50px;
        min-height: 50px;
        text-align: right;
    }
}

@media (min-width: 992px) and (max-width: 1028px) {
    .navbar-fixed-top #navbar_lists .hidden-sm,
    .navbar-fixed-top #navbar_datasets .hidden-sm {
        display: none !important;
    }
}

@media (min-width: 1029px) {
    .navbar-fixed-top .navbar-right:has(#toolbar_search_form) {
        width: 470px;
        min-width: 470px;
    }

    .navbar-fixed-top .navbar-right:has(#toolbar_search_form) #login_button_html_div {
        display: block;
        width: 400px;
        min-width: 400px;
        height: 50px;
        min-height: 50px;
        text-align: right;
    }

    .navbar-fixed-top #login_button_html_div #navbar_profile {
        max-width: 80px;
    }
}
/* AUTHENTICATED_TOOLBAR_RESERVATION_END */

@media (min-width: 768px) and (max-width: 940px) {
    body:has(#toolbar_search_form) {
        padding-top: 90px !important;
    }
}

/* Preserve the official two-row toolbar clearance at narrow desktop widths. */
@media (min-width: 768px) and (max-width: 880px) {
    body {
        padding-top: 90px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    body {
        padding-top: 0 !important;
        background: #ffffff !important;
    }

    .navbar-fixed-top {
        position: static !important;
    }
}

/* SeedQuest-owned pages. These classes never alter BreedBase form behavior. */
.sq-owned-page {
    width: 100%;
    margin: 0 auto 40px;
}

.sq-owned-page h1,
.sq-owned-page h2,
.sq-owned-page h3 {
    color: var(--sq-text-strong);
}

.sq-eyebrow {
    margin: 0 0 8px;
    color: var(--sq-blue-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.sq-lead {
    max-width: 760px;
    margin: 0;
    color: var(--sq-text);
    font-size: 17px;
    line-height: 1.6;
}

.sq-page-intro {
    margin: 8px 0 24px;
}

.sq-page-intro h1 {
    margin: 0 0 12px;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 750;
    line-height: 1.12;
}

.sq-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.sq-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sq-actions a.btn-primary,
.sq-actions a.btn-primary:link,
.sq-actions a.btn-primary:visited {
    color: #fff !important;
    border-color: var(--sq-blue-dark) !important;
    background: var(--sq-blue-dark) !important;
}

.sq-actions a.btn-primary:hover,
.sq-actions a.btn-primary:focus,
.sq-actions a.btn-primary:active {
    color: #fff !important;
    border-color: #075985 !important;
    background: #075985 !important;
}

.sq-home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: clamp(24px, 5vw, 64px);
    align-items: center;
    padding: clamp(28px, 6vw, 72px) 0;
}

.sq-home-hero-copy h1 {
    max-width: 850px;
    margin: 0 0 16px;
    font-size: clamp(34px, 5vw, 62px);
    font-weight: 780;
    line-height: 1.04;
    letter-spacing: -0.025em;
}

.sq-home-summary,
.sq-info-card,
.sq-feature-card,
.sq-dashboard-group,
.sq-citation,
.sq-legal-copy,
.sq-faq-list article {
    border: 1px solid var(--sq-line);
    border-radius: var(--sq-radius);
    background: var(--sq-surface);
    box-shadow: var(--sq-shadow);
}

.sq-home-summary {
    padding: 26px;
}

.sq-home-summary-logo {
    display: block;
    width: 218px;
    max-width: 100%;
    height: 64px;
    margin: 0 0 24px;
    object-fit: contain;
    object-position: left center;
}

.sq-home-summary h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.sq-home-summary > p {
    margin: 0 0 14px;
    color: var(--sq-text-muted);
    line-height: 1.55;
}

.sq-check-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sq-check-list li {
    position: relative;
    padding: 10px 0 10px 28px;
    border-top: 1px solid #eef2f7;
}

.sq-check-list li::before {
    position: absolute;
    top: 10px;
    left: 2px;
    color: var(--sq-green);
    content: "✓";
    font-weight: 800;
}

.sq-feature-grid,
.sq-info-grid,
.sq-help-grid,
.sq-dashboard-primary,
.sq-dashboard-groups {
    display: grid;
    gap: 16px;
}

.sq-feature-grid,
.sq-dashboard-primary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sq-info-grid,
.sq-help-grid,
.sq-dashboard-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sq-feature-card {
    display: block;
    min-height: 178px;
    padding: 24px;
    color: var(--sq-text) !important;
    text-decoration: none !important;
}

.sq-feature-card > .glyphicon {
    display: inline-grid;
    width: 42px;
    height: 42px;
    margin-bottom: 16px;
    place-items: center;
    border-radius: 9px;
    background: #e0f2fe;
    color: var(--sq-blue-dark);
    font-size: 18px;
}

.sq-feature-card h3,
.sq-info-card h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.sq-feature-card p,
.sq-info-card p {
    margin: 0;
    color: var(--sq-text-muted);
    line-height: 1.55;
}

.sq-info-grid {
    margin-top: 16px;
}

.sq-info-card {
    padding: 24px;
}

.sq-info-card--wide {
    grid-column: 1 / -1;
}

.sq-home-credit {
    margin-top: 14px !important;
    font-size: 12px;
}

.sq-dashboard-primary {
    margin-bottom: 18px;
}

.sq-dashboard-hero {
    display: flex;
    min-height: 158px;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    border-radius: var(--sq-radius);
    color: #ffffff !important;
    text-decoration: none !important;
    box-shadow: var(--sq-shadow);
}

.sq-dashboard-hero--trials {
    background: linear-gradient(135deg, #0369a1, #0284c7);
}

.sq-dashboard-hero--germplasm {
    background: linear-gradient(135deg, #3f6212, #65a30d);
}

.sq-dashboard-hero--observations {
    background: linear-gradient(135deg, #475569, #334155);
}

.sq-dashboard-hero > .glyphicon {
    margin-bottom: auto;
    font-size: 25px;
}

.sq-dashboard-hero strong {
    font-size: 18px;
}

.sq-dashboard-hero small {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
}

.sq-dashboard-group {
    overflow: hidden;
}

.sq-dashboard-group h2 {
    margin: 0;
    padding: 16px 18px;
    border-bottom: 1px solid var(--sq-line);
    background: var(--sq-surface-muted);
    font-size: 16px;
}

.sq-dashboard-group h2 .glyphicon {
    margin-right: 7px;
    color: var(--sq-blue-dark);
}

.sq-dashboard-group > a {
    display: flex;
    min-height: 62px;
    flex-direction: column;
    justify-content: center;
    padding: 10px 18px;
    border-bottom: 1px solid #eef2f7;
    color: var(--sq-text) !important;
    text-decoration: none !important;
}

.sq-dashboard-group > a:last-child {
    border-bottom: 0;
}

.sq-dashboard-group > a:hover,
.sq-dashboard-group > a:focus {
    background: #f8fafc;
}

.sq-dashboard-group > a span {
    margin-top: 2px;
    color: var(--sq-text-muted);
    font-size: 12px;
}

.sq-help-grid {
    margin-bottom: 18px;
}

.sq-help-grid .sq-info-card a,
.sq-inline-links a {
    display: inline-block;
    margin-top: 14px;
    font-weight: 650;
}

.sq-citation,
.sq-legal-copy {
    padding: 24px;
}

.sq-citation h2 {
    margin-top: 0;
    font-size: 20px;
}

.sq-faq-list {
    display: grid;
    gap: 14px;
}

.sq-faq-list article {
    padding: 20px 22px;
}

.sq-faq-list h2 {
    margin: 0 0 8px;
    font-size: 17px;
}

.sq-faq-list p,
.sq-legal-copy p {
    margin: 0 0 14px;
    line-height: 1.65;
}

.sq-faq-list p:last-child,
.sq-legal-copy p:last-child {
    margin-bottom: 0;
}

.sq-inline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 18px;
}

.sq-dashboard-nav > a .glyphicon {
    margin-right: 4px;
}

.sq-site-footer {
    margin-top: 64px;
    border-top: 1px solid var(--sq-line);
    background: var(--sq-surface-muted);
    color: var(--sq-text-muted);
}

.sq-site-footer > .container-fluid {
    width: min(calc(100% - 24px), var(--sq-content-max));
    margin: 0 auto;
    padding: 28px 0;
}

.sq-footer-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto minmax(220px, auto);
    gap: 28px;
    align-items: start;
}

.sq-footer-logo {
    display: block;
    width: 164px;
    height: 48px;
    object-fit: contain;
    object-position: left center;
}

.sq-footer-grid p {
    max-width: 460px;
    margin: 12px 0 0;
}

.sq-footer-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(80px, 1fr));
    gap: 8px 18px;
}

.sq-footer-version {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}

.sq-footer-version strong {
    color: var(--sq-text);
    font-size: 13px;
}

@media (max-width: 900px) {
    .sq-home-hero,
    .sq-footer-grid {
        grid-template-columns: 1fr;
    }

    .sq-feature-grid,
    .sq-dashboard-primary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .sq-home-hero {
        padding: 28px 0;
    }

    .sq-feature-grid,
    .sq-info-grid,
    .sq-help-grid,
    .sq-dashboard-primary,
    .sq-dashboard-groups {
        grid-template-columns: 1fr;
    }

    .sq-footer-links {
        grid-template-columns: 1fr;
    }
}
