:root {
  --bg: #f4f7f2;
  --surface: #ffffff;
  --surface-muted: #f0f4ee;
  --surface-soft: #f8fbf7;
  --line: #d7e0d2;
  --text: #1f2a1f;
  --muted: #586558;
  --accent: #1f7a4b;
  --accent-soft: rgba(31, 122, 75, 0.08);
  --danger: #b42318;
  --warning: #b54708;
  --info: #175cd3;
  --shadow: 0 12px 32px rgba(24, 34, 24, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

a,
button,
input,
select {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(23, 92, 211, 0.28);
  outline-offset: 2px;
}

a {
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.topbar__inner {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand__logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
}

.brand__copy {
  display: grid;
  gap: 2px;
}

.brand__copy strong {
  font-size: 0.96rem;
}

.brand__copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.page-shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.page-intro {
  display: grid;
  margin-bottom: 20px;
}

.page-intro h1 {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.08;
}

.auth-view {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.auth-panel {
  width: min(100%, 420px);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel__header {
  display: grid;
  gap: 6px;
}

.auth-panel__header h1,
.auth-panel__header p {
  margin: 0;
}

.auth-panel__header h1 {
  font-size: 1.5rem;
}

.auth-panel__header p {
  color: var(--muted);
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.auth-panel .action-button {
  width: 100%;
}

.main-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.main-nav__button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
}

.main-nav__button[data-active='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.statistics-root {
  display: grid;
  gap: 16px;
}

.statistics-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.statistics-toolbar__source,
.statistics-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.statistics-toolbar__actions {
  display: contents;
}

.statistics-toolbar__source {
  flex: 0 0 auto;
  display: grid;
  gap: 5px;
}

.statistics-toolbar__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.statistics-toolbar__source > span {
  color: var(--muted);
  font-size: 0.84rem;
}

.statistics-filterbar {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: end;
  min-width: 0;
  align-items: end;
  gap: 8px;
}

.statistics-period-field {
  min-width: 310px;
  margin: 0;
  padding: 0;
  border: 0;
}

.statistics-period-field legend,
.statistics-grain-field > span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.statistics-period-field__inputs {
  display: flex;
  align-items: center;
  min-height: 40px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.statistics-period-field__inputs input {
  min-width: 134px;
  min-height: 38px;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.statistics-period-field__separator {
  color: var(--muted);
}

.statistics-grain-field {
  display: grid;
  gap: 4px;
}

.statistics-grain-field select {
  min-width: 126px;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.statistics-apply,
.statistics-all-time {
  min-inline-size: 108px;
}

.statistics-all-time[data-active='true'] {
  border-color: var(--accent);
  color: var(--accent);
}

.statistics-refresh {
  grid-column: 2;
  grid-row: 1;
  min-inline-size: 120px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

.source-notice {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.5;
}

.source-notice[data-tone='warning'] {
  border-left-color: var(--warning);
}

.source-notice[data-tone='error'] {
  border-left-color: var(--danger);
}

.source-notice[data-tone='info'] {
  border-left-color: var(--info);
}

.statistics-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.statistics-metrics > div {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.statistics-metrics dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.statistics-metrics dd {
  margin: 6px 0;
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.statistics-metrics small,
.money-breakdown__amount small {
  color: var(--muted);
  font-size: 0.76rem;
}

[data-tone='positive'] {
  color: #0f6b3d !important;
}

[data-tone='negative'] {
  color: var(--danger) !important;
}

.revenue-chart {
  display: grid;
  gap: 14px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.chart-legend__item,
.chart-legend__trend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-legend__item {
  padding: 3px 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.chart-legend__item:hover {
  background: var(--surface-muted);
}

.chart-legend__item[aria-pressed='false'] {
  opacity: 0.45;
  text-decoration: line-through;
}

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

.chart-legend__trend i {
  width: 22px;
  height: 0;
  border-top: 2px dashed #173f2d;
  border-radius: 0;
}

.revenue-chart__body {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  overflow-x: auto;
}

.revenue-chart__axis {
  position: sticky;
  left: 0;
  z-index: 2;
  height: 300px;
  padding: 26px 0 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.revenue-chart__plot {
  position: relative;
  height: 300px;
  display: flex;
  gap: 4px;
  align-items: stretch;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(to top, transparent 24%, var(--line) 25%, transparent 26%),
    linear-gradient(to top, transparent 49%, var(--line) 50%, transparent 51%),
    linear-gradient(to top, transparent 74%, var(--line) 75%, transparent 76%);
}

.revenue-chart__trend {
  position: absolute;
  z-index: 1;
  top: 30px;
  right: 2px;
  bottom: 36px;
  left: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 66px);
  overflow: visible;
  pointer-events: none;
}

.revenue-chart__trend path {
  fill: none;
  stroke: #173f2d;
  stroke-width: 2;
  stroke-dasharray: 1.4 1.1;
  vector-effect: non-scaling-stroke;
}

.chart-scale-toggle {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.chart-scale-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.revenue-chart__column {
  min-width: 68px;
  flex: 1 0 68px;
  display: grid;
  grid-template-rows: 24px minmax(0, 1fr) 30px;
  gap: 6px;
}

.revenue-chart__value {
  align-self: end;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.revenue-chart__bar {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  min-height: 0;
}

.revenue-chart__segment {
  display: block;
  width: 100%;
  min-height: 1px;
}

.revenue-chart__segment:first-child {
  border-radius: 0 0 3px 3px;
}

.revenue-chart__segment:last-child {
  border-radius: 3px 3px 0 0;
}

.revenue-chart__label {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.section-controls,
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.section-controls {
  justify-content: flex-end;
}

.statistics-field {
  display: grid;
  gap: 5px;
  min-width: 190px;
}

.statistics-field > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.statistics-field input,
.statistics-field select {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.statistics-field--search {
  flex: 1 1 320px;
}

.timeline-details,
.premium-history {
  display: grid;
  gap: 10px;
}

.timeline-details h3,
.section-block__body > h3 {
  margin: 4px 0 0;
  font-size: 0.92rem;
}

.comparison-amount {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.comparison-amount strong,
.delta-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.comparison-amount span {
  color: var(--muted);
  font-size: 0.78rem;
}

.delta-value {
  font-weight: 700;
}

.money-breakdown {
  min-width: 250px;
  display: grid;
  gap: 6px;
}

.money-breakdown div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
}

.money-breakdown span {
  color: var(--muted);
}

.money-breakdown strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money-breakdown__amount {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.premium-summary {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar-panel {
  position: sticky;
  top: 24px;
  padding: 16px;
}

.detail-panel {
  min-height: 860px;
  padding: 20px;
}

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

.stats-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  min-width: 0;
}

.stats-grid dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.stats-grid dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.app-nav {
  display: grid;
  gap: 10px;
}

.sidebar-filters {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.sidebar-field {
  display: grid;
  gap: 6px;
}

.sidebar-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-field input,
.sidebar-field select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.app-nav__item {
  width: 100%;
  min-height: 108px;
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.app-nav__item[data-active='true'] {
  border-color: rgba(31, 122, 75, 0.3);
  background: var(--accent-soft);
}

.app-nav__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.app-nav__title-block,
.app-nav__stats {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.app-nav__title {
  font-size: 0.95rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.app-nav__meta,
.app-nav__stats span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.app-nav__status {
  min-width: 68px;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(31, 122, 75, 0.12);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.detail-view {
  display: grid;
  gap: 18px;
}

.detail-summary {
  display: grid;
  gap: 14px;
}

.detail-summary__title,
.detail-summary__badges,
.detail-summary__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.detail-summary__title {
  display: grid;
  gap: 4px;
}

.detail-summary h2 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.detail-summary__meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.inline-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--accent);
  font-weight: 600;
}

.inline-link[data-disabled='true'] {
  color: var(--muted);
  pointer-events: none;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.detail-tabs__button {
  min-inline-size: 132px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

.detail-tabs__button[data-active='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.tab-panel {
  min-height: 520px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.section-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.section-block--guide {
  background: rgba(23, 92, 211, 0.04);
}

.section-block__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-block__header h2 {
  margin: 0;
  font-size: 1rem;
}

.section-block__note {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.section-block__body {
  display: grid;
  gap: 12px;
}

.guide-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding-left: 20px;
}

.guide-list li {
  display: grid;
  gap: 4px;
}

.guide-list span,
.guide-note {
  color: var(--muted);
  line-height: 1.55;
}

.guide-note {
  margin: 0;
}

.billing-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.billing-form--app {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.billing-form--grant {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.billing-check,
.billing-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.billing-check {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
}

.billing-check input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.billing-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.billing-field input,
.billing-field select {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: end;
  min-height: 40px;
  min-inline-size: 180px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.action-button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.action-button--danger {
  color: var(--danger);
}

.action-button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.form-error {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-actions .action-button {
  min-inline-size: 216px;
}

.inline-error {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.table-pagination {
  display: grid;
  min-width: 760px;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 48px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
}

.table-pagination label,
.table-pagination__navigation {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-pagination select,
.table-pagination button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.table-pagination select {
  padding: 4px 28px 4px 8px;
}

.table-pagination__range {
  font-variant-numeric: tabular-nums;
}

.table-pagination__navigation {
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}

.table-pagination button {
  min-width: 34px;
  padding: 0;
  cursor: pointer;
}

.table-pagination button:disabled {
  cursor: default;
  opacity: 0.45;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.sortable-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-transform: inherit;
}

.sortable-header__marker {
  color: var(--accent);
  font-size: 0.9rem;
}

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

.table-cell-stack {
  display: grid;
  gap: 4px;
}

.table-cell-stack strong,
.table-cell-stack span {
  overflow-wrap: anywhere;
}

.table-cell-stack span {
  color: var(--muted);
  font-size: 0.82rem;
}

.log-block {
  display: grid;
  gap: 10px;
}

.log-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.log-block__header span {
  color: var(--muted);
  font-size: 0.82rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(31, 42, 31, 0.06);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge[data-tone='active'] {
  color: #0f5e35;
  background: rgba(31, 122, 75, 0.12);
}

.status-badge[data-tone='warning'] {
  color: #8a4b00;
  background: rgba(181, 71, 8, 0.14);
}

.status-badge[data-tone='error'] {
  color: #8f1d14;
  background: rgba(180, 35, 24, 0.14);
}

.status-badge[data-tone='info'] {
  color: #175cd3;
  background: rgba(23, 92, 211, 0.1);
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
}

@media (max-width: 1160px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar-panel {
    position: static;
  }

  .stats-grid,
  .statistics-metrics,
  .billing-form,
  .billing-form--app,
  .billing-form--grant {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-toolbar,
  .statistics-toolbar__actions {
    align-items: flex-start;
  }

  .statistics-toolbar {
    flex-direction: column;
  }

  .statistics-toolbar__actions {
    width: 100%;
    justify-content: space-between;
  }

  .statistics-filterbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 820px) {
  .page-shell,
  .topbar__inner {
    width: min(100% - 20px, 1360px);
  }

  .topbar__inner,
  .statistics-toolbar__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    padding-bottom: 2px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .main-nav__button {
    width: 100%;
  }

  .page-intro h1 {
    font-size: 1.9rem;
  }

  .stats-grid,
  .statistics-metrics,
  .billing-form,
  .billing-form--app,
  .billing-form--grant {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    min-height: auto;
    padding: 16px;
  }

  .tab-panel {
    min-height: auto;
  }

  .detail-summary__badges,
  .detail-summary__links,
  .detail-tabs,
  .section-block__header,
  .log-block__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-button,
  .inline-actions .action-button,
  .detail-tabs__button {
    width: 100%;
    min-inline-size: 0;
  }

  .statistics-filterbar,
  .statistics-field,
  .section-controls,
  .table-toolbar {
    width: 100%;
  }

  .statistics-filterbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .statistics-period-field,
  .statistics-grain-field,
  .statistics-apply,
  .statistics-all-time {
    grid-column: 1 / -1;
  }

  .statistics-period-field,
  .statistics-grain-field select {
    width: 100%;
  }

  .statistics-period-field__inputs input {
    min-width: 0;
    width: 50%;
  }

  .statistics-refresh {
    width: 100%;
  }
}
