:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #5f6b7a;
  --line: #d9e1ea;
  --brand: #165a72;
  --brand-2: #2f7d68;
  --warn: #a75f00;
  --soft: #e8f3f4;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 22px;
  background: #10242d;
  color: #fff;
}
.brand {
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0;
}
.topbar nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.topbar nav a {
  color: #d7edf2;
  padding: 7px 9px;
  border-radius: 6px;
}
.topbar nav a:hover {
  background: rgba(255,255,255,.1);
  text-decoration: none;
}
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px;
}
footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 22px 40px;
  color: var(--muted);
}
.panel, .auth-box, .hero-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(17, 32, 44, .04);
}
.hero-panel {
  background: linear-gradient(180deg, #ffffff 0%, #edf7f5 100%);
}
.hero-panel h1 { margin: 0 0 4px; font-size: 30px; }
.hero-panel p { margin: 4px 0; color: var(--muted); }
.auth-box {
  max-width: 460px;
  margin: 60px auto;
}
h1, h2, h3 { line-height: 1.25; letter-spacing: 0; }
h2 { margin-top: 0; }
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: #f9fbfd;
}
td small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 88px; resize: vertical; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fff;
  color: var(--brand);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
button.primary, .button.primary {
  background: var(--brand);
  color: #fff;
}
button:hover, .button:hover {
  background: var(--soft);
  text-decoration: none;
}
button.primary:hover { background: #0f485d; }
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  align-items: end;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.stack {
  display: grid;
  gap: 12px;
}
.mini {
  min-width: 260px;
}
.mini-action {
  min-width: 280px;
}
.mini-action details {
  margin-top: 8px;
}
.mini-action textarea {
  min-height: 72px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.stat b { display: block; font-size: 30px; color: var(--brand); }
.stat span { color: var(--muted); }
.pill {
  display: inline-block;
  border: 1px solid #b9d5d6;
  background: var(--soft);
  color: #164e56;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.inline-actions {
  margin-top: 0;
}
.inline-actions button {
  padding: 7px 10px;
  font-size: 12px;
}
.flash {
  border: 1px solid #f0d394;
  background: #fff7df;
  color: var(--warn);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
}
.notice {
  border: 1px solid #b9d5d6;
  background: #edf7f5;
  color: #164e56;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
}
.notice.warning {
  border-color: #e7bd73;
  background: #fff4d9;
  color: #875000;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.meta-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 14px;
  margin: 0;
}
.meta-list dt {
  color: var(--muted);
  font-weight: 700;
}
.meta-list dd {
  margin: 0;
}
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.rule-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
code {
  background: #edf1f5;
  border: 1px solid #d7dee6;
  padding: 1px 5px;
  border-radius: 4px;
}
details summary { cursor: pointer; color: var(--brand); font-weight: 700; }
label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; font-weight: 700; }
label input, label textarea, label select { color: var(--ink); font-weight: 400; }
@media (max-width: 820px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  main { padding: 14px; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}
