/* 数据同步控制台 — 纸感·克制·有呼吸(web_console_design §3.6) */
:root {
  --paper: #F7F5F2;
  --card: #FFFFFF;
  --hairline: #E7E2DA;
  --ink: #1C1917;
  --muted: #78716C;
  --teal: #0F766E;
  --teal-soft: #F0F7F6;
  --ok: #15803D;
  --warn: #D97706;
  --bad: #BE123C;
  --radius: 12px;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --display: "Space Grotesk", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--paper); color: var(--ink);
  font-family: "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}
a { color: var(--teal); text-decoration: none; }
button { font: inherit; cursor: pointer; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.r { text-align: right; }
.bad-text { color: var(--bad); }
.stale { color: var(--warn); }

/* ---- 顶栏 ---- */
.topbar {
  display: flex; align-items: center; gap: 32px;
  padding: 0 48px; height: 56px;
  background: var(--card); border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; letter-spacing: .02em; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.topbar nav a.active { color: var(--teal); background: var(--teal-soft); }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.userbox form { display: inline; }
.link { background: none; border: none; color: var(--teal); padding: 0; }

main { max-width: 1280px; margin: 0 auto; padding: 32px 48px 64px; }

/* ---- 状态点 / 标签 ---- */
.dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px; background: var(--muted);
}
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.muted { background: #A8A29E; }
.tag {
  font-size: .78rem; color: var(--muted); border: 1px solid var(--hairline);
  border-radius: 6px; padding: 1px 8px; background: var(--card); white-space: nowrap;
}

/* ---- 总览 ---- */
.banner {
  background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E;
  border-radius: var(--radius); padding: 10px 20px; margin-bottom: 24px;
}
.strip {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  background: var(--hairline); border: 1px solid var(--hairline);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 24px;
}
.stat { background: var(--card); padding: 16px 24px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: .78rem; color: var(--muted); }
.stat-value { font-weight: 600; }
.stat-value.big { font-family: var(--display); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat-value.big small { font-size: .9rem; color: var(--muted); font-weight: 400; }

.card {
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
}
.ds-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.ds-head h2 { font-size: 1.15rem; }
.ds-numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.ds-numbers .stat { padding: 0; }
.ring-stat { flex-direction: row !important; align-items: center; gap: 12px; }
.ring-text { font-family: var(--display); font-size: 13px; fill: var(--ink); font-weight: 600; }
.ds-row {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 12px 0; border-top: 1px solid var(--hairline); flex-wrap: wrap;
}
.freq { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.freq-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; }
.freq-chip b { font-family: var(--mono); font-weight: 500; }
.freq-chip i { display: inline-block; height: 6px; background: var(--teal); border-radius: 3px; opacity: .75; }
.health { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.health a.dot { margin: 0 0 0 10px; }
.activity { display: flex; align-items: center; gap: 12px; }
.ds-links { display: flex; align-items: center; gap: 16px; }
.btn-ghost {
  border: 1px solid var(--hairline); background: var(--card); color: var(--teal);
  border-radius: 8px; padding: 5px 14px; font-weight: 500;
}
.btn-ghost:hover { border-color: var(--teal); }
.footnote { font-size: .8rem; margin-top: 8px; }
.empty {
  background: var(--card); border: 1px dashed var(--hairline); border-radius: var(--radius);
  padding: 48px; text-align: center; color: var(--muted);
}

/* ---- 明细 ---- */
.page-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.page-head h1 { font-size: 1.3rem; }
#filters {
  display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 12px 16px;
}
#filters input[type="search"], #filters select {
  height: 36px; border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--card); font: inherit; color: var(--ink);
}
#filters input[type="search"] { flex: 1; min-width: 240px; padding: 0 14px; }
#filters select {
  appearance: none; -webkit-appearance: none; padding: 0 32px 0 12px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2378716C' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
#filters select:hover { border-color: #D6D0C6; }
#filters input:focus, #filters select:focus { outline: 2px solid var(--teal); outline-offset: -1px; }
.check { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .9rem; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--teal); cursor: pointer; }

