:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --soft: #f8fafc;
  --line: #d7deea;
  --text: #1f2937;
  --muted: #667085;
  --ink: #111827;
  --blue: #2563eb;
  --cyan: #0e7490;
  --green: #07845d;
  --amber: #b45309;
  --red: #c24132;
  --sidebar: #172033;
  --shadow: 0 14px 34px rgba(20, 31, 54, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
.hidden { display: none !important; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, #eef4ff 0%, #f8fafc 100%); }
.login-panel { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 28px; }
.login-panel h1 { margin: 24px 0 8px; font-size: 26px; letter-spacing: 0; }
.login-panel p { color: var(--muted); line-height: 1.7; }

.brand-row, .brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: #fff; color: var(--blue); display: grid; place-items: center; flex: 0 0 auto; }
.login-panel .brand-mark { background: #eff6ff; }
.brand-mark svg { width: 20px; height: 20px; }
.brand strong, .brand-row strong { display: block; font-size: 15px; }
.brand span, .brand-row span { display: block; margin-top: 3px; color: #8a95a8; font-size: 12px; }

.form { display: grid; gap: 12px; }
.form label span, .inline-form label span { display: block; margin-bottom: 6px; color: #344054; font-size: 12px; font-weight: 700; }
.form input, .form textarea, .form select, .inline-form input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); padding: 10px 11px; outline: none;
}
.form input:focus, .form textarea:focus, .form select:focus, .inline-form input:focus { border-color: #94b7ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.form textarea { min-height: 132px; resize: vertical; line-height: 1.6; }
.inline-form { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(120px, .7fr) 92px 92px auto; gap: 8px; margin-bottom: 12px; }
.error { color: var(--red); margin-top: 10px; min-height: 20px; font-size: 13px; }
.success { color: var(--green); background: #ecfdf3; border-radius: 8px; padding: 10px; margin-bottom: 10px; font-size: 13px; line-height: 1.6; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); color: #eef4ff; padding: 22px 18px; display: flex; flex-direction: column; gap: 18px; }
.brand { padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,0.14); }
.nav { display: grid; gap: 8px; }
.nav button { border: 0; border-radius: 8px; background: transparent; color: #cbd5e1; padding: 11px 12px; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 10px; font-weight: 700; min-height: 42px; }
.nav button.active { background: #2a3550; color: #fff; }
.nav svg, .btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.sidebar-note { margin-top: auto; padding: 14px; border-radius: 8px; background: rgba(255,255,255,.08); color: #dbe5f3; font-size: 12px; line-height: 1.7; }

.main { padding: 22px 28px 34px; overflow: auto; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.title h1 { margin-bottom: 7px; font-size: 24px; letter-spacing: 0; }
.title p { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.account-pill { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px 10px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.mini-btn { border: 1px solid var(--line); background: var(--soft); border-radius: 7px; color: #344054; padding: 5px 8px; cursor: pointer; }
.notice { background: #fff7ed; color: var(--amber); border: 1px solid #fed7aa; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.view { display: none; }
.view.active { display: block; }

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 16px; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); }
.panel, .metric, .task-box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 0 rgba(16,24,40,.03); }
.panel, .task-box { padding: 16px; }
.metric { padding: 15px; min-height: 100px; }
.metric .label { color: var(--muted); font-size: 13px; }
.metric .value { margin-top: 11px; font-size: 25px; font-weight: 800; color: var(--ink); }
.metric .hint { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin-bottom: 5px; font-size: 16px; letter-spacing: 0; }
.panel-head p { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.ok { color: var(--green); background: #ecfdf3; }
.warn { color: var(--amber); background: #fff7ed; }
.bad { color: var(--red); background: #fff1f0; }
.neutral { color: #475467; background: #f2f4f7; }
.blue { color: var(--blue); background: #eff6ff; }
.cyan { color: var(--cyan); background: #ecfeff; }
.dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; display: inline-block; }
.ok-dot { color: var(--green); }
.btn { border: 1px solid var(--line); background: #fff; color: #344054; border-radius: 8px; min-height: 38px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 700; }
.btn.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.btn:disabled { opacity: .6; cursor: wait; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid #edf1f7; vertical-align: middle; }
th { color: var(--muted); font-weight: 700; background: var(--soft); }
tr:last-child td { border-bottom: 0; }
.code { font-family: Consolas, "Courier New", monospace; color: #344054; }

.rule-list, .switch-list, .event-list { display: grid; gap: 9px; }
.event-list { max-height: 330px; overflow: auto; padding-right: 4px; align-content: start; }
.event-list::-webkit-scrollbar, .log-box::-webkit-scrollbar { width: 8px; height: 8px; }
.event-list::-webkit-scrollbar-thumb, .log-box::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.event-note { position: sticky; top: 0; z-index: 1; border: 1px solid #e3e8f0; border-radius: 8px; background: #fff; color: var(--muted); padding: 8px 10px; font-size: 12px; line-height: 1.4; }
.rule, .switch-row, .event-item { border: 1px solid #edf1f7; border-radius: 8px; background: var(--soft); padding: 10px; font-size: 13px; }
.rule { display: grid; grid-template-columns: 118px minmax(0,1fr); gap: 10px; }
.rule strong { color: var(--ink); }
.rule span, .switch-row p { color: var(--muted); line-height: 1.5; }
.event-item { display: grid; gap: 4px; min-height: 78px; }
.event-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; min-width: 0; }
.event-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-meta { color: var(--muted); line-height: 1.45; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-message { color: #475467; }
.action-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }

.ops-hero { background: #172033; color: #fff; border-radius: 8px; padding: 22px; display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 20px; align-items: center; box-shadow: var(--shadow); margin-bottom: 16px; }
.ops-hero h2 { margin-bottom: 8px; font-size: 22px; letter-spacing: 0; }
.ops-hero p { margin-bottom: 0; color: #d5deec; line-height: 1.7; font-size: 13px; }
.eyebrow { color: #9cc9ff; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 7px; }
.license-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 8px; padding: 14px; }
.license-card .code { display: block; margin-top: 9px; color: #fff; font-size: 15px; font-weight: 800; }
.license-card p { margin: 8px 0 0; color: #d5deec; font-size: 12px; }

.flow-panel { min-height: 280px; }
.flow-main { display: grid; grid-template-columns: minmax(0, 1fr) 86px; gap: 16px; align-items: start; margin-bottom: 14px; }
.flow-phase { font-size: 21px; line-height: 1.25; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.flow-detail { color: var(--muted); font-size: 13px; line-height: 1.65; }
.flow-percent { text-align: right; color: var(--blue); font-size: 28px; font-weight: 850; line-height: 1; }
.progress-track { height: 10px; background: #e8edf5; border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress-track > div { height: 100%; width: 0%; background: linear-gradient(90deg, #2563eb, #0e7490); border-radius: inherit; transition: width .2s ease; }
.queue-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.queue-pill { border: 1px solid #e3e8f0; background: #fff; border-radius: 8px; padding: 9px; min-height: 58px; }
.queue-pill span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.queue-pill strong { color: var(--ink); font-size: 19px; }
.issue-line { border: 1px solid #edf1f7; background: #fff; border-radius: 8px; padding: 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.runner-window { background: #edf2f8; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.runner-titlebar { min-height: 42px; background: #243048; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 14px; font-size: 13px; }
.window-dots { display: flex; gap: 6px; }
.window-dots span { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; }
.runner-body { padding: 16px; display: grid; gap: 14px; }
.runner-status { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.mini-status { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; min-height: 56px; }
.lane-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 10px; }
.lane-grid.compact { grid-template-columns: repeat(5, minmax(110px, 1fr)); }
.lane { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 12px; min-height: 112px; }
.lane h3 { margin: 0 0 9px; font-size: 13px; color: #344054; }
.lane strong { display: block; color: var(--ink); font-size: 23px; margin-bottom: 5px; }
.lane p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.log-box { height: 230px; overflow: auto; background: #101828; color: #d8e1f1; border-radius: 8px; padding: 12px; font-family: Consolas, "Courier New", monospace; font-size: 12px; line-height: 1.7; }

@media (max-width: 1180px) {
  .grid-4, .runner-status, .lane-grid, .lane-grid.compact, .queue-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2.wide-left, .ops-hero { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .topbar, .panel-head { flex-direction: column; }
  .grid-4, .runner-status, .lane-grid, .lane-grid.compact, .inline-form, .queue-strip { grid-template-columns: 1fr; }
  .flow-main { grid-template-columns: 1fr; }
  .flow-percent { text-align: left; }
}
