/* Shared work surfaces. Keep layout and interactive states consistent across pages. */
[hidden] { display: none !important; }

:root {
    --brand-accent: #176b79;
    --brand-accent-2: #176b79;
    --surface-muted: #f3f6f7;
    --border: #dce3e6;
    --shadow: 0 2px 8px rgb(20 40 50 / 4%);
    --text: #20313c;
    --muted: #526571;
}

body { background: #f3f6f7; line-height: 1.5; }
.page-shell.layout-container { padding: 1.5rem var(--layout-padding) 2rem; gap: 1rem; align-content: start; }
.app-header { padding: 0.65rem 0; background: #fff; box-shadow: none; backdrop-filter: none; }
.logo-mark { background: #176b79; border-radius: 9px; box-shadow: none; }
.headline { font-size: 1rem; }
.brand-copy .eyebrow { font-size: 0.65rem; }
.user-menu { flex-wrap: wrap; justify-content: flex-end; }
.user-badge { background: transparent; border: 0; font-weight: 500; max-width: 260px; overflow-wrap: anywhere; }
.surface, .hero, .settings-section, .inset-card { border-radius: 10px; box-shadow: var(--shadow); }
.surface { padding: 1.25rem; }
.hero.gradient { background: #fff; border: 1px solid var(--border); }
.hero { padding: 1.25rem; }
.search-hero { display: block; border: 0 !important; background: transparent !important; padding: 0; box-shadow: none; }
.search-hero .eyebrow { display: none; }
.search-hero h1, .detail-hero h1 { max-width: none; font-size: clamp(1.5rem, 2.2vw, 2rem); line-height: 1.3; }
.search-hero .hero-content { display: grid; gap: 0.3rem; }
.badge-row:empty { display: none; }
.badge-row { margin-top: 0.3rem; gap: 0.5rem; }
.search-panel, .results-panel { margin-top: 0; }
.search-panel .eyebrow, .results-panel .eyebrow { display: none; }
.section-title { font-size: 1.05rem; }
.section-header { gap: 0.75rem; margin-bottom: 0.65rem; }
.search-form { margin-top: 0.65rem; }
.search-fields { gap: 0.8rem; }
.form-control { gap: 0.35rem; }
.form-control label { font-weight: 600; font-size: 0.85rem; }
input, select, textarea { border-radius: 6px; }
.form-control input, .form-control select, .form-control textarea { background: #fff; padding: 0.65rem 0.75rem; }
button, a.primary, a.ghost, a.secondary { border-radius: 6px; min-height: 42px; padding: 0.55rem 0.85rem; font-weight: 600; box-shadow: none; }
button.primary, a.primary { background: #176b79; border: 1px solid #176b79; box-shadow: none; }
button.primary:hover, a.primary:hover { background: #105561; }
button.ghost, a.ghost { background: #fff; border-color: var(--border); }
button.ghost:hover, a.ghost:hover { background: #f0f5f6; }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid #176b79; outline-offset: 3px; }
.results-header { flex-wrap: wrap; }
.analysis-actions { gap: 0.5rem; }
.results-tools { display: grid; grid-template-columns: minmax(0,1fr) minmax(160px,240px) auto; align-items: end; gap: .75rem; margin: .85rem 0; }
.results-tools .form-control { min-width: 0; }
.results-tools > span { padding-bottom: .65rem; }
.results-status-row:has(> [hidden]):not(:has(> :not([hidden]))) { display: none; }
.results-panel:has(#enrichment-progress:not([hidden])) #augmentation-pill:not(.error) { display: none; }
.results-status-row:not(:has(> :not([hidden], #augmentation-pill))) { margin: 0; }
.results-table-wrapper { overflow-x: auto; }
.results-table { min-width: 0; table-layout: fixed; font-size: .88rem; }
.results-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.results-table th { font-size: .72rem; letter-spacing: .025em; text-transform: none; }
.results-table th, .results-table td { padding: .75rem .65rem; vertical-align: middle; }
.result-select-width { width: 44px; }
.result-title-width { width: auto; }
.result-company-width { width: 24%; }
.result-location-width { width: 22%; }
.result-score-width { width: 108px; }
.result-action-width { width: 90px; }
.results-table .table-link, .results-table .job-company, .results-table .result-place { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.45; }
.results-table .job-company { color: var(--text); font-size: .85rem; }
.results-table .source-stack { min-width: 0; max-width: none; gap: .15rem; font-size: .83rem; }
.result-source { font-size: .74rem; color: var(--muted); overflow-wrap: anywhere; }
.results-table .result-score { text-align: center; }
.results-table .score-badge { border-radius: 5px; box-shadow: none; padding: .25rem .45rem; font-size: .9rem; white-space: nowrap; }
.result-research-status { display: grid; gap: .2rem; font-size: .75rem; line-height: 1.3; overflow-wrap: anywhere; }
.result-research-status .result-phase { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.result-research-status progress { width: 100%; height: 5px; accent-color: #176b79; }
.result-research-status small, .result-score-empty { font-size: .73rem; line-height: 1.35; color: var(--muted); }
.results-table tbody tr { cursor: default; }
.results-table tbody tr.selected { background: #eaf4f5; box-shadow: inset 3px 0 0 #176b79; }
.results-table .selection-column { padding: 0; width: 44px; }
.result-check { display: flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; margin: 0; cursor: pointer; }
.result-check input { cursor: pointer; width: 18px; height: 18px; margin: 0; }
.results-table .details-column { width: 90px; text-align: right; }
.results-table .details-button { min-height: 44px; padding: .4rem .6rem; font-size: .8rem; width: auto; }
.result-mobile-label { display: none; }
.pill { border-radius: 6px; padding: 0.3rem 0.6rem; font-size: 0.82rem; font-weight: 500; }
.pill.error { overflow-wrap: anywhere; }
.enrichment-progress { margin-block: .7rem; border-radius: 6px; background: #eef7f8; padding: .6rem .8rem; gap: .65rem; align-items: center; }
.enrichment-progress-copy { display: flex; align-items: baseline; flex-wrap: wrap; gap: .2rem .75rem; font-size: .88rem; }
.enrichment-progress-copy .helper-text { font-size: .8rem; }
.progress-glass { width: 12px; height: 28px; border-radius: 4px; border-color: #176b79; box-shadow: none; }
.progress-glass-large { width: 10px; height: 28px; }
.progress-glass-shine { display: none; }
.progress-water { background: #176b79; }
.job-progress-copy { font-size: 0.8rem; }
.map-card { padding: 0.8rem 1rem; }
.map-header { margin: 0; align-items: center; }
.map-header h2 { font-size: 0.95rem; }
.map-header .helper-text { font-size: 0.8rem; }
.map-shell { margin-top: 0.75rem; }
.map { height: 300px; border-radius: 6px; }
.map-legend { position: static; background: transparent; padding: 0.4rem 0 0; box-shadow: none; }
.map-legend .helper-text { font-size: 0.8rem; }
.detail-hero { padding: 1.25rem; }
.detail-hero .hero-actions { margin-top: 0.75rem; }
.detail-content { gap: 1rem; }
.detail-description { overflow-wrap: anywhere; }
.detail-sidebar .surface { box-shadow: none; }
.modal-backdrop { backdrop-filter: none; background: rgb(20 35 45 / 45%); }
.modal-dialog { width: min(94vw, 680px); border-radius: 10px; }
.modal-header, .modal-footer { padding: 1rem 1.25rem; flex-shrink: 0; }
.modal-header h3 { margin: 0; font-size: 1.15rem; }
.modal-header .modal-close { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0; gap: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); line-height: 1; box-shadow: none; }
.modal-header .modal-close:hover { background: #eef4f5; border-color: var(--border); transform: none; box-shadow: none; }
.modal-header .modal-close:active { background: #dcebed; }
.modal-close svg { display: block; flex-shrink: 0; pointer-events: none; }
.modal-body { padding: 1rem 1.25rem; }
.modal-footer .wizard-nav { width: 100%; }
.card-option { border-radius: 8px; padding: 1rem; }
.card-option h4 { margin: 0 0 0.3rem; }
.card-option .helper-text { margin: 0; font-weight: 400; }
.card-option:has(input:checked) { border-color: #176b79; background: #eef7f8; }
.app-footer { margin-top: 1rem; background: #fff; z-index: auto; }
.footer-powered { border-top: 0; display: flex; flex-wrap: wrap; justify-content: space-between; }
.footer-heading { display: none; }
.footer-subtitle { font-size: 0.8rem; }
.logo-tile { width: 145px; min-height: 40px; border: 0; padding: 0; background: transparent; }
.logo-tile img { max-height: 30px; }
.auth-shell { gap: 1.5rem; }
.auth-panel { background: #e7f1f2; border: 1px solid var(--border); border-radius: 10px; }
.auth-panel h2, .auth-panel .eyebrow { color: var(--text); }
.auth-panel p, .auth-panel .helper-text { color: var(--muted); }
.auth-panel::after { display: none; }
.auth-card { box-shadow: var(--shadow); border-radius: 10px; }

@media (max-width: 980px) {
    .search-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .search-submit { width: 100%; }
    .user-badge { max-width: 190px; font-size: 0.8rem; }
}
@media (max-width: 760px) {
    .page-shell.layout-container { padding: 1rem var(--layout-padding) 1.5rem; }
    .surface { padding: 1rem; }
    .app-bar { align-items: center; }
    .user-menu { gap: 0.35rem; }
    .user-badge { display: none; }
    .brand-copy .headline { font-size: 0.85rem; }
    .header-actions { flex: 1; justify-content: flex-end; }
    .app-header .app-bar { display: flex; flex-wrap: nowrap; }
    .app-header .brand { width: auto; flex-shrink: 0; }
    .header-actions, .user-menu { width: auto; }
    .user-menu { display: flex; }
    .user-menu > a, .user-menu > button, .user-menu .logout-form, .user-menu .logout-form button { width: auto; }
    .analysis-actions { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; }
    .analysis-actions .selection-count { min-width: 0; text-align: left; font-size: .8rem; }
    .analysis-actions > button { width: 100%; min-height: 44px; padding: .45rem .5rem; font-size: .8rem; }
    .results-tools { grid-template-columns: minmax(0,1fr) minmax(125px,.8fr); gap: .5rem .65rem; }
    .results-tools .form-control { min-width: 0; }
    .results-tools .form-control input, .results-tools .form-control select { padding-inline: .5rem; font-size: .85rem; }
    .results-tools > span { grid-column: 1/-1; padding: 0; font-size: .8rem; }
    .results-table-wrapper { overflow: visible; margin-top: .6rem; }
    .results-table { display: block; width: 100%; }
    .results-table colgroup { display: none; }
    .results-table thead, .results-table tbody { display: block; }
    .results-table tr { display: grid; grid-template-columns: 36px minmax(0,1fr) 84px; column-gap: .4rem; }
    .results-table th { padding: .55rem 0; font-size: .7rem; border-bottom: 0; }
    .results-table thead { border-bottom: 1px solid var(--border); border-radius: 5px 5px 0 0; }
    .results-table thead tr { align-items: center; }
    .results-table thead .selection-column { width: 36px; }
    .results-table thead .result-title { grid-column: 2; }
    .results-table thead .result-company, .results-table thead .result-location, .results-table thead .details-column { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .result-desktop-label { display: none; }
    .result-mobile-label { display: inline; }
    .results-table tbody tr { padding: .7rem 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; row-gap: .15rem; }
    .results-table tbody tr.selected { box-shadow: inset 3px 0 0 #176b79; }
    .results-table tbody td { display: block; padding: 0; border: 0; min-width: 0; }
    .results-table .selection-column { grid-column: 1; grid-row: 1/4; width: 36px; align-self: start; }
    .result-check { width: 36px; min-height: 44px; }
    .results-table .result-title { grid-column: 2; grid-row: 1; }
    .results-table .table-link { -webkit-line-clamp: 3; font-size: .88rem; line-height: 1.4; }
    .results-table .result-company { grid-column: 2; grid-row: 2; }
    .results-table .job-company { font-size: .78rem; line-height: 1.35; color: var(--muted); }
    .results-table .result-location { grid-column: 2; grid-row: 3; }
    .results-table .result-place { -webkit-line-clamp: 1; font-size: .77rem; line-height: 1.35; }
    .result-source { font-size: .68rem; line-height: 1.3; }
    .results-table .result-score { grid-column: 3; grid-row: 1/3; padding: .15rem .35rem 0; align-self: start; }
    .results-table .details-column { grid-column: 3; grid-row: 3; align-self: end; width: auto; text-align: center; }
    .results-table .details-button { min-height: 44px; min-width: 70px; }
    .results-table .result-research-status { font-size: .7rem; }
    .results-table td.empty-state { grid-column: 1/-1; padding: .8rem; }
    .map-header { flex-wrap: wrap; }
    .map { height: 240px; }
    .detail-hero h1 { font-size: 1.4rem; }
    .footer-powered, .footer-logo-strip { gap: 0.75rem; }
    .footer-logo-strip { display: flex; flex-wrap: wrap; }
}
@media (max-width: 520px) {
    .search-fields { grid-template-columns: 1fr; }
    .app-header .app-bar { gap: 0.5rem; }
    .brand-copy { display: none; }
    .user-menu { display: flex; flex-wrap: wrap; }
    .user-menu .logout-form { width: auto; }
    .user-menu > a, .user-menu button { width: auto; font-size: 0.8rem; }
    .option-grid { grid-template-columns: 1fr; }
    .modal-header, .modal-body, .modal-footer { padding: 1rem; }
    .modal-footer .wizard-nav { display: flex; }
    .logo-tile { width: 135px; }
}

.form-control input[type="search"] { width: 100%; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 1rem; color: var(--text); appearance: none; }
.form-control input[type="search"]:focus-visible { outline: 3px solid #176b79; outline-offset: 3px; }

/* Align controls independently of neighbouring help text. */
.form-control { align-content: start; }
.form-control label { margin-bottom: 0; }
.form-control input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.form-control select { box-sizing: border-box; min-height: 44px; height: 44px; }
.settings-card { width: min(1120px, 100%); margin-top: 0; }
.settings-card > .section-header h1 { font-size: 1.5rem; }
.settings-section { padding: 1rem; gap: 0.8rem; background: #fff; box-shadow: none; }
.settings-section-header { padding-bottom: 0.6rem; }
.settings-section-header h2 { font-size: 1.1rem; }
.settings-section-grid { align-items: start; gap: 0.85rem 1.25rem; }
.settings-section .helper-text { margin: 0; }
.settings-actions { position: static; padding: 0; border: 0; box-shadow: none; backdrop-filter: none; }

/* Job details: readable sections, with facts before the long text on small screens. */
.detail-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.detail-nav a { padding: 0.5rem 0.8rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 0.9rem; }
.detail-nav a:hover { background: #e7f1f2; }
.detail-workspace { grid-template-columns: minmax(0, 1fr) 280px; gap: 1.25rem; }
.detail-main { grid-column: 1; grid-row: 1; }
.detail-sidebar { grid-column: 2; grid-row: 1; min-width: 0; }
.detail-main > [id] { scroll-margin-top: 6rem; }
.detail-card .section-header { align-items: flex-start; }
.detail-card .section-title { font-size: 1.15rem; line-height: 1.4; }
.analysis-summary { grid-template-columns: minmax(140px, 0.5fr) minmax(0, 1.5fr); gap: 1rem; }
.analysis-summary > div, .briefing-grid article { min-width: 0; border: 0; border-radius: 6px; padding: 0.85rem; }
.analysis-summary .analysis-next-step { grid-column: 1 / -1; background: #eaf4f5 !important; border-left: 3px solid #176b79 !important; }
.briefing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.briefing-grid article:first-child { grid-column: 1 / -1; }
.enrichment-card { background: #fff; border-color: var(--border); }
.enrichment-grid { align-items: start; gap: 1rem 1.5rem; }
.enrichment-block { min-width: 0; padding: 1rem 0 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; overflow-wrap: anywhere; }
.enrichment-block-wide { grid-column: 1 / -1; }
.enrichment-block-wide > p { max-width: 78ch; }
.enrichment-block-wide > .insights-list { columns: 2; column-gap: 2rem; }
.enrichment-block .insights-list li { break-inside: avoid; padding-left: 0.1rem; margin-bottom: 0.4rem; line-height: 1.6; }
.provenance-row { gap: 0.35rem 0.5rem; margin-bottom: 0.75rem; }
.provenance-source { max-width: 100%; overflow-wrap: anywhere; font-size: 0.78rem; text-underline-offset: 3px; }
.compact-facts > div { grid-template-columns: minmax(80px, 0.45fr) minmax(0, 1fr); }
.detail-disclosure > summary { padding-block: 0.35rem; line-height: 1.5; }
.original-description { margin-top: 0; }
.original-description > summary .helper-text { display: block; margin: 0.25rem 0 0; font-size: 0.85rem; font-weight: 400; color: var(--muted); }
.detail-description { max-width: 78ch; font-size: 1rem; line-height: 1.75; padding-top: 0.75rem; }
.detail-description > :first-child { margin-top: 0; }
.detail-description h3 { font-size: 1.1rem; line-height: 1.4; }
.detail-description li { margin-bottom: 0.45rem; }
.detail-description a, .enrichment-block a { text-decoration: underline; text-underline-offset: 3px; }
.detail-sidebar .fact-list dt { text-transform: none; letter-spacing: normal; font-size: 0.8rem; }
.detail-sidebar .fact-list dd { font-weight: 500; font-size: 0.9rem; }

/* The console gets its own viewport-sized layout; export dialogs retain their size. */
.admin-console-dialog { width: min(96vw, 1200px); max-width: 1200px; height: min(92dvh, 960px); max-height: 92dvh; }
.admin-console-dialog .modal-header .eyebrow { margin: 0 0 0.15rem; }
.admin-console-dialog .modal-body { flex: 1; min-height: 0; overflow: hidden; gap: 0.75rem; padding-bottom: 0.85rem; }
.admin-console-dialog .admin-console-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 0.75rem; margin: 0; }
.admin-console-filters .form-control { min-width: 0; }
.admin-console-filter-actions { flex-wrap: wrap; }
.console-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; font-size: 0.85rem; }
.console-toolbar p { margin: 0; }
.console-toolbar label { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.85rem; font-weight: 500; cursor: pointer; }
.console-toolbar input { margin: 0; flex-shrink: 0; }
.console-toolbar .admin-console-option { padding: 0; border: 0; background: transparent; }
#admin-console-status { flex: 1 1 auto; }
#admin-console-status[data-variant="connected"] { color: #166534; }
.admin-console-dialog .console-output { flex: 1; min-height: 0; max-height: none; margin: 0; padding: 0; border-radius: 6px; white-space: normal; overflow: auto; overscroll-behavior: contain; overflow-anchor: none; scrollbar-gutter: stable; font-size: 0.82rem; line-height: 1.55; }
.console-entry { padding: 0.85rem 1rem; border-bottom: 1px solid #334155; border-left: 3px solid transparent; }
.console-entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.75rem; color: #cbd5e1; font-size: 0.75rem; }
.console-time, .console-level { white-space: nowrap; }
.console-level { font-weight: 700; color: #7dd3fc; }
.console-entry[data-level="warning"] { border-left-color: #fbbf24; }
.console-entry[data-level="warning"] .console-level { color: #fcd34d; }
.console-entry[data-level="error"], .console-entry[data-level="critical"] { border-left-color: #fb7185; }
.console-entry[data-level="error"] .console-level, .console-entry[data-level="critical"] .console-level { color: #fda4af; }
.console-message { margin: 0.4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.console-category { margin: 0.35rem 0 0; color: #94a3b8; font-size: 0.72rem; overflow-wrap: anywhere; }
.console-exception { margin-top: 0.5rem; }
.console-exception summary { cursor: pointer; color: #fda4af; }
.console-exception pre { margin: 0.5rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.console-empty { padding: 1rem; margin: 0; color: #cbd5e1; }

@media (max-width: 1120px) {
    .detail-workspace { grid-template-columns: minmax(0, 1fr); }
    .detail-sidebar { grid-column: 1; grid-row: 1; position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .detail-main { grid-column: 1; grid-row: 2; }
    .detail-sidebar .fact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
}
@media (max-width: 760px) {
    .analysis-summary, .briefing-grid, .enrichment-grid { grid-template-columns: minmax(0, 1fr); }
    .enrichment-block-wide > .insights-list { columns: 1; }
    .detail-sidebar { grid-template-columns: minmax(0, 1fr); }
    .admin-console-dialog { width: calc(100vw - 1rem); height: calc(100dvh - 1rem); max-height: calc(100dvh - 1rem); }
    .admin-console-dialog .modal-body { overflow-y: auto; }
    .admin-console-dialog .admin-console-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-console-filter-actions { grid-column: 1 / -1; }
    .admin-console-dialog .console-output { flex: 1 0 35dvh; }
    .console-toolbar #admin-console-status { flex-basis: 100%; }
    .console-toolbar .admin-console-option { flex-basis: 100%; }
    .console-entry { padding: 0.75rem; }
    .source-list li { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
    .admin-console-dialog .admin-console-filters { grid-template-columns: minmax(0, 1fr); }
    .admin-console-dialog .modal-header, .admin-console-dialog .modal-body, .admin-console-dialog .modal-footer { padding: 0.75rem; }
    .admin-console-dialog .wizard-nav button { flex: 1 1 auto; }
    .admin-console-dialog .wizard-nav .spacer { display: none; }
    .compact-facts > div { grid-template-columns: minmax(0, 1fr); }
}
@media (max-height: 650px) {
    .admin-console-dialog .modal-body { overflow-y: auto; }
    .admin-console-dialog .console-output { flex: 1 0 220px; }
    .detail-sidebar { position: static; }
}

@media (max-width: 360px) {
    .results-table tr { grid-template-columns: 32px minmax(0,1fr) 76px; column-gap: .25rem; }
    .results-table .selection-column, .results-table thead .selection-column, .results-table .result-check { width: 32px; }
    .results-table .result-score { padding-inline: .15rem; }
    .results-table .table-link { font-size: .84rem; }
}
