/* 报销机器人 运维监控：1920×1080 铺满视口的应用式排版（顶栏 + 三栏，各栏各自滚动）；手机上改为单栏整页滚动。 */
:root {
  --bg: #eef1f5;
  --card: #ffffff;
  --line: #dfe4ec;
  --line-soft: #edf0f5;
  --text: #1d2733;
  --muted: #677485;
  --soft: #f6f8fb;
  --green: #17803d;
  --green-bg: #e4f4ea;
  --orange: #c25100;
  --orange-bg: #fff0e0;
  --red: #c4302b;
  --red-bg: #fdecea;
  --blue: #1f5fbf;
  --blue-bg: #e8f0fd;
  --grey: #5f6b7a;
  --grey-bg: #eceff3;
  --mode: #8a94a3;
  --radius: 10px;
}
body.mode-production { --mode: var(--green); }
body.mode-debug { --mode: var(--orange); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.noscript { padding: 24px; }
.boot { padding: 40px; color: var(--muted); text-align: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 14px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; font-weight: 500; line-height: 1.2;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #194f9f; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--soft); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover:not(:disabled) { background: #126631; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover:not(:disabled) { background: #a34400; }
.btn-block { width: 100%; min-height: 42px; font-size: 15px; }
.btn-big { min-height: 44px; padding: 8px 18px; font-size: 15px; }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 14px;
  background: linear-gradient(160deg, #e9eef6 0%, #f6f8fb 60%, #eef3f0 100%);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px 26px 20px; box-shadow: 0 10px 30px rgba(24, 39, 75, .08); display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { font-size: 20px; }
.login-sub { color: var(--muted); margin-top: -8px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.field input {
  height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
  font-weight: 400; font-size: 15px;
}
.field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 95, 191, .15); }
.field .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.form-msg { min-height: 20px; font-size: 13px; color: var(--red); }
.form-msg.ok { color: var(--green); }
.form-msg.info { color: var(--muted); }

/* ---------- 主界面骨架 ---------- */
.app {
  height: 100vh; display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden;
}
.topbar {
  grid-row: 1; display: flex; align-items: center; gap: 18px; padding: 8px 14px; background: #fff;
  border-top: 4px solid var(--mode); border-bottom: 1px solid var(--line);
}
.brand { font-size: 17px; font-weight: 700; white-space: nowrap; }
.mode-badge {
  padding: 5px 16px; border-radius: 999px; font-weight: 700; font-size: 15px; letter-spacing: .5px;
  background: var(--grey-bg); color: var(--grey); white-space: nowrap;
}
body.mode-production .mode-badge { background: var(--green); color: #fff; }
body.mode-debug .mode-badge { background: var(--orange); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.refresh-info { color: var(--muted); font-size: 13px; margin-right: 6px; white-space: nowrap; }
.refresh-info.busy::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  grid-row: 2; margin: 10px 14px 0; padding: 10px 14px; border-radius: 8px; font-weight: 500;
  background: var(--red-bg); color: var(--red); border: 1px solid #f3c4c1;
}
.banner.warn { background: var(--orange-bg); color: var(--orange); border-color: #f5cfa6; }

.columns {
  grid-row: 3; min-height: 0; display: grid; gap: 12px; padding: 12px 14px 14px;
  grid-template-columns: minmax(340px, 1fr) minmax(420px, 1.45fr) minmax(340px, 1.1fr);
}
.col { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.col-c .card-fill { flex: 1 0 auto; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card h2 {
  font-size: 15px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 8px;
}
.card h2 .count { color: var(--muted); font-weight: 400; font-size: 13px; }
.card-body { padding: 12px 14px; }
.card-mode { border: 2px solid var(--mode); }
.section-title { font-weight: 600; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.section-title:first-child { margin-top: 0; }
.err { color: var(--red); }

/* 模式卡 */
.mode-now {
  display: inline-block; font-size: 24px; font-weight: 800; padding: 4px 16px; border-radius: 10px;
  background: var(--grey-bg); color: var(--grey);
}
.mode-now.production { background: var(--green-bg); color: var(--green); }
.mode-now.debug { background: var(--orange-bg); color: var(--orange); }
.mode-desc { margin: 10px 0 8px; font-size: 14px; }
.mode-actions { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.mode-hint { font-size: 12px; color: var(--muted); }
.mode-warn { margin-top: 8px; font-size: 13px; color: var(--orange); }
.result-box { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; border: 1px solid var(--line); }
.result-box.ok { background: var(--green-bg); color: var(--green); border-color: #bfe3cc; }
.result-box.bad { background: var(--red-bg); color: var(--red); border-color: #f3c4c1; }
.result-box.warn { background: var(--orange-bg); color: var(--orange); border-color: #f5cfa6; }
.result-box p + p { margin-top: 4px; }

/* 键值行 */
.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); column-gap: 12px; row-gap: 0; }
.kv > .k { color: var(--muted); padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.kv > .v { padding: 7px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; overflow-wrap: anywhere; }
.kv > .k:nth-last-child(2), .kv > .v:last-child { border-bottom: 0; }
.v .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* 状态小标签 */
.pill {
  display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px;
  background: var(--grey-bg); color: var(--grey); white-space: nowrap; vertical-align: 1px;
}
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.warn { background: var(--orange-bg); color: var(--orange); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.info { background: var(--blue-bg); color: var(--blue); }
.pill + .pill { margin-left: 4px; }

/* 磁盘条 */
.bar { height: 8px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; margin-top: 5px; max-width: 280px; }
.bar-fill { height: 100%; background: var(--green); border-radius: 999px; }
.bar-fill.warn { background: var(--orange); }
.bar-fill.bad { background: var(--red); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; overflow-wrap: anywhere; }
.table tr:last-child td { border-bottom: 0; }
.table td.name { font-weight: 600; white-space: nowrap; }
.table td.when { white-space: nowrap; }
.table .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

/* 数字块 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.tile { background: var(--soft); border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 12px; }
.tile .num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.tile .lbl { color: var(--muted); font-size: 12px; }
.tile.warn .num { color: var(--orange); }
.tile.bad .num { color: var(--red); }

/* 列表 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.list li:last-child { border-bottom: 0; }
.list .line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.list .line2 { color: var(--muted); font-size: 12px; margin-top: 2px; }
.empty { color: var(--muted); font-size: 13px; padding: 4px 0; }

/* 告警 */
.alert-item .ts { color: var(--muted); font-size: 12px; white-space: nowrap; }
.alert-item .src { color: var(--muted); font-size: 12px; }
.alert-item .text { margin-top: 3px; white-space: pre-wrap; word-break: break-word; font-size: 13px; }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 14px;
  padding: 20px 22px 18px; box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
.modal h3 { font-size: 18px; margin-bottom: 12px; }
.modal-body { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.effect { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); }
.effect.debug { background: var(--orange-bg); border-color: #f5cfa6; color: #8a3a00; }
.effect.production { background: var(--green-bg); border-color: #bfe3cc; color: #0f5a2b; }
.effect b { display: block; margin-bottom: 2px; }
.progress { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.progress::before {
  content: ""; flex: 0 0 auto; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .8s linear infinite;
}

/* ---------- 中等宽度：两栏（左栏占满高度，右边上下两块） ---------- */
@media (max-width: 1279px) and (min-width: 901px) {
  .columns { grid-template-columns: minmax(320px, 1fr) minmax(0, 1.3fr); grid-template-rows: minmax(0, 1.4fr) minmax(0, 1fr); }
  .col-a { grid-row: 1 / span 2; grid-column: 1; }
  .col-b { grid-row: 1; grid-column: 2; }
  .col-c { grid-row: 2; grid-column: 2; }
  .refresh-info { display: none; }
}

/* ---------- 手机：单栏，整页滚动 ---------- */
@media (max-width: 900px) {
  .app { height: auto; min-height: 100%; display: block; overflow: visible; }
  .topbar {
    position: sticky; top: 0; z-index: 20; flex-wrap: wrap; gap: 6px 10px; padding: 8px 10px;
  }
  .brand { font-size: 15px; }
  .mode-badge { font-size: 14px; padding: 4px 12px; }
  .topbar-right { width: 100%; margin-left: 0; gap: 6px; }
  .refresh-info { margin-right: auto; font-size: 12px; white-space: normal; }
  .topbar-right .btn { min-height: 32px; padding: 5px 10px; font-size: 13px; }
  .banner { margin: 8px 10px 0; }
  .columns { display: block; padding: 10px; }
  .col { overflow: visible; padding-right: 0; }
  .col + .col { margin-top: 12px; }
  .kv { grid-template-columns: 78px minmax(0, 1fr); }
  .mode-now { font-size: 22px; }
  .btn-big { width: 100%; }
  /* 定时任务表在窄屏上一行一块 */
  .table.stack thead { display: none; }
  .table.stack tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { display: block; border: 0; padding: 2px 0; white-space: normal; }
  .table.stack td[data-label]::before { content: attr(data-label) "："; color: var(--muted); font-size: 12px; }
  .modal-actions .btn { flex: 1 1 auto; }
}
