:root {
  color-scheme: light;
  --navy: #091b2c;
  --navy-2: #102b47;
  --blue: #1677ff;
  --blue-dark: #0958d9;
  --blue-soft: #eaf3ff;
  --bg: #f3f6fa;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #6b7787;
  --line: #dde5ee;
  --danger: #d9363e;
  --success: #12805c;
  --warning: #ad6800;
  --shadow: 0 10px 30px rgba(19, 45, 77, .08);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--text); background: var(--bg); font: 14px/1.55 "Microsoft YaHei", "PingFang SC", Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.primary { background: var(--blue); color: #fff; }
.primary:hover { background: var(--blue-dark); }
.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); }
.danger { color: var(--danger); }

/* Login */
.auth-page { min-height: 100vh; position: relative; overflow: hidden; background:
  radial-gradient(circle at 4% 8%, rgba(55, 151, 255, .55), transparent 14%),
  radial-gradient(circle at 92% 90%, rgba(69, 135, 255, .12), transparent 26%),
  linear-gradient(120deg, #f4f9ff 0%, #fff 52%, #eef5ff 100%); }
.auth-logo { position: absolute; top: 28px; right: 46px; display: flex; align-items: center; gap: 8px; font-size: 28px; font-weight: 700; color: #2478d8; z-index: 3; }
.logo-mark { width: 36px; height: 36px; display: inline-grid; place-items: center; color: #fff; background: linear-gradient(145deg, #3349ff, #16a5ff); clip-path: polygon(50% 0, 100% 55%, 78% 55%, 78% 100%, 22% 100%, 22% 55%, 0 55%); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(520px, 1fr) 420px; gap: 70px; align-items: center; max-width: 1380px; margin: 0 auto; padding: 80px 70px 50px; }
.auth-headline { font-size: clamp(38px, 4.2vw, 64px); line-height: 1.15; font-weight: 800; margin: 0 0 12px; color: #101722; }
.auth-headline strong { color: #1677ff; font-style: italic; }
.auth-subtitle { font-size: clamp(28px, 3vw, 46px); line-height: 1.25; font-weight: 800; margin: 0 0 34px; }
.feature-list { display: grid; gap: 15px; max-width: 680px; }
.feature { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; background: rgba(226, 239, 255, .62); padding: 9px 10px; }
.feature span:first-child { background: var(--blue); color: #fff; padding: 3px 10px; white-space: nowrap; }
.feature span:last-child { font-size: 24px; color: #42546a; }
.auth-card { background: rgba(255,255,255,.96); border: 1px solid #e6edf5; border-radius: 14px; box-shadow: var(--shadow); padding: 26px 28px 24px; }
.auth-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.auth-tab { background: transparent; padding: 0 0 12px; color: var(--muted); font-size: 16px; border-bottom: 2px solid transparent; }
.auth-tab.active { color: var(--text); font-weight: 700; border-color: var(--blue); }
.form-grid { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: #53606e; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; outline: none; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #74aaff; box-shadow: 0 0 0 3px rgba(22,119,255,.1); }
.auth-submit { width: 100%; border-radius: 7px; padding: 11px 16px; color: #fff; background: var(--blue); margin-top: 4px; }
.auth-switch { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 2px; }
.auth-switch button { padding: 0; color: var(--blue); background: transparent; }
.agreement { color: #8a95a3; font-size: 12px; margin-top: 16px; }
.form-message { padding: 9px 11px; border-radius: 7px; margin-bottom: 12px; font-size: 13px; }
.form-message.error { background: #fff2f0; color: #b42318; border: 1px solid #ffd5d2; }
.form-message.success { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }

/* App shell */
.app-shell { min-height: 100vh; background: var(--bg); }
.topbar { height: 62px; background: var(--navy); color: #fff; display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.topbar .brand { width: 215px; display: flex; align-items: center; gap: 9px; font-size: 22px; font-weight: 800; color: #2f8cff; }
.topbar .brand .logo-mark { width: 28px; height: 28px; font-size: 0; }
.top-nav { display: flex; align-self: stretch; }
.top-nav button { align-self: stretch; min-width: 92px; padding: 0 20px; color: #e7eef8; background: transparent; border-left: 1px solid rgba(255,255,255,.03); }
.top-nav button:hover, .top-nav button.active { background: rgba(47, 126, 255, .2); color: #fff; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 15px; color: #d8e4f4; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #4794ff, #165acb); font-weight: 700; }
.page { max-width: 1660px; margin: 0 auto; padding: 18px 22px 40px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.panel { background: var(--panel); border: 1px solid #e7edf4; border-radius: 8px; box-shadow: 0 3px 12px rgba(20, 47, 80, .045); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px 12px; border-bottom: 1px solid #eef2f6; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 18px; }
.panel-body { padding: 18px; }
.tabs-line { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs-line button { background: transparent; padding: 0 0 10px; color: #526174; border-bottom: 2px solid transparent; }
.tabs-line button.active { color: var(--blue); font-weight: 700; border-color: var(--blue); }
.dashboard-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.store-select { min-width: 190px; }
input, select { height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; background: #fff; color: var(--text); }
.btn { height: 36px; padding: 0 16px; border-radius: 6px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-top: 4px; }
.summary-card { min-height: 105px; padding: 16px; border: 1px solid #e9eef4; border-radius: 7px; background: linear-gradient(145deg, #fff, #fbfdff); position: relative; overflow: hidden; }
.summary-card span { color: #53606e; }
.summary-card strong { display: block; margin-top: 18px; font-size: 25px; }
.summary-card::after { content: ""; width: 70px; height: 70px; border-radius: 50%; background: rgba(22,119,255,.06); position: absolute; right: -10px; bottom: -25px; }
.side-stack { display: grid; gap: 18px; align-content: start; }
.quick-grid { display: grid; gap: 12px; }
.quick-item { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 7px; background: #f8fbff; border: 1px solid #e7f0ff; }
.quick-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: #e8f2ff; color: var(--blue); font-weight: 800; }
.empty { min-height: 260px; display: grid; place-items: center; color: #9ba6b3; text-align: center; }
.empty-box { width: 120px; height: 110px; border-radius: 12px; border: 1px solid #e9edf2; background: #fbfcfd; margin: 0 auto 10px; display: grid; place-items: center; font-size: 32px; color: #c5ced8; }

/* Monitor */
.monitor-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 62px); }
.sidebar { background: #fff; border-right: 1px solid #e2e8f0; padding: 12px 0; }
.sidebar-title { padding: 8px 18px 12px; color: #7b8794; font-size: 12px; }
.sidebar-item { width: 100%; height: 43px; display: flex; align-items: center; gap: 10px; padding: 0 18px; color: #344256; background: #fff; text-align: left; }
.sidebar-item:hover { background: #f5f9ff; }
.sidebar-item.active { color: #0958d9; background: #eaf3ff; border-left: 4px solid var(--blue); padding-left: 14px; }
.monitor-main { min-width: 0; padding: 20px 22px 40px; }
.monitor-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.monitor-head h1 { margin: 0; font-size: 22px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid #eef2f6; }
.filter-bar input, .filter-bar select { min-width: 150px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 12px 14px; border-bottom: 1px solid #edf1f5; text-align: left; }
th { background: #dbe9ff; color: #24354b; font-weight: 700; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #aeb8c4; }
.status-dot.ok { background: #19a36b; }
.status-dot.warn { background: #d99000; }
.rule-detail { max-width: 570px; white-space: normal; color: #5c6877; font-size: 12px; line-height: 1.7; }
.text-actions { display: flex; gap: 10px; }
.text-actions button { padding: 0; background: transparent; color: var(--blue); }
.text-actions button.danger { color: var(--danger); }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 14px 16px; color: var(--muted); }
.placeholder-note { margin: 16px; padding: 16px; border-radius: 8px; background: #f6faff; border: 1px solid #d9e8ff; color: #42607f; }
.authorize-list { display: grid; gap: 10px; }
.authorize-item { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; padding: 13px 14px; }
.authorize-item:hover { border-color: #8bbaff; background: #f8fbff; }

@media (max-width: 980px) {
  .auth-wrap { grid-template-columns: 1fr; padding: 90px 22px 30px; }
  .auth-logo { top: 22px; right: 22px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .monitor-layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-title { display: none; }
  .sidebar-item { width: auto; min-width: max-content; border-left: 0 !important; border-bottom: 3px solid transparent; }
  .sidebar-item.active { border-left: 0; border-bottom-color: var(--blue); }
  .topbar { padding: 0 12px; }
  .topbar .brand { width: auto; margin-right: 10px; }
  .page, .monitor-main { padding: 14px; }
}

/* Rule editor */
.rule-editor { padding: 16px; display: grid; gap: 16px; }
.rule-section { border: 1px dashed #cfd9e6; border-radius: 8px; padding: 16px; background: #fff; }
.rule-section .section-title { font-weight: 700; margin-bottom: 14px; }
.rule-form-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; }
.rule-form-grid label, .wide-label { display: grid; gap: 6px; color: #53606e; font-size: 13px; }
.rule-form-grid input, .rule-form-grid select { width: 100%; }
.switch-line { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.switch-line input { width: auto; height: auto; }
.condition-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; width: max-content; max-width: 100%; }
.condition-row select[data-key="field"] { width: 240px; }
.condition-row select[data-key="operator"] { width: 105px; }
.condition-value-wrap { display: flex; align-items: center; gap: 6px; }
.condition-value-wrap input { width: 120px; }
.condition-unit { color: #788595; min-width: 16px; }
.condition-match-wrap { display: flex; align-items: center; gap: 8px; color: #53606e; white-space: nowrap; }
.condition-match-wrap select { width: 95px; }
.condition-row .text-action { padding: 0 6px; }
.add-condition { width: auto; padding: 8px 14px; background: #edf5ff; color: var(--blue); border: 0; border-radius: 6px; }
.plan-transfer { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-column { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.plan-column-head { padding: 10px 12px; background: #eef4fb; color: #344256; font-weight: 700; }
.plan-column > input { width: calc(100% - 24px); margin: 10px 12px 0; }
.plan-list { min-height: 180px; max-height: 260px; overflow: auto; padding: 10px 12px; }
.plan-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; border-bottom: 1px solid #eef2f6; padding: 9px 0; }
.plan-item button, .text-action { border: 0; background: transparent; color: var(--blue); padding: 0; }
.plan-item button.danger, .text-action.danger { color: var(--danger); }
.plan-empty { padding: 55px 0; text-align: center; color: #9ba6b3; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; }
.log-line { padding: 8px 0; border-bottom: 1px solid #eef2f6; color: #526174; }
@media (max-width: 900px) {
  .rule-form-grid, .plan-transfer { grid-template-columns: 1fr; }
  .condition-row { width: 100%; }
}

.tutorial { display: grid; gap: 7px; padding: 12px; margin-bottom: 14px; border-radius: 7px; background: #f7fbff; color: #4d5d70; }
.contact-options { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 0; }
.contact-option { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.contact-option input { width: auto; height: auto; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; }
.metric-grid label { display: grid; gap: 5px; color: #53606e; font-size: 12px; }
.metric-grid input { width: 100%; }
.dry-run-result { margin: 14px 0 0; padding: 12px; border-radius: 7px; background: #f5faff; border: 1px solid #d8e8ff; color: #35526f; white-space: pre-wrap; min-height: 60px; }
@media (max-width: 900px) { .metric-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); } }

.scheduler-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: #f8fbff; border-bottom: 1px solid #e7eef7; }
.scheduler-info { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.scheduler-info input { width: 64px; height: 30px; }
.scheduler-actions { display: flex; align-items: center; gap: 8px; }
.scheduler-interval { display: flex; align-items: center; gap: 6px; color: #53606e; font-size: 13px; }
.scheduler-interval input { width: 64px; height: 30px; }
.log-detail { max-width: 700px; white-space: normal; color: #526174; }

.pending-plans { display: grid; gap: 8px; }
.pending-plan { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fbfdff; }
