:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --border: #e2e1dc;
  --border-strong: #cfcdc6;
  --text: #1f1f1d;
  --text-2: #5f5e5a;
  --text-3: #8a8880;
  --accent: #0f6e56;
  --accent-soft: #e1f5ee;
  --warn: #854f0b;
  --warn-soft: #faeeda;
  --danger: #a32d2d;
  --danger-soft: #fcebeb;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 16px; font-weight: 500; margin: 0 0 4px; }
.login-card p.sub { margin: 0 0 20px; color: var(--text-3); font-size: 12px; }

label { display: block; font-size: 12px; color: var(--text-2); margin: 0 0 6px; }

input[type="email"], input[type="password"], input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 14px;
  outline: none;
}
input:focus { border-color: var(--accent); }

button {
  font-family: inherit;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { opacity: 0.92; }
button.block { width: 100%; }

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
header.top h1 { font-size: 15px; font-weight: 500; margin: 0; }
header.top .who { font-size: 12px; color: var(--text-2); font-family: var(--mono); }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.ok { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.badge.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge.off { background: var(--surface-2); color: var(--text-3); }
.badge.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

nav.tabs { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
nav.tabs button { border: none; background: transparent; color: var(--text-2); padding: 7px 12px; }
nav.tabs button[aria-selected="true"] { background: var(--surface); border: 1px solid var(--border); color: var(--text); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 22px; font-weight: 500; font-family: var(--mono); line-height: 1.2; }
.kpi .k { font-size: 11px; color: var(--text-3); margin-top: 2px; }

h2.sec { font-size: 13px; font-weight: 500; color: var(--text-2); margin: 26px 0 10px; }
h2.sec:first-child { margin-top: 0; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
th { background: var(--surface-2); font-weight: 500; font-size: 12px; color: var(--text-2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
td.num { font-family: var(--mono); text-align: right; }
.muted { color: var(--text-3); }
.tiny { font-size: 11px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.toolbar input { margin-bottom: 0; max-width: 240px; }

.empty { padding: 28px; text-align: center; color: var(--text-3); font-size: 13px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

.note { background: var(--accent-soft); border: 1px solid transparent; border-radius: 10px; padding: 12px 14px; font-size: 12px; color: #06433a; margin-bottom: 18px; }
.note.warn { background: var(--warn-soft); color: #5a3608; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); margin-right: 6px; vertical-align: middle; }
.dot.on { background: var(--accent); }
.dot.off { background: var(--danger); }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #1f1f1d; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 20; }
#toast.show { opacity: 1; }

[hidden] { display: none !important; }