.table-wrap {
  border: 1px solid var(--hairline); border-radius: var(--radius);
  overflow: clip;  /* clip 不产生滚动容器,thead sticky 保持有效 */
  background: var(--card);
}
table.tasks, table.runs { width: 100%; border-collapse: collapse; background: var(--card); }
table.tasks { table-layout: fixed; }
.tasks thead th {
  text-align: left; font-size: .78rem; color: var(--muted); font-weight: 500;
  padding: 10px 12px; border-bottom: 1px solid var(--hairline); background: #FBFAF8;
  position: sticky; top: 56px; z-index: 5; white-space: nowrap;
}
.tasks tbody td {
  padding: 10px 12px; border-bottom: 1px solid #F1EDE7; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.tasks tbody tr { cursor: pointer; transition: background .12s; }
.tasks tbody tr:nth-child(even) { background: #FBFAF8; }
.tasks tbody tr:hover { background: var(--teal-soft); }
.tasks tbody tr:last-child td { border-bottom: none; }
.tasks th.r, .tasks td.r { text-align: right; font-variant-numeric: tabular-nums; }
.remark { color: var(--warn); cursor: help; }

/* ---- 抽屉 ---- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(28, 25, 23, .18); z-index: 30; }
.drawer-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; z-index: 31;
  background: var(--card); border-left: 1px solid var(--hairline);
  padding: 24px; overflow-y: auto; animation: slide-in .2s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-head h3 { font-size: 1rem; word-break: break-all; }
.close { font-size: 1.1rem; color: var(--muted); }
.target { font-size: .8rem; margin: 6px 0 14px; word-break: break-all; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin-bottom: 16px; }
.tabs button {
  background: none; border: none; padding: 8px 14px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--teal); }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.kv-grid > div { display: flex; flex-direction: column; gap: 2px; }
.kv-grid b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.timeline {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  background: var(--paper); border-radius: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.timeline > div { display: flex; flex-direction: column; }
.timeline b { font-size: .9rem; font-family: var(--mono); }
.timeline .arrow { color: var(--muted); }
.error-box { border: 1px solid #FECDD3; background: #FFF1F2; border-radius: 8px; padding: 12px; }
.error-box pre, .run-err pre {
  font-family: var(--mono); font-size: .78rem; white-space: pre-wrap; word-break: break-all;
  max-height: 180px; overflow-y: auto; margin-top: 6px; color: var(--ink);
}
.runs { font-size: .85rem; }
.runs th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--hairline); }
.runs td { padding: 6px 8px; border-bottom: 1px solid #F1EDE7; }
.runs td.r, .runs th.r { text-align: right; }
.run-fail td { background: #FFF1F2; }
.run-err td { padding: 0 8px 8px; background: #FFF1F2; border-bottom: 1px solid #FECDD3; }
.run-skip td { padding: 0 8px 8px; background: #F5F5F4; color: var(--muted); border-bottom: 1px solid var(--hairline); }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.config dt { font-size: .78rem; color: var(--muted); margin-top: 12px; }
.config dd { margin: 0; }
.columns { margin-top: 18px; }
.columns summary { cursor: pointer; color: var(--teal); font-size: .9rem; }
.columns table { margin-top: 10px; }

/* ---- 登录 ---- */
.login-body { height: 100vh; }
.login-split { display: grid; grid-template-columns: 55% 45%; height: 100vh; }
.login-art {
  background: var(--teal); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 28px; padding: 48px;
}
.login-art img { width: min(420px, 80%); }
.login-art-caption { color: #CCFBF1; font-size: 1.3rem; font-weight: 700; letter-spacing: .04em; }
.login-art-caption span { font-weight: 400; opacity: .7; font-size: .9rem; margin-left: 8px; }
.login-form-side { display: flex; align-items: center; justify-content: center; }
.login-form { width: min(340px, 84%); display: flex; flex-direction: column; gap: 16px; }
.login-form h1 { font-size: 1.5rem; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
.login-form input {
  padding: 10px 14px; border: 1px solid var(--hairline); border-radius: 8px;
  font: inherit; background: var(--card); color: var(--ink);
}
.login-form input:focus { outline: 2px solid var(--teal); outline-offset: -1px; }
.btn-primary {
  background: var(--teal); color: #fff; border: none; border-radius: 8px;
  padding: 11px; font-weight: 600; letter-spacing: .2em; margin-top: 6px;
}
.btn-primary:hover { background: #115E59; }
.login-error {
  background: #FFF1F2; border: 1px solid #FECDD3; color: var(--bad);
  border-radius: 8px; padding: 8px 12px; font-size: .9rem;
}

@media (max-width: 1100px) {
  .strip { grid-template-columns: repeat(2, 1fr); }
  .ds-numbers { grid-template-columns: repeat(2, 1fr); }
  .login-split { grid-template-columns: 1fr; }
  .login-art { display: none; }
  main, .topbar { padding-left: 24px; padding-right: 24px; }
}