:root {
  --primary: #168eea;
  --primary-dark: #066fc4;
  --ink: #132238;
  --muted: #6c7b90;
  --line: #dbe5ef;
  --panel: #ffffff;
  --background: #f3f7fb;
  --success: #0c9b67;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
a { color: var(--primary-dark); text-decoration: none; }
.topbar { height: 64px; padding: 0 max(24px, calc((100% - 1220px) / 2)); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(105deg, #061b4a, #0879dc 70%, #13b8f3); color: white; box-shadow: 0 4px 18px rgba(11,68,126,.18); }
.brand { color: white; font-size: 19px; font-weight: 800; letter-spacing: .03em; }
.container { max-width: 1220px; margin: 0 auto; padding: 28px 20px 60px; }
.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
h1, h2, h3 { margin: 0 0 8px; }
.muted, small { color: var(--muted); }
.panel, .login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 10px 28px rgba(25,74,120,.06); margin-top: 22px; }
.login-card { max-width: 440px; margin: 80px auto; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 22px; }
.stats-grid article { background: linear-gradient(145deg, #0a4c9f, var(--primary)); color: white; border-radius: 16px; padding: 22px; box-shadow: 0 12px 28px rgba(10,106,191,.2); }
.stats-grid strong { display: block; font-size: 32px; }
.stats-grid span { opacity: .86; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-weight: 700; }
input, button { font: inherit; }
input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; background: white; color: var(--ink); }
button { border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; background: white; cursor: pointer; }
button.primary { color: white; border-color: var(--primary); background: var(--primary); font-weight: 800; }
button.primary:hover { background: var(--primary-dark); }
button.danger-button { color: #b42323; border-color: #f0b8b8; background: #fff7f7; }
button.danger-button:hover { color: white; border-color: #c93434; background: #c93434; }
.link-button { color: white; border-color: rgba(255,255,255,.4); background: transparent; }
.source-form { display: grid; grid-template-columns: minmax(180px,.7fr) minmax(300px,1.3fr) auto; gap: 12px; margin: 18px 0 12px; }
.inline-name-form { display: grid; grid-template-columns: minmax(130px,1fr) auto; gap: 6px; min-width: 250px; }
.notice { padding: 12px 14px; background: #eef8ff; border-left: 4px solid var(--primary); border-radius: 8px; color: #24547c; }
.table-wrap { overflow: auto; margin-top: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.interval-stepper { display: inline-grid; grid-template-columns: 38px 54px 38px; align-items: center; gap: 5px; }
.interval-stepper button { padding: 7px 0; color: white; border-color: var(--primary); background: var(--primary); font-size: 18px; line-height: 1; }
.interval-stepper button:disabled { cursor: not-allowed; opacity: .35; }
.interval-stepper strong { text-align: center; white-space: nowrap; }
.badge { display: inline-block; padding: 4px 9px; border-radius: 999px; background: #e6edf5; font-size: 12px; }
.badge.success { background: #dff7ed; color: #087650; }
.search-form { display: flex; gap: 8px; min-width: 380px; }
.entity-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.entity-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.entity-card p { color: #43546a; line-height: 1.55; overflow-wrap: anywhere; }
.flash { padding: 13px 16px; border-radius: 10px; background: #ddf7eb; color: #087650; margin-bottom: 18px; }
.flash.error { background: #ffe7e7; color: #a92323; }
.error-text { color: #b72626; }
@media (max-width: 760px) {
  .stats-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .source-form { grid-template-columns: 1fr; }
  .search-form { min-width: 0; width: 100%; }
  .entity-grid { grid-template-columns: 1fr; }
}
