:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --ink: #17212b;
  --muted: #65717e;
  --line: #dce2e7;
  --accent: #087f8c;
  --accent-dark: #056671;
  --green: #18875b;
  --amber: #b66a09;
  --red: #c23b45;
  --blue: #3169b3;
  --sidebar: #1c2933;
  --radius: 8px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 216px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); color: #dce7ec; padding: 22px 14px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 28px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: #f2c14e; color: #1c2933; font-size: 19px; font-weight: 800; border-radius: 7px; }
.brand strong, .brand small { display: block; }
.brand strong { color: #fff; font-size: 15px; }
.brand small { color: #8fa1ad; margin-top: 2px; }
nav { display: grid; gap: 5px; }
.nav-item { height: 44px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 6px; padding: 0 13px; color: #b9c8d1; background: transparent; text-align: left; }
.nav-item img, .icon-button img, button img, .search-box img, .eligibility img { width: 18px; height: 18px; }
.nav-item img { filter: invert(84%) sepia(9%) saturate(310%) hue-rotate(158deg); }
.nav-item:hover { background: #263844; color: #fff; }
.nav-item.active { background: #e9f7f8; color: #075c65; font-weight: 700; }
.nav-item.active img { filter: invert(31%) sepia(31%) saturate(1270%) hue-rotate(139deg); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 9px; color: #9db0ba; padding: 14px 12px 2px; border-top: 1px solid #33444f; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8b98a0; }
.status-dot.ok { background: #48c78e; }
.status-dot.warn { background: #f2c14e; }
.workspace { min-width: 0; padding: 0 34px 40px; }
.topbar { height: 94px; display: flex; align-items: center; justify-content: space-between; }
h1, h2, p { margin: 0; }
h1 { font-size: 23px; line-height: 1.2; }
h2 { font-size: 16px; }
.topbar p, .panel-head p { color: var(--muted); margin-top: 5px; }
.top-actions { display: flex; gap: 8px; }
.icon-button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.icon-button:hover { border-color: #aebac2; background: #f9fbfc; }
.view { display: none; }
.view.active { display: block; }
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px 18px; min-height: 88px; }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; font-size: 25px; margin-top: 8px; }
.metric.green strong { color: var(--green); } .metric.amber strong { color: var(--amber); } .metric.blue strong { color: var(--blue); } .metric.red strong { color: var(--red); }
.split-layout { display: grid; grid-template-columns: minmax(520px, 1.35fr) minmax(340px, .8fr); gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { min-height: 70px; padding: 17px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.neutral { background: #edf1f4; color: #586572; }.badge.success { background: #e7f6ee; color: #13744c; }.badge.warning { background: #fff3df; color: #995906; }.badge.danger { background: #fbeaec; color: #a72c37; }.badge.info { background: #e8f1fb; color: #285b9e; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 20px; }
.span-2 { grid-column: span 2; }
.field { display: grid; gap: 7px; color: #3d4852; }
.field > span { font-size: 12px; font-weight: 650; }
.field-hint { color: var(--muted); font-size: 11px; line-height: 1.45; }
input, select, textarea { width: 100%; border: 1px solid #cfd7dd; border-radius: 6px; background: #fff; color: var(--ink); padding: 10px 11px; outline: none; }
input, select { height: 40px; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8,127,140,.12); }
.eligibility { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid #cfe5de; background: #f0faf6; border-radius: 6px; color: #316353; font-size: 12px; }
.schedule-field { margin: 0; padding: 0; border: 0; }
.schedule-field legend { margin-bottom: 7px; padding: 0; font-size: 12px; font-weight: 650; }
.segmented-control { width: fit-content; display: grid; grid-template-columns: repeat(2, 130px); border: 1px solid #cfd7dd; border-radius: 6px; overflow: hidden; background: #fff; }
.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.segmented-control span { height: 38px; display: grid; place-items: center; color: var(--muted); border-right: 1px solid #cfd7dd; }
.segmented-control label:last-child span { border-right: 0; }
.segmented-control input:checked + span { background: #e9f7f8; color: var(--accent-dark); font-weight: 700; box-shadow: inset 0 0 0 1px var(--accent); }
.schedule-at { max-width: 360px; margin-top: 12px; }
.schedule-at.hidden { display: none; }
.speed-control { margin: 0; padding: 14px 15px; border: 1px solid #cfd7dd; border-radius: 6px; background: #f8fafb; }
.speed-control legend { padding: 0 5px; font-size: 12px; font-weight: 650; color: #3d4852; }
.speed-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.speed-heading strong { font-size: 17px; }
.speed-control input[type="range"] { height: 28px; margin: 8px 0 0; padding: 0; border: 0; box-shadow: none; accent-color: var(--accent); cursor: pointer; }
.speed-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.speed-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 11px 0 8px; }
.speed-presets button { min-height: 34px; padding: 0 8px; font-size: 12px; }
.speed-presets button.active { border-color: var(--accent); background: #e9f7f8; color: var(--accent-dark); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; }
.primary, .secondary, .danger { min-height: 40px; border-radius: 6px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; font-weight: 650; }
.primary { background: var(--accent); color: #fff; }.primary:hover { background: var(--accent-dark); }.primary:disabled { opacity: .45; cursor: not-allowed; }
.primary img, .danger:not(.ghost) img { filter: brightness(0) invert(1); }
.secondary { background: #fff; color: #35424d; border-color: #cfd7dd; }.secondary:hover { background: #f6f8f9; }
.danger { background: var(--red); color: #fff; }.danger.ghost { background: #fff; color: var(--red); border-color: #edc7ca; }
.wide { width: 100%; }
.campaign-list { max-height: 690px; overflow: auto; }
.campaign-item { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.campaign-item:last-child { border: 0; }
.campaign-title { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.campaign-title strong { max-width: 75%; }
.campaign-meta, .campaign-counts { margin-top: 8px; color: var(--muted); font-size: 12px; }
.provider-label { color: var(--accent-dark); font-weight: 700; }
.campaign-counts { display: flex; flex-wrap: wrap; gap: 8px 13px; }
.campaign-progress { height: 6px; margin-top: 13px; overflow: hidden; border-radius: 3px; background: #e8edf0; }
.campaign-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.campaign-progress-label { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.campaign-progress-label span:last-child { text-align: right; }
.campaign-actions { display: flex; gap: 8px; margin-top: 12px; }
.campaign-actions button { min-height: 34px; padding: 7px 12px; }
.callback-row { align-items: center; gap: 10px; }
.callback-row code { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.callback-row .icon-button { flex: 0 0 auto; }
.empty-state { color: var(--muted); padding: 34px 20px; text-align: center; }
.toolbar { min-height: 72px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.toolbar select { width: auto; min-width: 140px; }
.search-box { height: 40px; min-width: 260px; flex: 0 1 370px; display: flex; align-items: center; gap: 8px; border: 1px solid #cfd7dd; border-radius: 6px; background: #fff; padding: 0 10px; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8,127,140,.12); }
.search-box input { height: auto; border: 0; padding: 0; box-shadow: none; }
.search-box input:focus { box-shadow: none; }
.toolbar-spacer { flex: 1; }.toolbar-meta { margin-left: auto; color: var(--muted); }
.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { height: 44px; padding: 0 14px; background: #f1f4f6; color: #52606c; text-align: left; font-size: 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid #edf0f2; vertical-align: top; overflow-wrap: anywhere; }
tbody tr:hover { background: #fafcfd; }
.cell-main { font-weight: 600; }.cell-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.error-text { color: #9c3139; font-size: 12px; line-height: 1.45; max-height: 54px; overflow: auto; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); }
.template-layout { display: grid; grid-template-columns: 310px minmax(500px, 1fr); gap: 16px; }
.template-list { min-height: 520px; }
.template-item { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; padding: 14px 18px; }
.template-item:hover, .template-item.active { background: #eef8f8; }
.template-item strong, .template-item span { display: block; }.template-item span { color: var(--muted); margin-top: 4px; font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(320px, 1fr)); gap: 16px; }
.setting-panel { padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.setting-panel h2 { margin-bottom: 16px; }
.setting-row { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid #edf0f2; }
.setting-row span:first-child { color: var(--muted); }
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(17,28,36,.46); display: grid; place-items: center; padding: 24px; }
.overlay.hidden { display: none; }
.dialog { width: min(94vw, 760px); max-height: 90vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 24px 70px rgba(10,24,34,.22); }
.login-dialog { width: min(92vw, 410px); padding: 30px; }
.dialog-icon { width: 42px; height: 42px; display: grid; place-items: center; background: #e8f6f7; border-radius: 7px; margin-bottom: 18px; }
.dialog-icon img { width: 21px; }
.login-dialog p { color: var(--muted); line-height: 1.6; margin: 8px 0 20px; }
.login-dialog .field { margin-bottom: 12px; }
.form-error { min-height: 22px; color: var(--red); font-size: 12px; }
.dialog-head { display: flex; justify-content: space-between; gap: 18px; padding: 20px; border-bottom: 1px solid var(--line); }
.dialog-head p { color: var(--muted); margin-top: 5px; }
.import-group { margin: 18px 20px 0; }
.compact { margin: 16px 20px; max-height: 330px; }
.consent-check { display: flex; align-items: flex-start; gap: 10px; margin: 18px 20px; padding: 13px; border: 1px solid #edd9aa; background: #fff9ec; border-radius: 6px; line-height: 1.55; }
.consent-check input { width: 17px; height: 17px; margin-top: 2px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; max-width: 420px; padding: 12px 16px; color: #fff; background: #21313c; border-radius: 6px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }.toast.error { background: #a52f39; }
@media (max-width: 1050px) { .split-layout { grid-template-columns: 1fr; }.metric-row { grid-template-columns: repeat(2, 1fr); }.settings-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .app-shell { display: block; min-height: 100dvh; }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 15; width: 100%; height: calc(68px + env(safe-area-inset-bottom)); padding: 7px 8px env(safe-area-inset-bottom); border-top: 1px solid #33444f; }
  .brand, .sidebar-foot { display: none; }
  .sidebar nav { height: 100%; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .nav-item { height: 54px; min-width: 0; flex-direction: column; justify-content: center; gap: 4px; padding: 4px 2px; font-size: 10px; line-height: 1; text-align: center; }
  .nav-item img { width: 19px; height: 19px; }
  .workspace { width: 100%; padding: 0 12px calc(84px + env(safe-area-inset-bottom)); }
  .topbar { position: sticky; top: 0; z-index: 10; height: 68px; margin: 0 -12px 10px; padding: 0 12px; background: rgba(244,246,248,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
  .topbar h1 { font-size: 19px; }
  .topbar p { display: none; }
  .top-actions { gap: 6px; }
  .top-actions .icon-button { width: 36px; height: 36px; }
  .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .metric { min-height: 72px; padding: 12px; }
  .metric strong { margin-top: 6px; font-size: 21px; }
  .split-layout { gap: 12px; }
  .panel-head { min-height: 62px; padding: 14px; gap: 10px; }
  .panel-head h2 { font-size: 15px; }
  .panel-head p { font-size: 12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px; }
  .span-2 { grid-column: span 1; }
  input, select { height: 44px; }
  .speed-control { padding: 12px; }
  .speed-heading strong { font-size: 16px; }
  .speed-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segmented-control { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-at { max-width: none; }
  .eligibility { align-items: flex-start; line-height: 1.5; }
  .form-actions, .form-actions .primary { width: 100%; }
  .campaign-list { max-height: none; }
  .campaign-item { padding: 14px; }
  .campaign-title strong { max-width: 68%; }
  .campaign-meta { line-height: 1.55; overflow-wrap: anywhere; }
  .campaign-progress-label { align-items: flex-start; }
  .campaign-counts { gap: 7px 11px; line-height: 1.45; }
  .campaign-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .campaign-actions button { min-width: 0; padding: 7px 5px; font-size: 12px; }
  .toolbar { min-height: 0; padding: 10px; align-items: stretch; flex-wrap: wrap; gap: 8px; }
  .toolbar select { width: calc(50% - 4px); min-width: 0; }
  .search-box { min-width: 100%; flex: 1 0 100%; order: -1; }
  .toolbar > button:not(.icon-button) { flex: 1 1 auto; min-width: 0; padding-inline: 11px; }
  .toolbar-spacer { display: none; }
  .toolbar-meta { width: 100%; margin: 0; padding: 2px 2px 0; }
  .table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 760px; }
  .table-wrap::after { content: '左右滑动查看完整内容'; position: sticky; left: 12px; display: block; width: max-content; padding: 7px 0 8px; color: var(--muted); font-size: 11px; }
  .pagination { justify-content: space-between; }
  .template-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .template-list { min-height: 0; max-height: 300px; overflow: auto; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .setting-panel { padding: 15px; }
  .setting-row { min-height: 0; padding: 11px 0; display: grid; justify-content: stretch; gap: 5px; }
  .setting-row > :last-child { overflow-wrap: anywhere; }
  .overlay { padding: 10px; align-items: center; }
  .dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .login-dialog { padding: 22px 18px; }
  .dialog-head { padding: 15px; }
  .import-group { margin: 14px 14px 0; }
  .compact { margin: 12px 14px; max-height: 36dvh; }
  .consent-check { margin: 14px; }
  .dialog-actions { position: sticky; bottom: 0; padding: 12px 14px; background: #fff; }
  .dialog-actions button { flex: 1; }
  .toast { right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); left: 12px; max-width: none; }
}
