/* Shared workspace refinement. Loaded after page styles so the same controls and
   navigation behave consistently. Desktop, tablet and phone rules are explicit. */
:root {
  --bg: #f5f6fa;
  --surface-2: #f8fafc;
  --text: #18263c;
  --text-secondary: #42516a;
  --muted: #606e82;
  --border: #e2e7ee;
  --border-strong: #c1cbd8;
  --accent: #5346d6;
  --accent-strong: #4335b9;
  --accent-deep: #302586;
  --accent-soft: #efedff;
  --accent-border: #d4cef9;
  --accent-text: #4335b9;
  --shadow-soft: 0 1px 2px rgba(24, 38, 60, .04), 0 4px 12px rgba(24, 38, 60, .025);
  --shadow: 0 2px 8px rgba(24, 38, 60, .035), 0 12px 30px rgba(24, 38, 60, .025);
  --shadow-lift: 0 4px 16px rgba(24, 38, 60, .08);
  --ring: 0 0 0 3px rgba(83, 70, 214, .17);
}
body.has-sidebar { background: radial-gradient(ellipse at 90% 0, #efedff 0, transparent 560px), var(--bg); }
a, button, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.skip-link { position: fixed; top: 8px; left: 12px; z-index: 100; padding: 12px 18px; color: #fff; background: var(--accent-deep); border-radius: 8px; transform: translateY(-160%); }
.skip-link:focus { transform: none; color: #fff; }
#main-content:focus { outline: none; box-shadow: none; }
.app-shell.with-sidebar { grid-template-columns: 244px minmax(0, 1fr); }
.has-sidebar .main { width: 100%; max-width: 1640px; margin-inline: auto; padding: 38px clamp(24px, 3vw, 52px) 64px; }
.sidebar { width: 244px; background: #fcfcfe; color: var(--text); border-right: 1px solid var(--border); padding: 24px 14px 16px; }
.brand { color: var(--text); font-size: 15px; font-weight: 750; letter-spacing: -.04em; gap: 9px; margin: 0 8px 28px; }
.brand:hover { color: var(--accent); }
.brand::before { background: var(--accent); box-shadow: 0 3px 8px rgba(83,70,214,.16); border-radius: 10px; }
.nav { gap: 3px; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.nav-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .13em; font-weight: 650; margin: 0 12px 9px; }
.nav a { color: var(--text-secondary); font-size: 13px; font-weight: 550; border-radius: 7px; min-height: 39px; }
.nav a:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.nav-icon { width: 18px; height: 18px; opacity: .8; }
.nav a.active { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent-border); font-weight: 650; box-shadow: 0 1px 2px rgba(48,37,134,.04); }
.nav a.active::before { display: none; }
.nav a.active .nav-icon { color: var(--accent); }
.nav-group { margin-top: 16px; padding: 0; border: 0; }
.nav-group-links a { padding-left: 12px; }
.nav-section { margin: 0; min-height: 30px; color: var(--muted); font-size: 10px; letter-spacing: .11em; font-weight: 650; padding: 7px 12px; }
.nav-section:hover { color: var(--text); }
.sidebar-account { padding: 16px 8px 0; margin-top: auto; border-top: 1px solid var(--border); }
.account-row { margin-bottom: 10px; }
.account-avatar { box-shadow: none; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--accent-border); }
.account-email { color: var(--text-secondary); font-size: 12px; }
.sidebar .button-subtle { color: var(--muted); background: var(--surface-2); border-color: var(--border); box-shadow: none; }
.sidebar .button-subtle:hover { color: var(--text); background: var(--surface-3); }
.page-head { gap: 20px; margin-bottom: 28px; align-items: center; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
h1 { font-size: clamp(26px, 2.3vw, 34px); font-weight: 700; letter-spacing: -.04em; line-height: 1.2; }
h2 { font-size: 18px; font-weight: 650; letter-spacing: -.025em; }
h3 { font-weight: 650; }
.page-head p { margin-bottom: 0; font-size: 14px; line-height: 1.65; max-width: 68ch; }
.eyebrow { color: var(--accent-strong); font-family: var(--font-sans); font-size: 10px; font-weight: 650; letter-spacing: .13em; margin-bottom: 10px; }
.panel { box-shadow: var(--shadow-soft); padding: 24px; border-radius: 16px; }
.button { min-height: 38px; border-radius: 8px; background: #fff; box-shadow: var(--shadow-soft); font-size: 13px; font-weight: 600; }
.button:hover { transform: none; background: var(--surface-2); border-color: #a8b4c5; box-shadow: var(--shadow-soft); }
.button.primary { background: var(--accent); border-color: var(--accent-strong); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 2px 4px rgba(48,37,134,.18); }
.button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); box-shadow: var(--shadow-soft); }
.button.secondary { color: var(--text-secondary); border-color: var(--border-strong); background: #fff; }
.button.secondary:hover { color: var(--text); background: var(--surface-2); }
.button.button-subtle { color: var(--text-secondary); background: var(--surface-2); border-color: var(--border-strong); }
.button.button-subtle:hover { color: var(--accent-deep); background: var(--accent-soft); border-color: var(--accent-border); }
:where(button, .button):disabled { opacity: .55; cursor: not-allowed; transform: none; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { border-radius: 8px; box-shadow: var(--shadow-soft); }
input::placeholder, textarea::placeholder { color: #707e91; }
.field-help { font-size: 13px; line-height: 1.6; }
.view-tabs { background: transparent; border: 0; padding: 0; gap: 4px; }
.view-tabs a { color: var(--muted); font-size: 13px; border-radius: 7px; padding: 9px 12px; }
.view-tabs a.active { color: var(--accent-strong); background: #fff; box-shadow: 0 0 0 1px var(--border), var(--shadow-soft); }
.metric:hover { transform: none; box-shadow: var(--shadow-soft); }
.metric .label { font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.metric .value { font-weight: 650; }
.table-wrap { box-shadow: none; }
th { color: var(--muted); font-weight: 600; background: var(--surface-2); }
.empty-state { color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.empty-state p { margin-bottom: 16px; }
.mobile-tabs, .topbar-search { display: none; }

/* Jobs: the result is the focus; less frequent actions sit in a disclosure. */
.jobs-head h1 { font-size: clamp(26px, 2.3vw, 34px); }
.jobs-control-panel { border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 20px; }
.jobs-command-bar { grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 12px; }
.jobs-export { position: relative; }
.jobs-export > summary { list-style: none; gap: 12px; }
.jobs-export > summary::-webkit-details-marker { display: none; }
.jobs-export > summary::after { content: '⌄'; }
.jobs-export[open] > summary { background: var(--surface-2); }
.jobs-export-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; z-index: 12; display: grid; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lift); }
.jobs-export-menu a { color: var(--text-secondary); padding: 12px; border-radius: 6px; font-size: 13px; }
.jobs-export-menu a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.quick-filters { gap: 8px; margin-top: 16px; }
.quick-filter-link, .quick-filter-edit { font-weight: 550; background: #fff; box-shadow: none; }
.quick-filters a.is-highlight, .quick-filters a.is-highlight:hover { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent-border); box-shadow: none; }
.advanced-filters { background: transparent; }
.advanced-filters > summary { font-weight: 550; color: var(--text-secondary); }
.advanced-filters > summary::after { content: '+'; margin-left: auto; font-size: 18px; }
.advanced-filters[open] > summary::after { content: '−'; }
.table-meta { padding: 16px 20px; font-size: 12px; }
.jobs-table th { font-size: 10px; letter-spacing: .04em; padding-block: 14px; }
.jobs-table td { padding-block: 20px; }
.job-title { color: var(--text); font-size: 14px; font-weight: 650; }
.job-title:hover { color: var(--accent); }
.company-cell a { color: var(--text-secondary); font-weight: 550; }
.match-reason { margin-top: 6px; font-size: 12px; line-height: 1.6; }
.match-reason strong { font-weight: 550; }
.score-badge { font-variant-numeric: tabular-nums; }
.file-actions > summary { min-width: 36px; min-height: 36px; }

/* Discovery: form and context side by side on desktop; one task per row on phones. */
.company-search { display: flex; align-items: end; gap: 12px; }
.company-search .field { flex: 1; min-width: 0; margin: 0; }
.company-search .button { min-height: 44px; }
.company-results .section-head { flex-wrap: wrap; gap: 12px; }
.company-results .section-head p { font-size: 13px; margin: 6px 0 0; overflow-wrap: anywhere; }
.company-export-note { color: var(--muted); font-size: 12px; }
.company-priority { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 6px; background: var(--surface-2); color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.company-priority.is-high { color: var(--accent-strong); background: var(--accent-soft); }
.company-table td { vertical-align: top; overflow-wrap: anywhere; }
.company-table .job-title { line-height: 1.6; }
.company-table .empty-state { padding: 48px 20px; }
@media (min-width: 701px) {
  .company-table { table-layout: fixed; width: 100%; }
  .company-table th:nth-child(1) { width: 12%; }
  .company-table th:nth-child(2) { width: 25%; }
  .company-table th:nth-child(3) { width: 20%; }
  .company-table th:nth-child(4) { width: 35%; }
  .company-table th:nth-child(5) { width: 8%; }
}
.discovery-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 24px; }
.discovery-intro { padding: 24px 0; }
.discovery-intro h2 { font-size: 22px; line-height: 1.35; }
.discovery-intro p { color: var(--muted); font-size: 13px; line-height: 1.75; }
.discovery-steps { display: grid; gap: 20px; padding: 0; margin: 24px 0; list-style: none; counter-reset: discovery; }
.discovery-steps li { counter-increment: discovery; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.discovery-steps li::before { content: counter(discovery, decimal-leading-zero); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 700; }
.discovery-steps strong { display: block; color: var(--text); font-size: 13px; margin: 3px 0 4px; }
.discovery-steps span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.discovery-channels { padding: 0; border: 0; margin-top: 8px; }
.discovery-channels legend { padding: 0; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.discovery-channels #id_channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.discovery-channels label { height: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); font-size: 12px; font-weight: 550; line-height: 1.45; }
.discovery-channels label:has(input:checked) { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-strong); }
.discovery-channels input { accent-color: var(--accent); width: 18px; height: 18px; flex-basis: 18px; }
.discovery-card { position: relative; padding-top: 26px; }
.discovery-card::before { content: ''; width: 26px; height: 3px; background: var(--accent-border); margin-bottom: 18px; border-radius: 3px; }
.discovery-card p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.discovery-card .button { justify-content: space-between; text-align: left; font-size: 12px; }
.discovery-card .button .muted { font-size: 10px; }

/* Tablet: full-size touch controls, two-column information where space permits. */
@media (max-width: 1100px) {
  .discovery-layout { grid-template-columns: minmax(0, 1fr); }
  .discovery-intro { display: none; }
}
@media (max-width: 920px) {
  .app-shell.with-sidebar { grid-template-columns: minmax(0, 1fr); }
  .has-sidebar .main { padding: 28px 24px 48px; }
  .mobile-topbar { min-height: 64px; padding: max(8px, env(safe-area-inset-top)) 16px 8px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); box-shadow: none; gap: 8px; }
  .topbar-brand { color: var(--text); font-size: 14px; letter-spacing: -.025em; }
  .topbar-brand:hover { color: var(--accent); }
  .nav-toggle { color: var(--text-secondary); background: transparent; border: 0; border-radius: 8px; box-shadow: none; }
  .nav-toggle:hover { color: var(--accent); background: var(--accent-soft); }
  .topbar-search { display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; color: var(--text-secondary); }
  .topbar-search svg { width: 20px; height: 20px; }
  .sidebar { width: min(328px, 88vw); padding: max(16px, env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom)); }
  .nav a { min-height: 44px; font-size: 14px; }
  .nav-section { margin: 0; min-height: 44px; display: flex; align-items: center; }
  .nav-close { justify-content: flex-end; color: var(--muted); }
  .button, .quick-filter-link, .quick-filter-edit, .advanced-filters > summary, .file-actions > summary { min-height: 44px; }
  .quick-filter-link, .quick-filter-edit { display: inline-flex; align-items: center; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px; }
  .jobs-command-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .jobs-command-bar .search-field { grid-column: 1 / -1; }
  .jobs-primary-actions { justify-content: flex-start; }
  .page-head { display: flex; flex-wrap: wrap; gap: 16px; }
  .page-head > div:first-child { flex-basis: 100%; }
  .page-head .view-tabs { margin: 0; }
  .discovery-channels label { min-height: 52px; }
}
/* Phone: persistent thumb navigation, card lists and a shorter route to content. */
@media (max-width: 700px) {
  html { scroll-padding-top: 80px; scroll-padding-bottom: 100px; }
  .has-sidebar .main { padding: 24px 16px calc(100px + env(safe-area-inset-bottom)); }
  h1 { font-size: 28px; }
  .page-head { margin-bottom: 18px; padding-bottom: 18px; }
  .page-head p { font-size: 13px; }
  .panel { padding: 20px; border-radius: 14px; }
  .nav-ready .mobile-tabs { position: fixed; inset: auto 0 0; z-index: 35; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px 12px max(6px, env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid var(--border); box-shadow: 0 -4px 20px rgba(24,38,60,.035); }
  .mobile-tabs a, .mobile-tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; padding: 6px 0; margin: 0; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font: inherit; font-size: 10px; font-weight: 600; text-decoration: none; cursor: pointer; }
  .mobile-tabs svg { width: 21px; height: 21px; opacity: 1; }
  .mobile-tabs [aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); }
  body:has(input:focus, textarea:focus, select:focus) .mobile-tabs { display: none; }
  .jobs-control-panel { padding: 16px; }
  .jobs-table td { padding: 0; }
  .jobs-table tbody tr { padding: 20px 16px 16px; gap: 12px 8px; border-radius: 14px; }
  .jobs-table .job-title { font-size: 16px; line-height: 1.45; }
  .jobs-table .match-reason { font-size: 12px; }
  .jobs-table .company-cell { font-size: 13px; }
  .card-table td.cell-actions { top: 8px; right: 8px; }
  .file-actions > summary { min-width: 44px; }
  .table-meta { padding: 0 2px 14px; }
  .table-meta .export-note { display: none; }
  .quick-filters { flex-wrap: nowrap; overflow-x: auto; padding: 3px 2px 7px; margin-top: 12px; scrollbar-width: thin; }
  .quick-filter-label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .quick-filters a, .quick-filter-edit { flex: 0 0 auto; }
  .advanced-filters { margin-top: 8px; border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 0; }
  .advanced-filters > summary { padding: 10px 0 0; }
  .advanced-filters[open] > summary { padding-bottom: 12px; }
  .view-tabs { width: 100%; gap: 3px; }
  .view-tabs a { flex: 1; text-align: center; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; padding-inline: 8px; }
  .discovery-channels #id_channels { grid-template-columns: minmax(0, 1fr); }
  .discovery-channels label { min-height: 48px; }
  .discovery-grid { gap: 0; }
  .companies-head .actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .company-search { flex-wrap: wrap; gap: 8px; }
  .company-search .field { flex-basis: 100%; }
  .company-search .button { flex: 1; }
  .company-results { padding: 0; background: transparent; border: 0; box-shadow: none; }
  .company-export-note { display: none; }
  .company-table td { padding: 0; }
  .company-table .job-title { font-size: 16px; }
  .company-table .empty-state { padding: 16px 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
.mobile-job-sort { display: none; }
@media (max-width: 700px) {
  .mobile-job-sort { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
  .mobile-job-sort a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text-secondary); }
  .mobile-job-sort [aria-current] { color: var(--accent-strong); border-color: var(--accent-border); }
}

/* Bound long organization names instead of allowing them to consume the table. */
@media (min-width: 701px) {
  .jobs-table { table-layout: fixed; width: 100%; min-width: 1060px; }
  .jobs-table th, .jobs-table td { padding-inline: 10px; overflow-wrap: anywhere; white-space: normal; }
  .jobs-table th:nth-child(1) { width: 4%; }
  .jobs-table th:nth-child(2) { width: 7%; }
  .jobs-table th:nth-child(3) { width: 13%; }
  .jobs-table th:nth-child(4) { width: 23%; }
  .jobs-table th:nth-child(5) { width: 12%; }
  .jobs-table th:nth-child(6) { width: 8%; }
  .jobs-table th:nth-child(7) { width: 11%; }
  .jobs-table th:nth-child(8) { width: 8%; }
  .jobs-table th:nth-child(9) { width: 9%; }
  .jobs-table th:nth-child(10) { width: 5%; }
  .jobs-table .role-cell, .jobs-table .location-cell, .jobs-table .salary-cell { min-width: 0; max-width: none; }
  .dashboard-table { table-layout: fixed; width: 100%; }
  .dashboard-table td { overflow-wrap: anywhere; }
  .dashboard-table th:nth-child(1) { width: 12%; }
  .dashboard-table th:nth-child(2) { width: 22%; }
  .dashboard-table th:nth-child(3) { width: 32%; }
  .dashboard-table th:nth-child(4) { width: 14%; }
  .dashboard-table th:nth-child(5) { width: 20%; }
}
#onboarding-root button { border: 1px solid var(--border); font-family: inherit; box-shadow: var(--shadow-soft); }
#onboarding-root button[aria-current="step"] { border-color: var(--accent); box-shadow: var(--ring); }
#onboarding-root button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.jobs-table .company-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; line-height: 1.6; }
.jobs-table .th-link { white-space: nowrap; }
@media (min-width: 701px) {
  .jobs-table td { vertical-align: top; }
}
