:root {
  --cp-blue: #2563eb; --cp-ink: #172033; --cp-muted: #667085; --cp-line: #dbe2ec;
  --cp-bg: #f3f6fa; --cp-panel: #fff; --cp-sidebar: #102342;
  color-scheme: light; font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--cp-ink); background: var(--cp-bg); font-size: 14px; }
a { color: #1d4ed8; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.cp-app { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.cp-sidebar { padding: 22px 16px; color: #fff; background: linear-gradient(180deg, var(--cp-sidebar), #0a1730 75%); }
.cp-brand { display: flex; align-items: center; gap: 11px; min-height: 50px; padding: 0 8px 20px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
.cp-brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px; color: #fff; background: linear-gradient(145deg, #5b8cff, #2f68e9); box-shadow: 0 8px 22px rgba(16,55,145,.36); font-size: 18px; font-weight: 800; }
.cp-brand strong, .cp-brand small { display: block; }
.cp-brand strong { font-size: 16px; letter-spacing: .02em; }
.cp-brand small { margin-top: 3px; color: #9fb3d3; font-size: 11px; }
.cp-nav { display: grid; gap: 5px; margin-top: 16px; }
.cp-nav p { margin: 15px 10px 3px; color: #7790b6; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.cp-nav a { display: grid; gap: 2px; padding: 10px 12px; border-radius: 9px; color: #dce7f7; }
.cp-nav a span { font-weight: 650; }
.cp-nav a small { color: #8fa5c7; font-size: 11px; }
.cp-nav a:hover, .cp-nav a.active { color: #fff; background: #18345f; }
.cp-nav a.active { box-shadow: inset 3px 0 #67a0ff; }
.cp-nav a:hover small, .cp-nav a.active small { color: #c3d4ee; }

.cp-main { min-width: 0; }
.cp-topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 26px; background: #fff; border-bottom: 1px solid var(--cp-line); }
.cp-topbar > div:first-child { display: grid; gap: 3px; }
.cp-topbar > div:first-child span { color: var(--cp-muted); font-size: 12px; }
.cp-user { display: flex; align-items: center; gap: 12px; }
.cp-user > span { font-weight: 650; }
.cp-user form { margin: 0; }
.cp-user button { padding: 7px 11px; color: #344054; background: #fff; border: 1px solid var(--cp-line); border-radius: 7px; cursor: pointer; }
.cp-user button:hover { border-color: #9bb0ca; background: #f8fafc; }
.cp-shell { display: grid; gap: 16px; max-width: 1640px; margin: 0 auto; padding: 24px 26px 44px; }
.cp-page-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.cp-page-head h1, .cp-panel h2, .cp-panel h3 { margin: 0; }
.cp-page-head h1 { margin-top: 4px; font-size: 25px; letter-spacing: -.02em; }
.cp-page-head p, .cp-panel-head p { margin: 5px 0 0; color: var(--cp-muted); }
.cp-eyebrow { color: var(--cp-blue); font-size: 11px; font-weight: 800; letter-spacing: .15em; }
.cp-update-time { padding: 7px 10px; color: var(--cp-muted); background: #fff; border: 1px solid var(--cp-line); border-radius: 7px; font-size: 12px; }
.cp-alert { margin: 0; padding: 12px 14px; border: 1px solid #f5c36b; border-radius: 9px; background: #fffbeb; color: #7c4a03; }
.cp-messages { display: grid; gap: 8px; }
.cp-message { margin: 0; padding: 11px 13px; border: 1px solid #aad9c2; border-radius: 8px; color: #067647; background: #ecfdf3; }
.cp-message.error { border-color: #f7b2ad; color: #b42318; background: #fef3f2; }

.cp-metrics, .cp-detail-grid { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); gap: 10px; }
.cp-metrics article, .cp-detail-grid article { display: grid; gap: 5px; min-width: 0; padding: 15px; background: var(--cp-panel); border: 1px solid var(--cp-line); border-radius: 9px; }
.cp-metrics span, .cp-detail-grid span, .cp-detail-grid small, .cp-metrics small { color: var(--cp-muted); font-size: 12px; }
.cp-metrics strong, .cp-detail-grid strong { overflow-wrap: anywhere; color: #182230; font-size: 19px; }
.cp-home-metrics { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.cp-home-metrics article { border-top: 3px solid #7aa4f8; }
.cp-home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .8fr); gap: 16px; }
.cp-panel { min-width: 0; padding: 17px; background: var(--cp-panel); border: 1px solid var(--cp-line); border-radius: 10px; box-shadow: 0 3px 16px rgba(26,43,72,.035); }
.cp-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.cp-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cp-shortcuts a { display: grid; gap: 5px; padding: 15px; color: var(--cp-ink); border: 1px solid var(--cp-line); border-radius: 9px; background: #fbfcfe; }
.cp-shortcuts a:hover { border-color: #91b2ee; background: #f5f8ff; }
.cp-shortcuts a span { color: var(--cp-muted); font-size: 12px; }
.cp-node-list { display: grid; }
.cp-node-list > div { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid #edf0f4; }
.cp-node-list > div:last-child { border-bottom: 0; }
.cp-node-list strong, .cp-node-list small { display: block; }
.cp-node-list small { margin-top: 2px; color: var(--cp-muted); font-size: 11px; }
.cp-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #d92d20; box-shadow: 0 0 0 3px #fee4e2; }
.cp-status-dot.online { background: #12b76a; box-shadow: 0 0 0 3px #d1fadf; }
.cp-empty-state { color: var(--cp-muted); text-align: center; }

.cp-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-filter a { padding: 6px 9px; color: #344054; border: 1px solid var(--cp-line); border-radius: 6px; }
.cp-filter a.active { color: #fff; border-color: var(--cp-blue); background: var(--cp-blue); }
.cp-table-wrap { overflow: auto; }
.cp-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.cp-table th, .cp-table td { padding: 10px 9px; border-bottom: 1px solid #e7ebf1; text-align: left; vertical-align: top; }
.cp-table th { color: #475467; background: #f8fafc; font-size: 12px; white-space: nowrap; }
.cp-table tr:last-child td { border-bottom: 0; }
.cp-table.compact td { font-size: 12px; }
.cp-node-link { display: grid; gap: 2px; }
.cp-node-link small, .cp-block { display: block; color: var(--cp-muted); font-size: 11px; }
.cp-badge { display: inline-block; padding: 3px 7px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.cp-badge.success { color: #067647; background: #ecfdf3; }
.cp-badge.warning { color: #934b00; background: #fffaeb; }
.cp-badge.danger { color: #b42318; background: #fef3f2; }
.cp-badge.muted { color: #475467; background: #f2f4f7; }
.cp-empty { padding: 28px !important; text-align: center !important; color: var(--cp-muted); }
.cp-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding-top: 12px; }
.cp-detail { display: grid; gap: 16px; }
.cp-detail-grid { grid-template-columns: repeat(6, minmax(150px, 1fr)); }
.cp-actions-grid { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 10px; }
.cp-action-tile { display: grid; gap: 5px; padding: 14px; color: var(--cp-ink); text-align: left; background: #f8faff; border: 1px solid #cfdcf4; border-radius: 9px; cursor: pointer; }
.cp-action-tile:hover { border-color: #7da4ec; background: #f1f6ff; }
.cp-action-tile strong { color: #1d4ed8; }
.cp-action-tile span { color: var(--cp-muted); font-size: 12px; line-height: 1.5; }
.cp-action-tile.danger { background: #fffafa; border-color: #f0cfcc; }
.cp-action-tile.danger strong { color: #b42318; }
.cp-modal { width: min(560px, calc(100vw - 28px)); max-height: min(820px, calc(100vh - 36px)); margin: auto; padding: 0; color: var(--cp-ink); background: transparent; border: 0; overflow: visible; }
.cp-modal::backdrop { background: rgba(11, 23, 43, .58); backdrop-filter: blur(2px); }
.cp-modal-card { max-height: min(820px, calc(100vh - 36px)); padding: 22px; background: #fff; border: 1px solid #d6deea; border-radius: 13px; box-shadow: 0 24px 70px rgba(10, 24, 50, .28); overflow-y: auto; }
.cp-modal-card > header { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding-bottom: 14px; border-bottom: 1px solid #e7ebf1; }
.cp-modal-card > header span { display: block; margin-bottom: 4px; color: var(--cp-blue); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.cp-modal-card > header h3 { margin: 0; font-size: 20px; }
.cp-modal-card > p { margin: 14px 0 2px; color: var(--cp-muted); }
.cp-modal-close { width: 34px; height: 34px; padding: 0; color: #475467; background: #f6f8fb; border: 1px solid var(--cp-line); border-radius: 8px; font-size: 22px; line-height: 1; cursor: pointer; }
.cp-modal-cancel { width: 100%; min-height: 38px; margin-top: 8px; color: #344054; background: #fff; border: 1px solid var(--cp-line); border-radius: 7px; cursor: pointer; }
.cp-modal-cancel:hover, .cp-modal-close:hover { background: #eef2f7; }
.cp-form { display: grid; gap: 10px; padding-top: 12px; }
.cp-form label { display: grid; gap: 4px; }
.cp-form label > span { font-weight: 600; }
.cp-form input, .cp-form select, .cp-form textarea, .cp-inline-filter select, .cp-inline-filter input { width: 100%; min-height: 38px; padding: 8px 9px; color: var(--cp-ink); background: #fff; border: 1px solid #cbd5e1; border-radius: 7px; }
.cp-form textarea { min-height: 72px; }
.cp-form small { color: var(--cp-muted); }
.cp-form button, .cp-inline-filter button { min-height: 38px; padding: 9px 13px; color: #fff; background: var(--cp-blue); border: 0; border-radius: 7px; cursor: pointer; }
.cp-form button.danger { background: #b42318; }
.cp-inline-filter { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.cp-inline-filter label { display: grid; gap: 4px; min-width: 180px; color: #344054; font-weight: 600; }
.cp-inline-filter label:first-child { min-width: 240px; }
.cp-primary-link, .cp-secondary-link { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 13px; border-radius: 7px; font-weight: 650; }
.cp-primary-link { color: #fff; background: var(--cp-blue); }
.cp-secondary-link { color: #344054; background: #fff; border: 1px solid var(--cp-line); }
.cp-form-panel { width: 100%; }
.cp-sms-test-form { gap: 7px; margin-top: 18px; }
.cp-sms-test-form > label { font-weight: 650; }
.cp-sms-test-phone-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.cp-form .cp-sms-test-phone-row input { width: 190px; max-width: 100%; }
.cp-sms-test-phone-row button { white-space: nowrap; }
.cp-sms-test-send-form { width: max-content; max-width: 100%; margin: 12px 0; padding: 0; }
.cp-sms-test-send-form button:disabled { opacity: .55; cursor: not-allowed; }
.cp-sms-test-result { margin: 10px 0; }
.cp-sms-test-content { min-width: 260px; max-width: 390px; line-height: 1.6; overflow-wrap: anywhere; }
.cp-config-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.cp-config-values > div { min-width: 0; }
.cp-config-values dt { color: var(--cp-muted); font-size: 12px; margin-bottom: 5px; }
.cp-config-values dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-config-long { grid-column: 1 / -1; min-width: 0; }
.cp-config-values summary, .cp-config-history summary { cursor: pointer; color: var(--cp-blue); }
.cp-config-values pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; padding: 12px; background: #f6f8fb; border-radius: 6px; font: inherit; }
.cp-config-history { margin-top: 16px; }
.cp-management-form { gap: 18px; padding-top: 0; }
.cp-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cp-form-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cp-form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cp-field { display: grid; align-content: start; gap: 5px; min-width: 0; color: #344054; }
.cp-field > span { font-weight: 650; }
.cp-field input, .cp-field select, .cp-field textarea, .cp-secret-template textarea, .cp-inline-confirm input { width: 100%; min-height: 40px; padding: 9px 10px; color: var(--cp-ink); background: #fff; border: 1px solid #c7d2e0; border-radius: 7px; outline: none; }
.cp-field textarea { resize: vertical; line-height: 1.55; }
.cp-field input:focus, .cp-field select:focus, .cp-field textarea:focus, .cp-inline-confirm input:focus { border-color: #5b8def; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.cp-field input:disabled { color: #667085; background: #f2f4f7; }
.cp-field small, .cp-form-note { color: var(--cp-muted); font-size: 12px; line-height: 1.55; }
.cp-field-check { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
.cp-field-check input { width: 18px; min-height: 18px; margin: 0; }
.cp-field-check small, .cp-field-check .cp-field-error { grid-column: 2; }
.cp-field-error { color: #b42318; font-size: 12px; font-weight: 600; }
.cp-form-errors { padding: 11px 13px; color: #b42318; background: #fef3f2; border: 1px solid #f7b2ad; border-radius: 8px; }
.cp-form-errors ul { margin: 0; padding-left: 20px; }
.cp-form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.cp-form-actions button, .cp-secret-row button, .cp-sticky-actions button, .cp-inline-confirm button { min-height: 40px; padding: 9px 14px; color: #fff; background: var(--cp-blue); border: 0; border-radius: 7px; cursor: pointer; }
.cp-form-actions a { font-weight: 600; }
.cp-danger-zone { width: 100%; border-color: #f2c6c2; background: #fffdfd; }
.cp-inline-confirm { display: flex; align-items: end; gap: 12px; }
.cp-inline-confirm label { display: grid; gap: 5px; width: min(420px, 100%); font-weight: 650; }
.cp-inline-confirm button.danger { background: #b42318; }
.cp-alert-danger { color: #912018; background: #fef3f2; border-color: #f5aaa3; }
.cp-secret-panel { display: grid; gap: 16px; max-width: 980px; }
.cp-secret-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; background: #f8fafc; border: 1px solid var(--cp-line); border-radius: 8px; }
.cp-secret-row > div { display: grid; gap: 6px; min-width: 0; }
.cp-secret-row span, .cp-secret-template > span { color: #475467; font-weight: 650; }
.cp-secret-row code { overflow-wrap: anywhere; font-size: 13px; }
.cp-secret-template { display: grid; gap: 6px; }
.cp-secret-template textarea { min-height: 170px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.5; resize: vertical; }
.cp-settings-form { display: grid; gap: 16px; }
.cp-sticky-actions { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 15px; color: #344054; background: rgba(255,255,255,.96); border: 1px solid #b8c7dc; border-radius: 9px; box-shadow: 0 8px 28px rgba(26,43,72,.14); backdrop-filter: blur(8px); }
.cp-sticky-actions span { color: var(--cp-muted); }

.cp-login-body { display: grid; place-items: center; min-height: 100vh; padding: 30px; color: #fff; background: radial-gradient(circle at 12% 8%, #315a96, transparent 38%), linear-gradient(135deg, #0d1d37, #10294f 55%, #173d70); }
.cp-login-layout { width: min(980px, 100%); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); align-items: center; gap: 64px; }
.cp-login-intro { max-width: 540px; }
.cp-login-kicker { color: #84adff; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.cp-login-intro h1 { margin: 14px 0 12px; font-size: clamp(34px, 5vw, 52px); letter-spacing: -.04em; }
.cp-login-intro p { max-width: 500px; color: #c4d3e9; font-size: 16px; line-height: 1.8; }
.cp-login-intro ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; padding: 0; list-style: none; }
.cp-login-intro li { padding: 7px 10px; color: #d8e6f8; border: 1px solid rgba(255,255,255,.17); border-radius: 999px; font-size: 12px; }
.cp-login-card { padding: 32px; color: var(--cp-ink); background: rgba(255,255,255,.98); border: 1px solid rgba(255,255,255,.45); border-radius: 16px; box-shadow: 0 24px 70px rgba(2,11,29,.32); }
.cp-login-brand { display: flex; align-items: center; gap: 10px; }
.cp-login-brand small { color: var(--cp-muted); font-weight: 700; }
.cp-login-card h2 { margin: 25px 0 6px; font-size: 23px; }
.cp-login-card > p { margin: 0 0 20px; color: var(--cp-muted); }
.cp-login-error { margin-bottom: 14px; padding: 10px 12px; color: #b42318; background: #fef3f2; border: 1px solid #f7b2ad; border-radius: 7px; }
.cp-login-form { display: grid; gap: 15px; }
.cp-login-form label { display: grid; gap: 6px; color: #344054; font-weight: 650; }
.cp-login-form input { width: 100%; height: 44px; padding: 9px 11px; color: var(--cp-ink); background: #fff; border: 1px solid #b9c5d4; border-radius: 8px; outline: none; }
.cp-login-form input:focus { border-color: #5b8def; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.cp-login-form button { height: 44px; margin-top: 4px; color: #fff; background: linear-gradient(135deg, #2e6be6, #1e4ead); border: 0; border-radius: 8px; font-weight: 750; cursor: pointer; }
.cp-login-form button:hover { filter: brightness(1.04); }
.cp-login-note { display: block; margin-top: 18px; color: #98a2b3; text-align: center; }

@media (max-width: 1100px) {
  .cp-metrics { grid-template-columns: repeat(3, 1fr); }
  .cp-detail-grid { grid-template-columns: repeat(3, 1fr); }
  .cp-actions-grid { grid-template-columns: repeat(2, 1fr); }
  .cp-home-grid { grid-template-columns: 1fr; }
  .cp-form-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .cp-app { display: block; }
  .cp-sidebar { padding: 14px; }
  .cp-brand { padding-bottom: 13px; }
  .cp-nav { display: flex; overflow-x: auto; gap: 7px; padding-bottom: 2px; }
  .cp-nav p { display: none; }
  .cp-nav a { min-width: max-content; padding: 8px 11px; border: 1px solid rgba(255,255,255,.08); }
  .cp-nav a small { display: none; }
  .cp-nav a.active { box-shadow: none; }
  .cp-topbar { padding: 11px 16px; }
  .cp-topbar > div:first-child span { display: none; }
  .cp-shell { padding: 18px 14px 36px; }
  .cp-login-layout { grid-template-columns: 1fr; gap: 28px; }
  .cp-login-intro { text-align: center; margin: 0 auto; }
  .cp-login-intro ul { justify-content: center; }
}
@media (max-width: 620px) {
  .cp-topbar > div:first-child { display: none; }
  .cp-topbar { justify-content: flex-end; }
  .cp-user { width: 100%; justify-content: space-between; }
  .cp-page-head, .cp-panel-head { align-items: stretch; flex-direction: column; }
  .cp-metrics, .cp-detail-grid, .cp-actions-grid, .cp-home-metrics, .cp-shortcuts { grid-template-columns: 1fr; }
  .cp-inline-filter { align-items: stretch; flex-direction: column; }
  .cp-inline-filter label, .cp-inline-filter label:first-child { min-width: 0; }
  .cp-login-body { padding: 18px; }
  .cp-login-intro p { font-size: 14px; }
  .cp-login-intro ul { display: none; }
  .cp-login-card { padding: 24px 20px; }
  .cp-form-grid, .cp-form-grid-two, .cp-form-grid-three { grid-template-columns: 1fr; }
  .cp-config-values { grid-template-columns: 1fr; }
  .cp-inline-confirm, .cp-secret-row, .cp-sticky-actions { align-items: stretch; flex-direction: column; }
  .cp-inline-confirm label { width: 100%; }
}
