/* MacFleet Cockpit - 公共样式 */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e3e6ea;
  --text: #1f2430;
  --muted: #6b7280;
  --brand: #185FA5;
  --brand-dark: #0C447C;
  --green: #1D9E75;
  --green-bg: #E1F5EE;
  --red: #E24B4A;
  --red-bg: #FCEBEB;
  --amber: #BA7517;
  --amber-bg: #FAEEDA;
  --gray: #888780;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; }

.topbar { background: var(--brand-dark); color: #fff; padding: 0 24px; height: 52px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar .logo { font-size: 16px; font-weight: 500; letter-spacing: .3px; display: flex; align-items: center; gap: 10px; }
.topbar .logo .dot { width: 10px; height: 10px; border-radius: 50%; background: #5DCAA5; display: inline-block; }
.topbar .nav { display: flex; gap: 4px; }
.topbar .nav a { color: rgba(255,255,255,.75); padding: 6px 14px; border-radius: 6px; font-size: 13px; }
.topbar .nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar .nav a.active { background: rgba(255,255,255,.18); color: #fff; }
.topbar .user { font-size: 12px; color: rgba(255,255,255,.7); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
.page-hide { display: none; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; transition: box-shadow .15s; }
.card.clickable:hover { box-shadow: 0 4px 12px rgba(16,24,40,.12); cursor: pointer; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .num { font-size: 26px; font-weight: 500; line-height: 1.2; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.green .num { color: var(--green); }
.stat.red .num { color: var(--red); }
.stat.amber .num { color: var(--amber); }
.stat.blue .num { color: var(--brand); }

.node-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.node-code { font-size: 15px; font-weight: 500; }
.node-merchant { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge.online { background: var(--green-bg); color: var(--green); }
.badge.ready { background: var(--green-bg); color: var(--green); }
.badge.offline { background: var(--red-bg); color: var(--red); }
.badge.pending { background: var(--amber-bg); color: var(--amber); }
.badge.deploying { background: var(--amber-bg); color: var(--amber); }
.badge.deploy_failed { background: var(--red-bg); color: var(--red); }
.badge.removed { background: #eee; color: var(--gray); }

.svc-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.svc { font-size: 11px; padding: 2px 8px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px; }
.svc.ok { background: var(--green-bg); color: var(--green); }
.svc.bad { background: var(--red-bg); color: var(--red); }
.svc .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.node-meta { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.7; }
.node-meta b { color: var(--text); font-weight: 500; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.panel h3 { font-size: 15px; font-weight: 500; margin-bottom: 12px; }
.panel h4 { font-size: 13px; font-weight: 500; margin: 14px 0 8px; color: var(--muted); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 8px 10px; border-bottom: 1px solid #f0f1f4; vertical-align: top; }
table.tbl tr:last-child td { border-bottom: none; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: #fff; border: none; padding: 8px 16px; border-radius: 6px; font-size: 13px; }
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }
.field.full { grid-column: 1 / -1; }
.hint { font-size: 11px; color: var(--muted); }

.alert-item { display: flex; gap: 10px; padding: 10px 12px; border-left: 3px solid var(--amber); background: #fff; border-radius: 0 6px 6px 0; margin-bottom: 8px; border: 1px solid var(--line); border-left-width: 3px; align-items: flex-start; }
.alert-item.crit { border-left-color: var(--red); }
.alert-item.info { border-left-color: var(--brand); }
.alert-item .time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.alert-item .msg { flex: 1; font-size: 13px; line-height: 1.5; }

.logbox { background: #0f1720; color: #d5e0ea; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; padding: 12px 14px; border-radius: 8px; max-height: 420px; overflow-y: auto; line-height: 1.7; white-space: pre-wrap; word-break: break-all; }
.logbox .ok { color: #5DCAA5; }
.logbox .warn { color: #FAC775; }
.logbox .err { color: #F09595; }

.curve-box { width: 100%; height: 120px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.legend .k { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }

.modal-mask { position: fixed; inset: 0; background: rgba(15,23,32,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 92%; max-width: 860px; max-height: 86vh; overflow: auto; padding: 20px 24px; }
.modal h3 { font-size: 15px; margin-bottom: 14px; }
.close-x { float: right; border: none; background: none; font-size: 18px; color: var(--muted); }

.toast { position: fixed; top: 64px; right: 20px; background: #1f2430; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 200; opacity: 0; transition: opacity .25s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 30px 0; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: rot .8s linear infinite; vertical-align: -2px; }
@keyframes rot { to { transform: rotate(360deg); } }
