:root {
  color-scheme: light;
  --bg: #f8f8f0;
  --surface: #f7f3df;
  --surface-soft: #fffbe7;
  --surface-tint: #e6f9f6;
  --text: #725d42;
  --muted: #9f927d;
  --muted-2: #b9aa91;
  --line: #e8dcc8;
  --blue: #19c8b9;
  --blue-dark: #0f9e94;
  --blue-soft: #e6f9f6;
  --yellow: #f5c31c;
  --green: #19a99b;
  --shadow: 0 10px 24px rgba(112, 91, 59, .10);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #252823;
  --surface: #34382f;
  --surface-soft: #2d312b;
  --surface-tint: #264c47;
  --text: #f7f3df;
  --muted: #c9bea7;
  --muted-2: #a99e87;
  --line: #5a5a49;
  --blue: #55d5c8;
  --blue-dark: #35b5a9;
  --blue-soft: #264c47;
  --shadow: 0 10px 24px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font-family: "Nunito", "Noto Sans SC", "Microsoft YaHei", sans-serif; font-size: 14px; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(66, 102, 232, .2); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 258px; flex: 0 0 258px; min-height: 100vh; padding: 30px 20px 18px; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.brand-block { display: flex; align-items: center; gap: 12px; padding: 0 9px; }
.brand-block strong { display: block; font-size: 19px; line-height: 1.2; letter-spacing: -.3px; }
.brand-block small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 9px; font-weight: 700; letter-spacing: 1.7px; }
.brand-mark { width: 35px; height: 35px; position: relative; border-radius: 11px; background: #edf3ff; }
.brand-mark span { position: absolute; width: 9px; height: 9px; border-radius: 4px; background: #4266e8; }
.brand-mark span:nth-child(1) { top: 7px; left: 13px; }
.brand-mark span:nth-child(2) { top: 17px; left: 6px; background: #f2b63f; }
.brand-mark span:nth-child(3) { top: 17px; right: 6px; background: #49b8cc; }

.side-nav { margin-top: 48px; display: grid; gap: 7px; }
.nav-item { min-height: 48px; padding: 0 13px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; text-align: left; transition: background .18s ease, color .18s ease; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item span { flex: 1; font-weight: 500; }
.nav-item b { color: var(--muted-2); font-size: 11px; font-weight: 500; }
.nav-item:hover { color: var(--blue); background: var(--surface-soft); }
.nav-item.active { color: var(--blue); background: var(--blue-soft); font-weight: 600; }

.sidebar-note { margin-top: auto; padding: 15px 14px; display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.note-icon { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; border-radius: 7px; color: var(--green); background: #e7f8ef; }
.note-icon svg { width: 15px; }
.sidebar-note strong { display: block; color: var(--text); font-size: 12px; }
.sidebar-note p { max-width: 155px; margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.sidebar-footer { margin-top: 18px; display: flex; align-items: center; gap: 7px; color: var(--muted-2); font-size: 11px; }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(45, 183, 121, .12); }
.version { margin-left: auto; color: var(--muted-2); }

.main-content { min-width: 0; flex: 1; padding: 34px clamp(24px, 4vw, 60px) 24px; overflow: hidden; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.eyebrow, .section-kicker { margin: 0; color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: 1.8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(25px, 3vw, 34px); line-height: 1.2; letter-spacing: -.7px; }
.subheading { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .profile-chip { height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); }
.icon-button { width: 42px; display: grid; place-items: center; }
.icon-button svg { width: 18px; }
.profile-chip { display: flex; align-items: center; gap: 9px; padding: 0 12px 0 7px; color: var(--text); }
.profile-chip svg { width: 15px; color: var(--muted); }
.profile-avatar { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: white; background: #f1ae36; font-weight: 700; }

.stats-strip { min-height: 90px; margin-top: 30px; padding: 0 24px; display: flex; align-items: center; gap: clamp(28px, 5vw, 66px); border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.stat-item { display: flex; align-items: center; gap: 11px; }
.stat-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; }
.stat-icon svg { width: 17px; }
.stat-icon.blue { color: var(--blue); background: var(--blue-soft); }.stat-icon.yellow { color: #c78d1e; background: #fff5dd; }.stat-icon.green { color: #1e9d67; background: #e4f7ed; }
.stat-item small { display: block; color: var(--muted); font-size: 11px; }.stat-item strong { display: block; margin-top: 3px; color: var(--text); font-size: 18px; font-weight: 700; }
.stat-spacer { flex: 1; }.last-sync { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; white-space: nowrap; }

.workspace-grid { margin-top: 26px; display: grid; grid-template-columns: minmax(285px, 330px) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.control-panel { padding: 24px; }
.results-panel { min-width: 0; padding: 24px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 19px; letter-spacing: -.25px; }.panel-badge { padding: 5px 8px; border-radius: 4px; color: var(--blue); background: var(--blue-soft); font-size: 11px; white-space: nowrap; }
.field-group { margin-top: 23px; }.field-label { display: block; margin-bottom: 9px; color: var(--text); font-size: 12px; font-weight: 600; }
.select-wrap { min-width: 0; position: relative; }.select-wrap select { width: 100%; height: 42px; appearance: none; border: 1px solid var(--line); border-radius: 7px; padding: 0 36px 0 12px; color: var(--text); background: var(--surface-soft); cursor: pointer; }.select-wrap svg { position: absolute; top: 13px; right: 12px; width: 16px; color: var(--muted); pointer-events: none; }
.field-hint { margin: 8px 0 0; color: var(--muted-2); font-size: 11px; line-height: 1.5; }.region-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }.district-wrap { margin-top: 8px; }
.prefix-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }.prefix-chip { min-width: 0; height: 36px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface-soft); font-size: 12px; transition: all .18s ease; }.prefix-chip:first-child { grid-column: 1 / -1; }.prefix-chip:hover { color: var(--blue); border-color: #aebeff; }.prefix-chip.active { color: var(--blue); border-color: #8fa6ff; background: var(--blue-soft); font-weight: 600; }
.label-line { display: flex; align-items: center; justify-content: space-between; }.label-line .field-label { margin-bottom: 9px; }.count-tip { color: var(--muted-2); font-size: 11px; }
.count-control { height: 42px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--surface-soft); }.count-control input { min-width: 0; flex: 1; height: 100%; border: 0; color: var(--text); background: transparent; text-align: center; font-weight: 700; outline: none; }.stepper { width: 42px; height: 100%; border: 0; color: var(--muted); background: transparent; }.stepper:hover { color: var(--blue); background: var(--blue-soft); }.stepper svg { width: 15px; }.quick-counts { display: flex; gap: 6px; margin-top: 9px; }.quick-counts button { min-width: 36px; height: 28px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: 11px; }.quick-counts button:hover, .quick-counts button.active { color: var(--blue); background: var(--blue-soft); font-weight: 600; }
.generate-button { width: 100%; height: 45px; margin-top: 25px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 7px; color: white; background: var(--blue); font-weight: 600; box-shadow: 0 9px 18px rgba(66, 102, 232, .2); }.generate-button:hover { background: var(--blue-dark); }.generate-button svg { width: 17px; }.generate-button kbd { margin-left: auto; margin-right: 11px; padding: 3px 5px; border: 1px solid rgba(255,255,255,.3); border-radius: 4px; color: rgba(255,255,255,.75); font-size: 10px; font-family: inherit; font-weight: 500; }.privacy-line { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 13px 0 0; color: var(--muted-2); font-size: 10px; }.privacy-line svg { width: 13px; }

.result-heading { align-items: center; }.result-heading h2 { display: flex; align-items: center; gap: 8px; }.result-count { min-width: 24px; height: 22px; display: inline-grid; place-items: center; border-radius: 5px; color: var(--blue); background: var(--blue-soft); font-size: 11px; }.result-actions { display: flex; align-items: center; gap: 8px; }.text-button, .outline-button { height: 34px; display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; font-size: 12px; }.text-button { border: 0; color: var(--muted); background: transparent; }.text-button:hover { color: var(--blue); }.outline-button { padding: 0 10px; border: 1px solid var(--line); color: var(--text); background: var(--surface); }.outline-button:hover { border-color: #a9baff; color: var(--blue); background: var(--blue-soft); }.text-button svg, .outline-button svg { width: 15px; }
.result-toolbar { min-height: 59px; margin-top: 15px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }.search-box { width: min(300px, 100%); height: 35px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }.search-box svg { width: 15px; color: var(--muted); }.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }.result-meta { display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: 11px; }.result-meta button { border: 0; color: var(--blue); background: transparent; font-size: 11px; }
.result-list { display: grid; gap: 8px; padding-top: 14px; }.result-row { min-height: 82px; display: grid; grid-template-columns: 24px 31px minmax(280px, 1fr) minmax(230px, .52fr); align-items: center; gap: 9px; padding: 11px 13px; border: 1px solid transparent; border-radius: 7px; background: var(--surface-soft); transition: border .16s ease, background .16s ease; }.result-row:hover { border-color: #cfdaff; background: var(--surface-tint); }.result-row.selected { border-color: #9db0ff; background: var(--blue-soft); }.row-check { width: 20px; height: 20px; position: relative; display: grid; place-items: center; }.row-check input { position: absolute; opacity: 0; }.row-check span { width: 17px; height: 17px; display: block; border: 1px solid #cbd4e3; border-radius: 4px; background: var(--surface); }.row-check input:checked + span { border-color: var(--blue); background: var(--blue); }.row-check input:checked + span::after { content: ""; display: block; width: 8px; height: 4px; margin: 4px 0 0 3px; border-bottom: 2px solid white; border-left: 2px solid white; transform: rotate(-45deg); }
.row-index { color: var(--muted-2); font-size: 11px; font-variant-numeric: tabular-nums; }.row-main { min-width: 0; }.address-line { display: flex; align-items: center; gap: 7px; min-width: 0; }.address-line strong { min-width: 0; overflow: hidden; color: var(--text); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }.source-tag, .operator-tag { flex: 0 0 auto; padding: 4px 6px; border-radius: 4px; font-size: 10px; }.source-tag.amap { color: #3776c7; background: #e7f2ff; }.source-tag.baidu { color: #c5791a; background: #fff2dc; }.source-tag.admin { color: #358c64; background: #e3f7ed; }.operator-tag.mobile { color: #238954; background: #e3f6ec; }.operator-tag.unicom { color: #b05242; background: #fbe9e5; }.operator-tag.telecom { color: #356fc1; background: #e6effc; }.operator-tag.radio { color: #7f55b2; background: #f0e8fa; }.row-sub { display: flex; align-items: center; gap: 12px; margin-top: 7px; color: var(--muted); font-size: 11px; }.row-sub span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.row-sub svg { width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; }.time-stamp { color: var(--muted-2); white-space: nowrap; }.phone-box { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }.phone-box > svg { width: 15px; flex: 0 0 15px; color: var(--yellow); }.phone-box > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.inline-copy { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; border: 0; border-radius: 6px; color: var(--muted); background: transparent; transition: color .16s ease, background .16s ease; }.inline-copy:hover { color: var(--blue); background: var(--surface); }.inline-copy svg { width: 14px; height: 14px; }.address-copy { margin-left: 1px; }.phone-copy { margin-left: auto; }.empty-result { min-height: 330px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }.empty-result[hidden], .result-list[hidden] { display: none; }.empty-illustration { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 20px; color: var(--blue); background: var(--blue-soft); }.empty-illustration svg { width: 28px; }.empty-result h3 { margin: 18px 0 6px; font-size: 16px; }.empty-result p { margin-bottom: 16px; color: var(--muted); font-size: 12px; }.empty-cta { height: 36px; padding: 0 13px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 6px; color: var(--blue); background: var(--blue-soft); font-size: 12px; }.empty-cta svg { width: 15px; }.no-match, .history-empty { min-height: 270px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }.no-match svg, .history-empty svg { width: 28px; }

.tips-row { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }.tip-card { min-height: 87px; padding: 16px; display: flex; align-items: flex-start; gap: 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }.tip-card > svg { width: 15px; margin-left: auto; color: var(--muted-2); }.tip-number { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 25px; border-radius: 7px; color: var(--blue); background: var(--blue-soft); font-size: 11px; font-weight: 700; }.tip-card strong { display: block; font-size: 12px; }.tip-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }.tip-card.accent .tip-number { color: #1e9d67; background: #e4f7ed; }.tip-card.accent > svg { color: var(--green); }
.footer { margin-top: 28px; padding: 0 2px; display: flex; justify-content: space-between; color: var(--muted-2); font-size: 11px; }.footer a { color: var(--blue); text-decoration: none; }.footer a:hover { text-decoration: underline; }

.history-view, .help-view { margin-top: 26px; padding: 24px; }.history-list { margin-top: 16px; display: grid; gap: 8px; }.history-item { min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }.history-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 7px; color: var(--blue); background: var(--blue-soft); }.history-icon svg { width: 16px; }.history-item strong { display: block; font-size: 12px; }.history-item p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }.history-item time { margin-left: auto; color: var(--muted-2); font-size: 11px; }.history-load { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--blue); background: var(--surface); font-size: 11px; }.help-grid { margin-top: 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }.help-grid > div { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }.help-grid span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-weight: 700; }.help-grid h3 { margin: 16px 0 7px; font-size: 14px; }.help-grid p { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

.toast { position: fixed; z-index: 20; top: 30px; left: 50%; display: flex; align-items: center; gap: 8px; padding: 11px 15px; border: 1px solid #cdeedc; border-radius: 7px; color: #208e5c; background: var(--surface); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, -14px); transition: opacity .2s ease, transform .2s ease; }.toast.show { opacity: 1; transform: translate(-50%, 0); }.toast svg { width: 17px; }

@media (max-width: 1120px) { .sidebar { width: 218px; flex-basis: 218px; padding-left: 14px; padding-right: 14px; }.main-content { padding-right: 28px; padding-left: 28px; }.workspace-grid { grid-template-columns: 290px minmax(0, 1fr); }.stats-strip { gap: 25px; padding: 0 17px; }.profile-chip span:nth-child(2) { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
@media (max-width: 880px) { .sidebar { width: 72px; flex-basis: 72px; padding: 22px 10px 14px; align-items: center; }.brand-block { padding: 0; }.brand-block > div:last-child, .nav-item span, .nav-item b, .sidebar-note, .sidebar-footer span:not(.status-dot) { display: none; }.side-nav { width: 100%; margin-top: 35px; }.nav-item { justify-content: center; padding: 0; }.nav-item.active { box-shadow: inset 3px 0 0 var(--blue); }.sidebar-footer { margin-top: auto; }.main-content { padding: 26px 18px 20px; }.workspace-grid { grid-template-columns: 1fr; }.control-panel { order: 1; }.results-panel { order: 2; }.stats-strip { overflow-x: auto; gap: 30px; }.stat-spacer, .last-sync { display: none; }.tips-row { grid-template-columns: 1fr; }.tip-card { min-height: 70px; }.help-grid { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .topbar { display: block; }.topbar-actions { margin-top: 18px; }.profile-chip { flex: 1; }.profile-chip span:nth-child(2) { max-width: none; }.stats-strip { min-height: auto; padding: 15px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }.workspace-grid { margin-top: 18px; }.control-panel, .results-panel, .history-view, .help-view { padding: 18px; }.result-heading { display: block; }.result-actions { margin-top: 15px; flex-wrap: wrap; }.result-toolbar { padding: 12px 0; display: block; }.search-box { width: 100%; }.result-meta { margin-top: 10px; justify-content: space-between; }.result-row { grid-template-columns: 22px 25px minmax(0, 1fr); align-items: start; }.row-main { grid-column: 3; }.phone-box { grid-column: 3; margin-top: 4px; }.row-sub { display: block; }.time-stamp { display: inline-block; margin-top: 4px; }.address-line { align-items: flex-start; flex-wrap: wrap; }.address-copy { margin-left: auto; }.phone-box .phone-copy { margin-left: auto; }.footer { display: block; line-height: 1.7; }.footer span:last-child { display: block; margin-top: 4px; }.history-item { flex-wrap: wrap; }.history-item time { margin-left: auto; }.history-load { margin-left: 43px; } }

/* Animal Island-inspired tokens: warm paper surfaces, mint actions, pill controls. */
.sidebar { background: var(--surface); border-right-color: var(--line); }
.brand-mark { border-radius: 14px; background: #dff7f2; }
.brand-mark span:nth-child(1) { background: var(--blue); }
.brand-mark span:nth-child(2) { background: #f5c31c; }
.brand-mark span:nth-child(3) { background: #e79868; }
.nav-item { border-radius: 50px; }
.nav-item.active { color: #794f27; background: #b7c6e5; }
.sidebar-note { border-radius: 18px; background: #fffbe7; }
.note-icon { border-radius: 50%; background: #e6f9f6; }
.stats-strip { border-radius: 20px; background: var(--surface); }
.icon-button, .profile-chip { border-radius: 50px; background: #fffbe7; }
.profile-avatar { background: #f5c31c; color: #725d42; }
.panel { background: rgb(247, 243, 223); }
.panel-badge, .result-count { border-radius: 50px; color: #0d8e84; background: #e6f9f6; }
.select-wrap select, .count-control, .search-box { border-radius: 50px; border-color: #e8dcc8; background: #fffbe7; }
.prefix-chip { border-radius: 50px; border-color: #e8dcc8; background: #fffbe7; }
.prefix-chip.active, .prefix-chip:hover { color: #108e84; border-color: #19c8b9; background: #e6f9f6; }
.quick-counts button { border-radius: 50px; }
.quick-counts button:hover, .quick-counts button.active { color: #725d42; background: #f5c31c; }
.generate-button { border-radius: 50px; color: #fffdf5; background: #19c8b9; box-shadow: 0 5px 0 0 #bdaea0; }
.generate-button:hover { background: #0f9e94; transform: translateY(1px); box-shadow: 0 4px 0 0 #bdaea0; }
.outline-button, .history-load { border-radius: 50px; border-color: #e8dcc8; background: #fffbe7; }
.text-button { border-radius: 50px; }
.result-toolbar { border-color: #e8dcc8; }
.result-row { border-radius: 16px; background: #fffbe7; }
.result-row:hover, .result-row.selected { border-color: #9bded6; background: #e6f9f6; }
.source-tag, .operator-tag { border-radius: 50px; }
.inline-copy { border-radius: 50%; color: #9f927d; }
.inline-copy:hover { color: #0f9e94; background: #e6f9f6; }
.empty-illustration { border-radius: 22px; color: #19c8b9; background: #e6f9f6; }
.empty-cta { border-radius: 50px; color: #725d42; background: #f5c31c; }
.tip-card, .history-item, .help-grid > div { border-radius: 18px; background: var(--surface); }
.tip-number, .history-icon, .help-grid span { border-radius: 50%; background: #e6f9f6; color: #0f9e94; }
.toast { border-radius: 50px; border-color: #bce8df; background: #fffbe7; color: #0f8f85; }

/* Dark mode overrides for the Animal Island-inspired layer. */
:root[data-theme="dark"] {
  --surface-accent: #3d4338;
  --surface-input: #2b302b;
  --surface-selected: #28524d;
  --line-strong: #6b7568;
  --text-on-accent: #f7f3df;
}

:root[data-theme="dark"] .brand-mark { background: #263f3b; }
:root[data-theme="dark"] .sidebar-note,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .profile-chip,
:root[data-theme="dark"] .select-wrap select,
:root[data-theme="dark"] .count-control,
:root[data-theme="dark"] .search-box,
:root[data-theme="dark"] .prefix-chip,
:root[data-theme="dark"] .outline-button,
:root[data-theme="dark"] .history-load,
:root[data-theme="dark"] .result-row,
:root[data-theme="dark"] .toast {
  background: var(--surface-input);
  border-color: var(--line);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .tip-card,
:root[data-theme="dark"] .history-item,
:root[data-theme="dark"] .help-grid > div {
  background: var(--surface);
}

:root[data-theme="dark"] .nav-item.active {
  color: var(--text-on-accent);
  background: #496078;
}
:root[data-theme="dark"] .nav-item:hover { background: var(--surface-accent); }
:root[data-theme="dark"] .sidebar-note p,
:root[data-theme="dark"] .field-hint,
:root[data-theme="dark"] .subheading,
:root[data-theme="dark"] .last-sync,
:root[data-theme="dark"] .result-meta,
:root[data-theme="dark"] .footer,
:root[data-theme="dark"] .sidebar-footer {
  color: var(--muted);
}
:root[data-theme="dark"] .panel-badge,
:root[data-theme="dark"] .result-count,
:root[data-theme="dark"] .empty-illustration,
:root[data-theme="dark"] .tip-number,
:root[data-theme="dark"] .history-icon,
:root[data-theme="dark"] .help-grid span {
  color: var(--blue);
  background: var(--surface-selected);
}
:root[data-theme="dark"] .prefix-chip.active,
:root[data-theme="dark"] .prefix-chip:hover,
:root[data-theme="dark"] .result-row:hover,
:root[data-theme="dark"] .result-row.selected,
:root[data-theme="dark"] .inline-copy:hover {
  color: var(--blue);
  border-color: var(--blue-dark);
  background: var(--surface-selected);
}
:root[data-theme="dark"] .quick-counts button:hover,
:root[data-theme="dark"] .quick-counts button.active {
  color: #2e3028;
  background: #e2b91e;
}
:root[data-theme="dark"] .empty-cta {
  color: #2e3028;
  background: #e2b91e;
}
:root[data-theme="dark"] .inline-copy { color: var(--muted); }
:root[data-theme="dark"] .row-check span { border-color: var(--line-strong); background: var(--surface-input); }
:root[data-theme="dark"] .outline-button:hover,
:root[data-theme="dark"] .history-load:hover { border-color: var(--blue); color: var(--blue); background: var(--surface-selected); }
:root[data-theme="dark"] .source-tag.amap { color: #9bc7ff; background: #263d58; }
:root[data-theme="dark"] .source-tag.baidu { color: #f4c47b; background: #4a3924; }
:root[data-theme="dark"] .source-tag.admin { color: #8fe0b6; background: #244638; }
:root[data-theme="dark"] .operator-tag.mobile { color: #8ee0b0; background: #244838; }
:root[data-theme="dark"] .operator-tag.unicom { color: #f1a69b; background: #4c2f2c; }
:root[data-theme="dark"] .operator-tag.telecom { color: #a4caff; background: #263d58; }
:root[data-theme="dark"] .operator-tag.radio { color: #d0b3f4; background: #3e2e50; }
:root[data-theme="dark"] .note-icon { background: var(--surface-selected); }
:root[data-theme="dark"] .stat-icon.yellow { color: #f5d36a; background: #4a4024; }
:root[data-theme="dark"] .stat-icon.green { color: #8ee0b0; background: #244838; }
:root[data-theme="dark"] .toast { color: #8ee0d6; border-color: #467a73; }
:root[data-theme="dark"] .generate-button { color: #16312e; background: #55d5c8; box-shadow: 0 5px 0 0 #1d2522; }
:root[data-theme="dark"] .generate-button:hover { background: #72e2d7; box-shadow: 0 4px 0 0 #1d2522; }

/* Final contrast fixes for elements with hard-coded light-theme rules. */
:root[data-theme="dark"] .result-toolbar {
  border-color: var(--line);
  border-top-color: var(--line);
  border-bottom-color: var(--line);
}
:root[data-theme="dark"] .tip-card.accent .tip-number {
  color: #8ee0b0;
  background: #244838;
}
:root[data-theme="dark"] .tip-card.accent > svg {
  color: #8ee0b0;
}
:root[data-theme="dark"] .profile-avatar {
  color: #2e3028;
}
:root[data-theme="dark"] .row-check input:checked + span {
  border-color: var(--blue);
  background: var(--blue);
}
:root[data-theme="dark"] .field-label,
:root[data-theme="dark"] .tip-card strong,
:root[data-theme="dark"] .history-item strong,
:root[data-theme="dark"] .help-grid h3 {
  color: var(--text);
}
:root[data-theme="dark"] input::placeholder {
  color: var(--muted-2);
  opacity: 1;
}
:root[data-theme="dark"] .phone-region { color: var(--muted); }
.phone-region {
  min-width: 0;
  max-width: 145px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 620px) {
  .phone-region { max-width: 120px; }
}

select, select option { color: var(--text); background: var(--surface-input); }
