:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
  color: #182230;
  background: #edf1f4;
}

* { box-sizing: border-box; }

body { margin: 0; }

.hidden { display: none !important; }
.login-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: #edf1f4;
}
.login-card {
  width: min(100%, 380px); display: grid; gap: 12px; padding: 22px;
  border: 1px solid #d9e1e8; border-radius: 10px; background: #fff;
}
.login-card h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.login-card p { margin: 0; color: #52657a; line-height: 1.45; }
.login-eyebrow { color: #0f5f9c !important; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.form-username-context {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.login-message { min-height: 20px; color: #ae2635; font-size: 13px; font-weight: 700; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; flex: 0 0 200px; padding: 16px 12px;
  background: #0f2233; color: #d6e2ee; display: flex; flex-direction: column; gap: 16px;
}
.sidebar .brand .eyebrow { color: #7fa8c9; margin: 0 0 4px; font-size: 11px; letter-spacing: .08em; }
.sidebar h1 { color: #fff; font-size: 16px; margin: 0; letter-spacing: -.02em; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  min-height: 34px; padding: 7px 12px; border: 0; border-radius: 6px; text-align: left;
  background: transparent; color: #c3d3e2; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700;
}
.menu-item:hover { background: #1a3550; color: #fff; }
.menu-item.active { background: #0f5f9c; color: #fff; }
.sidebar-foot { margin-top: auto; color: #6f8aa3; font-size: 11px; line-height: 1.5; }
.content { flex: 1; min-width: 0; padding: 20px 16px 40px; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 10px; }
.metric-card { padding: 10px 12px; background: #fff; border: 1px solid #d9e1e8; border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.metric-card dt { color: #64748b; font-size: 11px; }
.metric-card dd { margin: 0; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.metric-sub { color: #52657a; font-size: 11px; }
.progress { height: 6px; background: #e6ecf1; border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: #0f5f9c; transition: width .4s ease; }
.auto-row { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.auto-row label { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; }
.auto-row input { width: 70px; min-height: 30px; text-align: center; font-family: Consolas, monospace; }
.auto-hint { margin: 8px 0 0; color: #52657a; font-size: 12px; }
.auto-countdown { margin: 4px 0 0; font-family: Consolas, monospace; font-size: 15px; font-weight: 700; color: #0f5f9c; }
.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.event-item { display: grid; grid-template-columns: 128px 1fr; gap: 8px; padding: 3px 8px; background: #f6f8fa; border-radius: 6px; font-size: 12px; }
.event-item span:first-child { color: #64748b; font-family: Consolas, monospace; }
.event-success span:last-child { color: #176343; }
.event-f011 span:last-child, .event-failure span:last-child, .event-error span:last-child { color: #ae2635; }
.token-text { font-family: Consolas, monospace; }

h1, h2, p { margin-top: 0; }
h2 { margin-bottom: 2px; font-size: 15px; }
p { color: #52657a; line-height: 1.45; }
.panel { margin-bottom: 10px; padding: 12px 14px; background: #fff; border: 1px solid #d9e1e8; border-radius: 8px; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-heading p { margin-bottom: 0; font-size: 12px; }
.duration-breakdown { margin-top: 6px; color: #47617a; font-size: 12px; }
.section-heading p[data-state="missing"] { color: #ae2635; font-weight: 700; }
.section-heading p[data-state="ready"] { color: #176343; }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.status-grid div { padding: 8px 10px; background: #f6f8fa; border-radius: 6px; }
dt { color: #64748b; font-size: 11px; }
dd { margin: 3px 0 0; overflow-wrap: anywhere; font-weight: 700; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; color: #30465c; font-size: 12px; font-weight: 700; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
label { display: grid; gap: 4px; color: #30465c; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #b9c7d5; border-radius: 5px; color: #182230; background: #fff; font: inherit; }
input, select { min-height: 32px; padding: 5px 8px; }
textarea { padding: 10px; resize: vertical; font-family: Consolas, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus, button:focus { outline: 3px solid #98b9d8; outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.button { min-height: 32px; padding: 5px 11px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.primary { color: #fff; background: #0f5f9c; }
.secondary { color: #1e4264; border-color: #aebfce; background: #fff; }
.success { color: #176343; border-color: #9fd3b6; background: #f0faf3; }
.danger { color: #8e2532; border-color: #dfadb5; background: #fff7f7; }
.result-label { margin-bottom: 6px; }
.feedback { min-height: 20px; margin: 8px 0 0; font-weight: 700; font-size: 13px; }
.feedback[data-state="error"] { color: #ae2635; }
.feedback[data-state="success"] { color: #176343; }
.feedback[data-state="pending"] { color: #47617a; }
.history-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 5px; margin: 0; padding-left: 20px; }
.history-item { display: grid; gap: 2px; padding: 5px 10px; background: #f6f8fa; border-radius: 6px; }
.history-item span, .history-empty { color: #52657a; font-size: 12px; line-height: 1.4; }
.node-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; align-items: stretch; }
.node-item { display: grid; gap: 3px; align-content: start; padding: 6px 10px; background: #f6f8fa; border-radius: 6px; }
.node-item span { color: #52657a; font-size: 12px; overflow-wrap: anywhere; }
/* 双高亮：current=下一个轮到的节点（绿）；last-used=刚使用过的节点（蓝）。 */
.node-item.last-used { background: #e8f1fb; box-shadow: inset 3px 0 0 #1f5f9c; }
.node-item.last-used strong { color: #14406e; }
.last-used-badge { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 4px; background: #1f5f9c; color: #fff; font-size: 11px; font-weight: 700; overflow-wrap: normal; }
.node-item.current { background: #e8f6ec; box-shadow: inset 3px 0 0 #1f8a4c; }
.node-item.current strong { color: #14603a; }
.current-badge { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 4px; background: #1f8a4c; color: #fff; font-size: 11px; font-weight: 700; overflow-wrap: normal; }
.node-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.node-actions .button { min-height: 26px; padding: 3px 9px; font-size: 12px; }
.node-empty { grid-column: 1 / -1; padding: 12px; background: #f6f8fa; border-radius: 6px; color: #52657a; font-size: 13px; list-style: none; }
.check-field { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; font-weight: 700; color: #30465c; }
.check-field input { width: 16px; height: 16px; min-height: 0; padding: 0; }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; flex-direction: row; align-items: center; gap: 10px; padding: 8px 12px; }
  .sidebar .brand h1 { font-size: 14px; }
  .menu { flex-direction: row; flex: 1; }
  .menu-item { flex: 1; text-align: center; min-height: 32px; padding: 5px 6px; }
  .sidebar-foot { display: none; }
  .content { padding-top: 14px; }
  .metric-grid, .status-grid, .field-grid { grid-template-columns: 1fr; }
  .auto-row { gap: 6px 10px; }
  .auto-row label { white-space: normal; }
  .node-list, .event-list, .history-list { grid-template-columns: 1fr; }
  .panel { padding: 10px 12px; }
  .section-heading { flex-direction: column; }
  .section-heading .button { width: 100%; }
  .history-actions { width: 100%; }
  .history-actions .button { flex: 1; }
  .event-item { grid-template-columns: 1fr; }
}
