:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --ink: #1d2430;
  --muted: #5c6570;
  --line: #ddd6c8;
  --card: #fffdf8;
  --accent: #0c6b50;
  --accent-ink: #084838;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang TC", "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--accent-ink); }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

header {
  display: flex;
  justify-content: space-between;
  gap: 16px 24px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: inherit;
  font-weight: 650;
  text-decoration: none;
}

.brand img {
  display: block;
  height: auto;
  width: auto;
  max-height: 44px;
  max-width: min(240px, 72vw);
}

nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

nav a[aria-current="page"],
.page-nav a[aria-current="page"] {
  color: var(--accent-ink);
  font-weight: 650;
}

h1 {
  margin: 0 0 12px;
  font-size: 2rem;
  line-height: 1.2;
}

h2 { margin: 0 0 8px; font-size: 1.05rem; }

h3 { margin: 14px 0 0; font-size: 0.95rem; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lede {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.steps {
  max-width: 40rem;
  margin: 20px 0 0;
  padding-left: 1.25rem;
}

.steps li + li { margin-top: 8px; }

.note {
  max-width: 40rem;
  margin: 16px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.stack { display: grid; gap: 12px; margin-top: 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--accent); }

.card p,
.card li { margin: 0; }
.card p + p,
.card h3 + p { margin-top: 8px; }
.card ul { margin: 8px 0 0; padding-left: 1.2rem; }
.card li + li { margin-top: 4px; }

code {
  font-family: Consolas, "Courier New", monospace;
  background: #efeae0;
  border-radius: 4px;
  padding: 0 4px;
  overflow-wrap: anywhere;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.wrap-wide { max-width: 1100px; }

.catalog-tools {
  display: grid;
  gap: 12px;
}

.catalog-tools input {
  font: inherit;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

.docs-shell {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.doc-nav {
  position: sticky;
  top: 16px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.doc-nav a {
  display: block;
  overflow-wrap: anywhere;
}

.doc-group {
  display: grid;
  gap: 4px;
}

.doc-group p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-main { min-width: 0; }

html.js .doc-panel { display: none; }
html.js .doc-panel.is-active { display: block; }

@media (max-width: 760px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .doc-nav {
    position: static;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
}

.card,
.stack,
main,
header,
.brand {
  min-width: 0;
}

pre {
  margin: 12px 0 0;
  padding: 14px;
  overflow: auto;
  color: #f4f1ea;
  background: #1d2430;
  border-radius: 10px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
}

pre code { background: transparent; padding: 0; color: inherit; }

footer {
  margin-top: 36px;
  color: var(--muted);
  font-size: 0.92rem;
}

a:focus-visible,
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.console-app {
  min-width: 1180px;
  background: #f4f7fb;
  color: #1f2a3d;
}

.console-shell {
  display: flex;
  min-height: 100vh;
}

.console-side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: 248px;
  height: 100vh;
  flex: 0 0 248px;
  padding: 22px 16px 16px;
  background: #0d1b36;
  color: #fff;
}

.console-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 22px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.console-logo img {
  display: block;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  object-fit: cover;
  object-position: left center;
  border-radius: 8px;
  background: #000;
}

.console-logo span {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.console-menu {
  display: grid;
  gap: 6px;
}

.console-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 15px;
  text-align: left;
}

button.console-nav,
a.console-nav { cursor: pointer; text-decoration: none; }

.console-nav[aria-current="page"] {
  background: #2f6fed;
  color: #fff;
  font-weight: 650;
}

.console-side-foot {
  margin-top: auto;
  padding-top: 16px;
}

.console-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.console-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #16315f;
  color: #fff;
  font-weight: 700;
}

.console-account-text {
  display: grid;
  min-width: 0;
}

.console-account-text strong,
.console-account-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-account-text small { color: rgba(255, 255, 255, 0.62); }

.console-logout button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  cursor: pointer;
}

.console-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.console-work {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 40px;
}

.console-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.console-app h1 {
  margin: 0;
  color: #172033;
  font-size: 28px;
  line-height: 1.25;
}

.console-kicker {
  margin: 0 0 6px;
  color: #2f6fed;
  font-size: 13px;
}

.console-sub {
  margin: 6px 0 0;
  color: #8b95a7;
  font-size: 14px;
}

.console-top-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #8b95a7;
  font-size: 13px;
  white-space: nowrap;
}

.console-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef1f6;
  color: #667085;
  font-size: 13px;
}

.console-refresh {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: #667085;
  text-decoration: none;
}

.console-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.console-kpis-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.console-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
  margin-top: 12px;
}

.console-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #667085;
  font-size: 12px;
  font-weight: 650;
}

.console-toolbar input,
.console-toolbar select {
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
}

