:root {
  --ink: #172328;
  --muted: #65747a;
  --paper: #f5f2ea;
  --card: #fffdf8;
  --line: #dcd8cd;
  --blue: #1d5a63;
  --blue-soft: #e4eff0;
  --orange: #c15b32;
  --orange-soft: #f7e7dc;
  --green: #2e6b51;
  --green-soft: #e5f1e9;
  --violet: #6f67b1;
  --violet-soft: #efedfb;
  --red: #9e3f3f;
  --red-soft: #f5e2df;
  --shadow: 0 18px 45px rgba(41, 50, 48, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 0%, rgba(193, 91, 50, .11), transparent 28rem),
    radial-gradient(circle at 100% 20%, rgba(29, 90, 99, .09), transparent 34rem),
    var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding: 52px 0 30px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--orange);
  font: 700 .72rem/1.2 ui-monospace, "Cascadia Code", monospace;
  letter-spacing: .18em;
}

h1 { margin: 0; font: 800 clamp(2rem, 5vw, 4rem)/1 "Microsoft YaHei", sans-serif; letter-spacing: -.055em; }
.subtitle { margin: 16px 0 0; color: var(--muted); font-size: 1rem; }

.live-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, .7);
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}

.live-pill span { width: 8px; height: 8px; border-radius: 50%; background: #d19530; box-shadow: 0 0 0 4px rgba(209, 149, 48, .13); }
.live-pill.is-online span { background: #3a8b69; box-shadow: 0 0 0 4px rgba(58, 139, 105, .13); }
.live-pill.is-error span { background: var(--red); }

.commute-settings { margin: 28px 0; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 253, 248, .94); box-shadow: var(--shadow); }
.settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; cursor: pointer; list-style: none; }
.settings-heading::-webkit-details-marker { display: none; }
.settings-heading:focus { outline: 0; }
.settings-heading:focus-visible { border-radius: 12px; box-shadow: 0 0 0 3px rgba(29, 90, 99, .13); }
.settings-heading > div { min-width: 0; flex: 1; }
.settings-heading::after { flex: 0 0 auto; margin-top: 7px; color: var(--muted); content: "展开设置 +"; font-size: .72rem; font-weight: 700; }
.commute-settings[open] .settings-heading::after { content: "收起设置 −"; }
.section-kicker { margin: 0 0 6px; color: var(--blue); font: 700 .66rem/1.2 ui-monospace, "Cascadia Code", monospace; letter-spacing: .14em; }
.settings-heading h2 { margin: 0; font-size: 1.28rem; }
.settings-heading p:not(.section-kicker) { margin: 7px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.6; }
.map-status { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; background: #f7edcf; color: #8b5e13; font-size: .72rem; font-weight: 750; }
.map-status.is-ready { background: var(--green-soft); color: var(--green); }
.settings-body { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.settings-help { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.6; }
.settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.settings-form label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: .7rem; }
.settings-form input, .destination-editor input { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: white; color: var(--ink); }
.settings-form input:focus, .destination-editor input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29, 90, 99, .1); }
.settings-actions { display: flex; grid-column: 1 / -1; align-items: center; gap: 9px; }
.settings-actions button, .calculate-commute { padding: 9px 13px; border: 1px solid var(--blue); border-radius: 10px; background: var(--blue); color: white; cursor: pointer; font-size: .78rem; font-weight: 750; }
.settings-actions .secondary-button { background: transparent; color: var(--blue); }
.settings-actions button:disabled, .calculate-commute:disabled { cursor: not-allowed; opacity: .48; }
.settings-notice { min-height: 1.3em; margin: 11px 0 0; color: var(--green); font-size: .76rem; }
.settings-notice.is-error { color: var(--red); }

.toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 28px 0 20px; }
.filter-panel { display: grid; min-width: 0; gap: 8px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-label { width: 4.8rem; color: var(--muted); font-size: .72rem; font-weight: 750; }
.filter, .card-actions button { border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 253, 248, .7); cursor: pointer; transition: .18s ease; }
.filter { padding: 9px 14px; font-size: .86rem; }
.filter:hover, .card-actions button:hover { border-color: var(--blue); transform: translateY(-1px); }
.filter.is-active { border-color: var(--blue); background: var(--blue); color: white; }

