:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: #18271f;
  background: #f5f7f5;
  --muted: #55665c;
  --line: #dee6df;
  --green: #1b6347;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
button, input, select, textarea { font: inherit; }
button, .primary { cursor: pointer; }
button, select, input:not([type=checkbox]), textarea { color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
button:hover:not(:disabled) { background: #eef5f0; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid #24825c; outline-offset: 3px; }
.sidebar { background: #132c22; color: #eaf6ef; padding: 30px 16px 20px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px; margin-bottom: 45px; }
.brand strong { display: block; font-size: 21px; letter-spacing: .06em; }
.brand div span { color: #b3cabd; font-size: 12px; }
.mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #a4e6bb; color: #143423; font-size: 23px; font-weight: 800; }
nav { display: grid; gap: 6px; }
nav button { text-align: left; color: #c0d5c8; border-color: transparent; background: transparent; padding: 12px; }
nav button span { display: inline-block; width: 25px; }
nav button[aria-current], nav button:hover:not(:disabled) { color: #f2fff6; background: #264936; }
.environment { margin-top: auto; border-top: 1px solid #375346; padding: 19px 10px 0; font-size: 12px; color: #c0d5c8; }
.environment span { display: inline-block; width: 8px; height: 8px; margin-right: 8px; background: #a4e6bb; border-radius: 50%; }
main { width: 100%; max-width: 1490px; margin: auto; padding: 42px clamp(18px, 4vw, 64px) 56px; align-self: start; margin-top: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 26px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.page-actions button { white-space: nowrap; }
#connection-status { color: #5a410d; background: #fdf2d4; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(27px, 3vw, 36px); letter-spacing: -.04em; }
.page-header p, .hint, .dialog-header p { margin-top: 7px; color: var(--muted); font-size: 14px; }
.primary { display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--green); border: 1px solid var(--green); padding: 9px 15px; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.primary:hover, button.primary:hover:not(:disabled) { background: #174f39; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metrics article, .panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.metrics article { padding: clamp(12px, 2vw, 19px); }
.metrics span { display: block; color: var(--muted); font-size: 13px; }
.metrics strong { display: block; margin-top: 6px; font-size: clamp(24px, 3vw, 32px); font-variant-numeric: tabular-nums; }
.overview-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.overview-metrics small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.trend-toolbar { border-bottom: 1px solid var(--line); }
.trend-toolbar div { margin-right: auto; }
.trend-toolbar h2 { font-size: 19px; }
.trend-toolbar p { color: var(--muted); margin-top: 5px; font-size: 13px; }
#trend-days { list-style: none; padding: 10px 18px; margin: 0; }
#trend-days li { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) 2.8rem; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; color: var(--muted); }
#trend-days strong { text-align: right; color: #18271f; font-variant-numeric: tabular-nums; }
#trend-days meter { width: 100%; height: 13px; }
#trend-days meter::-webkit-meter-bar { background: #e9f2ec; border: 0; }
#trend-days meter::-webkit-meter-optimum-value { background: #2b7a55; }
#trend-days meter::-moz-meter-bar { background: #2b7a55; }
.toolbar, .pagination { padding: 14px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 230px; max-width: 360px; }
.search > span[aria-hidden] { position: absolute; left: 11px; top: 6px; color: var(--muted); font-size: 23px; }
.search input { padding-left: 32px !important; width: 100%; }
.check { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--muted); }
.check input { accent-color: var(--green); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
thead { background: #f3f7f4; color: #42574b; }
th, td { padding: 12px 18px; border-bottom: 1px solid #e9eee9; }
th { white-space: nowrap; font-size: 13px; }
td:first-child { min-width: 200px; }
td strong { font-weight: 650; }
td small { display: block; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.tag { display: inline-block; margin-left: 7px; border-radius: 4px; padding: 2px 5px; background: #e8f4ec; color: #245941; font-size: 11px; white-space: nowrap; }
.link-button { color: var(--green); border-color: transparent; padding: 5px 7px; white-space: nowrap; }
.pagination { justify-content: space-between; color: var(--muted); font-size: 13px; }
.pagination div { display: flex; gap: 9px; align-items: center; }
.empty { padding: 38px 18px; text-align: center; color: var(--muted); }
.mobile-label { display: none; }
#notice, #edit-error { color: #843426; background: #fff1eb; padding: 10px 12px; border-radius: 7px; margin-bottom: 14px; }
#notice[data-ok] { color: #245941; background: #e6f5eb; }
dialog { width: min(92vw, 495px); border: 1px solid var(--line); border-radius: 14px; padding: 23px; color: inherit; box-shadow: 0 18px 75px #122c2240; }
dialog::backdrop { background: #14281fc0; }
.editor-media { background: #f3f7f4; border-radius: 8px; padding: 12px; }
.editor-media img { display: block; width: 100%; max-height: 200px; object-fit: contain; }
.editor-media img[hidden] { display: none; }
.editor-media label { margin: 8px 0; }
.editor-media-link { display: flex; gap: 8px; }
.editor-media-link input { min-width: 0; flex: 1; }
.editor-media-link button { white-space: nowrap; }
.rule-list-dialog { width: min(94vw, 1000px); max-height: 86vh; }
.rule-filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.rule-filters label:first-child { flex: 1 1 240px; }
.rule-review-details { margin: 0 0 15px; }
.rule-review-details dt { font-weight: 600; margin-top: 9px; }
.rule-review-details dd { margin: 4px 0 0; color: var(--muted); }
#rule-review-source { margin-bottom: 15px; }
#rule-review-steps { margin: 8px 0 8px 24px; }
#rule-review-media { width: min(100%, 280px); object-fit: contain; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.dialog-header button { font-size: 19px; padding: 1px 9px; }
form label { display: grid; gap: 7px; margin: 14px 0; font-size: 14px; }
textarea { resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.offline { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 20px; }
.offline .panel { width: min(100%, 420px); padding: 28px; margin: 0; align-self: center; }
.login-panel { grid-column: 1 / -1; display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-panel .panel { width: min(100%, 430px); padding: clamp(20px, 5vw, 36px); }
.login-panel h1 { margin-top: 16px; }
#login-status { color: var(--muted); margin: 12px 0; }
.login-panel input { width: 100%; }
.login-panel form button { width: 100%; }
.offline h1 { margin-top: 18px; }
.offline p { margin: 8px 0 22px; color: var(--muted); line-height: 1.6; }
@media (max-width: 750px) {
  body { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 16px; flex-direction: row; align-items: center; justify-content: space-between; }
  .brand { margin: 0; padding: 0; }
  .brand strong { font-size: 16px; }
  .mark { width: 34px; height: 34px; font-size: 19px; }
  nav { display: flex; }
  nav button { font-size: 13px; padding: 7px; }
  nav button span, .environment { display: none; }
  main { padding-top: 25px; }
  .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .page-header { flex-wrap: wrap; }
  .metrics { gap: 7px; }
  .metrics article { padding: 10px; }
  .metrics span { font-size: 12px; }
  .toolbar { padding: 12px; }
  .search { max-width: none; flex-basis: 100%; }
  table, tbody { display: block; }
  thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  tbody { display: grid; gap: 8px; padding: 0 9px 9px; }
  tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 11px; gap: 8px; border: 1px solid var(--line); border-radius: 8px; }
  td, td:first-child { min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
  #rows td:first-child { grid-column: 1 / -1; }
  #rows td:last-child { justify-self: end; align-self: end; }
  .mobile-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 12px; }
  .link-button { min-height: 40px; padding-inline: 12px; }
  .pagination { padding: 11px; }
  #history .table-wrap { padding-top: 9px; }
}
