:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #28313d;
  --muted: #697386;
  --border: #d6dde6;
  --accent: #08b7f4;
  --accent-dark: #459cff;
  --danger: #ff556a;
  --danger-bg: #fff0f3;
  --soft: #f0f5f8;
  --soft-hover: #e6f1f7;
  --sidebar: #ffffff;
  --row-hover: #f1f5f8;
  --shadow: rgba(10, 10, 10, 0.12);
  --code: #1f2a38;
  --success-bg: #eef9ee;
  --success-text: #008800;
  --warning-bg: #fff7e3;
  --warning-border: #f5a623;
  --warning-text: #5c4300;
  --radius: 4px;
  --control-bg: rgba(255, 255, 255, 0.92);
  --control-shadow: rgba(10, 10, 10, 0.1);
  --topbar-bg: rgba(255, 255, 255, 0.84);
  --modal-shadow: rgba(10, 10, 10, 0.24);
  --overlay: rgba(12, 18, 28, 0.46);
  --primary-color: var(--accent);
  --primary-action-color: var(--accent);
  --primary-font-color: var(--text);
  --secondary-font-color: var(--muted);
  --details-light-color: var(--border);
  --content-bg-color: var(--panel);
  --main-bg-color: var(--bg);
  --border-radius: var(--radius);
  --form-element-height: 38px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151b24;
  --panel: #202936;
  --text: #dedede;
  --muted: #b9c0c9;
  --border: #3b4653;
  --accent: #08b7f4;
  --accent-dark: #459cff;
  --danger: #ff556a;
  --danger-bg: #402b35;
  --soft: #273342;
  --soft-hover: #2d3a4a;
  --sidebar: #202936;
  --row-hover: #243140;
  --shadow: rgba(10, 10, 10, 0.22);
  --code: #dedede;
  --success-bg: #1f3a31;
  --success-text: #90ee90;
  --warning-bg: #3d3320;
  --warning-border: #f5a623;
  --warning-text: #ffc658;
  --control-bg: rgba(31, 42, 56, 0.94);
  --control-shadow: rgba(10, 10, 10, 0.2);
  --topbar-bg: rgba(21, 27, 36, 0.82);
  --modal-shadow: rgba(0, 0, 0, 0.38);
  --overlay: rgba(4, 8, 14, 0.62);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #181f28;
    --panel: #1f2a38;
    --text: #dedede;
    --muted: #b9c0c9;
    --border: #3b4653;
    --accent: #08b7f4;
    --accent-dark: #459cff;
    --danger: #ff556a;
    --danger-bg: #402b35;
    --soft: #273342;
    --soft-hover: #2d3a4a;
    --sidebar: #1f2a38;
    --row-hover: #243140;
    --shadow: rgba(10, 10, 10, 0.22);
    --code: #dedede;
    --success-bg: #1f3a31;
    --success-text: #90ee90;
    --warning-bg: #3d3320;
    --warning-border: #f5a623;
    --warning-text: #ffc658;
    --control-bg: rgba(31, 42, 56, 0.94);
    --control-shadow: rgba(10, 10, 10, 0.2);
    --topbar-bg: rgba(21, 27, 36, 0.82);
    --modal-shadow: rgba(0, 0, 0, 0.38);
    --overlay: rgba(4, 8, 14, 0.62);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", Arial, Helvetica, sans-serif;
}

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

button,
.button-link {
  min-height: var(--form-element-height);
  border: 0;
  border-radius: var(--radius);
  padding: 0 16px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: var(--soft);
  color: var(--text);
}

