:root {
  color-scheme: light;
  --bg: #f7f9f9;
  --surface: #ffffff;
  --surface-soft: #eefafa;
  --text: #172026;
  --muted: #68747c;
  --line: #dfe6e8;
  --line-strong: #cbd6d9;
  --teal: #079996;
  --teal-dark: #087a78;
  --teal-soft: #dff6f5;
  --coral: #ff6547;
  --coral-soft: #fff0ec;
  --green: #1c9b56;
  --shadow: 0 12px 32px rgba(23, 32, 38, 0.07);
  --shadow-soft: 0 8px 24px rgba(23, 32, 38, 0.06);
  --shadow-lift: 0 18px 42px rgba(23, 32, 38, 0.11);
  --focus-ring: 0 0 0 3px rgba(7, 153, 150, 0.16);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --radius: 8px;
  --sidebar: 260px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(223, 246, 245, 0.62) 0, rgba(247, 249, 249, 0) 260px),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.26s var(--ease-standard);
}

.app-shell.sidebar-collapsed {
  --sidebar: 76px;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  transition: width 0.26s var(--ease-standard), padding 0.26s var(--ease-standard);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 4px 28px;
  color: var(--teal);
  font-size: 28px;
  font-weight: 800;
  text-decoration: none;
  transition: color 0.18s var(--ease-standard), transform 0.18s var(--ease-standard);
}

.brand:hover {
  transform: translateY(-1px);
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #667178;
}

.brand-icon svg {
  width: 30px;
  height: 30px;
}

.sidebar-collapsed .brand {
  justify-content: center;
  margin-inline: 0;
}

.sidebar-collapsed .brand > span:last-child,
.sidebar-collapsed .nav-item span,
.sidebar-collapsed .collapse-button span {
  display: none;
}

.sidebar-collapsed .nav-item,
.sidebar-collapsed .collapse-button {
  justify-content: center;
  padding-inline: 0;
}

.sidebar-collapsed .collapse-button svg {
  transform: rotate(180deg);
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 0 16px;
  color: #34424a;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 15px;
  font-weight: 560;
  transition: background 0.18s var(--ease-standard), color 0.18s var(--ease-standard), transform 0.18s var(--ease-standard);
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(90deg, #e5f8f7 0%, #f1fbfb 100%);
  color: var(--teal-dark);
}

.nav-item:hover {
  transform: translateX(2px);
}

.nav-item svg {
  width: 21px;
  height: 21px;
}

.collapse-button {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding: 12px 14px;
  color: #34424a;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  font-size: 15px;
  transition: background 0.18s var(--ease-standard), color 0.18s var(--ease-standard);
}

.collapse-button:hover {
  background: #f2f6f6;
}

.main {
  min-width: 0;
  padding: 0 24px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  margin: 0 -24px;
  padding: 0 24px;
  background: rgba(247, 249, 249, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  transition: background 0.22s var(--ease-standard), box-shadow 0.22s var(--ease-standard);
}

.topbar-status,
.topbar-actions,
.filter-row,
.legend,
.connection-state {
  display: flex;
  align-items: center;
}

.topbar-status {
  gap: 12px;
  color: #3f4c53;
  font-size: 14px;
}

.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  background: var(--line-strong);
  border-radius: 50%;
  box-shadow: 0 0 0 0 currentColor;
}

.status-dot.ok {
  background: var(--green);
  animation: statusPulse 2.8s ease-out infinite;
}

.status-dot.warn {
  background: var(--coral);
}

.divider {
  width: 1px;
  height: 20px;
  background: var(--line);
}

.topbar-actions {
  gap: 10px;
}

.updated-label {
  color: #4c5960;
  font-size: 14px;
}

.icon-button,
.settings-button,
.secondary-button,
.primary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 7px;
  transition: border-color 0.16s var(--ease-standard), background 0.16s var(--ease-standard), color 0.16s var(--ease-standard), transform 0.16s var(--ease-standard), box-shadow 0.16s var(--ease-standard);
}

.icon-button {
  width: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: #415057;
}

.settings-button,
.secondary-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: #27343b;
  font-size: 14px;
  font-weight: 620;
}

