:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: #eef2f6;
  color: #17202a;
  --bg: #eef2f6;
  --surface: #ffffff;
  --border: #d8e0ea;
  --muted: #64748b;
  --text: #17202a;
  --blue: #1769e0;
  --blue-dark: #0f55bd;
  --green: #15803d;
  --green-bg: #dcfce7;
  --red: #b42318;
  --red-bg: #fee2e2;
  --amber: #9a6700;
  --amber-bg: #fef3c7;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[v-cloak] {
  display: none;
}

.sr-only {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

h1,
h2,
h3,
h4,
p,
dl,
dd {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  background: #111827;
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px 14px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  min-height: 58px;
}

.brand-mark {
  align-items: center;
  background: var(--blue);
  border-radius: 8px;
  color: #ffffff;
  display: flex;
  font-weight: 800;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.brand h1 {
  font-size: 17px;
  line-height: 1.35;
}

.brand p,
.service-card p {
  color: #94a3b8;
  font-size: 12px;
  margin-top: 3px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #cbd5e1;
  display: flex;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #1f2937;
  color: #ffffff;
}

.nav-icon {
  align-items: center;
  background: #263244;
  border-radius: 6px;
  display: flex;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.service-card {
  align-items: center;
  background: #1f2937;
  border: 1px solid #334155;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
}

.status-dot {
  background: #22c55e;
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14);
  height: 10px;
  width: 10px;
}

.main-area {
  min-width: 0;
  padding: 24px;
}

.page-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-header h2 {
  color: var(--text);
  font-size: 26px;
  line-height: 1.25;
  margin-top: 4px;
}

.page-subtitle {
  color: var(--muted);
  margin-top: 6px;
}

.header-actions,
.button-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.endpoint-pill {
  background: #e8f0ff;
  border: 1px solid #c9dafc;
  border-radius: 999px;
  color: #184f9f;
  font-size: 13px;
  padding: 8px 12px;
  white-space: nowrap;
}

.primary-button,
.ghost-button,
.text-button {
  border-radius: 7px;
  min-height: 36px;
  padding: 8px 12px;
}

.primary-button {
  background: var(--blue);
  border: 1px solid var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.ghost-button {
  background: #ffffff;
  border: 1px solid var(--border);
  color: #1f2937;
}

.ghost-button:hover {
  background: #f8fafc;
}

.text-button {
  background: transparent;
  border: 0;
  color: var(--blue);
  font-weight: 700;
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card,
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  border-left: 4px solid var(--blue);
  padding: 16px;
}

.metric-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.metric-card strong {
  display: block;
  font-size: 28px;
  line-height: 1.2;
  margin-top: 8px;
}

.metric-card.success {
  border-left-color: var(--green);
}

.metric-card.danger {
  border-left-color: var(--red);
}

.metric-card.warning {
  border-left-color: #d97706;
}

.content-grid,
.debug-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.surface {
  min-width: 0;
  overflow: hidden;
}

.surface-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 64px;
  padding: 14px 16px;
}

.surface-header h3 {
  font-size: 17px;
}

.surface-header p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.recent-item,
.log-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-align: left;
}

.recent-item {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr);
  padding: 10px;
}

.recent-item:hover,
.log-card:hover {
  border-color: #b6c6dd;
  background: #f8fbff;
}

.recent-item strong,
.recent-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item small {
  color: var(--muted);
}

.info-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.info-list div {
  border-bottom: 1px solid #eef2f7;
  display: grid;
  gap: 10px;
  grid-template-columns: 120px minmax(0, 1fr);
  padding-bottom: 10px;
}

.info-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-list dt {
  color: var(--muted);
}

.info-list dd {
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
}

.filter-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  padding: 16px;
}

.filter-grid label {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 6px;
}

.filter-grid input,
.filter-grid select,
.json-editor {
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  outline: none;
}

.filter-grid input,
.filter-grid select {
  min-height: 36px;
  padding: 7px 9px;
}

.filter-grid input:focus,
.filter-grid select:focus,
.json-editor:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.13);
}

.table-wrap {
  overflow-x: auto;
}

.logs-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 980px;
  width: 100%;
}

.logs-table th,
.logs-table td {
  border-bottom: 1px solid #eef2f7;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.logs-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  position: sticky;
  top: 0;
}

.logs-table tbody tr {
  cursor: pointer;
}

.logs-table tbody tr:hover {
  background: #f8fbff;
}

.error-cell {
  color: var(--red);
  max-width: 220px;
  overflow-wrap: anywhere;
}

.badge {
  background: #eef2f7;
  border-radius: 999px;
  color: #334155;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  white-space: nowrap;
}

