:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-alt: #f0f2f1;
  --ink: #111714;
  --muted: #63706a;
  --line: #d9dfdb;
  --green: #087443;
  --green-soft: #def7e9;
  --blue: #3157c8;
  --blue-soft: #e9eeff;
  --coral: #e95d43;
  --coral-soft: #fff0ec;
  --amber: #9a5b00;
  --amber-soft: #fff1d6;
  --red: #b42318;
  --shadow: 0 12px 34px rgba(17, 23, 20, 0.08);
  --sidebar: 232px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: var(--ink);
  border-right: 1px solid var(--line);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  font-size: 18px;
}
.brand-mark {
  width: 34px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  border-radius: 7px;
  font-family: Georgia, serif;
  font-size: 21px;
}

.desktop-nav { margin-top: 42px; display: grid; gap: 7px; }
.nav-button {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #65716a;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.nav-button:hover { background: #f2f4f3; color: var(--ink); }
.nav-button.active { background: var(--green-soft); color: #075c37; }
.nav-glyph { width: 21px; text-align: center; font-size: 17px; font-weight: 700; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 10px; background: #edf0ee; color: #65716a; font-size: 10px; }
.nav-button.active .nav-count { background: white; color: var(--green); }

.sidebar-profile {
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 36px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d5a645;
  color: #2c2007;
  font-size: 12px;
  font-weight: 800;
}
.sidebar-profile strong, .sidebar-profile small { display: block; }
.sidebar-profile strong { font-size: 13px; }
.sidebar-profile small { color: var(--muted); margin-top: 3px; font-size: 11px; }

main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  min-height: 92px;
  padding: 24px clamp(22px, 4vw, 52px) 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 245, 244, 0.92);
  position: sticky;
  top: 0;
  z-index: 4;
  backdrop-filter: blur(12px);
}
.topbar h1 { margin: 4px 0 0; font-size: 26px; line-height: 1.1; letter-spacing: 0; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.agent-status { min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 17px; background: white; color: #46524b; font-size: 11px; font-weight: 700; }
.agent-status i { width: 7px; height: 7px; border-radius: 50%; background: #18a865; box-shadow: 0 0 0 4px #e1f7eb; }
.icon-button {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.bell-icon { display: block; margin: auto; width: 15px; height: 17px; border: 2px solid var(--ink); border-radius: 9px 9px 5px 5px; }
.bell-icon::after { content: ""; display: block; width: 5px; height: 2px; margin: 15px auto 0; border-radius: 2px; background: var(--ink); }
.notification-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border: 2px solid white; border-radius: 50%; background: #df3b30; }
.primary-button, .secondary-button, .text-button {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 700;
}
.primary-button { padding: 0 17px; border: 1px solid #166534; background: var(--green); color: white; }
.primary-button:hover { background: #115329; }
.topbar .primary-button { border-color: var(--ink); background: var(--ink); }
.topbar .primary-button:hover { background: #2b332f; }
.secondary-button { padding: 0 15px; border: 1px solid var(--line); background: white; color: var(--ink); }
.text-button { min-height: 34px; padding: 0; border: 0; background: transparent; color: var(--blue); }
.danger-button { color: var(--red); }

.page-content { padding: 24px clamp(22px, 4vw, 48px) 60px; max-width: 1420px; margin: 0 auto; }
.focus-strip { min-height: 112px; margin-bottom: 18px; padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-radius: 8px; background: #17251d; color: white; overflow: hidden; position: relative; }
.focus-strip::after { content: ""; position: absolute; width: 180px; height: 180px; right: 9%; top: -92px; border: 34px solid rgba(255,255,255,.055); border-radius: 50%; }
.focus-copy { position: relative; z-index: 1; }
.focus-copy span { display: block; margin-bottom: 7px; color: #a9c4b1; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.focus-copy h2 { margin: 0; font-size: 20px; letter-spacing: 0; }
.focus-copy p { margin: 7px 0 0; color: #b8c9bd; font-size: 12px; }
.focus-progress { position: relative; z-index: 1; min-width: 180px; }
.focus-progress div { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 10px; color: #c4d3c8; }
.focus-progress strong { color: white; }
.focus-progress-bar { height: 8px; overflow: hidden; border-radius: 4px; background: #33473a; }
.focus-progress-bar i { display: block; height: 100%; border-radius: 4px; background: #52d38c; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
.metric {
  min-height: 86px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: inline-block; margin-top: 8px; font-size: 22px; }
.metric small { margin-left: 7px; color: var(--green); font-size: 10px; font-weight: 700; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(260px, .65fr); gap: 18px; align-items: start; }
.section-heading { margin: 0 0 13px; display: flex; justify-content: space-between; align-items: end; }
.section-heading h2 { margin: 0; font-size: 17px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel { padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.activity-panel { border-top: 3px solid #d7a337; }
.portal-leads { margin-bottom: 22px; }
.lead-strip { display: grid; grid-template-columns: repeat(4, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.lead-item { min-width: 190px; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.lead-provider { color: var(--blue); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.lead-item h3 { min-height: 34px; margin: 7px 0 12px; overflow: hidden; font-size: 12px; line-height: 1.4; }
.lead-item button { width: 100%; font-size: 10px; }

.job-list { display: grid; gap: 10px; }
.job-card {
  padding: 17px;
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  transition: border-color .15s, transform .15s;
}
.job-card:hover { border-color: #aebcaf; transform: translateY(-1px); box-shadow: var(--shadow); }
.company-logo {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: white;
  font-weight: 800;
  font-size: 14px;
}
.job-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-title { margin: 0; font-size: 15px; }
.job-company { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.job-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; color: #526057; font-size: 11px; }
.badge { display: inline-flex; min-height: 21px; padding: 2px 7px; align-items: center; border-radius: 4px; background: var(--surface-alt); color: #536158; font-size: 10px; font-weight: 700; }
.badge.new { color: var(--blue); background: var(--blue-soft); }
.score-block { min-width: 68px; padding: 7px 9px; align-self: start; border-radius: 6px; background: var(--green-soft); text-align: center; }
.score { font-size: 18px; font-weight: 850; color: var(--green); }
.score-label { color: var(--muted); font-size: 10px; }
.job-actions { grid-column: 2 / -1; display: flex; gap: 8px; padding-top: 5px; }
.job-actions button { min-height: 35px; }

.activity-list { display: grid; }
.activity-item { position: relative; padding: 2px 0 18px 27px; }
.activity-item:not(:last-child)::before { content: ""; position: absolute; top: 13px; bottom: 0; left: 7px; border-left: 1px solid var(--line); }
.activity-dot { position: absolute; top: 4px; left: 0; width: 15px; height: 15px; border: 4px solid white; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px #a7b4a9; }
.activity-item p { margin: 0; font-size: 12px; line-height: 1.45; }
.activity-item time { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.quota-bar { height: 7px; margin: 10px 0 7px; overflow: hidden; border-radius: 3px; background: var(--surface-alt); }
.quota-bar span { display: block; width: 32%; height: 100%; background: #d5a645; }

.pipeline { overflow-x: auto; padding-bottom: 10px; }
.pipeline-grid { min-width: 860px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pipeline-column { min-height: 430px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #eef1ef; }
.pipeline-header { margin-bottom: 12px; display: flex; justify-content: space-between; font-size: 12px; font-weight: 750; }
.pipeline-card { margin-bottom: 9px; padding: 13px; border: 1px solid #d8ded8; border-radius: 6px; background: white; }
.pipeline-card h3 { margin: 0; font-size: 13px; }
.pipeline-card p { margin: 5px 0 9px; color: var(--muted); font-size: 11px; }
.pipeline-card footer { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; }

.outreach-table { width: 100%; border-collapse: collapse; }
.outreach-table th, .outreach-table td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
.outreach-table th { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.contact-cell strong, .contact-cell span { display: block; }
.contact-cell span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.status { display: inline-block; padding: 4px 7px; border-radius: 4px; font-size: 10px; font-weight: 750; }
.status.due { background: var(--amber-soft); color: var(--amber); }
.status.draft { background: var(--blue-soft); color: var(--blue); }
.status.sent { background: var(--green-soft); color: var(--green); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-section h2 { margin: 0 0 16px; font-size: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 15px; }
.field label { font-size: 11px; font-weight: 700; }
.field small { color: var(--muted); font-size: 10px; }
.field input, .field select { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); }
.field textarea { width: 100%; padding: 10px 11px; resize: vertical; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); line-height: 1.45; }
.toggle-row { min-height: 51px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 12px; }
.switch { width: 40px; height: 22px; padding: 3px; border: 0; border-radius: 11px; background: #aeb8b0; }
.switch::before { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; transition: transform .15s; }
.switch.on { background: var(--green); }
.switch.on::before { transform: translateX(18px); }

.empty-state { padding: 50px 20px; text-align: center; border: 1px dashed #bdc7be; border-radius: 7px; }
.empty-state h2 { margin: 0; font-size: 17px; }
.empty-state p { max-width: 420px; margin: 8px auto 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }

dialog { width: min(560px, calc(100vw - 28px)); max-height: 88vh; padding: 0; border: 0; border-radius: 8px; color: var(--ink); box-shadow: 0 24px 80px rgba(18, 31, 22, .25); }
dialog::backdrop { background: rgba(13, 23, 16, .5); backdrop-filter: blur(3px); }
.dialog-content { padding: 22px; }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; }
.dialog-header h2 { margin: 0; font-size: 19px; }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 20px; }
.match-reasons { margin: 20px 0; padding: 14px; background: var(--surface-alt); border-radius: 6px; }
.match-reasons h3 { margin: 0 0 8px; font-size: 12px; }
.match-reasons ul { margin: 0; padding-left: 18px; color: #465149; font-size: 12px; line-height: 1.7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 20; display: grid; gap: 8px; }
.toast { width: min(340px, calc(100vw - 32px)); padding: 13px 15px; border-radius: 6px; background: #17271c; color: white; font-size: 12px; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.mobile-nav { display: none; }

@media (max-width: 980px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .activity-panel { order: 2; }
}

@media (max-width: 720px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  main { margin-left: 0; }
  .topbar { min-height: 80px; padding: 13px 14px 11px; }
  .topbar h1 { font-size: 22px; }
  .eyebrow { font-size: 10px; }
  .page-content { padding: 14px 12px 28px; }
  .agent-status { display: none; }
  .focus-strip { min-height: 132px; padding: 17px; display: block; }
  .focus-copy h2 { font-size: 18px; }
  .focus-progress { min-width: 0; margin-top: 18px; }
  .lead-strip { grid-template-columns: repeat(4, 230px); }
  .primary-button { padding: 0 12px; font-size: 12px; }
  .summary-grid { gap: 8px; margin-bottom: 19px; }
  .metric { min-height: 76px; padding: 11px; }
  .metric strong { margin-top: 6px; font-size: 21px; }
  .metric small { display: none; }
  .job-card { grid-template-columns: 40px minmax(0, 1fr) auto; padding: 13px; gap: 11px; }
  .company-logo { width: 40px; height: 40px; }
  .job-actions { grid-column: 1 / -1; }
  .job-actions button { flex: 1; }
  .score-block { min-width: 45px; }
  .score { font-size: 17px; }
  .panel { padding: 14px; }
  .settings-grid { grid-template-columns: 1fr; }
  .outreach-wrap { overflow-x: auto; }
  .outreach-table { min-width: 650px; }
  .mobile-nav {
    position: fixed;
    inset: auto 0 0 0;
    height: calc(62px + env(safe-area-inset-bottom));
    padding: 5px 7px env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
    z-index: 10;
  }
  .mobile-nav .nav-button { min-height: 50px; padding: 4px; display: grid; justify-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: 9px; text-align: center; }
  .mobile-nav .nav-button.active { background: var(--green-soft); color: var(--green); }
  .mobile-nav .nav-glyph { font-size: 16px; }
  .mobile-nav .nav-count { display: none; }
  .toast-region { left: 16px; right: 16px; bottom: 80px; }
}