.primary-button {
  padding: 0 18px;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.text-button {
  padding: 0 8px;
  color: var(--teal-dark);
  background: transparent;
  border: 0;
  font-size: 14px;
  font-weight: 700;
}

.icon-button:hover,
.settings-button:hover,
.secondary-button:hover {
  border-color: var(--line-strong);
  background: #f6fafa;
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.primary-button:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.icon-button:active,
.settings-button:active,
.secondary-button:active,
.primary-button:active,
.text-button:active {
  transform: translateY(0);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0 18px;
  animation: surfaceIn 0.42s var(--ease-out) both;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

.page-heading p,
.panel-heading span,
.metric-label,
.metric-note,
.api-meta span,
.dialog-heading p {
  color: var(--muted);
}

.page-heading p {
  margin-top: 6px;
  font-size: 15px;
}

.filter-row {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.period-controls {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.segment {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(84px, auto));
  overflow: hidden;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(23, 32, 38, 0.02);
}

.custom-period-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: #29363d;
  font-size: 14px;
  font-weight: 650;
  transition: border-color 0.18s var(--ease-standard), background 0.18s var(--ease-standard), color 0.18s var(--ease-standard), transform 0.18s var(--ease-standard), box-shadow 0.18s var(--ease-standard);
}

.custom-period-button.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(7, 153, 150, 0.2);
}

.date-range {
  display: none;
  align-items: center;
  gap: 8px;
}

.app-shell[data-period="custom"] .date-range {
  display: flex;
  animation: revealDown 0.22s var(--ease-out) both;
}

.date-range label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.16s var(--ease-standard), box-shadow 0.16s var(--ease-standard), background 0.16s var(--ease-standard);
}

.date-range label:focus-within {
  border-color: var(--teal);
  box-shadow: var(--focus-ring);
}

.date-range span {
  color: #526168;
  font-size: 13px;
  font-weight: 700;
}

.date-range input {
  width: 104px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #1f2b31;
  font-size: 14px;
  font-weight: 650;
}

.date-range input:focus-visible {
  box-shadow: none;
}

.date-range .icon-button:disabled {
  cursor: default;
  opacity: 0.5;
}

.segment button {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: #29363d;
  font-size: 14px;
  font-weight: 650;
  transition: background 0.18s var(--ease-standard), color 0.18s var(--ease-standard), box-shadow 0.18s var(--ease-standard);
}

.segment button:last-child {
  border-right: 0;
}

.segment button.active {
  background: var(--teal);
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.select-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.16s var(--ease-standard), box-shadow 0.16s var(--ease-standard), background 0.16s var(--ease-standard);
}

.select-field:focus-within {
  border-color: var(--teal);
  box-shadow: var(--focus-ring);
}

.select-field span {
  color: #526168;
  font-size: 13px;
  font-weight: 650;
}

.select-field select {
  min-width: 118px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #1f2b31;
  font-size: 14px;
  font-weight: 650;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(23, 32, 38, 0.02);
  transition: border-color 0.2s var(--ease-standard), box-shadow 0.2s var(--ease-standard), transform 0.2s var(--ease-standard), background 0.2s var(--ease-standard);
}

.metric-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  min-height: 118px;
  padding: 20px;
  animation: surfaceIn 0.42s var(--ease-out) both;
}

.metric-card:nth-child(2) {
  animation-delay: 0.04s;
}

.metric-card:nth-child(3) {
  animation-delay: 0.08s;
}

.metric-card:nth-child(4) {
  animation-delay: 0.12s;
}

.metric-card:nth-child(5) {
  animation-delay: 0.16s;
}

.metric-card:hover,
.panel:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.accent-card {
  border-color: #ffd0c6;
  background: linear-gradient(180deg, #fff 0%, var(--coral-soft) 100%);
}

.metric-label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 720;
}

.metric-value {
  display: block;
  color: #121b22;
  font-size: 28px;
  line-height: 1.05;
  font-weight: 760;
  white-space: nowrap;
  transition: color 0.18s var(--ease-standard);
}

.metric-value small {
  color: #27343b;
  font-size: 16px;
  font-weight: 660;
}

.metric-value.coral {
  color: var(--coral);
}

.metric-delta,
.metric-note {
  display: block;
  margin-top: 14px;
  font-size: 14px;
}

.metric-delta.up {
  color: var(--green);
}

.metric-delta.down {
  color: var(--coral);
}

.metric-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  transition: transform 0.22s var(--ease-standard), box-shadow 0.22s var(--ease-standard);
}

.metric-card:hover .metric-icon {
  transform: scale(1.04) rotate(-2deg);
  box-shadow: 0 10px 22px rgba(7, 153, 150, 0.13);
}

.metric-icon.teal {
  color: var(--teal);
  background: var(--teal-soft);
}

.metric-icon.coral-bg {
  color: var(--coral);
  background: #ffe1db;
}

.content-grid,
.lower-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.content-grid {
  grid-template-columns: minmax(280px, 0.85fr) minmax(380px, 1.25fr) minmax(300px, 1fr);
}

