* { box-sizing: border-box; }
:root {
  --ink: #0c1a26;
  --muted: #56707f;
  --line: #d6e1e9;
  --bg: #f4f7f9;
  --accent: #0d8f7a;
  --accent-dark: #0a6f5e;
  --danger: #c43e3e;
  --warning: #c08400;
  --gold: #c79b3a;
  --white: #fff;
}
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  display: flex;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 12px; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

/* Sidebar */
.sidebar {
  width: 200px;
  background: #0c1a26;
  color: #e6eef4;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar .brand {
  color: #fff;
  padding: 0 22px 18px;
  font-size: 18px;
  border-bottom: 1px solid #1f3140;
  margin-bottom: 12px;
}
.sidebar .brand span { color: var(--gold); font-weight: 400; }
.sidebar nav { display: flex; flex-direction: column; }
.nav-item {
  color: #bcc8d2;
  padding: 10px 22px;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: #122533; color: #fff; text-decoration: none; }
.nav-item.active { background: #122533; color: #fff; border-left-color: var(--gold); font-weight: 700; }

/* Content */
.content { flex: 1; padding: 0; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.topbar-build button {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}
.topbar-build button:hover { background: var(--accent-dark); }
.topbar-user { font-size: 13px; color: var(--muted); }

/* Flash */
.flash {
  margin: 18px 28px 0;
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 4px solid var(--accent);
  background: #e7f4f1;
  color: #0a4d40;
  font-size: 13px;
}
.flash-error { background: #fbe5e5; border-left-color: var(--danger); color: #7a1c1c; }
.flash-warning { background: #fdf2dc; border-left-color: var(--warning); color: #6b4a00; }

/* Card */
.panel {
  background: #fff;
  margin: 18px 28px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}
.panel-head h2 { margin: 0; }

/* Table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tbl th { color: var(--muted); font-weight: 700; background: #fafcfd; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fafcfd; }
.tbl td .row-actions { display: flex; gap: 8px; }
.tbl .muted { color: var(--muted); }
.tbl .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e6eef4;
  color: var(--muted);
  font-size: 12px;
}
.tbl .badge-on { background: #e7f4f1; color: var(--accent-dark); }
.tbl .badge-off { background: #f0e3e3; color: #8c3a3a; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: #fafcfd; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #e6c5c5; }
.btn-danger:hover { background: #fbe5e5; color: #7a1c1c; }
.btn-sm { padding: 4px 8px; font-size: 12px; }

/* Form */
.form { display: grid; gap: 14px; max-width: 760px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
.form input[type="text"], .form input[type="email"], .form input[type="date"], .form input[type="number"], .form select, .form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.form textarea { min-height: 110px; resize: vertical; }
.form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form .checkbox input { width: auto; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 6px; }
.form .help { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: -2px; }

/* Auth */
.auth-shell {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  background: #fff;
  padding: 28px 30px;
  border-radius: 10px;
  width: 360px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(12, 26, 38, 0.06);
}
.auth-card h1 { margin-bottom: 6px; }
.auth-card p.help { color: var(--muted); margin: 0 0 18px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 4px; }
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
}
.stat-card .num { font-size: 28px; font-weight: 850; color: var(--accent-dark); }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.inline-form { display: inline; }
.text-right { text-align: right; }
.muted { color: var(--muted); }
.empty-state { color: var(--muted); padding: 24px; text-align: center; }
