:root {
  color-scheme: light;
  --ink: #192137;
  --muted: #52607a;
  --line: #dce3ef;
  --paper: #fff;
  --back: #f4f6fb;
  --accent: #5441cf;
  --accent-light: #eeeaff;
  --good: #11604d;
  --good-bg: #e3f6ef;
  --warn: #825006;
  --warn-bg: #fff0d4;
  --bad: #a32342;
  --bad-bg: #ffedf1;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang HK", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--back); color: var(--ink); font-size: 1rem; line-height: 1.55; }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid #826cff; outline-offset: 3px; }
.skip { position: fixed; z-index: 3; top: .5rem; left: .5rem; transform: translateY(-200%); background: white; padding: .65rem; }
.skip:focus { transform: none; }
.topbar { background: #182139; color: white; }
.top-inner, .layout { max-width: 1360px; margin: auto; padding-inline: clamp(1rem, 3.6vw, 3.25rem); }
.top-inner { min-height: 4.25rem; display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.brand { color: white; text-decoration: none; font-weight: 750; display: flex; align-items: center; gap: .7rem; white-space: nowrap; }
.brand strong { color: #c5bbff; margin-left: .2rem; }
.brand-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; background: #6550eb; font-size: 1.25rem; }
.top-right, .controls { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.source { color: #e5ddff; background: #3b3559; padding: .2rem .58rem; border-radius: .4rem; font-size: .875rem; }
.button, select, .link-button { border: 1px solid var(--line); background: white; color: var(--ink); border-radius: .5rem; padding: .46rem .75rem; font-size: .875rem; font-weight: 650; }
.button:hover, select:hover { border-color: #8c7bec; }
.topbar .button { border-color: #586380; background: #28344e; color: white; }
.layout { padding-block: 2rem 1rem; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.eyebrow { color: var(--accent); font-size: .875rem; font-weight: 700; margin: 0 0 .25rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.78rem, 4vw, 2.6rem); line-height: 1.24; letter-spacing: -.05em; }
h2 { font-size: 1.2rem; line-height: 1.4; }
h3 { font-size: 1rem; }
#subtitle { color: var(--muted); margin-top: .45rem; }
.controls label { display: grid; gap: .25rem; color: var(--muted); font-size: .875rem; min-width: 9rem; }
select { appearance: none; min-height: 2.55rem; max-width: 19rem; padding-right: 2rem; background: white linear-gradient(45deg, transparent 50%, #655a89 50%) right 15px top 17px / 5px 5px no-repeat; }
.tabs { display: flex; gap: 1.1rem; border-bottom: 1px solid var(--line); margin: 1.5rem 0 1.1rem; overflow: auto; }
.tabs a { text-decoration: none; color: var(--muted); white-space: nowrap; padding: .55rem .22rem .65rem; border-bottom: 3px solid transparent; font-weight: 700; }
.tabs a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; }
.card, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: .85rem; }
.card { padding: 1rem 1.08rem; min-width: 0; }
.metric-label { color: var(--muted); font-size: .875rem; font-weight: 650; }
.metric-value { font-variant-numeric: tabular-nums; font-size: clamp(1.75rem, 3.1vw, 2.5rem); font-weight: 760; line-height: 1.28; letter-spacing: -.05em; margin-top: .2rem; }
.card p, .meta, .panel-head p, footer { color: var(--muted); font-size: .875rem; }
.card p { margin-top: .28rem; }
.panel { padding: 1rem 1.15rem; margin-top: .9rem; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: .6rem; margin-bottom: .8rem; }
.panel-head p { margin-top: .18rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .9rem; }
.legend { display: flex; gap: .8rem; flex-wrap: wrap; color: var(--muted); font-size: .875rem; }
.legend span::before { content: ""; display: inline-block; width: .68rem; height: .68rem; border-radius: .16rem; background: var(--accent); margin-right: .35rem; }
.legend span + span::before { background: #dfdcfa; }
.graph { display: grid; grid-template-columns: repeat(var(--days), minmax(2.5rem, 1fr)); gap: .35rem; padding-top: .1rem; overflow: auto; }
.bar-button { border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: .5rem; font-size: .875rem; padding: .35rem .1rem .13rem; min-width: 0; }
.bar-button:hover, .bar-button[aria-pressed="true"] { background: #f5f2ff; border-color: #e0d9ff; color: var(--accent); }
.bar-track { display: flex; align-items: end; justify-content: center; height: 6rem; background: repeating-linear-gradient(to top, transparent 0 1.46rem, #edf0f6 1.46rem 1.5rem); border-bottom: 1px solid #d7deec; margin-bottom: .3rem; }
.bar { border-radius: .32rem .32rem 0 0; width: 55%; max-width: 2.25rem; position: relative; overflow: hidden; background: #dfdcfa; }
.bar i { position: absolute; background: var(--accent); bottom: 0; left: 0; width: 100%; }
.progress { background: #eae6fa; height: .52rem; border-radius: 1rem; overflow: hidden; margin: .65rem 0; }
.progress span { display: block; height: 100%; background: var(--accent); }
.alerts { display: grid; gap: .46rem; }
.alert { display: flex; justify-content: space-between; align-items: start; gap: .65rem; padding: .48rem 0; border-bottom: 1px solid var(--line); }
.alert:last-child { border: 0; }
.alert p { color: var(--muted); font-size: .875rem; }
.status { display: inline-block; border-radius: 1rem; white-space: nowrap; padding: .17rem .56rem; font-size: .875rem; font-weight: 700; }
.normal, .complete { color: var(--good); background: var(--good-bg); }
.delayed, .running { color: var(--warn); background: var(--warn-bg); }
.failed { color: var(--bad); background: var(--bad-bg); }
.inactive, .unknown, .planned { color: #465470; background: #eaf0f8; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9rem; text-align: left; }
th, td { padding: .65rem .65rem .65rem .1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); white-space: nowrap; font-size: .875rem; }
tbody tr:last-child td { border: 0; }
td .meta { display: block; }
.num { white-space: nowrap; }
.link-button { background: var(--accent-light); border: 0; color: var(--accent); white-space: nowrap; }
.link-button:hover { background: #e0d9ff; }
.empty { padding: .65rem 0; color: var(--muted); }
.summary { display: flex; flex-wrap: wrap; gap: .8rem 1.3rem; margin-bottom: 1rem; }
.summary span { color: var(--muted); font-size: .875rem; }
.summary strong { display: block; color: var(--ink); font-size: 1.25rem; }
footer { margin-top: 1rem; }
dialog { color: var(--ink); border: 1px solid var(--line); border-radius: 1rem; width: min(720px, calc(100% - 2rem)); max-height: 85dvh; padding: 1.15rem; }
dialog::backdrop { background: #11182f88; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding-bottom: .8rem; }
.detail-note { color: var(--muted); margin-bottom: .85rem; overflow-wrap: anywhere; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: 0; } }
@media (max-width: 620px) {
  .layout { padding-top: 1.2rem; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .card, .panel { padding-inline: .75rem; }
  .tabs { gap: .8rem; }
  .top-inner { min-height: 4rem; }
  .top-right { gap: .35rem; justify-content: end; }
  .source { font-size: .8rem; }
  .controls { width: 100%; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .controls label { min-width: 0; }
  select { width: 100%; }
}

[hidden] { display: none !important; }
.notice { border: 1px solid #f1dca6; background: #fff5dc; color: #704509; padding: .65rem .85rem; border-radius: .55rem; margin: .65rem 0; font-size: .875rem; }
.suspended { color: var(--bad); background: var(--bad-bg); }
.pending_setup, .pending_review { color: var(--warn); background: var(--warn-bg); }
.paused { color: #465470; background: #eaf0f8; }
.quota-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.quota-totals > * { border: 1px solid var(--line); padding: .65rem; border-radius: .55rem; color: var(--muted); font-size: .875rem; }
.quota-totals strong { display: block; color: var(--ink); font-size: 1.28rem; }
.target-input { display: block; width: 7rem; max-width: 100%; padding: .3rem .42rem; border: 1px solid #abb7cf; border-radius: .35rem; color: var(--ink); background: white; font-variant-numeric: tabular-nums; }
.target-input:focus-visible { outline: 3px solid #826cff; outline-offset: 2px; }
.quota-note { margin: .7rem 0 .35rem; }
.field-warning { display: block; color: var(--warn); font-size: .875rem; }
.field-warning:empty { display: none; }
.version { color: var(--accent); background: var(--accent-light); border-radius: .4rem; padding: .26rem .55rem; font-size: .875rem; font-weight: 650; }
.enable { display: flex; align-items: center; white-space: nowrap; gap: .35rem; }
.enable input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.settings-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin-top: .9rem; }
.settings-actions p { font-size: .875rem; }
.primary { background: var(--accent); border-color: var(--accent); color: white; }
.primary:hover { background: #4838b4; }
details > summary { cursor: pointer; font-weight: 700; }
details[open] > summary { margin-bottom: .55rem; }
@media (max-width: 620px) {
  .quota-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quota table { min-width: 690px; }
}
.account-address { display: block; overflow-wrap: anywhere; }
.quota td .link-button { margin-top: .2rem; }
.account-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem 1rem; }
.account-form label { display: grid; gap: .25rem; font-size: .875rem; color: var(--muted); }
.account-form input, .account-form select { width: 100%; max-width: 100%; min-height: 2.4rem; border: 1px solid var(--line); border-radius: .45rem; padding: .35rem .5rem; background-color: white; color: var(--ink); }
.account-form .settings-actions, .account-form p { grid-column: 1 / -1; }
.settings-toolbar { position: sticky; z-index: 1; top: 0; margin: .4rem 0 .2rem; padding: .4rem 0; background: var(--paper); }

.topbar a.button { text-decoration: none; }
.overview-metrics { margin-top: .9rem; }
.insight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.insight-grid article { min-width: 0; padding: .85rem .95rem; border: 1px solid #e3dcff; border-radius: .7rem; background: #f8f6ff; }
.insight-grid article strong { display: block; color: #4633b4; font-size: clamp(1.48rem, 3vw, 2.15rem); line-height: 1.35; font-variant-numeric: tabular-nums; }
.insight-grid article p, .insight-note { color: var(--muted); font-size: .875rem; margin-top: .25rem; }
.pool-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pool-metrics article { border-color: #cfe9e1; background: #f2faf7; }
.pool-metrics article strong { color: var(--good); }
.health-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.health-check { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .6rem; }
.health-check .meta { margin-left: auto; }
.health-dot { display: inline-block; width: .5rem; height: .5rem; margin-right: .34rem; background: currentColor; border-radius: 50%; vertical-align: .04em; }
.health-warnings { display: grid; gap: .5rem; margin-top: .65rem; }
.health-warning { display: flex; align-items: start; flex-wrap: wrap; gap: .45rem .7rem; border-left: 3px solid #d09127; border-radius: .4rem; background: #fffaf0; padding: .52rem .7rem; }
.health-warning.high { border-color: #c33056; background: #fff4f6; }
.health-warning p { color: var(--muted); font-size: .875rem; }
.health-baseline { margin-top: .55rem; }
.pool-curve { margin: .2rem 0 0; }
.pool-curve figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; color: var(--muted); font-size: .875rem; }
.pool-curve svg { display: block; max-width: 100%; width: 100%; color: #14836b; }
.pool-curve .curve-grid { fill: none; stroke: #dfe8ed; stroke-width: 1; stroke-dasharray: 4 5; }
.pool-curve .curve-line { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pool-curve circle { fill: var(--paper); stroke: currentColor; stroke-width: 2; }
.month-chart { display: grid; grid-template-columns: repeat(var(--months), minmax(4.5rem, 1fr)); overflow-x: auto; }
.month-point { display: grid; text-align: center; justify-items: stretch; gap: .32rem; color: var(--muted); font-size: .875rem; }
.month-point strong { padding-inline: .35rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.month-track { height: 8rem; display: flex; justify-content: center; align-items: end; background: repeating-linear-gradient(to top, transparent 0 1.95rem, #e8edf6 1.95rem 2rem); border-bottom: 1px solid var(--line); }
.month-bar { display: flex; flex-direction: column; width: min(45%, 3.6rem); border-radius: .32rem .32rem 0 0; overflow: hidden; }
.month-reported { background: var(--accent); }
.month-opening, .month-legend span + span::before { background: #99c4dc; }
@media (max-width: 620px) {
  .pool-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight-grid article { padding: .7rem; }
  .health-checks { grid-template-columns: 1fr; }
  .health-check .meta { margin-left: 0; }
  .topbar .brand-icon { display: none; }
}