.lower-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
}

.panel {
  min-width: 0;
  padding: 18px;
  animation: surfaceIn 0.42s var(--ease-out) both;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  font-size: 16px;
  line-height: 1.2;
}

.panel-heading span,
.legend {
  font-size: 13px;
}

.panel-heading > span {
  overflow: hidden;
  max-width: 132px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline {
  display: grid;
  max-height: 328px;
  overflow: auto;
  padding-right: 4px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 52px 18px 1fr;
  gap: 12px;
  min-height: 52px;
  color: #2f3a41;
  font-size: 14px;
  animation: listItemIn 0.28s var(--ease-out) both;
}

.timeline-item:nth-child(2) {
  animation-delay: 0.025s;
}

.timeline-item:nth-child(3) {
  animation-delay: 0.05s;
}

.timeline-item:nth-child(4) {
  animation-delay: 0.075s;
}

.timeline-item:nth-child(5) {
  animation-delay: 0.1s;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: -8px;
  left: 70px;
  width: 1px;
  background: var(--line);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-time {
  padding-top: 2px;
  color: #526168;
  font-size: 13px;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  background: var(--teal);
  border-radius: 50%;
  box-shadow: 0 0 0 4px #e2f7f6;
  transition: transform 0.18s var(--ease-standard), box-shadow 0.18s var(--ease-standard);
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.18);
  box-shadow: 0 0 0 6px #d9f4f3;
}

.timeline-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-bottom: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
  transition: background 0.18s var(--ease-standard), color 0.18s var(--ease-standard);
}

.pill.coral {
  color: #d9472c;
  background: #ffe4de;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(var(--bar-count, 7), minmax(34px, 1fr));
  align-items: end;
  gap: 12px;
  overflow: hidden;
  min-height: 296px;
  padding: 22px 6px 0;
  background-image: linear-gradient(to top, var(--line) 1px, transparent 1px);
  background-size: 100% 56px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 18px, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 18px, #000 100%);
}

.bar-chart[data-period="30d"],
.bar-chart[data-period="all"],
.bar-chart[data-period="custom"] {
  gap: 8px;
  grid-template-columns: repeat(var(--bar-count, 5), minmax(46px, 1fr));
}

.bar-item {
  display: grid;
  grid-template-rows: 22px minmax(120px, 1fr) 28px;
  align-items: end;
  justify-items: center;
  min-width: 0;
  animation: listItemIn 0.3s var(--ease-out) both;
}

.bar-item:nth-child(2) {
  animation-delay: 0.025s;
}

.bar-item:nth-child(3) {
  animation-delay: 0.05s;
}

.bar-item:nth-child(4) {
  animation-delay: 0.075s;
}

.bar-item:nth-child(5) {
  animation-delay: 0.1s;
}

.bar-item:nth-child(6) {
  animation-delay: 0.125s;
}

.bar-value {
  color: #3c4a51;
  font-size: 12px;
  font-weight: 720;
}

.bar-track {
  position: relative;
  display: flex;
  align-items: end;
  width: min(48px, 72%);
  height: 100%;
}