.badge.success {
  background: var(--green-bg);
  color: var(--green);
}

.badge.danger {
  background: var(--red-bg);
  color: var(--red);
}

.badge.warning {
  background: var(--amber-bg);
  color: var(--amber);
}

.pager {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 12px 16px;
}

.pager span {
  color: var(--muted);
  font-size: 13px;
}

.log-card-list {
  display: none;
}

.json-editor {
  display: block;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  min-height: 460px;
  padding: 14px;
  resize: vertical;
  width: 100%;
}

.code-block {
  background: #111827;
  color: #e5e7eb;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  min-height: 120px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-state,
.detail-error {
  color: var(--muted);
  padding: 24px 16px;
  text-align: center;
}

.inline-error,
.detail-error {
  color: var(--red);
}

.file-list {
  display: flex;
  flex-direction: column;
}

.file-row {
  align-items: center;
  border-bottom: 1px solid #eef2f7;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 90px 190px;
  padding: 12px 16px;
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row span,
.file-row small {
  color: var(--muted);
}

.mobile-tabbar {
  display: none;
}

.drawer {
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 20;
}

.drawer::before {
  background: rgba(15, 23, 42, 0.42);
  content: "";
  inset: 0;
  opacity: 0;
  position: absolute;
  transition: opacity 0.18s ease;
}

.drawer.open {
  pointer-events: auto;
}

.drawer.open::before {
  opacity: 1;
}

.drawer-panel {
  background: #ffffff;
  border-left: 1px solid var(--border);
  bottom: 0;
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  max-width: 720px;
  position: absolute;
  right: 0;
  top: 0;
  transform: translateX(100%);
  transition: transform 0.18s ease;
  width: min(720px, 100%);
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 16px 18px;
}

.drawer-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 16px;
}

.drawer-body h4 {
  color: #334155;
  font-size: 14px;
  margin-bottom: 6px;
}

.drawer-body .code-block {
  max-height: 260px;
}

@media (min-width: 769px) and (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .side-nav.compact {
    padding: 14px 10px;
  }

  .side-nav.compact .brand {
    justify-content: center;
  }

  .side-nav.compact .brand div:last-child,
  .side-nav.compact .nav-item span:last-child,
  .side-nav.compact .service-card div {
    display: none;
  }

  .side-nav.compact .nav-item {
    justify-content: center;
    padding: 10px;
  }

  .side-nav.compact .service-card {
    justify-content: center;
  }

  .main-area {
    padding: 18px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid,
  .debug-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: 70px;
  }

  .app-shell {
    display: block;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .side-nav {
    display: none;
  }

  .main-area {
    max-width: 100vw;
    overflow-x: hidden;
    padding: 14px;
  }

  .page-header,
  .surface-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header h2 {
    font-size: 22px;
  }

  .header-actions,
  .button-row {
    justify-content: flex-start;
  }

  .stats-grid,
  .content-grid,
  .debug-grid {
    grid-template-columns: 1fr;
  }

  .metric-card strong {
    font-size: 24px;
  }

  .recent-item {
    grid-template-columns: 1fr;
  }

  .info-list div,
  .file-row {
    grid-template-columns: 1fr;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    display: none;
  }

  .log-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .log-card {
    display: block;
    padding: 12px;
    width: 100%;
  }

  .log-card-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .log-card-head small {
    color: var(--muted);
    font-size: 12px;
  }

  .log-card strong {
    display: block;
    margin-bottom: 10px;
    overflow-wrap: anywhere;
  }

  .log-card dl {
    display: grid;
    gap: 7px;
  }

  .log-card dl div {
    display: grid;
    gap: 8px;
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .log-card dt {
    color: var(--muted);
  }

  .log-card dd {
    overflow-wrap: anywhere;
  }

  .pager {
    justify-content: space-between;
  }

  .json-editor {
    min-height: 360px;
  }

  .mobile-tabbar {
    background: #ffffff;
    border-top: 1px solid var(--border);
    bottom: 0;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    left: 0;
    min-height: 64px;
    position: fixed;
    right: 0;
    width: 100vw;
    z-index: 15;
  }

  .mobile-tabbar button {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    font-size: 12px;
    gap: 3px;
    justify-content: center;
    min-width: 0;
  }

  .mobile-tabbar button.active {
    color: var(--blue);
    font-weight: 700;
  }

  .mobile-tabbar strong {
    font-size: 12px;
  }

  .drawer-panel {
    max-width: none;
    width: 100%;
  }

  .drawer-body {
    padding-bottom: 82px;
  }
}
