:root {
  color-scheme: light;
  --canvas: #f3f5fc;
  --paper: #fff;
  --ink: #10172b;
  --muted: #556179;
  --line: #e2e6f0;
  --control-line: #d9dfea;
  --violet: #5c44da;
  --violet-soft: #f2eefd;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --header: 72px;
  --rail: clamp(249px, 21.8vw, 346px);
  font: 15px/1.5 "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button:not([disabled]), select, input[type="checkbox"] { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.topbar {
  height: var(--header);
  padding: 0 25px 0 27px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand, .topbar-actions, .mode, .button { display: inline-flex; align-items: center; }
.brand { gap: 15px; font-size: 27px; font-weight: 720; }
.brand svg { color: var(--violet); }
.topbar-actions { gap: 29px; }
.mode { gap: 9px; color: var(--muted); white-space: nowrap; }
.mode-dot { width: 9px; height: 9px; border-radius: 100%; background: #9aa4b7; }
.button {
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 17px;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  background: var(--paper);
  white-space: nowrap;
  font-weight: 520;
}
.button:not(:disabled):hover { background: #f7f6ff; border-color: #c2b7f4; }
.button:disabled { color: #69758a; background: #fafbfe; cursor: default; }
.button.primary { color: #fff; border-color: var(--violet); background: var(--violet); }
.button.primary:hover { background: #4a33c5; }
.button.refresh { min-height: 40px; padding-inline: 14px; }
.refresh svg { color: var(--muted); }

.workspace {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  height: calc(100dvh - var(--header));
}
.app-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 21px 14px 26px;
  background: var(--paper);
  border-right: 1px solid var(--line);
}
.app-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.app-title h2, .section-title h2 { font-size: 21px; font-weight: 690; }
.app-title span { font-weight: 600; }
.app-search {
  margin: 0 8px 19px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  min-height: 39px;
  color: var(--muted);
  background: #fafbfe;
  border: 1px solid var(--control-line);
  border-radius: 8px;
}
.app-search:focus-within { border-color: var(--violet); box-shadow: 0 0 0 2px #5c44da20; }
.app-search input { inline-size: 100%; min-width: 0; border: 0; background: transparent; outline: none; }
.app-search input::placeholder { color: var(--muted); }
.app-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.app-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 72px;
  padding: 9px 9px 9px 14px;
  border-left: 4px solid transparent;
  border-radius: 7px;
}
.app-item:hover { background: #f7f7fc; }
.app-item.selected { background: var(--violet-soft); border-left-color: var(--violet); }
.app-item:focus-visible { outline-offset: -2px; }
.app-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 9px;
}
.app-icon-0 { background: #e6dbfc; color: #603ad7; }
.app-icon-1 { background: #dff1f6; color: #087ba2; }
.app-icon-2 { background: #feecd7; color: #c46716; }
.app-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.app-id { font: 560 14px/1.35 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.last-seen, .rail-footer p, .rail-empty { color: var(--muted); font-size: 13px; }
.rail-empty { padding: 7px 11px; }
.rail-footer { margin: 12px 8px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.rail-footer p { margin-top: 9px; }
.test-toggle { display: inline-flex; gap: 9px; align-items: center; cursor: pointer; }
.test-toggle input {
  margin: 0;
  inline-size: 17px;
  block-size: 17px;
  accent-color: var(--violet);
}

.content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  gap: 24px;
  padding: 30px 16px 33px 23px;
  overflow-y: auto;
  background: var(--canvas);
}
.content-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-inline: 10px;
  gap: 20px;
}
h1 { font-size: 35px; line-height: 1.25; font-weight: 740; letter-spacing: -.035em; }
.selected-app {
  margin-top: 4px;
  font: 500 17px/1.45 var(--mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.range-form { flex: none; }
.select { position: relative; display: inline-block; min-width: 0; }
.select select {
  display: block;
  appearance: none;
  width: 100%;
  min-height: 38px;
  padding: 5px 29px 5px 13px;
  background: var(--paper);
  border: 1px solid var(--control-line);
  border-radius: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 3px #14275107;
}
.select svg {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
}
.range-select { width: clamp(146px, 16.7vw, 260px); }
.range-select select { min-height: 42px; }
.date-section { padding-inline: 10px; }
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}
.section-title span, .event-heading span, .table-footer { color: var(--muted); }
.date-strip { display: flex; gap: 14px; padding: 2px 3px 5px; overflow-x: auto; scrollbar-width: thin; }
.date-chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 130px;
  min-height: 63px;
  padding: 6px 12px;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  background: #fafbfe;
  box-shadow: 0 1px 3px #14275108;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.date-chip time { font-size: 18px; font-weight: 710; }
.date-chip span { color: var(--muted); }
.date-chip:hover { border-color: #b6a7fa; }
.date-chip.selected { border-color: var(--violet); box-shadow: inset 0 0 0 1px var(--violet); background: #eeebfc; }
.date-chip.selected time, .date-chip.selected span { color: #38279e; }
.date-chip:focus-visible { outline-offset: -4px; }

.events-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 270px;
  padding: 0 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 3px #14275109;
}
.event-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 8px 15px;
}
.event-heading { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.event-heading h2 { font-size: 24px; line-height: 1.25; font-weight: 710; }
.event-heading span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.event-filters { display: flex; align-items: center; gap: 12px; }
.event-select { width: 152px; }
.sort-select { width: 161px; }
.table-scroll { min-height: 0; flex: 1; overflow: auto; scrollbar-width: thin; border-radius: 8px 8px 0 0; }
.table-scroll:focus-visible { outline-offset: -2px; }
table { width: 100%; min-width: 875px; border-collapse: separate; border-spacing: 0; text-align: left; }
thead { position: sticky; inset-block-start: 0; z-index: 1; background: #f0f2f9; color: #30394e; }
th, td { padding: 0 13px; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { height: 39px; font-weight: 660; }
td { height: 42px; font: 500 13px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
tr:hover td { background: #f9f8ff; }
.event-name { display: inline-flex; gap: 10px; align-items: center; }
.event-name:hover { color: var(--violet); }
.event-dot { display: inline-block; width: 8px; height: 8px; border-radius: 100%; flex: none; }
.event-dot.violet { background: #6a49db; }
.event-dot.green { background: #379a55; }
.event-dot.blue { background: #237af0; }
.event-dot.orange { background: #eb861e; }
.row-id { display: block; max-width: 20ch; overflow: hidden; text-overflow: ellipsis; }
.action-cell { padding-inline: 4px; }
.row-action { display: grid; place-items: center; min-height: 34px; min-width: 32px; border-radius: 6px; color: var(--muted); }
.row-action:hover { color: var(--violet); background: var(--violet-soft); }
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 11px 8px 13px;
}
.pager { display: flex; align-items: center; gap: 10px; }
.page-number { min-width: 68px; text-align: center; color: var(--ink); font-variant-numeric: tabular-nums; }

.empty, .notice {
  border-radius: 10px;
  color: var(--muted);
  padding: 18px;
}
.empty { margin: auto; text-align: center; }
.empty h2, .empty h3 { color: var(--ink); font-size: 19px; margin-bottom: 7px; }
.workspace-empty { margin: 24px 0 0; padding: 38px 14px; background: var(--paper); border: 1px solid var(--line); }
.notice { border: 1px solid #f0dfb6; background: #fffbf1; color: #795c19; }

.detail {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(470px, 100%);
  max-width: 100%;
  max-height: none;
  height: 100dvh;
  padding: 26px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: -8px 0 26px #23254b18;
  overflow-y: auto;
}
.detail::backdrop { background: #14203b48; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 17px; }
.detail-header h2 { font-size: 23px; overflow-wrap: anywhere; }
.detail-header p { color: var(--muted); font: 13px/1.4 var(--mono); margin-top: 5px; overflow-wrap: anywhere; }
.detail-header p:empty, .detail-status:empty { display: none; }
.detail-status { margin-top: 20px; color: var(--muted); }
.close-detail { padding: 6px; min-width: 36px; }
.detail-fields { margin: 13px 0 24px; }
.detail-fields div { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.detail-fields dt { color: var(--muted); font-size: 13px; }
.detail-fields dd { margin: 0; font: 13px/1.5 var(--mono); word-break: break-word; }
.detail-params h3 { margin-bottom: 8px; font-size: 17px; }
.detail-params pre { padding: 14px; margin: 0; background: #f4f5fb; border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.55 var(--mono); }

@media (min-width: 1350px) and (min-height: 850px) {
  :root { --header: 80px; font-size: 16px; }
  .brand { font-size: 29px; gap: 19px; }
  .brand svg { width: 38px; height: 38px; }
  .button.refresh { min-height: 45px; }
  .app-rail { padding-top: 25px; padding-bottom: 34px; }
  .app-title h2, .section-title h2 { font-size: 23px; }
  .app-search { min-height: 44px; margin-bottom: 23px; }
  .app-item { min-height: 81px; gap: 15px; }
  .app-icon { width: 51px; height: 51px; }
  .app-id { font-size: 16px; }
  .last-seen, .rail-footer p { font-size: 15px; }
  .content { padding-top: 34px; padding-bottom: 66px; gap: 30px; }
  .content-heading { margin-bottom: 6px; }
  h1 { font-size: 39px; }
  .selected-app { font-size: 19px; }
  .range-select select { min-height: 46px; }
  .section-title { margin-bottom: 14px; }
  .date-strip { gap: 16px; }
  .date-chip { min-width: 150px; min-height: 70px; }
  .date-chip time { font-size: 21px; }
  .event-toolbar { padding-block: 17px; }
  .event-heading h2 { font-size: 26px; }
  .event-select { width: 164px; }
  .sort-select { width: 180px; }
  .event-filters select { min-height: 44px; }
  th { height: 46px; }
  td { height: 47px; font-size: 15px; }
  .table-footer { padding-block: 14px 15px; }
  .pager .button { min-height: 39px; }
}

@media (max-width: 1120px) {
  .event-heading { gap: 2px 10px; }
  .event-heading h2 { font-size: 21px; }
  .event-filters { gap: 7px; }
  .event-select { width: 130px; }
  .sort-select { width: 135px; }
}

@media (max-width: 820px) {
  :root { --header: 60px; font-size: 14px; }
  .topbar { padding-inline: 16px; }
  .brand { gap: 9px; font-size: 21px; }
  .brand svg { width: 25px; height: 25px; }
  .topbar-actions { gap: 13px; }
  .button.refresh { min-height: 35px; padding-inline: 10px; }
  .workspace { display: block; height: auto; }
  .app-rail { border-right: 0; border-bottom: 1px solid var(--line); padding: 13px 12px; }
  .app-title { margin-bottom: 8px; }
  .app-title h2, .section-title h2 { font-size: 18px; }
  .app-search { margin-bottom: 8px; }
  .app-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
  .app-item { flex: 0 0 auto; max-width: min(280px, 88vw); min-height: 54px; }
  .app-icon { width: 31px; height: 31px; border-radius: 7px; }
  .app-icon svg { width: 19px; height: 19px; }
  .app-id { font-size: 12px; }
  .rail-footer { display: flex; align-items: baseline; justify-content: space-between; padding-top: 8px; margin-top: 6px; gap: 10px; }
  .rail-footer p { margin-top: 0; }
  .content { gap: 19px; padding: 18px 12px 25px; overflow: visible; }
  .content-heading, .date-section { padding-inline: 4px; }
  h1 { font-size: 26px; }
  .selected-app { font-size: 13px; }
  .range-select { width: 130px; }
  .range-select select { min-height: 35px; }
  .date-strip { gap: 8px; }
  .date-chip { min-height: 53px; min-width: 86px; }
  .date-chip time { font-size: 16px; }
  .event-toolbar { flex-wrap: wrap; padding: 10px 3px; }
  .events-card { padding: 0 6px; }
  .table-scroll { max-height: 420px; }
  .table-footer { padding: 8px 3px 10px; font-size: 12px; flex-wrap: wrap; }
  .pager { margin-left: auto; gap: 5px; }
  .pager .button { min-height: 33px; padding-inline: 9px; }
  .page-number { min-width: 49px; }
}

@media (max-width: 400px) {
  .content-heading { align-items: flex-start; gap: 7px; }
  .range-select { width: 124px; }
  .select select { padding-inline: 9px 22px; }
  .select svg { right: 5px; }
  .detail { padding: 19px; }
}