button.secondary:hover {
  background: var(--soft-hover);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.compact {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

button.full {
  width: 100%;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: #181f28;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] input,
  :root[data-theme="system"] select,
  :root[data-theme="system"] textarea {
    background: #181f28;
  }
}

textarea {
  min-height: 110px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

code {
  color: var(--code);
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.console-controls {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: flex-end;
}

.controls-slot {
  display: flex;
  justify-content: flex-end;
  min-width: max-content;
}

.login-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.language-control,
.theme-control {
  position: relative;
}

.language-toggle,
.theme-toggle,
.language-options button,
.theme-options button {
  min-height: 38px;
  border: 1px solid var(--border);
  background: var(--control-bg);
  color: var(--text);
  box-shadow: 0 1px 2px var(--control-shadow);
}

.language-toggle {
  min-width: 92px;
  gap: 7px;
  justify-content: center;
}

.language-toggle::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.language-control.open .language-toggle::after {
  transform: rotate(225deg) translateY(-1px);
}

.language-options,
.theme-options {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--control-bg);
  box-shadow: 0 8px 26px var(--control-shadow);
}

.language-control.open .language-options,
.theme-control.open .theme-options {
  display: grid;
}

.language-options button {
  min-width: 92px;
  justify-content: flex-start;
  box-shadow: none;
}

.theme-control {
  width: 38px;
  transition: width 180ms ease;
}

.theme-control.open {
  width: 148px;
}

.theme-toggle {
  width: 38px;
  min-width: 38px;
  border-radius: 999px;
  padding: 0;
  box-shadow: 0 1px 2px var(--control-shadow);
}

.theme-options {
  top: 0;
  right: 0;
  grid-auto-flow: column;
  box-shadow: none;
  background: transparent;
  border: 0;
  padding: 0;
}

.theme-options button {
  width: 38px;
  min-width: 38px;
  border-radius: 999px;
  padding: 0;
  box-shadow: 0 1px 2px var(--control-shadow);
}

.theme-control:not(.open) .theme-options {
  display: none;
}

.theme-control.open .theme-toggle {
  display: none;
}

.language-options button:hover,
.language-options button.active,
.theme-options button:hover,
.theme-options button.active {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.login-view {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 70px var(--shadow);
}

.login-card form,
.form-grid {
  display: grid;
  gap: 12px;
}

.mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-weight: 900;
}

.form-error {
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
}

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

.brand small,
.muted {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  justify-content: flex-start;
  background: transparent;
  color: var(--text);
}

.nav button.active,
.nav button:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent-dark);
}

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

.topbar,
.section-head,
.inline-form,
.filters,
.user-menu {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -24px 18px;
  padding: 18px 24px;
  background: var(--topbar-bg);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  backdrop-filter: blur(16px);
}

.section-head > .inline-form,
.section-head > button,
.section-head > .button-link {
  margin-left: auto;
}

.panel-subsection {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.panel-subsection h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.member-form {
  justify-content: flex-start;
}

.member-form input {
  max-width: 320px;
}

.member-form select {
  max-width: 140px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions button,
td select {
  min-height: 34px;
}

.created-key {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--soft);
}

.created-key code {
  overflow: auto;
  white-space: nowrap;
}

.topbar h1 {
  font-size: 30px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.breadcrumbs span + span::before {
  content: "/";
  margin-right: 7px;
  color: color-mix(in srgb, var(--muted) 58%, transparent);
}

.command-button {
  gap: 10px;
  min-width: 210px;
  justify-content: space-between;
  color: var(--muted);
}

kbd {
  min-width: 34px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font: 700 11px "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.mobile-nav-toggle {
  display: none;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  flex: 0 0 auto;
  align-self: center;
  gap: 4px;
}

.mobile-nav-toggle span {
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: currentColor;
}

.sidebar-backdrop,
.command-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: var(--overlay);
  z-index: 45;
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  padding: min(10vh, 80px) 16px 16px;
}

.command-panel {
  position: relative;
  z-index: 81;
  width: min(720px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--panel);
  box-shadow: 0 24px 80px var(--modal-shadow);
  padding: 16px;
}

.command-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.command-head h2 {
  font-size: 18px;
}

.command-search input {
  min-height: 46px;
  font-size: 16px;
}

.command-results {
  display: grid;
  gap: 6px;
  max-height: min(420px, 50vh);
  overflow: auto;
}

.command-item {
  width: 100%;
  min-height: 54px;
  justify-content: flex-start;
  gap: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.command-item:hover,
.command-item.active {
  border-color: var(--border);
  background: var(--soft);
  color: var(--text);
}

.command-item strong,
.command-item span {
  display: block;
}

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

.command-item .mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
}

.panel,
.metric {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--shadow) 36%, transparent);
}

