:root {
  --bg: #e6eef6;
  --surface: #f5f8fc;
  --surface-2: #dfe8f2;
  --border: #9eb1c7;
  --text: #0d2238;
  --muted: #3d5168;
  --accent: #1558b0;
  --accent-soft: #d3e4f8;
  --you-bg: #f8ead0;
  --you-border: #c4842a;
  --you-text: #6a4308;
  --ai-bg: #d3e4f8;
  --ai-border: #1558b0;
  --ai-text: #0d3a78;
  --good: #0b7a45;
  --good-bg: #d4f0e1;
  --warn: #b45309;
  --warn-bg: #fde8cc;
  --bad: #b42318;
  --bad-bg: #fde4e1;
  --sidebar-bg: #0b1f3a;
  --sidebar-text: #f3f7fb;
  --sidebar-muted: #9db0c6;
  --sidebar-hover: #143056;
  --sidebar-active: #1a4d86;
  --sidebar-line: #1a3358;
  --mark: #c4842a;
  --bg0: var(--bg);
  --bg1: var(--surface-2);
  --bg2: var(--surface-2);
  --bg-elevated: var(--surface);
  --panel: var(--surface);
  --line: var(--border);
  --line-strong: #7f95ae;
  --focus: var(--accent);
  --focus-soft: var(--accent-soft);
  --warm: var(--mark);
  --warm-soft: var(--you-bg);
  --accent-2: var(--warn);
  --danger: var(--bad);
  --ok: var(--good);
  --font: "Avenir Next", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  --sidebar-w: clamp(160px, 12vw, 220px);
  --space: clamp(6px, 0.6vw, 12px);
  --space-lg: clamp(8px, 0.8vw, 14px);
  --fs-xs: clamp(10px, 0.5vw + 8px, 12px);
  --fs-sm: clamp(11px, 0.65vw + 9px, 13px);
  --fs: clamp(12px, 0.85vw + 10px, 14px);
  --fs-md: var(--fs);
  --fs-lg: clamp(13px, 0.9vw + 10px, 17px);
  --fs-xl: clamp(15px, 1.1vw + 11px, 20px);
  --text-stat: clamp(18px, 1.6vw + 10px, 26px);
  --text-base: var(--fs);
  --text-sm: var(--fs-sm);
  --text-xs: var(--fs-xs);
  --text-lg: var(--fs-lg);
  --text-xl: var(--fs-xl);
}

* { box-sizing: border-box; }
*, *::before, *::after { border-radius: 0 !important; }
html, body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.45;
}

h1, h2, h3 {
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
h1 { font-size: var(--text-lg); margin: 0 0 0.55rem; }
h2 { font-size: var(--text-lg); margin: 0 0 0.55rem; }
h3 { font-size: var(--text-base); margin: 0 0 0.45rem; font-weight: 600; }

.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.mono-sm {
  font-family: var(--mono);
  font-size: var(--text-sm);
}
.section-title { margin: 0 0 0.75rem; font-size: var(--text-lg); }
.page-head h1 { font-size: var(--text-lg); margin: 0 0 0.35rem; }
.page-head p { font-size: var(--text-sm); }
.panel > h2:first-child,
.panel .section-title { margin-top: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--fs-xs);
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  width: 100vw;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}
.shell-guest {
  grid-template-columns: 1fr;
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-line);
  padding: var(--space-lg) var(--space);
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-lg);
  text-decoration: none;
  color: inherit;
}
.brand-copy { min-width: 0; }
.logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
}
.brand-name {
  display: block;
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.brand-sub {
  display: block;
  margin-top: 4px;
  font-size: var(--fs-xs);
  letter-spacing: 0.01em;
  color: var(--sidebar-muted);
  font-weight: 400;
  line-height: 1.25;
}
.sidebar-nav { display: block; }
.sidebar-section {
  margin-top: var(--space-lg);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  margin-bottom: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--sidebar-line);
}
.sidebar-nav .sidebar-section:first-child {
  border-top: none;
  margin-top: 8px;
  padding-top: 0;
}
.nav-item {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: clamp(6px, 0.8vh, 10px) clamp(8px, 0.8vw, 12px);
  cursor: pointer;
  font-size: var(--fs);
  color: var(--sidebar-text);
  margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.current {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
  font-weight: 600;
}
.nav-button {
  font: inherit;
  appearance: none;
}
.nav-user {
  display: block;
  margin: 10px 0 6px;
  padding: clamp(8px, 0.9vh, 12px) clamp(8px, 0.8vw, 12px);
  border-top: 1px solid var(--sidebar-line);
  border-bottom: 1px solid var(--sidebar-line);
}
.nav-user-name {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--sidebar-text);
  line-height: 1.35;
}
.nav-user-email {
  display: block;
  font-size: var(--fs-xs);
  color: var(--sidebar-muted);
  word-break: break-all;
  line-height: 1.35;
  margin-top: 2px;
}
.nav-user-name + .nav-user-email {
  margin-top: 3px;
}
.sidebar-logout { margin: 0; }