.bar-fill {
  width: 100%;
  min-height: 4px;
  height: var(--height);
  background: linear-gradient(180deg, #cdeeed 0%, var(--teal) 100%);
  border-radius: 4px 4px 0 0;
  transform-origin: bottom;
  animation: barGrow 0.58s var(--ease-out) both;
  transition: filter 0.18s var(--ease-standard), transform 0.18s var(--ease-standard);
}

.bar-item:hover .bar-fill {
  filter: saturate(1.08);
  transform: scaleY(1.02);
}

.bar-item:last-child .bar-fill {
  background: linear-gradient(180deg, #1ab8b4 0%, var(--teal-dark) 100%);
}

.bar-label {
  align-self: start;
  color: #526168;
  font-size: 12px;
  white-space: nowrap;
}

.bar-chart[data-period="30d"] .bar-label,
.bar-chart[data-period="all"] .bar-label,
.bar-chart[data-period="custom"] .bar-label {
  font-size: 11px;
}

.source-panel {
  margin-top: 16px;
}

.source-usage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.source-row {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
  min-height: 120px;
  padding: 12px 14px;
  background: #fbfdfd;
  border: 1px solid #edf2f3;
  border-radius: var(--radius);
  animation: listItemIn 0.32s var(--ease-out) both;
  transition: border-color 0.18s var(--ease-standard), background 0.18s var(--ease-standard), box-shadow 0.18s var(--ease-standard), transform 0.18s var(--ease-standard);
}

.source-row:nth-child(2) {
  animation-delay: 0.03s;
}

.source-row:nth-child(3) {
  animation-delay: 0.06s;
}

.source-row:nth-child(4) {
  animation-delay: 0.09s;
}

.source-row:nth-child(5) {
  animation-delay: 0.12s;
}

.source-row:hover {
  background: #fff;
  border-color: #dce9eb;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.source-row-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.source-row-main strong {
  overflow: hidden;
  color: #172026;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-row-main span,
.source-row time {
  color: var(--muted);
  font-size: 13px;
}

.source-row-share {
  display: grid;
  gap: 6px;
}

.source-row-share span {
  color: #172026;
  font-size: 14px;
  font-weight: 760;
}

.source-row time {
  align-self: end;
}

.source-bar {
  overflow: hidden;
  height: 8px;
  background: #e8f1f1;
  border-radius: 999px;
}

.source-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal) 0%, #7fd6c1 100%);
  border-radius: inherit;
  animation: sourceGrow 0.5s var(--ease-out) both;
  transform-origin: left;
}

.legend {
  gap: 8px;
  color: #526168;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-dot.teal {
  background: var(--teal);
}

.legend-line {
  width: 24px;
  border-top: 1px dashed #98a8ad;
}

.insight-panel {
  display: flex;
  flex-direction: column;
}

.insight-summary {
  margin-bottom: 12px;
  padding: 13px;
  color: #26343b;
  background: linear-gradient(180deg, #f3fbfb 0%, #fff 100%);
  border: 1px solid #d7eeee;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.quality-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.quality-item {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 10px;
  background: #fbfdfd;
  border: 1px solid #edf2f3;
  border-radius: var(--radius);
  transition: border-color 0.18s var(--ease-standard), transform 0.18s var(--ease-standard), box-shadow 0.18s var(--ease-standard);
}

.quality-item:hover,
.insight-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.quality-item.ok {
  border-color: #cdebdc;
  background: #f4fbf7;
}

.quality-item.warn {
  border-color: #ffd0c6;
  background: #fff7f4;
}

.quality-item strong {
  color: #1f2b31;
  font-size: 12px;
  line-height: 1.15;
}

.quality-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.insight-item {
  display: grid;
  gap: 8px;
  min-height: 76px;
  padding: 12px;
  background: #fbfdfd;
  border: 1px solid #edf2f3;
  border-radius: var(--radius);
  transition: border-color 0.18s var(--ease-standard), transform 0.18s var(--ease-standard), box-shadow 0.18s var(--ease-standard);
}

.insight-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
}

.insight-item strong {
  align-self: end;
  color: #172026;
  font-size: 18px;
  line-height: 1.1;
}

.table-panel {
  padding-bottom: 8px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 0;
  border-bottom: 1px solid #eef2f3;
  text-align: left;
  font-size: 14px;
}

th {
  color: #4d5b62;
  font-size: 12px;
  font-weight: 760;
}

td {
  color: #2b373d;
}

tbody tr {
  transition: background 0.16s var(--ease-standard), transform 0.16s var(--ease-standard);
}

tbody tr:hover {
  background: #f7fbfb;
}

tbody tr:hover td:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

tbody tr:hover td:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

tr:last-child td {
  border-bottom: 0;
}

.detail-panel {
  min-height: 260px;
}

.last-detail {
  display: grid;
  gap: 16px;
}

.last-detail-top {
  display: flex;
  align-items: center;
  gap: 18px;
}

.last-detail-volume {
  color: #121b22;
  font-size: 34px;
  font-weight: 780;
}

.last-detail-volume small {
  font-size: 17px;
  font-weight: 680;
}

.detail-list {
  display: grid;
  gap: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #2f3b42;
  font-size: 14px;
  transition: color 0.16s var(--ease-standard);
}

.detail-row:hover {
  color: #172026;
}

.detail-row span:first-child {
  color: #67737a;
}

.api-panel {
  display: grid;
  grid-template-columns: 1.2fr 1.35fr 0.8fr 0.55fr 0.9fr auto;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
}

.api-column h2 {
  margin-bottom: 14px;
  font-size: 16px;
}

.connection-state {
  gap: 10px;
  color: var(--teal-dark);
  font-size: 14px;
}

.api-meta {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
}

.api-meta strong {
  overflow: hidden;
  color: #243039;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(23, 32, 38, 0.22);
  animation: dialogIn 0.2s var(--ease-out) both;
}

.settings-dialog::backdrop {
  background: rgba(23, 32, 38, 0.35);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease both;
}

.settings-card {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading h2 {
  font-size: 20px;
}

.dialog-heading p {
  margin-top: 6px;
  font-size: 14px;
}

.input-field {
  display: grid;
  gap: 8px;
  color: #34424a;
  font-size: 14px;
  font-weight: 700;
}

.input-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #172026;
  outline: 0;
  transition: border-color 0.16s var(--ease-standard), box-shadow 0.16s var(--ease-standard);
}

.input-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 170px;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: #253139;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  color: #fff;
  background: #1f2b31;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toastIn 0.24s var(--ease-out) both;
}