.metrics-panel {
  display: grid;
  gap: 14px;
  padding: 0;
  overflow: hidden;
}

.metrics-panel .section-head {
  padding: 18px 18px 0;
}

.metrics-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 180px);
  border: 0;
  background: var(--soft);
}

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

.metric {
  display: grid;
  gap: 5px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  font-size: 20px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.data-table {
  display: grid;
  min-width: max-content;
}

.table-toolbar {
  position: sticky;
  left: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  min-width: min(100%, 720px);
  padding: 16px 24px 0;
  background: var(--panel);
}

.table-search {
  flex: 1;
  min-width: 240px;
  max-width: 360px;
}

.table-selection-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
  justify-content: flex-end;
}

.table-actions:empty {
  display: none;
}

.table-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.model-group {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.model-group + .model-group {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.model-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.model-group-head h3 {
  margin: 0;
  font-size: 14px;
}

.model-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.model-tabs button {
  min-height: 36px;
  padding: 0 12px;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--muted);
}

.model-tabs button.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--text);
}

.model-tabs small {
  color: inherit;
  font-weight: 800;
}

.model-tab-panel {
  display: grid;
  gap: 12px;
}

.model-filter-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
}

.model-filter-row h3 {
  margin: 0;
  font-size: 16px;
}

.model-filter-row p {
  margin: 4px 0 0;
}

.model-filter-row label {
  min-width: min(260px, 100%);
}

.detail-panel,
.usage-card {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.detail-head,
.request-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-head p {
  margin-top: 4px;
}

.check-row {
  grid-auto-flow: column;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: start;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.wide {
  grid-column: 1 / -1;
}

.click-row {
  cursor: pointer;
}

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

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

.code-grid pre {
  min-height: 120px;
  max-height: 320px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--soft) 42%, var(--panel));
  white-space: pre-wrap;
  word-break: break-word;
}

.usage-panels {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.k2-monitoring-chart {
  --zoom-out-button-container-width: 8rem;
  display: grid;
  gap: 8px;
  min-height: 338px;
  margin-top: 10px;
}

.k2-monitoring-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  gap: 12px;
}

.k2-monitoring-chart-title {
  flex: 1;
  margin-left: var(--zoom-out-button-container-width);
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
  text-align: center;
}

.k2-monitoring-chart-unit {
  display: flex;
  justify-content: flex-start;
  width: 70px;
  padding-left: 24px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.k2-monitoring-chart-actions {
  width: var(--zoom-out-button-container-width);
}

.k2-monitoring-chart-plot {
  min-height: 300px;
}

.k2-monitoring-chart svg {
  width: 100%;
  height: 300px;
  overflow: visible;
}

.k2-monitoring-chart text {
  user-select: none;
  fill: var(--text);
}

.chart-grid line {
  stroke: color-mix(in srgb, var(--border) 72%, transparent);
  stroke-width: 1;
}

.chart-grid text,
.chart-x-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-axis,
.chart-tick {
  stroke: var(--border);
  stroke-width: 1.2;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.chart-point circle {
  fill: var(--panel);
  stroke: var(--accent);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  transition: fill 140ms ease, r 140ms ease, stroke-width 140ms ease;
}

.chart-point:hover circle,
.chart-point:focus circle {
  fill: var(--accent);
  r: 7;
  stroke-width: 3;
  outline: none;
}

table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--panel);
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
}

.provider-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-weight: 700;
}

.provider-identity img {
  display: block;
  width: 28px;
  height: 28px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  object-fit: contain;
}