.console-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.console-pager p { margin: 0; color: #475467; font-size: 13px; }

.console-pager button {
  min-height: 36px;
  margin-left: 8px;
  padding: 6px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  font: inherit;
  cursor: pointer;
}

.console-pager button:disabled { opacity: 0.45; cursor: default; }

.console-app tr[hidden] { display: none; }

.console-status-summary { margin: 0; }

.console-status-alert {
  margin: 12px 0 0;
  padding: 10px 12px 10px 1.6rem;
  border-radius: 12px;
  background: #fff4e5;
}

.console-diagnostics { margin-top: 12px; }
.console-diagnostics summary { cursor: pointer; color: #2f6fed; font-weight: 650; }

.console-app .revenue-board { display: grid; gap: 12px; }
.console-app .revenue-board .console-kpis { gap: 12px; }
.console-app .revenue-board .console-kpi { min-height: 0; padding: 14px 16px; }
.console-app .revenue-board .console-kpi-detail:empty { display: none; }
.console-app .revenue-board table { margin-top: 8px; }

.console-kpi {
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-areas:
    "icon label"
    "icon value"
    "icon detail";
  align-items: center;
  min-height: 118px;
  padding: 18px 18px 16px;
  border-radius: 16px;
}

.console-kpi-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.console-kpi-label {
  grid-area: label;
  color: #667085;
  font-size: 14px;
}

.console-kpi strong {
  grid-area: value;
  color: #172033;
  font-size: 26px;
  line-height: 1.2;
}

.console-kpi-detail {
  grid-area: detail;
  color: #98a2b3;
  font-size: 13px;
}

.console-kpi-blue { background: #eaf2ff; color: #2f6fed; }
.console-kpi-violet { background: #f3eeff; color: #7a5af8; }
.console-kpi-green { background: #e9f8ef; color: #179a54; }
.console-kpi-amber { background: #fff4e5; color: #f79009; }

.console-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  margin-top: 16px;
}

.console-stack { display: grid; gap: 16px; }

.console-card {
  padding: 18px 20px 16px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.04);
}

.console-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #172033;
  font-size: 16px;
}

.console-card p,
.console-card li { color: #475467; }

.console-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.console-chip {
  padding: 6px 10px;
  border: 1px solid #eaecf0;
  border-radius: 8px;
  color: #667085;
  font-size: 13px;
}

.console-empty,
.console-note,
.console-footnote { color: #667085; }

.console-note,
.console-footnote { margin: 12px 0 0; font-size: 13px; }

.console-app table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 14px;
}

.console-app th,
.console-app td {
  padding: 10px 8px;
  border-bottom: 1px solid #eef1f6;
  text-align: left;
}

.console-app th { color: #98a2b3; font-weight: 600; }

.console-chart {
  display: block;
  width: 100%;
  height: auto;
  color: #98a2b3;
  font-size: 11px;
}

.console-chart line { stroke: #eaecf0; }
.console-chart polyline { fill: none; stroke: #2f6fed; stroke-width: 2; }
.console-chart text { fill: #98a2b3; }

.console-trend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  color: #667085;
  font-size: 13px;
}

.console-status-list { margin: 8px 0 0; padding-left: 1.2rem; }
.console-status-list li + li { margin-top: 4px; }

.console-solo {
  max-width: 560px;
  margin: 48px auto;
}

.console-app .console-form button {
  background: #2f6fed;
}

.console-app .provider-panel {
  width: 86%;
  max-width: 86%;
}

.console-app #provider-admin [hidden] {
  display: none !important;
}

.console-app .provider-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 16px;
  width: max-content;
  max-width: 100%;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  background: #f8fafc;
}

.console-app .provider-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.console-app .provider-zone > span {
  flex: 0 0 100%;
  color: #667085;
  font-size: 12px;
  font-weight: 650;
}

.console-app .provider-zone input,
.console-app .provider-zone select,
.console-app .provider-secret input {
  font: inherit;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #172033;
}

.console-app .provider-zone input { width: 180px; flex: none; }
.console-app .provider-zone select { width: auto; min-width: 112px; flex: none; }

.console-app .provider-toolbar button,
.console-app .provider-detail-bar [data-provider-add],
.console-app .provider-form-actions button[type="submit"] {
  font: inherit;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #2f6fed;
  border-radius: 8px;
  background: #2f6fed;
  color: #fff;
  cursor: pointer;
}

.console-app .provider-detail-bar,
.console-app .provider-actions,
.console-app .provider-form-actions,
.console-app .provider-pager,
.console-app .provider-secret {
  display: flex;
  align-items: center;
  gap: 8px;
}

.console-app .provider-detail-bar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.console-app .provider-detail-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-right: auto;
}

.console-app .provider-detail-id h2 { margin: 0; }

.console-app .provider-detail-bar [data-provider-back],
.console-app .provider-action,
.console-app .provider-pager button,
.console-app .provider-form-actions button[type="button"],
.console-app .provider-secret button {
  font: inherit;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  cursor: pointer;
}

.console-app .provider-actions { justify-content: flex-end; }

.console-app .provider-panel table {
  width: 100%;
  margin-top: 8px;
  table-layout: fixed;
}

.console-app [data-provider-list-table] th:nth-child(1) { width: 18%; }
.console-app [data-provider-list-table] th:nth-child(2) { width: 12%; }
.console-app [data-provider-list-table] th:nth-child(3),
.console-app [data-provider-list-table] th:nth-child(4) { width: 14%; }
.console-app [data-provider-list-table] th:nth-child(5) { width: 24%; }
.console-app [data-provider-list-table] th:nth-child(6) { width: 18%; }

.console-app [data-provider-table] th:nth-child(1) { width: 16%; }
.console-app [data-provider-table] th:nth-child(2) { width: 34%; }
.console-app [data-provider-table] th:nth-child(3) { width: 14%; }
.console-app [data-provider-table] th:nth-child(4) { width: 20%; }
.console-app [data-provider-table] th:nth-child(5) { width: 16%; }

.console-app .provider-panel th,
.console-app .provider-panel td {
  padding: 14px 12px;
  vertical-align: middle;
}

.console-app .provider-panel th:last-child,
.console-app .provider-panel td:last-child { text-align: right; }

.console-app .provider-pager {
  justify-content: flex-end;
  margin-top: 14px;
  color: #667085;
}

.console-app .provider-form {
  display: grid;
  gap: 12px;
  max-width: 460px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  background: #f8fafc;
}

.console-app .provider-form h3 { margin: 0; }

.console-app .provider-form label {
  display: grid;
  gap: 6px;
  color: #475467;
}

.console-app .provider-secret input { flex: 1; }

.console-app .provider-empty,
.console-app [data-provider-list-empty],
.console-app [data-provider-empty] {
  margin: 20px 0 8px;
  padding: 28px 16px;
  border: 1px dashed #d0d5dd;
  border-radius: 12px;
  text-align: center;
}

.console-app .telegram-panel { width: max-content; max-width: 100%; }

.console-app .telegram-note { margin: 8px 0 0; font-size: 13px; }

.console-app .telegram-credentials {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 8px 12px;
  width: max-content;
  max-width: 100%;
  margin-top: 10px;
}

.console-app .telegram-field {
  display: grid;
  gap: 4px;
  color: #475467;
  font-size: 13px;
}

.console-app .telegram-entry {
  display: flex;
  align-items: center;
  gap: 8px;
}

.console-app .telegram-credentials input { width: 220px; }

.console-app #telegram-chat { width: 160px; }

.console-app .telegram-credentials input,
.console-app .telegram-credentials button,
.console-app .telegram-switches button {
  font: inherit;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #172033;
}

.console-app .telegram-credentials button.telegram-save,
.console-app .telegram-switches button {
  width: auto;
  flex: 0 0 auto;
  border-color: #2f6fed;
  background: #2f6fed;
  color: #fff;
  cursor: pointer;
}

.console-app .telegram-reveal {
  width: auto;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 4px 10px;
  background: #fff;
  color: #172033;
  cursor: pointer;
}

.console-app .telegram-state {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: #475467;
  font-size: 13px;
  white-space: nowrap;
}

.console-app .telegram-switches {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px 14px;
  width: max-content;
  max-width: 100%;
  margin-top: 12px;
}

.console-app .telegram-notice { min-height: 1.2em; margin: 8px 0 0; font-size: 13px; }

.console-app .telegram-switches button:disabled,
.console-app .telegram-credentials button:disabled { opacity: 0.45; cursor: default; }

.console-app .provider-pill-on { background: #e9f8ef; color: #179a54; }
.console-app .provider-pill-off { background: #f2f4f7; color: #667085; }

.console-app .provider-toolbar button:disabled,
.console-app .provider-action:disabled,
.console-app .provider-pager button:disabled,
.console-app .provider-detail-bar button:disabled,
.console-app .provider-form button:disabled {
  opacity: 0.45;
  cursor: default;
}

@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
}

.console-form {
  display: grid;
  gap: 12px;
  max-width: 420px;
  margin-top: 16px;
}

.console-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.console-form input {
  font: inherit;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

.console-form input[type="checkbox"] {
  width: auto;
  padding: 0;
}

.console-reveal {
  display: flex;
  align-items: center;
  gap: 8px;
}

.console-form button {
  font: inherit;
  width: fit-content;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
}

.console-form button:focus-visible,
.console-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