.main {
  padding: 0;
  width: 100%;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.shell-guest .main {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}
.main-inner {
  flex: 1;
  min-height: 0;
}
.shell:not(.shell-guest) .main-inner {
  display: flex;
  flex-direction: column;
}

.guest-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.guest-brand { margin: 0; color: var(--text); }
.guest-brand .brand-sub { color: var(--muted); }
.guest-nav {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.guest-nav a { color: var(--accent); text-decoration: none; font-weight: 600; }
.shell-guest .main-inner {
  padding: 1rem clamp(1rem, 2vw, 1.75rem) 2.5rem;
  max-width: 48rem;
  margin: 0 auto;
  width: 100%;
}

.site-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-sm);
}
.site-footer a {
  color: var(--accent);
  text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }

.legal-doc {
  max-width: 42rem;
  line-height: 1.65;
}
.legal-doc h1 { margin-top: 0; }
.legal-doc h2 {
  margin-top: 1.75rem;
  font-size: 1.1rem;
}
.legal-doc ul { padding-left: 1.25rem; }
.legal-doc li { margin-bottom: 0.35rem; }
.legal-doc code {
  font-size: 0.9em;
  background: var(--surface-2, rgba(0,0,0,0.04));
  padding: 0.1em 0.35em;
}

.btn, button, .btn-secondary, a.btn, a.btn-secondary {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: clamp(5px, 0.6vh, 8px) clamp(8px, 1vw, 14px);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  background: var(--surface);
  color: inherit;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.08s ease, filter 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn, button:not(.secondary):not(.linkish):not(.nav-button):not(.kit-tab) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-secondary, button.secondary, a.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-danger {
  background: var(--surface);
  border: 1px solid var(--bad);
  color: var(--bad);
}
.btn:hover, button:hover, a.btn:hover, a.btn-secondary:hover { filter: brightness(1.05); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }

/* Immediate press feedback */
.btn:active, button:active, a.btn:active, a.btn-secondary:active,
.btn.is-pressed, button.is-pressed, a.btn.is-pressed, a.btn-secondary.is-pressed {
  transform: translateY(1px) scale(0.98);
  filter: brightness(0.88);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12);
}
.btn-secondary:active, button.secondary:active, a.btn-secondary:active,
.btn-secondary.is-pressed, button.secondary.is-pressed, a.btn-secondary.is-pressed {
  background: color-mix(in srgb, var(--line) 35%, transparent);
  filter: none;
}
.btn-danger:active, .btn-danger.is-pressed {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  filter: none;
}
.btn:focus-visible, button:focus-visible, a.btn:focus-visible, a.btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* After click while waiting for navigation / server */
.btn.is-busy, button.is-busy, a.btn.is-busy, a.btn-secondary.is-busy {
  opacity: 0.72;
  cursor: wait;
  filter: brightness(0.9);
  pointer-events: none;
  position: relative;
}
.btn.is-busy::after, button.is-busy::after, a.btn.is-busy::after {
  content: "";
  display: inline-block;
  width: 0.65em;
  height: 0.65em;
  margin-left: 0.45em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.05em;
  animation: btn-spin 0.65s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
button:disabled, .btn:disabled, a.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
  pointer-events: none;
}