.provider-fallback {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.select-cell {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.select-cell input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.table-sort {
  min-height: auto;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 800;
  text-align: left;
}

.table-sort small {
  min-width: 10px;
  color: var(--accent-dark);
}

.table-sort:hover,
.table-sort.active {
  background: transparent;
  color: var(--accent-dark);
}

tr:hover {
  background: var(--row-hover);
}

.badge {
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 12px;
  font-weight: 700;
}

.badge.off {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.empty,
.secret-row {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.secret-row {
  margin: 14px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border-style: solid;
  background: color-mix(in srgb, var(--warning-border) 16%, var(--panel));
  color: var(--text);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 30px var(--shadow);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 900px) {
  .console-controls {
    justify-content: flex-start;
  }

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

  .sidebar {
    position: fixed;
    z-index: 60;
    inset: 0 auto 0 0;
    width: min(320px, calc(100vw - 48px));
    height: 100svh;
    min-height: 100svh;
    gap: 12px;
    transform: translateX(-104%);
    box-shadow: 20px 0 70px var(--modal-shadow);
    transition: transform 180ms ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .topbar,
  .section-head,
  .inline-form,
  .filters,
  .user-menu {
    flex-direction: column;
    align-items: stretch;
  }

  .member-form input,
  .member-form select {
    max-width: none;
  }

  .created-key {
    grid-template-columns: 1fr;
  }

  .table-toolbar {
    align-items: stretch;
    padding: 12px;
  }

  .table-search {
    max-width: none;
    min-width: min(220px, 100%);
  }

  .table-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .user-menu .controls-slot,
  .user-menu .console-controls {
    justify-content: flex-start;
  }

  .nav button {
    justify-content: flex-start;
    min-width: 0;
    padding-inline: 8px;
    text-align: left;
  }

  .main {
    padding: 0 18px 18px;
  }

  .topbar {
    margin-inline: -18px;
    padding: 14px 18px;
  }

  .mobile-nav-toggle {
    display: inline-flex;
  }

  .command-button {
    min-width: min(100%, 300px);
  }

  .panel,
  .metric {
    padding: 16px;
  }

  .secret-row {
    grid-template-columns: 1fr;
  }

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

  .k2-monitoring-chart,
  .k2-monitoring-chart svg {
    min-width: 0;
    height: 240px;
  }

  .k2-monitoring-chart {
    --zoom-out-button-container-width: 0;
    min-height: 278px;
  }

  .k2-monitoring-chart-header {
    align-items: flex-start;
  }

  .k2-monitoring-chart-title {
    margin-left: 0;
    text-align: left;
  }

  .k2-monitoring-chart-plot {
    min-height: 240px;
  }

  .k2-monitoring-chart-unit,
  .k2-monitoring-chart-actions {
    display: none;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    left: 14px;
    max-width: none;
  }
}

@media (max-width: 460px) {
  body {
    overflow-x: hidden;
  }

  .login-view {
    align-items: start;
    padding: 12px;
  }

  .login-card {
    width: 100%;
    padding: 18px;
  }

  .login-card-head {
    align-items: center;
  }

  .controls-slot,
  .console-controls {
    width: auto;
    min-width: 0;
  }

  .language-toggle {
    width: 42px;
    min-width: 42px;
    padding-inline: 0;
  }

  .language-toggle::after,
  #languageCurrentCode {
    display: none;
  }

  .theme-control.open {
    width: 130px;
  }

  .app-view {
    min-height: 100svh;
  }

  .sidebar {
    padding: 12px;
  }

  .brand {
    align-items: flex-start;
  }

  .nav button {
    min-height: 38px;
    white-space: nowrap;
  }

  .main {
    padding: 0 12px 12px;
  }

  .topbar {
    margin-inline: -12px;
    padding: 12px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .topbar p,
  .brand small {
    font-size: 12px;
  }

  .panel,
  .metric {
    padding: 14px;
  }

  .metric strong {
    font-size: 18px;
  }

  .table-wrap {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  table {
    font-size: 12px;
  }

  th,
  td {
    padding: 8px;
  }

  .section-head h2 {
    font-size: 20px;
  }

  .command-panel {
    padding: 12px;
  }

  .command-button {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 620px) {
  .model-filter-row {
    display: grid;
  }

  .model-filter-row label {
    min-width: 0;
  }

  .model-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .model-tabs::-webkit-scrollbar {
    display: none;
  }
}
