.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
}
.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.metric-icon, .sec-ico {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: #f5f5f7;
  color: #1d1d1f;
  border: 1px solid rgba(0,0,0,.06);
}
.metric-icon svg, .sec-ico svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
}
.metric-val {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 650;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.metric-val em {
  font-style: normal;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}
.metric-bar {
  height: 3px;
  background: #ececef;
  overflow: hidden;
}
.metric-bar i {
  display: block;
  height: 100%;
  background: #1d1d1f;
}
.metric-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-foot b {
  color: var(--ink);
  font-weight: 600;
}

.query {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(2, minmax(150px, 180px)) auto;
  gap: 14px;
  align-items: end;
  padding: 16px 18px;
  border: 1px solid var(--line);
  box-shadow: none;
}
.field-lbl {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.field-lbl svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
  flex: none;
}
.btn-ico { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.75; fill: none; margin-right: 6px; flex: none; }
#err.err {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 0;
  margin: 14px 0 0;
  padding: 11px 14px;
  border: 1px solid #f0c8c4;
  border-left: 3px solid #9f1d14;
  background: #fdecec;
  color: #9f1d14;
  font-size: 13px;
  line-height: 1.45;
}
#err.err::before {
  content: "!";
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #9f1d14;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.note { display: none; }

.sheet-card { margin-top: 16px; border: 1px solid var(--line); box-shadow: none; }
.table-card { padding: 0; overflow: hidden; }
.sheet-head, .chart-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.chart-head { margin-bottom: 12px; }
.sheet-head { padding: 14px 18px 12px; border-bottom: 1px solid var(--line); }
.sheet-head-title, .chart-title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.sheet-head h2, .chart-title h2 { margin: 0; font-size: 16px; font-weight: 640; letter-spacing: -.02em; }
.sheet-head > span, .chart-title > span:not(.sec-ico) { color: var(--muted); font-size: 12px; }
.chart-tabs { display: inline-flex; border: 1px solid #d2d2d7; background: #f7f7f9; }
.chart-tab { height: 30px; padding: 0 12px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.chart-tab.on { background: #1d1d1f; color: #fff; font-weight: 600; }
.chart-box { position: relative; width: 100%; height: 240px; border-top: 1px solid var(--line); padding-top: 12px; }
.chart-box canvas { display: block; width: 100%; height: 100%; }
.chart-tip { position: absolute; z-index: 10; pointer-events: none; min-width: 148px; padding: 8px 10px; background: rgba(29,29,31,.95); color: #fff; font-size: 12px; line-height: 1.55; font-variant-numeric: tabular-nums; box-shadow: 0 8px 24px rgba(0,0,0,.16); }
.chart-tip strong { display: block; margin-bottom: 3px; font-size: 12px; font-weight: 600; color: #f5f5f7; border-bottom: 1px solid rgba(255,255,255,.14); padding-bottom: 3px; }
.chart-tip div { display: flex; justify-content: space-between; gap: 14px; color: #d2d2d7; }
.chart-tip b { color: #fff; font-weight: 600; }

.table-wrap { overflow-x: auto; }
table.logs-table { width: 100%; border-collapse: collapse; min-width: 640px; table-layout: fixed; }
.logs-table th, .logs-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logs-table tbody tr:hover { background: #fafafd; }
.logs-table th { color: var(--muted); font-size: 12px; font-weight: 600; background: #f7f7f9; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 0; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: #e8f6ee; color: #0b6b32; }
.model-tag { display: inline-block; padding: 2px 7px; background: #f2f2f4; border: 1px solid rgba(0,0,0,.06); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--ink); }
.money-cell { font-weight: 620; color: var(--ink); font-variant-numeric: tabular-nums; }
.time-cell { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.time-cell svg { width: 13px; height: 13px; stroke: var(--muted); stroke-width: 1.6; fill: none; flex: none; }
.empty { color: var(--muted); padding: 32px 4px; text-align: center !important; }
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 18px; }
.pager-info { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pager-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.pager-nums { display: inline-flex; align-items: center; gap: 4px; }
.pager-btn { height: 32px; padding: 0 11px; font-size: 12px; }
.pager-num { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid #d2d2d7; border-radius: 0; background: #fff; color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
.pager-num.on { border-color: #1d1d1f; background: #1d1d1f; color: #fff; font-weight: 600; }
.pager-dots { padding: 0 4px; color: var(--muted); font-size: 12px; }
.pager-jump { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.pager-jump input { width: 64px; height: 32px; padding: 0 8px; border: 1px solid #d2d2d7; border-radius: 0; background: #fff; color: var(--ink); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.pager-jump input:disabled { background: #f5f5f7; color: #a1a1a6; }
#err:empty, #note:empty { display: none; }
@media (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .query { grid-template-columns: 1fr 1fr; }
  .grow, .query .btn { grid-column: 1 / -1; }
  .query .btn { width: 100%; }
  .pager-nav { margin-left: 0; }
}
@media (max-width: 560px) {
  .query, .metrics { grid-template-columns: minmax(0, 1fr); }
  .sheet-head, .chart-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .chart-box { height: 210px; }
}
