:root {
  --ink: #17211b;
  --muted: #66736b;
  --paper: #f4f1e9;
  --surface: rgba(255, 255, 255, .86);
  --line: #dedbd0;
  --green: #0f7552;
  --green-deep: #0a523c;
  --green-soft: #e2f0e9;
  --table-row-light: #fff;
  --table-row-dark: #eaf0eb;
  --table-row-hover: #dcebe1;
  --table-row-selected: #d4e8dc;
  --amber: #c88628;
  --red: #b83d42;
  --shadow: 0 18px 50px rgba(41, 52, 45, .08);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; background:
  radial-gradient(circle at 12% -8%, rgba(36, 143, 101, .14), transparent 30rem),
  linear-gradient(180deg, #f8f6f0 0, var(--paper) 42rem); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar { position: relative; z-index: 50; height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 max(24px, calc((100vw - 1540px) / 2)); border-bottom: 1px solid rgba(23, 33, 27, .1); background: rgba(248, 246, 240, .82); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 38px; height: 38px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 11px; color: #fff; background: var(--green); font: 800 20px/1 Georgia, serif; box-shadow: 0 8px 20px rgba(15, 117, 82, .22); }
.brand p, .brand h1 { margin: 0; }
.brand p, .eyebrow { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.brand h1 { margin-top: 2px; font-size: 16px; white-space: nowrap; }
.brand-title-row { display: flex; align-items: center; gap: 8px; }
.release-version { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 7px; border: 1px solid rgba(15,117,82,.22); border-radius: 999px; color: var(--green-deep); background: rgba(226,240,233,.75); font-size: 11px; font-weight: 750; white-space: nowrap; }
.status-pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.65); font-size: 13px; }
.status-pill span { width: 8px; height: 8px; border-radius: 50%; background: #20a66d; box-shadow: 0 0 0 4px rgba(32,166,109,.12); }
.topbar-actions, .primary-nav { display: flex; min-width: 0; align-items: center; gap: 8px; }
.nav-link { padding: 8px 12px; border: 1px solid rgba(15,117,82,.2); border-radius: 999px; color: var(--green-deep); background: rgba(255,255,255,.62); font-size: 12px; font-weight: 750; text-decoration: none; }
.nav-link:hover { border-color: rgba(15,117,82,.42); background: #fff; }
.nav-link.active { border-color: rgba(15,117,82,.34); background: var(--green-soft); }
.account-menu { position: relative; flex: 0 0 auto; }
.account-menu-trigger { display: block; max-width: 250px; overflow: hidden; cursor: pointer; font: inherit; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.account-dropdown { position: absolute; top: calc(100% + 9px); right: 0; z-index: 60; min-width: 168px; padding: 7px; border: 1px solid rgba(23,33,27,.12); border-radius: 13px; background: rgba(255,255,255,.97); box-shadow: 0 16px 36px rgba(26,42,33,.16); opacity: 0; transform: translateY(-5px); visibility: hidden; pointer-events: none; transition: opacity .15s ease, transform .15s ease, visibility .15s ease; }
.account-dropdown::before { position: absolute; right: 0; bottom: 100%; left: 0; height: 10px; content: ""; }
.account-menu.open .account-dropdown { opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto; }
.analytics-menu .account-dropdown { right: auto; left: 0; min-width: 190px; }
.account-dropdown-item { display: flex; width: 100%; min-height: 36px; align-items: center; padding: 8px 11px; border: 0; border-radius: 8px; color: var(--green-deep); background: transparent; font-size: 12px; font-weight: 700; text-align: left; text-decoration: none; white-space: nowrap; }
.account-dropdown-item:hover, .account-dropdown-item:focus-visible, .account-dropdown-item.active { background: var(--green-soft); outline: none; }
.account-dropdown-button { cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }

main { width: min(1540px, calc(100% - 40px)); margin: 14px auto 60px; }
.list-toolbar .eyebrow { margin: 0 0 9px; }

.panel { border: 1px solid rgba(23,33,27,.1); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.query-panel { padding: 16px 20px 18px; }
.section-heading, .list-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.section-heading h2, .list-toolbar h2 { margin: 0; font-size: 20px; }
.section-heading > p, .muted { margin: 0; color: var(--muted); font-size: 13px; }
.query-grid { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(240px, 1.6fr) repeat(3, minmax(130px, .8fr)) minmax(190px, 1.2fr); gap: 10px; align-items: end; margin-top: 12px; }
.field, .toolbar-controls label { display: grid; gap: 5px; }
.query-grid input, .query-grid select, .wallet-overview-query-grid input, .wallet-overview-query-grid select { min-width: 0; }
.field > span, .toolbar-controls label > span { color: #47534c; font-size: 12px; font-weight: 700; }
.wallet-picker-field { min-width: 0; }
.wallet-address-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; }
.wallet-pusd-balance { color: var(--green); font-size: 12px; font-weight: 750; overflow-wrap: anywhere; }
.wallet-pusd-balance.failed { color: var(--red); }
.wallet-picker-heading { display: flex; min-height: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px 8px; }
.wallet-picker-heading > label { color: #47534c; font-size: 12px; font-weight: 700; }
.wallet-sort-controls { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; font-size: 11px; white-space: nowrap; }
.wallet-sort-controls > span { margin-right: 3px; color: var(--muted); }
.wallet-sort-controls > button { min-height: 24px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; color: #47534c; background: #fff; font-weight: 700; }
.wallet-sort-controls > button:hover { border-color: var(--green); }
.wallet-sort-controls > button[aria-pressed="true"] { border-color: var(--green); color: var(--green-deep); background: var(--green-soft); }
.wallet-sort-controls > button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
input, select { width: 100%; height: 40px; padding: 0 11px; border: 1px solid #d5d6cd; border-radius: 9px; color: var(--ink); background: #fff; outline: none; transition: border .2s, box-shadow .2s; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,117,82,.11); }
.query-actions { display: flex; gap: 7px; grid-column: 1 / -1; justify-content: flex-end; }
.button { height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; white-space: nowrap; }
.button.primary { color: #fff; background: var(--green); box-shadow: 0 7px 18px rgba(15,117,82,.18); }
.button.primary:hover { background: var(--green-deep); }
.button.secondary { border-color: var(--line); color: #445048; background: #fff; }
.button.query-page-link { margin-right: auto; border-color: rgba(15,117,82,.3); color: var(--green-deep); background: var(--green-soft); }
.button.query-page-link:hover { border-color: var(--green); background: #d4e8dc; }
.button.query-page-link:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.button.pm-profile-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.button.pm-profile-button:hover { border-color: var(--green); color: var(--green-deep); background: var(--green-soft); }
.button.pm-profile-button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.button.position-button { border-color: rgba(200,134,40,.42); color: #7c521b; background: #fff8ea; }
.button.position-button:hover { border-color: var(--amber); background: #fff2d8; }
.button:disabled { opacity: .55; cursor: default; }
.message { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.message.error { color: #8e252d; background: #f9e7e7; }

.summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 14px 0; }
.position-summary-grid { grid-template-columns: repeat(4, 1fr); }
.stat-card { min-height: 100px; padding: 14px 16px; border: 1px solid rgba(23,33,27,.09); border-radius: 14px; background: rgba(255,255,255,.78); box-shadow: 0 8px 24px rgba(41,52,45,.05); }
.stat-card > span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-card strong { display: block; margin: 8px 0 5px; font: 600 clamp(21px, 1.8vw, 29px) Georgia, serif; white-space: nowrap; }
.stat-card small { color: #849087; font-size: 11px; }
.stat-card.count-card { color: #fff; border-color: var(--green); background: linear-gradient(145deg, #14795a, #0b5942); }
.stat-card.count-card > span, .stat-card.count-card small { color: rgba(255,255,255,.72); }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

.list-panel { overflow: hidden; }
.list-toolbar { padding: 23px 24px 19px; border-bottom: 1px solid var(--line); }
.list-toolbar .muted { margin-top: 7px; }
.toolbar-controls { display: flex; align-items: end; gap: 10px; }
.toolbar-controls select, .toolbar-controls input { min-width: 120px; height: 40px; }
.prediction-toolbar { align-items: start; }
.prediction-toolbar > :first-child, .prediction-toolbar > .toolbar-controls { flex: 0 0 auto; }
.prediction-tag-filter { flex: 1; min-width: 0; }
.prediction-tag-controls, .prediction-tag-modes { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.prediction-tag-controls { color: #47534c; font-size: 12px; }
.prediction-tag-modes label, .prediction-tag-option { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.prediction-tag-filter input { flex: 0 0 auto; width: 14px; height: 14px; margin: 0; padding: 0; accent-color: var(--green); }
.prediction-tag-controls button { padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--green-deep); background: #fff; font-size: 11px; }
.prediction-tag-controls button:disabled { opacity: .45; cursor: default; }
.prediction-tags-hint { margin: 7px 0; color: var(--muted); font-size: 11px; }
.prediction-tag-options { display: flex; flex-wrap: wrap; align-content: start; gap: 6px; max-height: 170px; overflow-y: auto; padding: 2px; }
.prediction-tag-option { max-width: 100%; min-height: 27px; padding: 4px 8px; border: 1px solid #dce5dd; border-radius: 8px; color: #486253; background: #f5f8f4; font-size: 11px; overflow-wrap: anywhere; }
.prediction-tag-option:has(input:checked) { border-color: var(--green); color: var(--green-deep); background: var(--green-soft); }
.prediction-tag-option:focus-within { outline: 2px solid rgba(15,117,82,.35); outline-offset: 1px; }
@media (max-width: 1120px) {
  .prediction-toolbar { flex-wrap: wrap; }
  .prediction-tag-filter { order: 3; flex-basis: 100%; }
}
.table-wrap { overflow: auto; max-height: calc(100vh - 220px); }
table { width: 100%; min-width: 1500px; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.position-table { min-width: 1320px; }
th { position: sticky; top: 0; z-index: 2; padding: 12px 13px; border-bottom: 1px solid #d7d8cf; color: #566159; background: #f4f4ee; text-align: left; font-size: 11px; letter-spacing: .02em; white-space: nowrap; }
.sort-button { display: inline-flex; align-items: center; gap: 5px; margin: -6px -7px; padding: 6px 7px; border: 0; border-radius: 7px; color: inherit; background: transparent; font-size: inherit; font-weight: 750; white-space: nowrap; }
.sort-button:hover { color: var(--green); background: rgba(15,117,82,.07); }
.sort-button:focus-visible { outline: 2px solid rgba(15,117,82,.4); outline-offset: 1px; }
.sort-button.active { color: var(--green-deep); }
.sort-icon { display: inline-block; width: 10px; color: var(--green); font-size: 9px; line-height: 1; text-align: center; }
th.number .sort-button { margin-left: auto; }
th[aria-sort] { background: #edf3ee; }
.date-column { width: 84px; min-width: 84px; }
.count-column { width: 64px; min-width: 64px; padding-right: 5px; padding-left: 5px; }
.count-column .sort-button { gap: 2px; margin-right: 0; margin-left: 0; padding-right: 0; padding-left: 0; }
.count-column .sort-icon { width: 8px; }
td { padding: 13px; border-bottom: 1px solid #e7e5dc; vertical-align: middle; background: var(--table-row-background, var(--table-row-light)); }
tbody tr { cursor: pointer; }
/* Count visible data rows, excluding expanded withdrawal details. Nested tables restart their own stripes. */
tbody > tr { --table-row-background: var(--table-row-light); }
tbody > tr:nth-child(even of :not(.withdrawal-history):not([hidden])) { --table-row-background: var(--table-row-dark); }
tbody > tr:where(:not(.withdrawal-history)):is(:hover, :focus-within) > td { background: var(--table-row-hover); }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; min-width: 320px; max-width: 400px; }
th:first-child { z-index: 3; }
.event-title { color: #1d2821; font-weight: 750; line-height: 1.45; }
.event-meta { margin-top: 6px; color: #899189; font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.tag, .outcome, .close-type { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.tag { color: #486253; background: #eaf0eb; }
.outcome { color: #8b5b18; background: #faefd9; }
.close-type { color: #506058; background: #edf0ee; }
.number { text-align: right; }
td.number { font-variant-numeric: tabular-nums; }
.main-number { display: block; font-weight: 750; }
.sub-number { display: block; margin-top: 4px; color: #899189; font-size: 10px; }
.date { min-width: 84px; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.35; }
.date-part { display: block; }
.date-part + .date-part { margin-top: 2px; color: #778179; }
.position-status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; color: #486253; background: #eaf0eb; font-size: 10px; font-weight: 750; white-space: nowrap; }
.position-status.redeemable { color: #805315; background: #faefd9; }
.empty { padding: 55px 20px; color: var(--muted); text-align: center; }
.list-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 24px; color: var(--muted); font-size: 12px; }
.list-footer p { margin: 0; }
.pagination { display: flex; align-items: center; gap: 7px; }
.page-button { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 9px; color: #455148; background: #fff; }
.page-button:disabled { opacity: .4; cursor: default; }
#current-page { min-width: 70px; text-align: center; font-weight: 700; }

.loading { position: fixed; inset: auto 22px 22px auto; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 13px 17px; border-radius: 12px; color: #fff; background: #17251d; box-shadow: 0 12px 30px rgba(0,0,0,.18); font-size: 13px; }
.loading[hidden] { display: none; }
.loading i { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 30; max-width: min(520px, calc(100% - 30px)); padding: 12px 17px; border-radius: 10px; color: #fff; background: #1c2821; opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: .22s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Wallet category overview */
.wallet-overview-main { width: min(1540px, calc(100% - 40px)); }
.wallet-overview-query-grid { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(240px, 1.6fr) repeat(3, minmax(130px, .8fr)) minmax(190px, 1.2fr); gap: 10px; align-items: end; margin-top: 12px; }
.wallet-overview-summary { margin-top: 14px; }
.wallet-overview-table { min-width: 1450px; }
.wallet-overview-table th:first-child, .wallet-overview-table td:first-child { min-width: 185px; max-width: 220px; }
.wallet-overview-table th:nth-child(2), .wallet-overview-table td:nth-child(2) { min-width: 125px; max-width: 145px; }
.wallet-overview-table th:nth-child(3), .wallet-overview-table td:nth-child(3) { width: 100px; min-width: 100px; }
.wallet-overview-table tbody tr { cursor: default; }
.count-stats-heading { min-width: 125px; }
.count-stats-heading > span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 500; white-space: nowrap; }
.count-stats-cell { min-width: 125px; }
.count-stats-cell .sub-number { white-space: nowrap; }
.wallet-table-name { overflow: hidden; color: #1d2821; font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.wallet-profile-link { display: inline-block; max-width: 100%; overflow: hidden; color: inherit; text-decoration: none; text-overflow: ellipsis; vertical-align: bottom; }
.wallet-profile-link:hover { color: var(--green); text-decoration: underline; }
.wallet-profile-link:focus-visible { border-radius: 3px; outline: 2px solid rgba(15,117,82,.35); outline-offset: 3px; }
.address-copy { padding: 0; border: 0; color: #7c8880; background: transparent; cursor: copy; font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.address-copy:hover { color: var(--green); }
.address-copy:focus-visible { border-radius: 3px; outline: 2px solid rgba(15,117,82,.35); outline-offset: 3px; }
.record-line { display: inline-flex; gap: 4px; font-variant-numeric: tabular-nums; }
.record-line b, .record-line i, .record-line em { min-width: 25px; padding: 3px 6px; border-radius: 6px; text-align: center; font-size: 10px; font-style: normal; }
.record-line b { color: var(--green-deep); background: var(--green-soft); }
.record-line i { color: #9b3037; background: #f7e7e7; }
.record-line em { color: #68736c; background: #eceeea; }
.detail-link { color: var(--green); font-size: 11px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.detail-link:hover { text-decoration: underline; }
.row-actions { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.watch-button { min-width: 70px; height: 30px; padding: 0 10px; border: 1px solid rgba(15,117,82,.35); border-radius: 8px; color: var(--green-deep); background: #f5fbf7; font-size: 11px; font-weight: 800; }
.watch-button:hover { border-color: var(--green); background: var(--green-soft); }
.watch-button.watched { border-color: transparent; color: #5f7568; background: #e9efeb; opacity: 1; }
.wallet-overview-note { margin: 10px 4px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

/* Watch management */
.watch-management-main { width: min(1320px, calc(100% - 40px)); }
.wallet-import-main { width: min(1080px, calc(100% - 40px)); }
.wallet-import-main > .panel:not(.wallet-job-panel) { margin-top: 18px; padding: 24px; }
.wallet-task-items { padding: 0 22px; }
.wallet-import-main .section-heading { gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.wallet-import-main .wallet-check input { accent-color: var(--green); }
.wallet-import-panel, .wallet-job-panel, .wallet-label-panel, .wallet-delete-panel { margin-top: 18px; }
.wallet-import-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.wallet-import-form .button { min-height: 42px; }
.wallet-batch-form { display: flex; flex-direction: column; align-items: stretch; }
.wallet-batch-form > .button { align-self: flex-start; }
.wallet-address-row { display: flex; align-items: end; gap: 12px; margin-bottom: 12px; }
.wallet-address-row .field { flex: 1; min-width: 0; }
.wallet-completion-options { max-height: 360px; overflow: auto; margin: 14px 0; }
.wallet-check { display: flex; align-items: center; gap: 10px; padding: 8px; overflow-wrap: anywhere; }
.wallet-check input { width: 18px; height: 18px; flex-shrink: 0; }
.wallet-task-items > p, #wallet-completion-logs > p { padding: 12px 0; border-bottom: 1px solid #ddd; overflow-wrap: anywhere; white-space: pre-wrap; }
#wallet-job-error { white-space: pre-wrap; }
.wallet-label-form { display: grid; grid-template-columns: minmax(180px, .9fr) minmax(240px, 1.3fr) minmax(130px, .75fr) 85px auto; gap: 12px; align-items: end; }
.wallet-label-form > .field { min-width: 0; }
.wallet-label-form .button { min-height: 42px; }
.wallet-label-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; margin-bottom: 18px; }
.wallet-label-search > .field { min-width: 0; }
.wallet-label-search .button { min-height: 42px; }
.wallet-label-search > .wallet-overview-note { grid-column: 1 / -1; margin: 0; }
.wallet-label-account { max-width: 440px; margin: 18px 0 8px; }
#wallet-label-view-note { margin-bottom: 18px; }
#wallet-label-list-status { margin-top: 20px; }
.wallet-label-table-wrap { overflow: auto; margin-top: 8px; }
#wallet-label-list { width: 100%; min-width: 650px; }
#wallet-label-list th:first-child, #wallet-label-list td:first-child { position: static; min-width: 60px; max-width: none; }
#wallet-label-list code { font-size: 12px; }
.job-badge { align-self: center; border-radius: 999px; padding: 8px 14px; background: #edf1ee; color: #52615a; font-size: 13px; font-weight: 800; }
.job-badge[data-phase="QUEUED"], .job-badge[data-phase="IMPORTING"], .job-badge[data-phase="AGGREGATING"] { background: #fff1d9; color: #935b00; }
.job-badge[data-phase="SUCCEEDED"] { background: #e1f3eb; color: #08724e; }
.job-badge[data-phase="FAILED"] { background: #fbe6e6; color: #a22d2d; }
.wallet-job-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; background: #e3e5df; border-top: 1px solid #e3e5df; }
.wallet-job-details div { min-width: 0; padding: 18px 22px; background: #fff; }
.wallet-job-details dt { margin-bottom: 7px; color: #718078; font-size: 12px; font-weight: 700; }
.wallet-job-details dd { margin: 0; overflow-wrap: anywhere; color: #1d2a24; font-weight: 700; }
.wallet-job-details [role="button"][aria-disabled="false"] { cursor: pointer; }
.wallet-job-details [role="button"][aria-disabled="false"]:hover { background: #f3faf6; }
.wallet-job-details [role="button"]:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
.wallet-job-copy-feedback { margin-left: 10px; color: var(--green); font-weight: 400; }
.wallet-delete-panel { border-color: #ebcfd1; }
.wallet-delete-form { display: grid; grid-template-columns: minmax(240px, .9fr) minmax(300px, 1.1fr) auto; gap: 12px; align-items: end; }
.danger-action { min-height: 42px; border: 1px solid #bd4b53; background: #a9343c; color: #fff; }
.danger-action:hover { background: #8f2830; }
.danger-action:disabled { border-color: #d8bfc1; background: #d8bfc1; cursor: not-allowed; }
.delete-warning { margin: 14px 0 0; color: #8b3a40; font-size: 13px; }
.server-status-main { width: min(1320px, calc(100% - 40px)); }
.server-status-hero { margin-bottom: 18px; }
.server-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.capacity-panel { margin-bottom: 18px; overflow: hidden; }
.disk-card + .disk-card { border-top: 1px solid var(--line); }
.disk-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 20px 24px 16px; }
.disk-identity { min-width: 0; }
.disk-identity h3 { display: inline; margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.disk-identity p { margin: 8px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.disk-roles { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 12px; vertical-align: middle; }
.disk-roles span { padding: 3px 8px; border-radius: 6px; background: #e6f3ec; color: var(--green-deep); font-size: 11px; font-weight: 700; }
.disk-location, .disk-unavailable { margin: 0; padding: 0 24px 20px; font-size: 12px; overflow-wrap: anywhere; }
.disk-location { padding-top: 16px; border-top: 1px solid var(--line); }
.capacity-percent { align-self: center; color: var(--green-deep); font: 700 30px Georgia, serif; }
.capacity-track { height: 14px; margin: 0 24px; overflow: hidden; border-radius: 999px; background: #edf0ec; }
.capacity-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .35s ease; }
.capacity-track span[data-level="warning"] { background: #c88628; }
.capacity-track span[data-level="danger"] { background: #b63f47; }
.capacity-legend { display: flex; justify-content: space-between; gap: 18px; padding: 15px 24px 21px; color: var(--muted); font-size: 12px; }
.capacity-legend strong { margin-left: 4px; color: var(--ink); }
.process-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 20px; color: var(--muted); font-size: 12px; }
.process-stats strong { color: var(--ink); }
.status-table-wrap { max-height: 390px; }
.status-table { min-width: 760px; }
.status-table tbody tr { cursor: default; }
.log-management-panel { margin-top: 18px; }
.watch-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 28px; border: 1px solid rgba(15,117,82,.14); border-radius: 20px; color: #fff; background: linear-gradient(135deg, #0d674a, #123f32); box-shadow: var(--shadow); }
.watch-hero .eyebrow { margin: 0 0 9px; color: rgba(255,255,255,.65); }
.watch-hero h2 { margin: 0; font: 600 clamp(24px, 3vw, 34px) Georgia, "Microsoft YaHei", serif; }
.watch-hero p:last-child { max-width: 700px; margin: 9px 0 0; color: rgba(255,255,255,.7); font-size: 13px; line-height: 1.65; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.watch-hero .button.primary { flex: 0 0 auto; color: var(--green-deep); background: #fff; box-shadow: none; }
.watch-summary { grid-template-columns: repeat(4, 1fr); }
.watch-source-value { font-size: 25px !important; }
.monitor-error { border-color: #e7c7c9; background: #fff8f8; }
.monitor-error .watch-source-value { color: #9a3037; }
.monitor-error small { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.watch-toolbar { align-items: center; }
.watch-filters input { min-width: 240px; }
.watch-table-wrap { max-height: calc(100vh - 330px); min-height: 260px; }
.watch-table { min-width: 980px; }
.watch-table th:first-child, .watch-table td:first-child { min-width: 210px; max-width: 240px; }
.watch-table th:nth-child(2), .watch-table td:nth-child(2) { min-width: 330px; }
.watch-table tbody tr { cursor: default; }
.watch-category-list { display: flex; flex-wrap: wrap; gap: 7px; }
.watch-category-chip { display: inline-flex; align-items: center; min-height: 29px; overflow: hidden; border: 1px solid #dce7df; border-radius: 999px; color: #3e5d4b; background: #eef5f1; font-size: 10px; font-weight: 750; white-space: nowrap; }
.watch-category-chip > span { padding: 4px 7px 4px 10px; }
.watch-category-chip button { align-self: stretch; width: 27px; border: 0; border-left: 1px solid #dce7df; color: #718178; background: transparent; font-size: 16px; line-height: 1; }
.watch-category-chip button:hover { color: #982d34; background: #f8eaea; }
.watch-status { display: inline-flex; align-items: center; gap: 7px; min-height: 27px; padding: 4px 9px; border-radius: 999px; color: var(--green-deep); background: var(--green-soft); font-size: 10px; font-weight: 800; white-space: nowrap; }
.watch-status i { width: 6px; height: 6px; border-radius: 50%; background: #20a66d; }
.danger-button { height: 32px; padding: 0 11px; border: 1px solid #e7c7c9; border-radius: 8px; color: #9a3037; background: #fff7f7; font-size: 11px; font-weight: 750; white-space: nowrap; }
.danger-button:hover { border-color: #c55a60; background: #fbe9ea; }
.watch-empty { display: grid; justify-items: center; gap: 9px; }
.watch-empty strong { color: var(--ink); font-size: 15px; }
.watch-empty span { max-width: 520px; line-height: 1.6; }
.watch-empty .button { margin-top: 8px; }
.email-recipient-panel { margin-bottom: 14px; overflow: hidden; }
.email-recipient-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.email-recipient-toolbar h2 { margin: 4px 0 0; }
.email-recipient-form { display: flex; align-items: flex-end; gap: 9px; }
.email-recipient-form label { min-width: 300px; }
.email-recipient-form input { width: 100%; height: 40px; }
.email-recipient-form .button { height: 40px; white-space: nowrap; }
.email-table-wrap { max-height: 290px; }
.email-recipient-table { min-width: 700px; }
.email-recipient-table th:first-child, .email-recipient-table td:first-child { min-width: 310px; max-width: none; }
.email-recipient-table tbody tr { cursor: default; }
.email-address { color: var(--ink); font-weight: 750; }
.prototype-pill span { background: var(--amber); box-shadow: 0 0 0 4px rgba(200,134,40,.12); }
.login-page { min-height: 100vh; background: radial-gradient(circle at 20% 15%, #e4f2eb, transparent 34%), #f3f1e9; }
.login-shell { display: grid; min-height: calc(100vh - 66px); place-items: center; margin: 0 auto; }
.login-card { width: min(430px, calc(100vw - 32px)); padding: 34px; border: 1px solid rgba(23,33,27,.1); border-radius: 22px; background: rgba(255,255,255,.92); box-shadow: 0 24px 70px rgba(35,49,40,.13); }
.login-brand { color: var(--ink); }
.login-brand h1 { margin: 3px 0 0; font-size: 24px; }
.login-copy { margin: 22px 0; color: var(--muted); line-height: 1.6; }
.stack-form { display: grid; gap: 15px; }
.stack-form label, .account-form label { display: grid; gap: 6px; color: #47534c; font-size: 12px; font-weight: 700; }
.stack-form .button { width: 100%; margin-top: 5px; }
.stack-form .message { margin: 0; }
.account-main { width: min(1180px, calc(100% - 40px)); }
.account-panel { margin-bottom: 16px; overflow: hidden; }
.account-panel h2 { margin: 4px 0 0; }
.account-form { display: grid; grid-template-columns: repeat(3,minmax(180px,1fr)) auto; gap: 12px; align-items: end; padding: 22px 24px; }
.account-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.inline-form { display: flex; gap: 9px; align-items: center; }
.inline-form input { min-width: 300px; }
.account-table { min-width: 850px; }
.account-table th:first-child,.account-table td:first-child { min-width: 220px; max-width: none; }
.account-table tbody tr { cursor: default; }
.position-snapshot-table { min-width: 1250px; }
.position-snapshot-table th:nth-child(3),.position-snapshot-table td:nth-child(3) { min-width: 360px; max-width: 520px; white-space: normal; }
.position-snapshot-table th:nth-child(5),.position-snapshot-table td:nth-child(5) { text-align: right; white-space: nowrap; }
.position-link-row { cursor: pointer !important; }
.position-link-row:hover { background: #eef7f2; }
.position-link-row:focus { outline: 2px solid var(--green); outline-offset: -2px; }
.position-market-link { color: var(--green-deep); font-weight: 750; text-decoration: none; }
.position-market-link:hover { text-decoration: underline; }
.small-button { height: 32px; padding: 0 10px; font-size: 11px; }
.mono { font-family: Consolas,Monaco,monospace; font-size: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1240px) {
  .query-grid, .wallet-overview-query-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .query-grid .wallet-select-field, .query-grid .wallet-field,
  .wallet-overview-query-grid .wallet-select-field, .wallet-overview-query-grid .wallet-field { grid-column: span 2; }
}

@media (max-width: 1120px) {
  .wallet-label-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .position-summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .topbar { height: 60px; gap: 10px; padding: 0 16px; }
  .login-shell { min-height: calc(100vh - 60px); }
  .brand p, .status-pill { display: none; }
  main { width: min(100% - 24px, 1540px); margin-top: 12px; margin-bottom: 30px; }
  .query-panel { padding: 14px; }
  .section-heading { align-items: start; }
  .section-heading > p { display: none; }
  .query-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .query-grid > .field, .wallet-overview-query-grid > .field { min-width: 0; }
  .query-grid .query-actions, .wallet-overview-query-grid .query-actions { flex-wrap: wrap; }
  .query-grid .wallet-select-field, .query-grid .wallet-field, .query-actions { grid-column: 1 / -1; }
  .query-actions .button { flex: 1; }
  .summary-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .position-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .position-summary-grid .stat-card strong { font-size: clamp(17px, 4.8vw, 20px); white-space: normal; overflow-wrap: anywhere; }
  .stat-card { min-height: 96px; padding: 13px; }
  .stat-card.count-card { grid-column: 1 / -1; }
  .list-toolbar { align-items: start; padding: 19px 17px; }
  .toolbar-controls { display: grid; grid-template-columns: minmax(120px, 1fr); }
  #custom-size-field { grid-column: 1 / -1; }
  .list-footer { align-items: flex-start; flex-direction: column; padding: 15px 17px; }
  .pagination { width: 100%; justify-content: space-between; }
  .table-wrap { max-height: 72vh; }
  th:first-child, td:first-child { min-width: 260px; max-width: 290px; }
  .nav-link { padding: 7px 10px; font-size: 11px; }
  .wallet-overview-main { width: min(100% - 24px, 1540px); }
  .wallet-overview-query-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wallet-overview-query-grid .wallet-select-field, .wallet-overview-query-grid .wallet-field, .wallet-overview-query-grid .query-actions { grid-column: 1 / -1; }
  .wallet-overview-query-grid .query-actions .button { flex: 1; }
  .wallet-overview-toolbar { align-items: flex-start; flex-direction: column; }
  .wallet-overview-toolbar .toolbar-controls { display: grid; width: 100%; grid-template-columns: 1fr; }
  .wallet-overview-table th:first-child, .wallet-overview-table td:first-child { min-width: 175px; max-width: 205px; }
  .wallet-overview-summary .stat-card strong { font-size: clamp(17px, 4.8vw, 20px); white-space: normal; }
  .watch-management-main { width: min(100% - 24px, 1320px); }
  .wallet-import-main { width: min(100% - 24px, 1080px); }
  .server-status-main { width: min(100% - 24px, 1320px); }
  .server-status-page .topbar { height: auto; min-height: 60px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
  .server-status-page .topbar-actions { flex-wrap: wrap; justify-content: flex-start; }
  .wallet-import-form, .wallet-job-details, .wallet-label-form, .wallet-label-search, .wallet-delete-form { grid-template-columns: 1fr; }
  .server-summary { grid-template-columns: repeat(2, 1fr); }
  .capacity-legend { flex-direction: column; gap: 7px; }
  .watch-hero { align-items: flex-start; flex-direction: column; padding: 21px; }
  .watch-summary { grid-template-columns: 1fr 1fr; }
  .email-recipient-toolbar, .email-recipient-form { align-items: stretch; flex-direction: column; }
  .email-recipient-form { width: 100%; }
  .email-recipient-form label { min-width: 0; }
  .watch-toolbar { align-items: flex-start; flex-direction: column; }
  .watch-filters { display: grid; width: 100%; grid-template-columns: 1fr; }
  .watch-filters input { min-width: 0; }
  .watch-table th:first-child, .watch-table td:first-child { min-width: 185px; max-width: 210px; }
  .account-main { width: min(100% - 24px,1180px); }
  .account-form { grid-template-columns: 1fr; }
  .account-toolbar,.inline-form { align-items: stretch; flex-direction: column; }
  .inline-form input { min-width: 0; }
}

@media (max-width: 480px) {
  body[data-wallet-page] .topbar { height: auto; min-height: 66px; flex-direction: column; align-items: stretch; padding: 14px 12px; gap: 12px; }
  body[data-wallet-page] .topbar-actions { flex-wrap: wrap; justify-content: space-between; }
  body[data-wallet-page] .primary-nav { flex-wrap: wrap; }
  body[data-wallet-page] .nav-link { white-space: nowrap; }
  .wallet-import-main > .panel:not(.wallet-job-panel) { padding: 18px; }
  .brand-mark { display: none; }
  .brand { gap: 0; }
  .topbar-actions { gap: 5px; }
  .nav-link { padding: 7px 8px; }
}