@keyframes surfaceIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes listItemIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes revealDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes barGrow {
  from {
    transform: scaleY(0.18);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes sourceGrow {
  from {
    transform: scaleX(0.08);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes statusPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(28, 155, 86, 0.22);
  }
  72% {
    box-shadow: 0 0 0 7px rgba(28, 155, 86, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(28, 155, 86, 0);
  }
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1220px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-grid,
  .lower-grid,
  .api-panel {
    grid-template-columns: 1fr;
  }

  .insight-panel {
    order: 3;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    padding: 14px 14px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-collapsed .brand > span:last-child,
  .sidebar-collapsed .nav-item span {
    display: inline;
  }

  .brand {
    margin: 0 0 12px;
    font-size: 24px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 12px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 12px;
  }

  .collapse-button {
    display: none;
  }

  .main {
    padding: 0 14px 24px;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    margin: 0 -14px;
    padding: 12px 14px;
  }

  .topbar-status {
    flex-wrap: wrap;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-row {
    justify-content: flex-start;
  }

  .period-controls {
    width: 100%;
  }

  .segment {
    flex: 1 1 auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .custom-period-button {
    flex: 0 0 auto;
  }

  .date-range {
    display: none;
    width: 100%;
  }

  .app-shell[data-period="custom"] .date-range {
    display: flex;
  }

  .date-range label {
    flex: 1 1 0;
  }

  .date-range input {
    width: 100%;
    min-width: 0;
  }

  .select-field {
    flex: 1 1 180px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .settings-button span,
  .nav-item span,
  .collapse-button span,
  .updated-label,
  .divider {
    display: none;
  }

  .nav-item {
    justify-content: center;
    width: 44px;
    padding: 0;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 10px 10px 8px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
  }

  .brand {
    margin-bottom: 8px;
    font-size: 20px;
  }

  .nav-list {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 10;
    justify-content: space-around;
    padding: 8px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(23, 32, 38, 0.16);
    backdrop-filter: blur(16px);
  }

  .nav-item {
    flex: 1 1 0;
    width: auto;
    min-height: 40px;
  }

  .main {
    padding-bottom: 92px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 104px;
  }

  .metric-card:hover,
  .panel:hover,
  .source-row:hover,
  .quality-item:hover,
  .insight-item:hover {
    transform: none;
  }

  .content-grid,
  .lower-grid {
    gap: 12px;
  }

  .panel {
    padding: 14px;
  }

  .insight-grid {
    grid-template-columns: 1fr;
  }

  .quality-list {
    grid-template-columns: 1fr;
  }

  .date-range {
    display: none;
    grid-template-columns: 1fr 1fr 38px;
    gap: 8px;
  }

  .period-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .segment {
    width: 100%;
  }

  .custom-period-button {
    width: 100%;
  }

  .app-shell[data-period="custom"] .date-range {
    display: grid;
  }

  .date-range label {
    min-width: 0;
    padding-inline: 8px;
  }

  .date-range span {
    display: inline;
    font-size: 12px;
  }

  .date-range input {
    font-size: 12px;
  }

  .bar-chart {
    gap: 4px;
    overflow-x: visible;
    grid-template-columns: repeat(var(--bar-count, 7), minmax(24px, 1fr));
    padding-inline: 0;
  }

  .bar-chart[data-period="30d"],
  .bar-chart[data-period="all"],
  .bar-chart[data-period="custom"] {
    grid-template-columns: repeat(var(--bar-count, 5), minmax(42px, 1fr));
  }

  .source-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .source-row time {
    justify-self: start;
  }

  .bar-track {
    width: min(32px, 74%);
  }

  .bar-label,
  .bar-value {
    font-size: 10px;
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }

  table {
    min-width: 0;
  }

  th,
  td {
    padding: 11px 0;
    font-size: 12px;
  }

  th:nth-child(2),
  td:nth-child(2),
  th:nth-child(4),
  td:nth-child(4),
  th:nth-child(6),
  td:nth-child(6) {
    display: none;
  }

  .table-wrap {
    overflow: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
