:root {
  color-scheme: light;
  --ink: #18212b;
  --muted: #64707d;
  --line: #d9dee4;
  --soft: #f4f6f8;
  --paper: #ffffff;
  --brand: #006b5b;
  --brand-dark: #004f44;
  --blue: #205493;
  --danger: #a53b36;
  --warn: #9a6700;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: #eef1f4; color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .button { min-height: 36px; border: 1px solid var(--brand); border-radius: 5px; background: var(--brand); color: white; padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer; letter-spacing: 0; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .button:hover { background: var(--brand-dark); text-decoration: none; }
button.secondary, .button.secondary { background: white; color: var(--ink); border-color: #aab3bd; }
button.quiet { background: transparent; color: #dce7e5; border-color: transparent; }
button.link-button, button.danger-link { background: transparent; border: 0; color: var(--blue); padding: 4px; min-height: auto; }
button.danger-link { color: var(--danger); }
.topbar { height: 58px; background: #142a2e; color: white; display: flex; align-items: center; padding: 0 24px; gap: 26px; position: sticky; top: 0; z-index: 10; }
.brand { color: white; font-size: 17px; font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; align-self: stretch; overflow-x: auto; flex: 1; }
.topbar nav a { color: #cad7d5; display: flex; align-items: center; padding: 0 13px; border-bottom: 3px solid transparent; white-space: nowrap; }
.topbar nav a.active { color: white; border-color: #41bba5; }
.topbar form { margin: 0; }
main { width: min(1440px, calc(100% - 40px)); margin: 26px auto 60px; }
.auth-main { width: 100%; min-height: 100vh; margin: 0; display: grid; place-items: center; background: #e7ecef; padding: 24px; }
.login-panel { width: min(420px, 100%); background: white; border: 1px solid var(--line); border-radius: 6px; padding: 30px; box-shadow: 0 12px 30px rgba(20,42,46,.08); }
.login-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-heading h1 { margin: 0; font-size: 22px; }
.login-heading p { margin: 2px 0 0; color: var(--muted); }
.product-mark { width: 44px; height: 44px; background: var(--brand); color: white; display: grid; place-items: center; font-size: 24px; font-weight: 700; border-radius: 6px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 25px; letter-spacing: 0; }
.page-head p { margin: 3px 0 0; color: var(--muted); }
.back { display: inline-block; margin-bottom: 5px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metrics article { background: white; border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; }
.metrics span { display: block; color: var(--muted); }
.metrics strong { display: block; font-size: 27px; margin-top: 4px; }
.band, .form-section, .channel-group { background: white; border: 1px solid var(--line); margin-bottom: 16px; }
.band, .channel-group { padding: 0; }
.form-section { padding: 20px; }
.form-section.compact { padding: 14px 18px; }
.section-head { min-height: 48px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; font-size: 16px; }
.section-head span { color: var(--muted); font-size: 13px; }
.section-head > div > span { display: block; }
.inline-status, .info-strip { padding: 15px 18px; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.info-strip { background: #eaf4f1; border: 1px solid #bad9d1; margin-bottom: 16px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa3ad; }
.dot.ok { background: #14866d; }
.stack-form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.inline-form label { min-width: 210px; flex: 1; }
label { color: #33404d; font-weight: 600; }
input, select { display: block; width: 100%; min-height: 38px; border: 1px solid #aab3bd; border-radius: 4px; background: white; color: var(--ink); padding: 7px 10px; font: inherit; margin-top: 5px; letter-spacing: 0; }
input:focus, select:focus { outline: 2px solid rgba(0,107,91,.2); border-color: var(--brand); }
.actions { display: flex; justify-content: flex-end; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 10px 13px; border-bottom: 1px solid #e6e9ed; vertical-align: middle; }
th { color: #52606d; font-size: 12px; text-transform: uppercase; background: #f7f8fa; }
td small { display: block; color: var(--muted); margin-top: 2px; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
code { font-family: "Cascadia Mono", Consolas, monospace; background: var(--soft); padding: 2px 5px; border-radius: 3px; }
.status { display: inline-flex; align-items: center; min-height: 24px; border-radius: 4px; background: #e7ebef; color: #43505c; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.status.completed, .status.scheduled { background: #dff1eb; color: #075f4e; }
.status.running, .status.pending { background: #e1edf8; color: #174f80; }
.status.failed, .status.cancelled { background: #f7e5e3; color: #8b2f2a; }
.status.retry_wait, .status.paused { background: #fff0ce; color: #7a5200; }
.flash { padding: 11px 14px; border: 1px solid #a7d3c8; background: #e4f3ef; color: #075f4e; margin-bottom: 16px; border-radius: 4px; }
.flash.error { border-color: #e0b4af; background: #fae9e7; color: #7c2925; }
.empty { padding: 26px 18px; color: var(--muted); text-align: center; }
.sticky-actions { position: sticky; top: 58px; z-index: 5; background: #f6faf9; border: 1px solid #c7ddd8; padding: 10px 14px; margin-bottom: 15px; display: flex; align-items: center; justify-content: space-between; }
.channel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px; }
.channel-row { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border-radius: 4px; font-weight: 400; }
.channel-row:hover { background: var(--soft); }
.channel-row input { width: 17px; min-height: 17px; margin: 3px 0 0; }
.channel-row strong, .channel-row small { display: block; }
.channel-row small { color: var(--muted); margin-top: 2px; }
.row-actions { display: flex; gap: 4px; align-items: center; }
.row-actions form { margin: 0; }
.error-cell { max-width: 260px; color: var(--danger); overflow-wrap: anywhere; }
.error-page { width: min(500px, 100%); margin: 12vh auto; text-align: center; }
.error-page > strong { font-size: 64px; color: #9ca6b0; }
@media (max-width: 900px) {
  .topbar { height: auto; min-height: 58px; padding: 8px 14px; flex-wrap: wrap; gap: 5px 14px; }
  .topbar nav { order: 3; width: 100%; flex-basis: 100%; height: 44px; }
  .topbar form { margin-left: auto; }
  main { width: min(100% - 24px, 1440px); margin-top: 18px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sticky-actions { top: 102px; }
}
@media (max-width: 600px) {
  .page-head { align-items: flex-start; flex-direction: column; }
  .metrics, .form-grid, .channel-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form label { width: 100%; min-width: 0; }
  .inline-form button { width: 100%; }
  .login-panel { padding: 22px; }
}