.hero {
  padding: 4rem 0 3rem;
  max-width: 38rem;
}
.hero-logo {
  display: block;
  margin-bottom: 1rem;
  border-radius: 18%;
}
.hero h1 {
  font-size: var(--text-xl);
  line-height: 1.25;
  margin: 0 0 0.35rem;
  letter-spacing: -0.015em;
}
.hero-tagline {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 0.75rem !important;
}
.hero p {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin: 0 0 1.5rem;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.panel {
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: var(--space-lg);
  margin-bottom: 0;
}
.panel:last-child { border-bottom: none; }
.panel.workflow-start,
.panel.job-card {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
}
.detail-hero {
  border-left: 4px solid var(--accent);
}
.stats, .metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}
.stat, .metric {
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: var(--space-lg);
}
.stat:last-child, .metric:last-child { border-right: none; }
.stat-label, .metric .l {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.stat-value, .metric .n {
  font-size: var(--text-stat);
  font-weight: 700;
  margin-top: 2px;
  line-height: 1.1;
  font-family: var(--font);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin-bottom: 1rem;
}
label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 600;
}
input, select, textarea {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: var(--text-base);
  min-width: 10rem;
}
select, select option {
  font-weight: 400;
}
input[type="checkbox"] {
  appearance: auto;
  width: 1.2rem;
  height: 1.2rem;
  min-width: 1.2rem;
  min-height: 1.2rem;
  padding: 0;
  margin: 0;
  accent-color: var(--accent, #6bcf8e);
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
}
label:has(> input[type="checkbox"]) {
  cursor: pointer;
  user-select: none;
}
textarea { min-height: 5rem; width: 100%; resize: vertical; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}
th, td {
  text-align: left;
  padding: 0.7rem 0.45rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: var(--text-base);
}
th {
  color: var(--muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.status {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 0;
  border: 1px solid var(--line);
  font-size: var(--text-xs);
  text-transform: capitalize;
}
.status-interviewing, .status-screening { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.status-offer { border-color: var(--good); color: var(--good); background: var(--good-bg); }
.status-rejected, .status-closed { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.status-applied { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.flash {
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: var(--space-lg);
  margin-bottom: 0;
}
.error {
  background: var(--bad-bg);
  border-color: var(--bad);
  color: var(--bad);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}
.form-grid .full { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  align-items: center;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  border-left: 2px solid var(--line);
  padding: 0 0 1rem 0.9rem;
  margin-left: 0.35rem;
  position: relative;
}
.timeline li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: var(--accent);
  position: absolute;
  left: -5px;
  top: 0.35rem;
}
.timeline .when {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-family: var(--mono);
}
.inbox-sync-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  position: sticky;
  top: 0.5rem;
  z-index: 2;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg1) 92%, transparent);
}
.inbox-row { padding-left: 1rem; }
.inbox-subject {
  font-weight: 600;
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--text);
}
.inbox-company {
  font-weight: 600;
  color: var(--text);
}
.inbox-row strong { font-weight: 600; }
.inbox-one summary { list-style: none; }
.inbox-one summary::-webkit-details-marker { display: none; }
.login-card {
  max-width: 420px;
  margin: 3rem auto;
}
.login-card.invite-card { max-width: 520px; }
.login-card h1 { margin-top: 0; }
.invite-explain {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface-2, #f4f6f8);
}
.invite-explain h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}
.invite-explain p { margin: 0 0 0.55rem; }
.invite-bullets {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.5;
}
.invite-bullets li { margin: 0 0 0.35rem; }
.stack { display: grid; gap: 0.75rem; }
.profile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.profile-top h1 { margin: 0 0 0.35rem; }
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}
.profile-grid .span-2 { grid-column: 1 / -1; }
.profile-grid label,
.panel > label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.profile-grid input,
.panel textarea,
.resume-textarea {
  font: inherit;
  font-weight: 400;
  width: 100%;
}
.resume-textarea {
  min-height: 22em;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-weight: 600;
}
.check-row input { width: auto; min-width: auto; }
.emp-types {
  border: 1px solid var(--line);
  padding: 0.75rem 1rem 0.35rem;
  margin: 0.75rem 0 0;
}
.emp-types legend {
  padding: 0 0.35rem;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.emp-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1rem;
  margin: 0.35rem 0 0.5rem;
}
@media (max-width: 640px) {
  .emp-type-grid { grid-template-columns: 1fr; }
}
.profile-review-meta { margin-top: 0.75rem; }
.review-status-ok { color: var(--ok); }
.review-status-warn { color: var(--accent-2); }
.resume-review-panel {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface-2, #f4f6f8);
  max-height: 420px;
  overflow: auto;
}
.resume-review-body {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: var(--fs-sm);
  line-height: 1.5;
  font-weight: 400;
}
@media (max-width: 640px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-top { flex-direction: column; }
}