.search { display: flex; min-width: 290px; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.search:focus-within { outline: 3px solid rgba(29, 90, 99, .12); border-color: var(--blue); }
.search input { width: 100%; padding: 11px 0; border: 0; outline: 0; background: transparent; }
kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: .7rem; }

.unread-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -4px 0 22px;
  padding: 10px 13px;
  border: 1px solid rgba(193, 91, 50, .28);
  border-radius: 12px;
  background: rgba(247, 231, 220, .72);
  color: #7b3c24;
  font-size: .78rem;
  line-height: 1.55;
}
.unread-summary button {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(193, 91, 50, .42);
  border-radius: 999px;
  background: var(--card);
  color: var(--orange);
  cursor: pointer;
  font-size: .72rem;
  font-weight: 750;
}
.unread-summary button:disabled { cursor: wait; opacity: .55; }

.timeline { display: grid; gap: 30px; }
.day-group { display: grid; gap: 14px; }
.day-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 2px 10px; border-bottom: 1px solid var(--line); cursor: pointer; list-style: none; }
.day-heading::-webkit-details-marker { display: none; }
.day-heading::after { margin-left: 4px; color: var(--blue); content: "+"; font-size: 1.1rem; font-weight: 800; }
.day-group[open] > .day-heading::after { content: "−"; }
.day-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.day-date { color: var(--ink); font-size: 1.08rem; font-weight: 800; }
.day-count { color: var(--muted); font-size: .76rem; }
.day-new-count { padding: 5px 9px; border-radius: 999px; background: var(--orange); color: white; font-size: .7rem; font-weight: 800; box-shadow: 0 5px 14px rgba(193, 91, 50, .2); }
.day-content { display: grid; gap: 14px; padding-top: 14px; }
.day-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.lead-card { position: relative; padding: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 253, 248, .96); box-shadow: var(--shadow); }
.lead-card.quality-promising { border-color: #c7dbc9; background: linear-gradient(145deg, #fbfdf8 0%, #edf6ec 100%); }
.lead-card.quality-great { border-color: #a9cfb3; background: linear-gradient(145deg, #f7fcf5 0%, #dff1e3 100%); box-shadow: 0 20px 48px rgba(46, 107, 81, .13); }
.lead-card::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue); content: ""; }
.lead-card.quality-promising::before { background: #6e9f78; }
.lead-card.quality-great::before { width: 5px; background: var(--green); }
.lead-card.is-considering { border-color: var(--violet); outline: 2px solid rgba(111, 103, 177, .16); outline-offset: -2px; }
.lead-card.is-considering::before { width: 5px; background: var(--violet); }
.lead-card.is-rejected { border-color: #d6b7b3; background: linear-gradient(145deg, #fcf8f6 0%, #f4e1de 100%); opacity: .82; }
.lead-card.is-rejected::before { background: var(--red); }
.lead-card[data-status="closed"] { opacity: .68; }
.lead-card[data-status="closed"]::before { background: #8a9494; }
.lead-card[data-eligibility="mismatch"]::before { background: var(--red); }

.card-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.title-block { min-width: 0; flex: 1; }
.badges { display: flex; max-width: 48%; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.status-active { color: var(--green); background: var(--green-soft); }
.eligibility-review { color: #8b5e13; background: #f7edcf; }
.status-nonstandard { color: var(--orange); background: var(--orange-soft); }
.status-closed { color: #667174; background: #e8ebea; }
.info-complete { color: var(--green); background: var(--green-soft); }
.info-review { color: #8b5e13; background: #f7edcf; }
.decision-undecided { color: var(--muted); background: #eeece6; }
.decision-considering { color: var(--violet); background: var(--violet-soft); }
.decision-rejected { color: var(--red); background: var(--red-soft); }
.new-badge { color: white; background: var(--orange); }
.eligibility-eligible { color: var(--blue); background: var(--blue-soft); }
.eligibility-mismatch { color: var(--red); background: var(--red-soft); }
.lead-code { display: inline-flex; align-items: center; min-height: 25px; color: var(--muted); font: 600 .72rem/1.2 ui-monospace, "Cascadia Code", monospace; }
.lead-title { margin: 0; font-size: clamp(1.35rem, 2.2vw, 1.72rem); line-height: 1.25; letter-spacing: -.025em; }
.location-line { display: flex; align-items: baseline; gap: 8px; margin: 9px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.location-line span { flex: 0 0 auto; font-size: .7rem; }
.location-line strong { color: var(--blue); font-size: .9rem; }

.highlight-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.05fr) minmax(0, .85fr); gap: 1px; margin-top: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
.highlight-row > div { display: flex; min-height: 82px; flex-direction: column; justify-content: center; padding: 14px 16px; background: #faf8f2; }
.highlight-row span, .info-label { color: var(--muted); font-size: .7rem; letter-spacing: .02em; }
.pay-block strong { margin-top: 6px; color: var(--orange); font: 800 1.42rem/1.2 ui-monospace, "Cascadia Code", monospace; }
.pay-block small { margin-top: 6px; color: var(--muted); font-size: .68rem; line-height: 1.45; }
.effective-pay-block { background: #f2f7f5 !important; }
.effective-pay-block strong { margin-top: 6px; color: var(--muted); font: 800 .94rem/1.35 ui-monospace, "Cascadia Code", monospace; }
.effective-pay-block small { margin-top: 5px; color: var(--muted); font-size: .7rem; }
.effective-pay-block.is-ready strong { color: var(--green); font-size: 1.04rem; }
.lesson-meta strong { margin-top: 7px; font-size: .92rem; line-height: 1.4; }

.info-block { margin-top: 17px; }
.info-block p { margin: 6px 0 0; font-size: .9rem; line-height: 1.7; white-space: pre-wrap; }
.schedule-block p { font-weight: 650; }
.situation-block { padding: 13px 14px; border-left: 3px solid var(--blue); background: var(--blue-soft); }
.situation-block p { color: #284f55; }

.commute-block { margin-top: 18px; padding: 15px; border: 1px solid #ccdadd; border-radius: 15px; background: #f4f9f8; }
.commute-block.is-online { border-color: #b9d9c8; background: var(--green-soft); }
.commute-block.is-online .distance-filter-note { border-left-color: var(--green); background: rgba(255, 255, 255, .58); color: var(--green); }
.commute-summary-bar { display: grid; grid-template-columns: auto minmax(150px, 1fr) auto auto; align-items: center; gap: 10px 14px; cursor: pointer; list-style: none; }
.commute-summary-bar::-webkit-details-marker { display: none; }
.commute-summary-title { display: grid; gap: 4px; }
.commute-compact { color: #36575b; font-size: .78rem; line-height: 1.45; }
.commute-toggle { color: var(--blue); font-size: .7rem; font-weight: 750; white-space: nowrap; }
.commute-toggle::after { content: " +"; }
.commute-block[open] .commute-toggle::after { content: " −"; }
.commute-body { margin-top: 13px; padding-top: 12px; border-top: 1px solid #d6e1df; }
.commute-actions { display: flex; justify-content: flex-end; }
.commute-state { color: var(--blue); font-size: .86rem; }
.commute-state[data-state="error"], .commute-state[data-state="unconfigured"] { color: var(--red); }
.commute-state[data-state="stale"] { color: #8b5e13; }
.calculate-commute { flex: 0 0 auto; padding: 7px 10px; font-size: .72rem; }
.destination-editor { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; margin-top: 10px; color: var(--muted); font-size: .7rem; }
.destination-editor input { padding: 8px 9px; font-size: .78rem; }
.resolved-destination, .commute-reference { margin: 9px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.55; }
.distance-filter-note { margin: 9px 0 0; padding: 8px 9px; border-left: 2px solid #c08a2e; background: #fbf2db; color: #765416; font-size: .72rem; line-height: 1.55; }
.resolved-destination.is-approximate { padding-left: 8px; border-left: 2px solid #c08a2e; color: #765416; }
.commute-error { margin-top: 10px; padding: 9px 10px; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: .75rem; line-height: 1.5; }
.commute-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 12px; overflow: hidden; border: 1px solid #d6e1df; border-radius: 11px; background: #d6e1df; }
.commute-results[hidden] { display: none; }
.commute-leg { min-width: 0; padding: 11px; background: white; }
.commute-leg > strong { color: var(--blue); font-size: .75rem; }
.commute-leg p { margin: 6px 0 0; overflow-wrap: anywhere; color: #42565a; font-size: .72rem; line-height: 1.55; }
.commute-leg p.is-expensive { color: var(--red); font-weight: 750; }
.commute-leg p.is-good { color: var(--green); font-weight: 800; }
.commute-leg p.is-warning { color: #8b5e13; font-weight: 750; }
.commute-summary { display: grid; grid-column: 1 / -1; gap: 5px; padding: 11px; background: #e8f1ef; }
.commute-summary span { color: var(--muted); font-size: .68rem; }
.commute-summary strong { color: #294d50; font-size: .76rem; line-height: 1.5; }

.commute-highlights { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; }
.commute-highlights span { padding: 5px 8px; border-radius: 999px; font-size: .7rem; font-weight: 800; }
.commute-highlights span[data-tone="good"] { color: var(--green); background: var(--green-soft); }
.commute-highlights span[data-tone="warning"] { color: #8b5e13; background: #f7edcf; }
.commute-highlights span[data-tone="bad"] { color: var(--red); background: var(--red-soft); }

.fold-section { margin-top: 24px; overflow: hidden; border: 1px solid #cfc9bc; border-radius: 18px; background: rgba(255, 253, 248, .78); }
.day-content > .fold-section { margin-top: 0; }
.fold-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; cursor: pointer; list-style: none; }
.fold-section > summary::-webkit-details-marker { display: none; }
.fold-section > summary span:first-child { display: grid; gap: 4px; }
.fold-section > summary strong { font-size: .95rem; }
.fold-section > summary small { color: var(--muted); font-size: .7rem; font-weight: 400; }
.fold-count { padding: 5px 9px; border-radius: 999px; background: #ece9e1; color: var(--muted); font-size: .72rem; font-weight: 750; }
.fold-section[open] > summary { border-bottom: 1px solid var(--line); }
.mismatch-section { border-color: #dfc4c0; background: rgba(252, 244, 242, .82); }
.mismatch-section > summary strong { color: var(--red); }
.rejected-section { border-color: #dbc6c3; background: rgba(249, 239, 237, .7); }
.rejected-section > summary strong { color: var(--red); }
.fold-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; }
.fold-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.fold-card.quality-promising { border-color: #c7dbc9; background: #f0f7ee; }
.fold-card.quality-great { border-color: #a9cfb3; background: #e2f2e5; }
.fold-card.is-considering { border-color: var(--violet); box-shadow: inset 4px 0 0 var(--violet); }
.fold-card.is-rejected { border-color: #d6b7b3; background: #f4e1de; opacity: .88; }
.fold-card[data-kind="mismatch"] { border-left: 3px solid var(--red); }
.fold-card[data-kind="rejected"] { border-left: 3px solid #9e6c68; opacity: .9; }
.fold-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.fold-card .lead-title { font-size: 1.05rem; }
.fold-card .lead-pay { flex: 0 0 auto; color: var(--orange); font: 800 .88rem/1.4 ui-monospace, "Cascadia Code", monospace; }
.fold-address { margin: 5px 0 0; color: var(--blue); font-size: .74rem; }
.fold-reason { margin: 11px 0 0; color: #765416; font-size: .74rem; line-height: 1.55; }
.fold-card[data-kind="mismatch"] .fold-reason { color: var(--red); }
.fold-commute-summary, .fold-effective-pay { margin: 10px 0 0; padding: 8px 9px; border-radius: 8px; background: var(--blue-soft); color: #294d50; font-size: .72rem; line-height: 1.55; }
.fold-effective-pay { background: var(--green-soft); color: var(--green); font-weight: 750; }
.fold-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.fold-actions .lead-details-bar { min-width: 0; flex: 1; margin-top: 0; padding-top: 0; border-top: 0; }
.fold-actions .calculate-commute { flex: 0 0 auto; }

.condition-list { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); margin: 18px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.condition-list div { min-width: 0; padding: 12px 14px; }
.condition-list div + div { border-left: 1px solid var(--line); }
.condition-list dt { margin-bottom: 5px; color: var(--muted); font-size: .7rem; }
.condition-list dd { margin: 0; font-size: .84rem; line-height: 1.6; white-space: pre-wrap; }

.notice-list { margin-top: 14px; padding: 11px 14px; border-left: 3px solid #c08a2e; background: #f7edcf; color: #765416; font-size: .82rem; line-height: 1.55; }
.notice-list.is-mismatch { border-left-color: var(--red); background: var(--red-soft); color: #743333; }
.notice-list.is-review { border-left-color: #c08a2e; }
.notice-list p { margin: 3px 0; }

.lead-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.lead-tags span { padding: 6px 10px; border: 1px solid #cdd4d1; border-radius: 999px; background: #f0f3ef; color: #3f5357; font-size: .76rem; font-weight: 750; }
.lead-tags span[data-tone="good"] { border-color: #c6ddcf; background: var(--green-soft); color: var(--green); font-weight: 800; }
.lead-tags span[data-tone="warning"] { border-color: #ead9a7; background: #f7edcf; color: #8b5e13; }
.lead-tags span[data-tone="bad"] { border-color: #e3c2bd; background: var(--red-soft); color: var(--red); font-weight: 800; }
.priority-tags { margin-top: 14px; }
.priority-tags span { box-shadow: 0 3px 10px rgba(42, 59, 57, .045); }
.fold-tags { margin-top: 9px; }
.fold-tags span { padding: 4px 8px; font-size: .68rem; }

.decision-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.decision-actions > span { margin-right: 2px; color: var(--muted); font-size: .7rem; }
.decision-actions button { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: #faf8f2; color: var(--muted); cursor: pointer; font-size: .74rem; font-weight: 750; transition: .18s ease; }
.decision-actions button:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }
.decision-actions button[data-decision="considering"].is-active { border-color: var(--violet); background: var(--violet); color: white; }
.decision-actions button[data-decision="rejected"].is-active { border-color: var(--red); background: var(--red); color: white; }
.decision-actions button:disabled { cursor: wait; opacity: .55; }

.status-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 9px; }
.status-actions > span { color: var(--muted); font-size: .7rem; }
.status-actions button { padding: 6px 10px; border: 1px solid #c8c5bc; border-radius: 999px; background: rgba(255, 253, 248, .7); color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 750; transition: .18s ease; }
.status-actions button:hover { border-color: var(--blue); color: var(--blue); }
.status-actions button[data-next-status="active"] { border-color: #a9cfb3; background: var(--green-soft); color: var(--green); }
.status-actions button:disabled { cursor: wait; opacity: .55; }
.action-error { margin: 9px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: .72rem; line-height: 1.5; }

.lead-details-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.detail-buttons { display: flex; flex: 0 0 auto; align-items: center; gap: 11px; }
.view-details, .edit-lead { flex: 0 0 auto; padding: 4px 0; border: 0; background: transparent; color: var(--blue); cursor: pointer; font-size: .76rem; font-weight: 800; }
.edit-lead { color: var(--violet); }
.view-details:hover, .edit-lead:hover { color: var(--orange); }
.fold-details-bar { margin-top: 0; }

.lead-detail-dialog { width: min(700px, calc(100% - 32px)); max-height: min(86vh, 820px); padding: 0; overflow: visible; border: 0; border-radius: 20px; outline: 0; background: transparent; box-shadow: 0 28px 80px rgba(19, 30, 32, .25); }
.lead-detail-dialog::backdrop { background: rgba(23, 35, 40, .52); backdrop-filter: blur(3px); }
.detail-card { max-height: min(86vh, 820px); padding: 24px; overflow: auto; border: 1px solid rgba(255, 255, 255, .55); border-radius: 20px; background: var(--card); }
.detail-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.detail-card-header h2 { margin: 0; font-size: 1.45rem; line-height: 1.35; }
.detail-close { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #f2f1ec; color: var(--muted); cursor: pointer; font-size: 1.4rem; line-height: 1; }
.detail-close:hover { border-color: var(--blue); color: var(--blue); }
.detail-dialog-address { margin: 10px 0 16px; color: var(--blue); font-size: .82rem; font-weight: 700; }
.detail-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.detail-meta div { min-width: 0; padding: 10px 11px; background: #faf8f2; }
.detail-meta dt { color: var(--muted); font-size: .68rem; }
.detail-meta dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: .76rem; line-height: 1.5; }
.raw-block { margin-top: 14px; }
pre { max-height: 320px; margin: 7px 0 0; padding: 14px; overflow: auto; border-radius: 10px; background: #1f2a2d; color: #edf2ef; font: .78rem/1.65 ui-monospace, "Cascadia Code", monospace; white-space: pre-wrap; word-break: break-word; }
.card-actions { display: flex; align-items: center; justify-content: flex-start; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-actions button { padding: 7px 11px; font-size: .76rem; }
.manual-badge { background: var(--violet-soft); color: var(--violet); }
.lead-edit-dialog { width: min(760px, calc(100% - 32px)); }
.edit-help { margin: 7px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.55; }
.edit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 19px; }
.edit-fields label { display: grid; gap: 6px; color: var(--muted); font-size: .72rem; }
.edit-fields input, .edit-fields textarea, .edit-fields select { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: white; color: var(--ink); resize: vertical; }
.edit-fields input:focus, .edit-fields textarea:focus, .edit-fields select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(111, 103, 177, .12); }
.edit-wide { grid-column: 1 / -1; }
.edit-actions { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 9px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.edit-actions button { padding: 8px 12px; border: 1px solid var(--blue); border-radius: 9px; background: var(--blue); color: white; cursor: pointer; font-size: .76rem; font-weight: 750; }
.edit-actions .secondary-button { border-color: var(--line); background: transparent; color: var(--muted); }
.edit-actions button:disabled { cursor: wait; opacity: .55; }

.empty { padding: 72px 20px; border: 1px dashed #b9b5aa; border-radius: 20px; text-align: center; }
.empty-mark { color: var(--orange); font-size: 3rem; }
.empty h2 { margin: 10px 0 7px; }
.empty p { margin: 0; color: var(--muted); }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 32px 0 42px; color: var(--muted); font-size: .75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 780px) {
  .page-shell { width: min(100% - 24px, 1180px); }
  .masthead { padding-top: 30px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .filter-label { width: 100%; }
  .search { min-width: 0; }
  .unread-summary { align-items: flex-start; }
  .day-card-grid { grid-template-columns: 1fr; }
  .fold-card-grid { grid-template-columns: 1fr; }
  .edit-fields { grid-template-columns: 1fr; }
  .edit-wide { grid-column: auto; }
  .edit-actions { grid-template-columns: 1fr 1fr; }
  .edit-actions > span { display: none; }
  .badges { max-width: none; justify-content: flex-start; }
  .card-topline { flex-direction: column; }
}

@media (max-width: 480px) {
  .masthead { flex-direction: column; }
  .stats article { min-height: 92px; }
  .day-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .settings-heading { flex-direction: column; }
  .settings-form, .highlight-row, .condition-list, .detail-meta, .commute-results { grid-template-columns: 1fr; }
  .condition-list div + div { border-top: 1px solid var(--line); border-left: 0; }
  .lead-card { padding: 20px; }
  .fold-actions { align-items: stretch; flex-direction: column; }
  .fold-details-bar { width: 100%; }
  .detail-card { padding: 18px; }
  footer { flex-direction: column; }
}

/* Workbench UI redesign */
:root {
  --ink: #172033;
  --muted: #6b7280;
  --paper: #f6f7f9;
  --card: #ffffff;
  --line: #e4e7ec;
  --blue: #3156d3;
  --blue-soft: #eef2ff;
  --orange: #b9682f;
  --orange-soft: #fff4e8;
  --green: #247553;
  --green-soft: #eaf7f0;
  --violet: #6857c7;
  --violet-soft: #f1efff;
  --red: #a84343;
  --red-soft: #fbebeb;
  --shadow: 0 10px 28px rgba(23, 32, 51, .06);
}

body {
  background: var(--paper);
  color: var(--ink);
}

.page-shell { width: min(1240px, calc(100% - 40px)); }

.masthead {
  position: sticky;
  z-index: 20;
  top: 0;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 249, .92);
  backdrop-filter: blur(18px);
}

.eyebrow { display: none; }
h1 { font-size: 1.18rem; line-height: 1.2; letter-spacing: -.02em; }
.subtitle { margin-top: 4px; font-size: .76rem; }
.live-pill { padding: 7px 10px; background: white; box-shadow: 0 1px 2px rgba(23,32,51,.04); }

.commute-settings {
  margin: 16px 0;
  padding: 0;
  border-radius: 14px;
  background: white;
  box-shadow: none;
}
.settings-heading { padding: 14px 16px; align-items: center; }
.settings-heading .section-kicker { display: none; }
.settings-heading h2 { font-size: .92rem; }
.settings-heading p:not(.section-kicker) { margin-top: 4px; font-size: .72rem; }
.settings-heading::after { margin-top: 0; }
.map-status { padding: 5px 8px; font-size: .68rem; }
.settings-body { margin: 0; padding: 16px; background: #fbfcfe; border-radius: 0 0 14px 14px; }

.toolbar {
  position: sticky;
  z-index: 15;
  top: 66px;
  margin: 14px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 24px rgba(23,32,51,.05);
  backdrop-filter: blur(16px);
}
.filter-panel { gap: 6px; }
.filter-row { gap: 6px; }
.filter-label { width: 4.6rem; font-size: .68rem; }
.filter { padding: 7px 11px; border-radius: 9px; background: #fff; font-size: .76rem; }
.filter:hover { transform: none; background: #f8f9fb; }
.filter.is-active { background: var(--blue-soft); border-color: #cfd8ff; color: var(--blue); }
.search { min-width: 260px; border-radius: 10px; background: #f8f9fb; }
.search input { padding: 9px 0; font-size: .82rem; }

.unread-summary {
  margin: 0 0 18px;
  border-color: #f0d6b7;
  background: #fff8ef;
  color: #87542d;
}

.timeline { gap: 22px; }
.day-heading { padding: 0 2px 8px; }
.day-date { font-size: .96rem; }
.day-card-grid { gap: 12px; }

.lead-card {
  padding: 18px;
  border-radius: 14px;
  background: white;
  box-shadow: 0 4px 14px rgba(23,32,51,.045);
}
.lead-card.quality-promising,
.lead-card.quality-great { background: white; box-shadow: 0 4px 14px rgba(23,32,51,.045); }
.lead-card.quality-promising { border-color: #cfe5d8; }
.lead-card.quality-great { border-color: #afd5bd; }
.lead-card::before { width: 3px; }
.lead-card.quality-great::before { width: 4px; }
.lead-card.is-rejected { background: #fafafa; }
.lead-title { font-size: 1.1rem; }
.location-line { margin-top: 6px; font-size: .76rem; }
.location-line strong { font-size: .8rem; }

.badges { gap: 5px; }
.badge, .lead-code { min-height: 22px; padding: 3px 7px; font-size: .66rem; }

.lead-tags { margin-top: 10px; gap: 5px; }
.lead-tags span { padding: 4px 7px; box-shadow: none; font-size: .68rem; }

.highlight-row {
  grid-template-columns: 1fr 1.15fr .85fr;
  margin-top: 14px;
  border-radius: 10px;
  background: #edf0f4;
}
.highlight-row > div { min-height: 68px; padding: 10px 12px; background: #fbfcfd; }
.pay-block strong { font-size: 1.12rem; color: var(--ink); }
.effective-pay-block { background: #f7faf8 !important; }
.effective-pay-block.is-ready strong { color: var(--green); font-size: .9rem; }
.lesson-meta strong { font-size: .82rem; }

.info-block { margin-top: 13px; }
.info-block p { margin-top: 4px; font-size: .82rem; line-height: 1.55; }
.schedule-block p { font-weight: 600; }

.commute-block {
  margin-top: 13px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #f8fafc;
}
.commute-compact { font-size: .72rem; }
.commute-state { font-size: .76rem; }

.condition-list {
  margin-top: 13px;
  border-radius: 9px;
}
.condition-list div { padding: 9px 11px; }
.condition-list dd { font-size: .76rem; }

.decision-actions { margin-top: 12px; }
.decision-actions button,
.status-actions button { border-radius: 8px; background: white; }

.lead-details-bar { margin-top: 13px; padding-top: 11px; }

.fold-section {
  border-radius: 12px;
  background: white;
}
.fold-card { border-radius: 10px; background: white; }

.lead-detail-dialog,
.detail-card { border-radius: 14px; }
.detail-card { background: white; }

footer { padding-top: 24px; }

@media (max-width: 780px) {
  .page-shell { width: min(100% - 20px, 1240px); }
  .masthead { top: 0; }
  .toolbar { top: 62px; }
}

@media (max-width: 480px) {
  .masthead { flex-direction: row; gap: 12px; }
  .subtitle { display: none; }
  .live-pill strong { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
  .toolbar { top: 58px; }
  .highlight-row { grid-template-columns: 1fr; }
}

/* Quick origin control */
.header-actions { display: flex; align-items: center; gap: 8px; }
.quick-origin-button {
  display: inline-flex;
  max-width: 320px;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(23,32,51,.04);
}
.quick-origin-button:hover { border-color: #cbd3e7; background: #f9fafc; }
.quick-origin-button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.origin-dialog { width: min(520px, calc(100% - 32px)); }
.origin-fields { display: grid; gap: 14px; margin-top: 18px; }
.origin-fields > label:first-child { display: grid; gap: 6px; color: var(--muted); font-size: .72rem; }
.origin-fields input[type="text"],
.origin-fields input:not([type]) {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
}
#quick-origin-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49,86,211,.1); }
.origin-sync { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .74rem; }
.origin-sync input { width: auto; }
.origin-actions { grid-template-columns: 1fr auto auto; }
.origin-actions > span:first-child { display: none; }

@media (max-width: 640px) {
  .header-actions { gap: 6px; }
  .quick-origin-button { max-width: 46vw; }
  .live-pill { display: none; }
}

/* Manual import */
.primary-header-button {
  padding: 8px 12px;
  border: 1px solid var(--blue);
  border-radius: 9px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  font-size: .76rem;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(49,86,211,.14);
}
.primary-header-button:hover { filter: brightness(.97); }
.manual-import-dialog { width: min(720px, calc(100% - 32px)); }
.manual-import-fields { display: grid; gap: 12px; margin-top: 18px; }
.manual-import-fields label { display: grid; gap: 6px; color: var(--muted); font-size: .72rem; }
.manual-import-fields textarea,
.manual-import-fields input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}
.manual-import-fields textarea:focus,
.manual-import-fields input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49,86,211,.1);
}
.manual-import-result {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.manual-preview-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
}
.manual-preview-card h3 { margin: 0 0 10px; font-size: .85rem; }
.manual-preview-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 8px;
}
.manual-preview-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: white;
}
.manual-preview-grid span { color: var(--muted); font-size: .66rem; }
.manual-preview-grid strong { overflow-wrap: anywhere; font-size: .76rem; line-height: 1.45; }
.manual-preview-note {
  margin: 9px 0 0;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--orange-soft);
  color: #81502e;
  font-size: .72rem;
  line-height: 1.5;
}
.manual-preview-note.is-warning { background: var(--red-soft); color: var(--red); }
.manual-import-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.manual-import-actions button {
  padding: 8px 11px;
  border: 1px solid var(--blue);
  border-radius: 9px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 750;
}
.manual-import-actions .secondary-button {
  border-color: var(--line);
  background: white;
  color: var(--muted);
}
.manual-import-actions button:disabled { cursor: not-allowed; opacity: .5; }

@media (max-width: 640px) {
  .primary-header-button { padding-inline: 9px; }
  .manual-preview-grid { grid-template-columns: 1fr 1fr; }
  .manual-import-actions { grid-template-columns: 1fr 1fr; }
  .manual-import-actions > span { display: none; }
}

/* AI parser */
.ai-settings .settings-heading h2 { display: flex; align-items: center; gap: 8px; }
.ai-settings #ai-status { background: #ececf3; color: #666b79; }
.ai-settings #ai-status.is-ready { background: var(--violet-soft); color: var(--violet); }
.ai-parse-button {
  padding: 8px 11px;
  border: 1px solid var(--violet) !important;
  border-radius: 9px;
  background: var(--violet) !important;
  color: white !important;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 800;
}
.ai-parse-button:disabled { cursor: not-allowed; opacity: .5; }
.manual-parser-note {
  margin: 0;
  color: var(--violet);
  font-size: .7rem;
  font-weight: 800;
}
.manual-import-actions {
  grid-template-columns: auto 1fr auto auto auto;
}

@media (max-width: 640px) {
  .manual-import-actions { grid-template-columns: 1fr 1fr; }
  .manual-import-actions > span { display: none; }
}
