:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66757f;
  --line: #dfe5e8;
  --accent: #146c5f;
  --accent-dark: #0c5148;
  --blue: #2367a8;
  --danger: #b93636;
  --warning: #a7680a;
  --sidebar: #172126;
  --radius: 6px;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: "Segoe UI", "Microsoft JhengHei", sans-serif; letter-spacing: 0; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #e8edef; }
.login-panel { width: min(380px, 100%); padding: 34px; border: 1px solid var(--line); border-top: 4px solid var(--accent); background: var(--panel); box-shadow: 0 18px 48px rgba(27, 42, 49, .12); }
.login-panel h1 { margin: 18px 0 26px; font-size: 24px; }
.brand-mark { display: grid; place-items: center; width: 50px; height: 50px; background: var(--accent); color: white; font-weight: 750; font-size: 24px; border-radius: var(--radius); }
.brand-mark.small { width: 34px; height: 34px; font-size: 17px; }
label { display: grid; gap: 7px; color: #34444d; font-size: 13px; font-weight: 600; }
input, textarea, select { width: 100%; border: 1px solid #cfd8dc; border-radius: 5px; background: white; color: var(--ink); padding: 10px 11px; outline: none; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20, 108, 95, .12); }
.login-panel label + label { margin-top: 16px; }
.primary, .secondary, .text-btn { border: 0; border-radius: 5px; padding: 10px 15px; font-weight: 650; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.secondary { border: 1px solid #cbd5da; background: white; color: #2c3e47; }
.text-btn { background: transparent; color: var(--accent); padding-inline: 0; }
.full { width: 100%; margin-top: 10px; }
.error-text { min-height: 20px; color: var(--danger); font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px; background: var(--sidebar); color: white; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 24px; }
.brand strong { font-size: 16px; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav button, .sidebar-logout { border: 0; background: transparent; color: #b8c4c9; text-align: left; padding: 11px 12px; border-radius: 5px; display: flex; gap: 11px; align-items: center; }
.sidebar nav button span { width: 18px; text-align: center; font-size: 18px; }
.sidebar nav button:hover, .sidebar nav button.active { background: #25343b; color: white; }
.sidebar nav button.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-logout { margin-top: auto; width: 100%; }
.main { min-width: 0; padding: 0 32px 48px; }
.topbar { height: 94px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.topbar h2 { margin: 3px 0 0; font-size: 24px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 5px; background: white; font-size: 21px; }
.status-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 4px; font-size: 12px; font-weight: 650; }
.status-badge.success { background: #e1f3ec; color: #136044; }
.status-badge.warning { background: #fff1d6; color: #8a570c; }
.status-badge.danger { background: #fbe5e5; color: #9e2f2f; }
.status-badge.neutral { background: #e9edef; color: #53636c; }
.page { display: none; }
.page.active { display: block; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--panel); }
.stat { padding: 19px 20px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat span, .stat small { display: block; color: var(--muted); }
.stat span { font-size: 12px; font-weight: 650; }
.stat strong { display: block; margin: 8px 0 5px; font-size: 25px; }
.stat small { font-size: 12px; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin: 28px 0 12px; }
.section-head h3 { margin: 0 0 3px; font-size: 16px; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--panel); }
.detail-grid > div { padding: 15px 18px; border-right: 1px solid var(--line); }
.detail-grid > div:last-child { border-right: 0; }
.detail-grid span { color: var(--muted); font-size: 12px; }
.detail-grid strong { display: block; margin-top: 5px; font-size: 14px; word-break: break-word; }
.empty-state { display: block; padding: 24px; color: var(--muted); text-align: center; }
.table-wrap { overflow: auto; border: 1px solid var(--line); background: white; }
table { width: 100%; min-width: 780px; border-collapse: collapse; }
th, td { padding: 11px 13px; border-bottom: 1px solid #edf0f2; text-align: left; vertical-align: middle; font-size: 13px; }
th { background: #f7f9fa; color: #52636d; font-size: 11px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td code { color: #334851; font-size: 12px; }
.progress { width: 100px; height: 5px; overflow: hidden; background: #e5eaed; border-radius: 3px; }
.progress i { display: block; height: 100%; background: var(--accent); }
.segmented { display: inline-flex; border: 1px solid var(--line); padding: 3px; background: white; border-radius: 6px; margin-bottom: 18px; }
.segmented button { border: 0; background: transparent; padding: 8px 14px; border-radius: 4px; color: var(--muted); }
.segmented button.active { background: var(--sidebar); color: white; }
.form-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 24px; background: white; border: 1px solid var(--line); }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; border-top: 1px solid var(--line); padding-top: 18px; }
.form-message { margin-right: auto; color: var(--muted); font-size: 13px; }
.capability-strip { display: flex; flex-wrap: wrap; gap: 7px; min-height: 28px; }
.capability-strip span { padding: 5px 8px; border: 1px solid #cfd8dc; border-radius: 4px; background: #f7f9fa; color: #52636d; font-size: 12px; }
.text-output { max-width: 520px; max-height: 180px; margin: 0; padding: 10px; white-space: pre-wrap; background: #f7f9fa; color: #26373f; border-color: #dde4e7; }
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.toolbar input, .toolbar select { max-width: 190px; }
.accounts-list { display: grid; gap: 8px; }
.account-row { display: grid; grid-template-columns: minmax(160px, 1.2fr) repeat(3, minmax(120px, 1fr)) auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); background: white; }
.account-row small, .account-row span { color: var(--muted); font-size: 12px; }
.account-row strong { display: block; }
.validation-result { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 18px; padding: 16px; border: 1px solid #bcd8d0; background: #f1f8f5; }
.api-endpoint, .secret-notice { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); background: white; }
.api-endpoint span, .secret-notice span { color: var(--muted); font-size: 12px; }
.api-endpoint code, .secret-notice code { overflow-wrap: anywhere; }
.secret-notice { margin-bottom: 12px; border-color: #e5c479; background: #fff9e8; }
.secret-notice button { margin-left: auto; }
pre { margin: 0; padding: 18px; overflow: auto; border: 1px solid var(--line); background: #1c282e; color: #dce8e4; font-size: 12px; line-height: 1.6; }
#toast { position: fixed; right: 22px; bottom: 22px; max-width: min(380px, calc(100vw - 44px)); padding: 12px 15px; border-radius: 5px; background: #172126; color: white; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; font-size: 13px; }
#toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 68px 1fr; }
  .sidebar { padding-inline: 8px; }
  .brand strong, .sidebar nav button:not(.active) { font-size: 0; }
  .sidebar nav button { justify-content: center; }
  .sidebar nav button.active { font-size: 0; }
  .sidebar nav button span { font-size: 18px; }
  .sidebar-logout { font-size: 0; }
  .main { padding-inline: 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid > div:nth-child(2) { border-right: 0; }
  .detail-grid > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 5; top: auto; bottom: 0; width: 100%; height: 62px; padding: 6px; flex-direction: row; }
  .brand, .sidebar-logout { display: none; }
  .sidebar nav { width: 100%; display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
  .sidebar nav button, .sidebar nav button.active { padding: 8px 2px; font-size: 0; justify-content: center; box-shadow: none; }
  .main { padding: 0 12px 80px; }
  .topbar { height: 78px; }
  .topbar h2 { font-size: 20px; }
  .eyebrow, #accountBadge { display: none; }
  .stats-grid, .detail-grid, .form-layout { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .detail-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .account-row { grid-template-columns: 1fr; }
  .validation-result { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input, .toolbar select { max-width: none; flex: 1 1 140px; }
}
