:root {
  color-scheme: dark;
  --bg: #0d1421;
  --nav: #101927;
  --surface: #151f30;
  --field: #0f1827;
  --raised: #202d41;
  --line: #2e3d54;
  --text: #edf3fb;
  --muted: #a5b4c9;
  --accent: #65e4a1;
  --accent-bg: #17372e;
  --error: #ffb2b5;
  --warning: #f7cd81;
  --blue: #a7ccff;
  --radius: 12px;
  --sans: Inter, "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  font: 15px/1.55 var(--sans);
  color: var(--text);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { padding: 7px 14px; min-height: 40px; border-radius: 8px; cursor: pointer; touch-action: manipulation; border: 1px solid var(--line); background: var(--raised); white-space: nowrap; }
button:hover { background: #293a55; }
button:active { filter: brightness(.9); }
button:disabled { opacity: .52; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary { color: #0b2218; background: var(--accent); border-color: transparent; font-weight: 700; }
.primary:hover { background: #92f4bc; }
.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.danger { color: var(--error); margin-right: auto; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.25rem); line-height: 1.15; letter-spacing: -.025em; overflow-wrap: anywhere; }
h2 { font-size: 1.08rem; }
h3 { font-size: 1rem; }
.muted, small { color: var(--muted); }
.mono { font-family: var(--mono); }
.skip { position: absolute; top: -100px; left: 12px; color: var(--text); background: var(--raised); z-index: 10; padding: 8px 16px; }
.skip:focus { top: 10px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 67px; padding: 9px clamp(12px, 2.5vw, 30px); border-bottom: 1px solid var(--line); background: var(--nav); }
.brand { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.brand strong { font-size: 1.18rem; letter-spacing: -.02em; }
.brand-detail { color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; }
.mark { display: grid; place-items: center; width: 37px; height: 37px; color: var(--accent); background: var(--accent-bg); border: 1px solid #2b5445; border-radius: 10px; font: 700 1.04rem var(--mono); letter-spacing: -.08em; }
.mark.large { width: 52px; height: 52px; font-size: 1.4rem; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user { font-family: var(--mono); max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.login-view { display: grid; place-items: center; min-height: calc(100vh - 67px); padding: 28px 16px; background: radial-gradient(ellipse at 50% 25%, #19302f 0, transparent 53%); }
.login-card { width: min(100%, 430px); padding: clamp(22px, 5vw, 36px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 80px #050a1380; }
.login-head { display: grid; gap: 13px; margin-bottom: 25px; }
.login-head h1 { font-size: 1.8rem; }
.login-head p { color: var(--muted); }
.form-stack, .form-stack label, .filters label, .send-form label { display: grid; gap: 7px; align-content: start; }
.form-stack { gap: 15px; }
label { color: var(--muted); font-weight: 550; }
input, textarea, select { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--field); color: var(--text); }
textarea { resize: vertical; font-family: var(--mono); }
input::placeholder, textarea::placeholder { color: #8a9bb2; }
.check { grid-template-columns: auto 1fr; align-items: center; }
.check input { width: 18px; min-height: 18px; accent-color: var(--accent); }
.error, .warning { color: var(--error); overflow-wrap: anywhere; }
.notice { border: 1px solid #723a49; background: #34212d; border-radius: 8px; padding: 9px 13px; }
.warning { color: var(--warning); border-color: #6c5330; background: #30261c; }

.workspace { min-height: calc(100vh - 67px); display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: var(--nav); border-right: 1px solid var(--line); padding: 22px 15px; display: flex; gap: 14px; flex-direction: column; min-width: 0; }
.sidebar-top, .usage > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-top { padding: 0 4px; }
.count { border-radius: 6px; background: var(--raised); color: var(--muted); padding: 0 7px; }
.task-list { display: grid; gap: 6px; }
.task-card { text-align: left; display: grid; gap: 4px; padding: 9px 10px; min-width: 0; white-space: normal; background: transparent; }
.task-card[aria-current="true"] { background: #1c3540; border-color: #3f7265; }
.task-name { color: var(--text); font-weight: 650; overflow-wrap: anywhere; }
.task-caption { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.usage { margin-top: auto; display: grid; gap: 7px; color: var(--muted); font-size: .83rem; border-top: 1px solid var(--line); padding: 15px 4px 0; }
progress { accent-color: var(--accent); width: 100%; height: 7px; }
.work-area { padding: clamp(15px, 3.3vw, 38px); width: 100%; max-width: 1500px; }
.work-area > .notice { margin-bottom: 12px; }
.empty-work { display: grid; place-items: start; gap: 15px; align-content: center; min-height: 59vh; }
.empty-work p { color: var(--muted); }
.task-view { display: grid; gap: 16px; }
.task-hero { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.task-hero > div:first-child { min-width: 0; }
.task-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; flex-wrap: wrap; }
.tag, .status-pill { display: inline-flex; gap: 7px; align-items: center; font-size: .8rem; border: 1px solid var(--line); border-radius: 20px; padding: 3px 8px; color: var(--muted); white-space: nowrap; }
.tag { font-family: var(--mono); color: var(--blue); }
.status-pill[data-tone="active"] { color: var(--accent); border-color: #345a4c; background: var(--accent-bg); }
.status-pill[data-tone="warning"] { color: var(--warning); border-color: #67522f; }
.status-pill[data-tone="error"] { color: var(--error); border-color: #723a49; }
.status-pill::before, .dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: currentColor; }
.status-pill::before { content: ""; }
.dot[data-tone="active"] { color: var(--accent); }
.dot[data-tone="warning"] { color: var(--warning); }
.dot[data-tone="error"] { color: var(--error); }
.summary { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile, .panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tile { display: grid; align-content: space-between; gap: 7px; padding: 12px 15px; }
.eyebrow { color: var(--muted); font-size: .84rem; }
.endpoint-line { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.endpoint-line strong { overflow-wrap: anywhere; }
.endpoint-line button { min-height: 34px; padding: 3px 8px; }
.metric { font-size: 1.26rem; }
.panel { overflow: clip; }
.panel-head, .toolbar, .filters, .send-form, .pager { padding: 10px 15px; }
.panel-head, .toolbar { min-height: 53px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.segmented { display: flex; gap: 3px; padding: 3px; border-radius: 8px; background: var(--field); }
.segmented button { min-height: 33px; padding: 3px 14px; border-color: transparent; background: transparent; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--raised); color: var(--text); }
.inline-control { display: flex; align-items: center; gap: 8px; }
.inline-control select { width: auto; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.table-scroll { overflow: auto; min-height: 230px; max-height: 49vh; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; }
th { position: sticky; top: 0; background: #192538; color: var(--muted); font-size: .82rem; z-index: 1; }
td { font-family: var(--mono); font-size: .86rem; }
td:first-child, td:nth-child(2), td:nth-child(3), .size { white-space: nowrap; }
td:nth-child(3) { color: var(--muted); }
.size { text-align: right; }
.direction { font-family: var(--sans); }
.direction.rx { color: var(--accent); }
.direction.tx { color: var(--blue); }
.record-data { text-align: left; overflow-wrap: anywhere; white-space: pre-wrap; width: 100%; border: 0; background: transparent; padding: 3px 0; min-height: 28px; color: var(--text); }
.records-info { color: var(--warning); padding: 8px 15px; border-bottom: 1px solid var(--line); }
.empty-records { color: var(--muted); padding: 50px 12px; text-align: center; }
.pager { display: flex; justify-content: center; border-top: 1px solid var(--line); }
.send-form, .payload { display: grid; gap: 10px; }
.send-controls { display: grid; gap: 9px; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); }
.send-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#send-result { color: var(--muted); }
#send-result.error { color: var(--error); }

dialog { position: fixed; max-height: calc(100dvh - 28px); width: min(520px, calc(100% - 24px)); overflow: auto; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: #050a14c7; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.dialog-head h2 { font-size: 1.22rem; }
.dialog-head button { font-size: 1.2rem; }
.dialog-actions { display: flex; gap: 8px; justify-content: end; flex-wrap: wrap; }
.frame-data { background: var(--field); padding: 12px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: min(55vh, 500px); overflow: auto; }
.account-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; margin-bottom: 15px; }
.account-list button { display: flex; justify-content: space-between; white-space: normal; gap: 8px; text-align: left; }
.account-list button span { overflow-wrap: anywhere; }

@media (max-width: 920px) {
  .workspace { grid-template-columns: 184px minmax(0, 1fr); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters button { justify-self: start; }
}
@media (max-width: 700px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .task-list { grid-template-columns: repeat(auto-fit, minmax(min(124px, 100%), 1fr)); }
  .usage { display: none; }
  .brand-detail { display: none; }
  .user { max-width: 70px; }
  .top { gap: 4px; }
  .top button { padding-inline: 7px; }
  .task-hero { align-items: start; flex-direction: column; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary .tile:first-child { grid-column: 1 / -1; }
  .send-controls label:first-child { grid-column: 1 / -1; }
  .send-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-scroll td:first-child { white-space: normal; }
  .table-scroll th, .table-scroll td { padding-inline: 6px; }
}
@media (pointer: coarse) {
  button, input, select { min-height: 44px; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
}