.onboarding { max-width: 1100px; }
.onboarding-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0 0 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.ob-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.ob-step.current { color: var(--text); font-weight: 600; }
.ob-step.done { color: var(--ok); }
.ob-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--line);
}
.ob-step.current .ob-dot { background: var(--accent); }
.ob-step.done .ob-dot { background: var(--ok); }
.onboarding-card h1 { margin-top: 0; }
.onboarding-review {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 1rem;
  align-items: start;
}
.onboarding-coach { position: sticky; top: 1rem; }
.ob-cards { display: grid; gap: 0.75rem; }
.ob-card {
  border: 1px solid var(--line);
  padding: 0.85rem 1rem;
  background: var(--surface-2, #f4f6f8);
}
.ob-card.status-accepted { border-color: var(--ok); }
.ob-card.status-skipped { opacity: 0.65; }
.ob-card.is-working {
  border-color: var(--accent);
  opacity: 1;
  cursor: wait;
}
.ob-card.is-working .form-actions button { pointer-events: none; }
.ob-working {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.35rem 0 0.15rem;
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.ob-working-spinner {
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
  flex-shrink: 0;
}
.ob-card-title { margin: 0 0 0.5rem; font-weight: 600; }
.coach-thread {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  padding: 0.65rem;
  margin-bottom: 0.75rem;
  font-size: var(--fs-sm);
  background: var(--surface, #fff);
}
.coach-msg { margin: 0 0 0.55rem; white-space: pre-wrap; }
.coach-msg.user { color: var(--muted); }
.coach-patch pre {
  white-space: pre-wrap;
  font-size: var(--fs-sm);
  max-height: 160px;
  overflow: auto;
  background: var(--surface-2, #f4f6f8);
  padding: 0.5rem;
}
.ob-run-log {
  min-height: 8rem;
  max-height: 16rem;
  overflow: auto;
  background: var(--surface-2, #f4f6f8);
  border: 1px solid var(--line);
  padding: 0.75rem;
  font-size: var(--fs-sm);
}
.ob-banner {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent-soft, #e8f1fb);
}
@media (max-width: 860px) {
  .onboarding-review { grid-template-columns: 1fr; }
  .onboarding-coach { position: static; }
}
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: 1rem 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
@media (max-width: 640px) {
  input, select { min-width: 0; width: 100%; }
  .filters { flex-direction: column; align-items: stretch; }
  table { display: block; overflow-x: auto; }
}

.view-toolbar {
  display: grid;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.view-tabs {
  display: inline-flex;
  gap: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
  width: 100%;
  background: var(--surface-2);
}
.view-tab {
  color: var(--muted);
  text-decoration: none;
  padding: clamp(8px, 1vh, 12px) clamp(12px, 1.2vw, 18px);
  border-radius: 0;
  font-weight: 600;
  font-size: var(--text-sm);
  border-right: 1px solid var(--border);
}
.view-tab:last-child { border-right: none; }
.view-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.view-tab:hover { text-decoration: none; color: var(--text); background: var(--surface); }
.filters-inline {
  margin: 0;
  align-items: end;
  padding: var(--space-lg);
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--border);
}
.view-toolbar.panel {
  border-left: none;
  background: var(--surface);
  padding: 0;
}
.view-toolbar .filters-inline {
  background: transparent;
  border: 0;
  padding: var(--space-lg);
  margin-top: 0;
}
.status-multi {
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 0.5rem 0.65rem;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-width: 36rem;
  background: var(--bg2);
}
.status-multi legend {
  padding: 0 0.25rem;
  color: var(--muted);
  font-size: var(--fs-xs);
}
.chip-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem !important;
  font-size: var(--text-sm);
  color: var(--text);
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg2);
  cursor: pointer;
  user-select: none;
  min-height: 2.4rem;
}
.chip-check:hover { border-color: var(--accent); }
.chip-check:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg2));
}
.chip-check input {
  min-width: 1.2rem !important;
  width: 1.2rem !important;
  height: 1.2rem !important;
  min-height: 1.2rem !important;
}
.add-collapse summary {
  cursor: pointer;
  list-style: none;
}
.add-collapse summary::-webkit-details-marker { display: none; }

