:root {
  --bg: #f4f7fb;
  --card: rgba(255,255,255,0.92);
  --line: #dbe4f2;
  --text: #1c2840;
  --muted: #7c8aa5;
  --primary: #5b7cff;
  --primary-soft: #edf2ff;
  --danger: #f16678;
  --success: #1bbd7e;
  --warning: #d58a3d;
  --shadow: 0 18px 45px rgba(85, 108, 160, 0.12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #eff4ff 0%, #f7fbff 50%, #eef7f3 100%);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.auth-shell, .app-shell { min-height: 100vh; }
.auth-shell {
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 28px;
  padding: 28px; box-shadow: var(--shadow); display: grid; gap: 18px;
}
.auth-card h1 { margin: 0; font-size: 28px; }
.auth-card p { margin: 8px 0 0; color: var(--muted); }
.auth-card label, .form-stack label, .exec-left label, .schedule-card label { display: grid; gap: 8px; }
label span { color: var(--muted); font-size: 14px; }
input, select {
  width: 100%; min-height: 48px; border-radius: 18px; border: 1px solid var(--line);
  background: #fff; padding: 0 16px; outline: none; transition: .2s ease;
}
input:focus, select:focus { border-color: #9db2f8; box-shadow: 0 0 0 4px rgba(91,124,255,.12); }
.primary-btn, .ghost-btn, .danger-btn {
  min-height: 48px; border-radius: 18px; border: 1px solid transparent; padding: 0 18px; font-weight: 700;
}
.primary-btn { background: linear-gradient(135deg, #6d8bff, #5b7cff); color: #fff; }
.ghost-btn { background: var(--primary-soft); color: var(--primary); border-color: #d9e2ff; }
.danger-btn { background: #fff1f3; color: var(--danger); border-color: #ffd1d6; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 16px; border: 1px solid #d9e2ff; background: var(--primary-soft);
  color: var(--primary); display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 22px; height: 22px; }
.small { min-height: 40px; border-radius: 14px; padding: 0 14px; }
.wide { width: 100%; }
.auth-error { color: var(--danger); background: #fff2f4; border: 1px solid #ffd5dc; padding: 12px 14px; border-radius: 16px; }
.app-shell { padding: 20px; display: grid; gap: 18px; }
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 18px 24px; box-shadow: var(--shadow); gap: 12px;
}
.topbar h1 { margin: 0; font-size: 30px; text-align: center; justify-self: center; }
.topbar-side { min-width: 0; }
.topbar-side.right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.inline-actions { display: flex; gap: 10px; align-items: center; }
.muted-user, .current-account, .muted { color: var(--muted); }
.status-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.status-card, .panel-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.status-card { padding: 22px 24px; display: grid; gap: 10px; min-height: 120px; }
.status-card span { color: var(--muted); font-size: 14px; }
.status-card strong { font-size: 20px; line-height: 1.35; }
.success { color: var(--success); }
.warning { color: var(--warning); }
.workspace-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
.left-col, .center-col, .right-col { display: grid; gap: 18px; }
.panel-card { padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.card-head h2 { margin: 0; font-size: 22px; }
.form-stack { display: grid; gap: 14px; }
.execution-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
.exec-left { display: grid; gap: 14px; }
.schedule-card { border: 1px solid var(--line); border-radius: 22px; padding: 16px; background: #f9fbff; }
.schedule-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.switch { display: inline-flex; align-items: center; }
.switch input { display: none; }
.switch-ui {
  width: 118px; height: 44px; border-radius: 999px; border: 1px solid #dbe4ff; background: #eef3ff;
  display: flex; align-items: center; justify-content: space-between; padding: 0 10px; color: #7e8baa; font-weight: 700; position: relative; gap: 18px;
}
.switch-ui em { font-style: normal; font-size: 14px; position: relative; z-index: 1; min-width: 18px; }
.switch-ui .off { text-align: left; }
.switch-ui .on { text-align: right; }
.switch-ui b { position: absolute; left: 5px; width: 52px; height: 34px; border-radius: 999px; background: #fff; box-shadow: 0 6px 18px rgba(91,124,255,.18); transition: transform .22s ease, background .22s ease; }
.switch input:checked + .switch-ui b { transform: translateX(56px); background: #22c07a; }
.switch input:checked + .switch-ui { background: #eafaf2; border-color: #bde9cf; color: #4f7d60; }
.product-topline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; margin-bottom: 16px; }
.grow { display: grid; gap: 8px; }
.align-end { align-self: end; }
.price-banner {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; border: 1px solid var(--line); background: #f7faff; border-radius: 20px; padding: 18px 20px;
}
.price-banner strong { font-size: 42px; }
.price-banner span { color: var(--muted); }
.product-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.option-card {
  border: 1px solid var(--line); border-radius: 22px; background: #fbfdff; padding: 16px; display: grid; gap: 10px;
}
.option-card.full { grid-column: 1 / -1; }
.option-card h3 { margin: 0; font-size: 18px; }
.option-card small { color: var(--muted); }
.log-wrap { position: relative; }
.log-list {
  display: grid; gap: 8px; max-height: 70vh; overflow-y: auto; padding-right: 6px; scroll-behavior: smooth;
}
.log-item {
  background: #f8fbff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; color: #384764; line-height: 1.45; display: grid; gap: 6px;
}
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.log-head time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.log-message { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.log-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.scroll-top-btn {
  position: absolute; right: 14px; bottom: 14px; width: 42px; height: 42px; border-radius: 999px; border: 1px solid rgba(91,124,255,.18);
  background: rgba(255,255,255,.92); box-shadow: 0 10px 28px rgba(35,51,84,.14); color: var(--primary); font-size: 20px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transform: translateY(10px); transition: .18s ease;
}
.scroll-top-btn.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.log-item.success { background: #f4fcf8; border-color: #c9edd9; }
.log-item.success .log-badge { background: #dcf7e8; color: #149862; }
.log-item.warning { background: #fffaf3; border-color: #f2dfba; }
.log-item.warning .log-badge { background: #fff0cc; color: #bd7c24; }
.log-item.error { background: #fff5f6; border-color: #f5d2d8; }
.log-item.error .log-badge { background: #ffe0e6; color: #d3485d; }
.log-item.info { background: #f6f9ff; border-color: #dbe4f8; }
.log-item.info .log-badge { background: #e8efff; color: #5776ef; }
.empty-log, .empty-block {
  min-height: 140px; display: flex; align-items: center; justify-content: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 20px; background: #fafcff;
}
.badge { display: inline-flex; min-height: 36px; padding: 0 14px; align-items: center; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 28, 44, 0.28); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50;
}
.modal-card {
  width: min(1220px, 100%); max-height: 88vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 30px; box-shadow: 0 30px 90px rgba(36, 48, 83, 0.2); padding: 22px;
}
.account-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.account-tile {
  border: 1px solid var(--line); border-radius: 22px; padding: 14px; background: #fbfdff; display: grid; gap: 12px;
}
.account-tile.active { border-color: #afc0ff; background: #f5f8ff; }
.account-tile input { min-height: 44px; }
.account-tile-meta { color: var(--muted); font-size: 14px; }
.account-tile-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.settings-modal { width: min(620px, 100%); }
.settings-grid { display: grid; gap: 14px; }
.settings-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: rgba(20,28,44,.9); color: #fff; padding: 12px 18px; border-radius: 999px; z-index: 60;
}
@media (max-width: 1440px) {
  .status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workspace-grid { grid-template-columns: 320px minmax(0, 1fr); }
  .right-col { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .execution-layout { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .app-shell { padding: 14px; }
  .card-head, .product-topline { flex-direction: column; align-items: stretch; }
  .topbar { grid-template-columns: 1fr; }
  .topbar-side.right { justify-content: center; }
  .status-grid, .product-option-grid, .account-grid { grid-template-columns: 1fr; }
  .price-banner strong { font-size: 30px; }
}


.pid-modal { width: min(980px, 100%); }
.pid-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.pid-card { border: 1px solid var(--line); border-radius: 22px; background: #fbfdff; padding: 16px; display: grid; gap: 12px; text-align: left; color: var(--text); transition: .18s ease; }
.pid-card:hover { border-color: #afc0ff; background: #f4f8ff; transform: translateY(-1px); }
.pid-card-top, .pid-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pid-card-top span, .pid-card-meta span { color: var(--muted); font-size: 13px; }
.pid-card-name { font-weight: 700; line-height: 1.5; min-height: 44px; }
.schedule-toggle { display: inline-flex; align-items: center; cursor: pointer; }
.schedule-toggle input { display: none; }
.schedule-toggle-ui { display: grid; grid-template-columns: 18px 82px 18px; align-items: center; gap: 12px; }
.schedule-toggle-ui em { font-style: normal; font-size: 13px; font-weight: 700; color: #98a4bb; }
.schedule-toggle.enabled .on { color: var(--success); }
.schedule-toggle:not(.enabled) .off { color: var(--text); }
.schedule-toggle-ui .track { position: relative; height: 36px; border-radius: 999px; background: #e8eef8; border: 1px solid #d7e0f0; box-shadow: inset 0 2px 8px rgba(87, 107, 147, 0.08); }
.schedule-toggle-ui .track b { position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 8px 18px rgba(93, 112, 153, 0.2); transition: transform .2s ease, background .2s ease; }
.schedule-toggle.enabled .track { background: rgba(27,189,126,0.14); border-color: rgba(27,189,126,0.32); }
.schedule-toggle.enabled .track b { transform: translateX(46px); background: var(--success); }
@media (max-width: 1100px) { .pid-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .pid-grid { grid-template-columns: 1fr; } .schedule-toggle-ui { grid-template-columns: 18px 74px 18px; gap: 10px; } .schedule-toggle.enabled .track b { transform: translateX(38px); } }

.pid-tabs { display:flex; gap:10px; margin-bottom:16px; }
.pid-tab { min-height:44px; padding:0 16px; border-radius:16px; border:1px solid var(--line); background:#f6f9ff; color:var(--muted); font-weight:700; display:inline-flex; align-items:center; gap:8px; }
.pid-tab span { color:inherit; font-size:12px; }
.pid-tab.active { background:var(--primary-soft); color:var(--primary); border-color:#d9e2ff; }
.pid-empty { min-height:180px; border:1px dashed var(--line); border-radius:22px; background:#fafcff; display:flex; align-items:center; justify-content:center; color:var(--muted); }
.pid-tag { display:inline-flex; align-items:center; min-height:28px; padding:0 10px; border-radius:999px; background:#eef3ff; color:var(--primary) !important; font-size:12px !important; font-weight:700; }