.pipeline-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
}
.pipeline-chip {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
}
.pipeline-chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pipeline-chip.muted-chip { font-weight: 500; color: var(--muted); }
.action-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.action-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--bg2);
  border-left: 3px solid var(--accent-2);
}
.action-item.action-high { border-left-color: var(--accent-2); }
.action-item.action-medium { border-left-color: var(--focus); }
.action-body { flex: 1; min-width: 12rem; }
.action-detail { font-size: var(--text-sm); margin-top: 0.2rem; }
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.timeline-item {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.75rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.timeline-item:last-child { border-bottom: 0; }
.timeline-when { font-size: var(--fs-xs); white-space: nowrap; }
.timeline-role {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  margin-right: 0.5rem;
}
.timeline-role:hover { color: var(--accent); }
.timeline-msg { font-size: var(--text-base); margin-top: 0.35rem; line-height: 1.4; }
@media (max-width: 640px) {
  .timeline-item { grid-template-columns: 1fr; gap: 0.25rem; }
}
.pager {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 0 0.35rem;
}
.detail-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}
.detail-quick-status { margin: 0; }
.dashboard-status-form {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-start;
}
.dashboard-status-form .status-select {
  width: 100%;
  min-width: 7.5rem;
  max-width: 11rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.dashboard-status-form .status-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.email-preview {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: var(--text-sm);
  color: var(--muted);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0.65rem;
  max-height: 16rem;
  overflow: auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.job-card-top {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.job-headline {
  margin: 0 0 0.35rem;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
  color: var(--text);
  text-decoration: none;
}
a.job-headline:hover {
  color: var(--accent);
}
a.job-headline:hover .job-company,
a.job-headline:hover .job-title { color: var(--accent); }
.job-ext { font-weight: 500; font-size: 0.9em; }
.job-company { color: var(--text); }
.job-sep { color: var(--muted); font-weight: 500; }
.job-title { color: var(--text); font-weight: 600; }
.job-meta {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.4;
}
.job-meta .meta-dot { margin: 0 0.15rem; }
.job-why {
  margin: 0.4rem 0 0;
  font-size: var(--text-sm);
  line-height: 1.4;
  max-width: 70rem;
}
.app-row-primary {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.app-row-primary:hover {
  color: var(--accent);
  text-decoration: underline;
}
.app-row-meta { font-size: var(--text-sm); color: var(--muted); margin-top: 0.2rem; }
.apps-table {
  table-layout: fixed;
}
.apps-table .col-role {
  width: 28%;
  padding-right: 0.85rem;
}
.apps-table .col-details {
  width: 48%;
  padding-left: 0.35rem;
  border-left: 1px solid var(--line);
}
.apps-table .col-status { width: 12%; }
.apps-table .col-applied { width: 12%; }
.apps-table thead th {
  background: var(--surface-2);
  border-bottom-color: var(--border);
}
.apps-table tbody tr:nth-child(even) td {
  background: rgba(13, 34, 56, 0.02);
}
.apps-table tbody tr:hover td {
  background: var(--accent-soft);
}
.apps-table .col-details {
  border-left: 1px solid var(--border);
}
.apps-table .col-role .app-row-primary {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.apps-table .col-details .app-row-meta {
  color: var(--muted);
}
.score-ring {
  flex: 0 0 3rem;
  width: 3rem;
  height: 3rem;
  border-radius: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: var(--fs-sm);
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.score-ring.high { color: var(--good); border-color: var(--border); background: var(--good-bg); }
.score-ring.mid { color: var(--warn); border-color: var(--border); background: var(--warn-bg); }
.score-ring.low { color: var(--muted); border-color: var(--border); background: var(--surface-2); }
.btn-apply {
  background: var(--good) !important;
  border-color: var(--good) !important;
  color: #fff !important;
}
.discover-tabs {
  border-left: 4px solid var(--mark);
  background: var(--warn-bg);
  border-bottom: 1px solid var(--border);
}
.discover-tabs a.tab-active {
  color: var(--text);
  border-bottom-color: var(--mark);
}
.discover-tabs a {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.discover-tabs a:hover { color: var(--text); }
.apps-table thead th {
  background: var(--surface-2);
  border-bottom-color: var(--border);
}
.apps-table tbody tr:hover td {
  background: var(--accent-soft);
}
.apps-table .col-details {
  border-left: 1px solid var(--border);
}
.pipeline-chip {
  border: 1px solid var(--border);
  background: var(--surface);
}
.action-item {
  border: 1px solid var(--border);
  background: var(--surface);
  border-left: 4px solid var(--mark);
}
.action-item.action-high { border-left-color: var(--mark); }
.action-item.action-medium { border-left-color: var(--accent); }
.page-head {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 0;
}
.page-head .form-actions {
  align-items: center;
}
.page-head a.btn-secondary,
.page-head .btn.btn-secondary {
  background: var(--surface-2);
  border-color: var(--line);
  align-self: center;
  white-space: nowrap;
}
.workflow-start-restore {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  margin: 0 !important;
}
.pipeline-shortcuts {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.activity-intro {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  margin: 0;
  font-size: var(--text-sm);
}
@media (max-width: 800px) {
  html, body { overflow: auto; }
  .shell { grid-template-columns: 1fr; height: auto; min-height: 100vh; overflow: visible; }
  .sidebar { height: auto; overflow: visible; border-right: none; border-bottom: 1px solid var(--sidebar-line); }
  .main { height: auto; overflow: visible; }
}
.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.job-actions form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0; }
.decline-form input {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 0;
  padding: 0.45rem 0.55rem;
  font: inherit;
}
.workflow-steps {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.workflow-steps li { margin: 0.35rem 0; }
.workflow-steps strong { color: var(--text); }
.workflow-start-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
button.linkish {
  background: none;
  border: 0;
  color: var(--accent);
  padding: 0;
  min-width: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  box-shadow: none;
  transform: none;
}
button.linkish:hover { filter: none; color: var(--text); }
button.linkish:active, button.linkish.is-pressed {
  transform: none;
  filter: none;
  box-shadow: none;
  opacity: 0.7;
}
button.linkish.is-busy::after { display: none; }
.workflow-start .btn {
  display: inline-block;
  text-decoration: none;
  padding: 0.55rem 0.9rem;
  border-radius: 0;
  background: var(--accent);
  color: #f8fffe;
  border: 1px solid var(--accent);
  font-weight: 600;
}
.workflow-start .btn:hover { filter: brightness(1.05); text-decoration: none; }
.workflow-start .btn:active, .workflow-start .btn.is-pressed {
  transform: translateY(1px) scale(0.98);
  filter: brightness(0.88);
}
.kit-preview {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0.85rem;
  max-height: 28rem;
  overflow: auto;
  margin: 0;
}
.kit-doc-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.65rem;
}
.kit-doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.kit-doc-actions .kit-copy-text-btn {
  padding: 0.4rem 0.85rem;
  font-size: var(--fs-sm);
}
.kit-source { margin: 0 0 0.65rem; font-size: var(--fs-xs); }
.kit-view-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
}
.kit-tab {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg2);
  color: var(--muted);
  padding: 0.4rem 0.85rem;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, filter 0.08s ease;
}
.kit-tab + .kit-tab { border-left: 1px solid var(--line); }
.kit-tab:active, .kit-tab.is-pressed {
  filter: brightness(0.9);
  transform: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}
.kit-tab.is-active {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
}
.kit-md-pane,
.kit-pdf-pane { display: none; }
.kit-md-pane.is-active,
.kit-pdf-pane.is-active { display: block; }
.kit-md {
  background: var(--bg2);
  border: 1px solid var(--line);
  padding: 1.25rem 1.4rem;
  max-width: 52rem;
  color: var(--text);
  font-size: var(--fs);
  line-height: 1.55;
}
.kit-md h1 {
  margin: 0 0 0.65rem;
  font-size: var(--fs-xl);
  line-height: 1.25;
}
.kit-md h2 {
  margin: 1.35rem 0 0.55rem;
  font-size: var(--fs-lg);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.25rem;
}
.kit-md h3 {
  margin: 1rem 0 0.35rem;
  font-size: var(--fs-md);
}
.kit-md p { margin: 0.45rem 0; }
.kit-md ul, .kit-md ol {
  margin: 0.4rem 0 0.6rem;
  padding-left: 1.25rem;
}
.kit-md li { margin: 0.2rem 0; }
.kit-md a { color: var(--accent); }
.kit-md strong { color: var(--text); }
.kit-md em { color: var(--muted); }
.kit-md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}
.kit-pdf-toolbar { margin: 0 0 0.65rem; }
.kit-pdf-frame {
  width: 100%;
  min-height: 72vh;
  height: 820px;
  border: 1px solid var(--line);
  background: var(--bg1);
}
.kit-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.kit-inline input {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.35rem 0.5rem;
}
.upload-paths {
  margin: 0.85rem 0 0;
  padding: 0.85rem 1rem;
  background: var(--bg2);
  border: 1px solid var(--line);
}
.upload-path-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin: 0.45rem 0;
}
.upload-path {
  flex: 1;
  min-width: 12rem;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  word-break: break-all;
  color: var(--text);
  border-radius: 0;
  padding: 0.45rem 0.55rem;
  font: inherit;
}
.job-actions a.btn-secondary {
  display: inline-block;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  text-decoration: none;
  background: transparent;
}
@media (max-width: 640px) {
  .action-item { flex-direction: column; align-items: stretch; }
}

.metrics-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0 1rem 0.85rem;
}
.period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.period-tab {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.period-tab.active,
.period-tab:hover {
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}
.period-tab.active { background: color-mix(in srgb, var(--accent) 14%, var(--bg2)); }
.metrics-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.chart-panel h2 {
  margin: 0 0 0.35rem;
  font-size: var(--text-base);
}
.chart-note { margin: 0 0 0.65rem; font-size: var(--text-xs); }
.trend-chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.trend-grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.trend-y-label,
.trend-x-label {
  fill: var(--muted);
  font-size: 9px;
  font-family: var(--mono);
}
.trend-line {
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trend-area { opacity: 0.14; }
.trend-dot { stroke: var(--bg-elevated); stroke-width: 1.5; }
.line-apps { stroke: var(--accent); fill: var(--accent); }
.line-discover { stroke: var(--focus); fill: var(--focus); }
.line-events { stroke: color-mix(in srgb, var(--warm) 70%, var(--accent)); fill: color-mix(in srgb, var(--warm) 70%, var(--accent)); }
.line-cumulative { stroke: color-mix(in srgb, var(--ok) 80%, #1c2430); fill: color-mix(in srgb, var(--ok) 80%, #1c2430); }
.line-email { stroke: var(--accent-2); fill: var(--accent-2); }
.line-sync { stroke: color-mix(in srgb, var(--muted) 55%, var(--text)); fill: color-mix(in srgb, var(--muted) 55%, var(--text)); }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.65rem;
  font-size: var(--text-xs);
  color: var(--muted);
}
.swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  margin-right: 0.25rem;
  vertical-align: -0.05rem;
}
.sw-discover { background: var(--focus); }
.sw-events { background: color-mix(in srgb, var(--warm) 70%, var(--accent)); }
.sw-email { background: var(--accent-2); }
.sw-sync { background: color-mix(in srgb, var(--muted) 55%, var(--bg2)); }
.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.metrics-table th,
.metrics-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
  text-align: left;
}
.metrics-table th { color: var(--muted); font-weight: 600; }
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .guest-topbar, .view-toolbar, .workflow-start, .workflow-start-restore, .add-collapse,
  .metrics-toolbar button, .flash, .form-actions { display: none !important; }
  .shell { grid-template-columns: 1fr; height: auto; }
  .metrics-report, .metrics-table-wrap { break-inside: avoid; }
  body { background: #fff; color: #000; }
  .panel { border-color: #ccc; }
}
