:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #6b7785;
  --line: #dfe5eb;
  --brand: #145c7e;
  --brand-strong: #0f4660;
  --accent: #2f8f6b;
  --danger: #b42318;
  --warning: #b65b00;
  --radius: 6px;
  --topbar-height: 58px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-body {
  display: flex;
  min-height: 0;
  height: calc(100vh - var(--topbar-height));
}

.topbar {
  flex: 0 0 var(--topbar-height);
  height: var(--topbar-height);
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.sidebar {
  flex: 0 0 248px;
  width: 248px;
  min-height: 0;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 12px 14px;
}

.brand,
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  min-width: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-name {
  font-weight: 700;
  line-height: 18px;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  margin-top: 0;
}

.nav {
  display: grid;
  gap: 14px;
  margin-top: 2px;
}

.nav-section {
  display: grid;
  gap: 3px;
}

.nav-section-label {
  padding: 0 10px 3px;
  color: #8a96a3;
  font-size: 12px;
  line-height: 17px;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  height: 36px;
  color: #334155;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  border: 1px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: #f6f9fb;
  color: #1f2f3f;
}

.nav-item.active {
  color: #1d4ed8;
  background: #e8f1ff;
  border-color: #d7e5ff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #1d4ed8;
}

.nav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-icon {
  position: relative;
  width: 18px;
  height: 18px;
  color: currentColor;
  opacity: 0.82;
}

.nav-icon::before,
.nav-icon::after {
  position: absolute;
  content: "";
  box-sizing: border-box;
}

.nav-icon-dashboard::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.nav-icon-dashboard::after {
  left: 5px;
  right: 5px;
  bottom: 5px;
  height: 5px;
  border-top: 2px solid currentColor;
}

.nav-icon-partitions::before {
  inset: 3px 2px;
  border: 2px solid currentColor;
  border-radius: 999px / 45%;
}

.nav-icon-partitions::after {
  left: 3px;
  right: 3px;
  top: 7px;
  height: 5px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.nav-icon-migrations::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-icon-migrations::after {
  width: 7px;
  height: 7px;
  right: 2px;
  top: 2px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.nav-icon-operations::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.nav-icon-operations::after {
  left: 5px;
  top: 8px;
  width: 8px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -4px 0 currentColor, 0 4px 0 currentColor;
}

.nav-icon-audit::before {
  inset: 2px 4px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.nav-icon-audit::after {
  left: 7px;
  top: 6px;
  width: 6px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.nav-icon-account::before {
  left: 6px;
  top: 3px;
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-icon-account::after {
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 8px 8px 3px 3px;
}

.ui-tabs,
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ui-tab,
.subnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  color: #526170;
  text-decoration: none;
  font-size: 14px;
  line-height: 20px;
}

.ui-tab:hover,
.subnav a:hover {
  color: #17212b;
  background: #f4f7fa;
}

.ui-tab.active,
.subnav a.active {
  color: #fff;
  background: var(--brand);
  font-weight: 600;
}

.ui-tabs-card {
  position: relative;
  gap: 0;
  align-items: flex-end;
  width: 100%;
  margin-bottom: 0;
  padding: 0 0 0 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.ui-tabs-card .ui-tab {
  position: relative;
  min-height: 38px;
  margin: 0 3px -1px 0;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line);
  border-radius: 8px 8px 0 0;
  background: #f8fafc;
  color: #526170;
}

.ui-tabs-card .ui-tab:hover {
  background: #fff;
  color: #17212b;
}

.ui-tabs-card .ui-tab.active {
  z-index: 2;
  border-bottom-color: var(--panel);
  background: var(--panel);
  color: #1d4ed8;
  box-shadow: inset 0 2px 0 #1d4ed8;
}

.ui-tabs-card .ui-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--panel);
}

.ui-tabs-card + .panel,
.ui-tabs-card ~ .panel:first-of-type,
.ui-tabs-card + div > .panel:first-of-type {
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.page-content {
  padding: 18px 24px 28px;
}

.panel-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

.account {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.account::after {
  position: absolute;
  top: 100%;
  right: 0;
  width: 180px;
  height: 10px;
  content: "";
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  visibility: hidden;
  transition:
    opacity 130ms ease,
    transform 130ms ease,
    visibility 130ms ease;
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  max-width: 220px;
  padding: 0 8px 0 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  cursor: pointer;
  text-decoration: none;
}

.account-trigger:hover,
.account-trigger:focus-visible,
.account:focus-within .account-trigger {
  background: transparent;
}

.account-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #e8f1ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.account-name {
  max-width: 180px;
  overflow: hidden;
  font-size: 14px;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-caret {
  width: 6px;
  height: 6px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.68;
  transform: translateY(-1px) rotate(45deg);
}

.account:hover .account-caret,
.account:focus-within .account-caret {
  transform: translateY(1px) rotate(225deg);
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 164px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(15, 35, 52, 0.16);
}

.account-menu::before {
  position: absolute;
  top: -5px;
  right: 18px;
  width: 8px;
  height: 8px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: #fff;
  content: "";
  transform: rotate(45deg);
}

.account-menu form {
  margin: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.dropdown-item:hover,
.dropdown-item:focus-visible {
  background: #f1f5f9;
  color: #17212b;
  outline: none;
}

.account-menu .dropdown-item:hover,
.account-menu .dropdown-item:focus-visible {
  background: #f1f5f9;
}

.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 5px;
  min-height: 32px;
  padding: 0 10px;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.btn:hover,
button:hover {
  background: #f6f9fb;
  border-color: #cfd8e3;
}

.btn:focus-visible,
button:focus-visible {
  outline: 2px solid #c9e4ee;
  outline-offset: 1px;
}

.btn-primary,
button.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.btn-primary:hover,
button.primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn-secondary {
  background: #fff;
}

.btn-disabled {
  color: #a3adb8;
  background: #f6f8fa;
  cursor: not-allowed;
}

.btn-disabled:hover {
  border-color: var(--line);
  background: #f6f8fa;
}

.btn-sm {
  min-height: 28px;
  padding: 0 8px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.task-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric {
  padding: 16px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.task-card {
  min-width: 0;
  padding: 16px;
}

.task-card-head,
.task-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-card h2 {
  margin: 0;
  font-size: 16px;
}

.task-card p {
  min-height: 42px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 21px;
}

.task-card-foot span {
  min-width: 0;
  overflow: hidden;
  color: #526170;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.future-task-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.future-task-list span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafb;
  color: #526170;
  font-size: 13px;
}

.form-panel {
  max-width: 560px;
}

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

.profile-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfcfd;
}

.profile-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.profile-item strong {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 24px;
  font-size: 14px;
  font-weight: 600;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.panel-title h2 {
  margin: 0;
  font-size: 17px;
}

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

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

.compact-table table {
  min-width: 980px;
}

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

th {
  color: var(--muted);
  background: #f8fafb;
  font-weight: 600;
}

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

.selected-row td {
  background: #f2f8fb;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}

.status.ok {
  background: #e8f5ef;
  color: var(--accent);
}

.status.missing {
  background: #fff1e7;
  color: var(--warning);
}

.status.default {
  background: #eef2f6;
  color: #596675;
}

.toast-container {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: start;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 35, 52, 0.14);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast-success {
  border-left-color: var(--accent);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-info {
  border-left-color: var(--brand);
}

.toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.toast-success .toast-icon {
  background: var(--accent);
}

.toast-success .toast-icon::before {
  content: "✓";
}

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

.toast-error .toast-icon::before {
  content: "!";
}

.toast-warning .toast-icon {
  background: var(--warning);
}

.toast-warning .toast-icon::before {
  content: "!";
}

.toast-info .toast-icon {
  background: var(--brand);
}

.toast-info .toast-icon::before {
  content: "i";
}

.modal-lock {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.36);
  opacity: 0;
  transition: opacity 180ms ease;
}

.modal-panel {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 35, 52, 0.22);
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.modal-panel-wide {
  width: min(940px, calc(100vw - 32px));
}

.modal-open .modal-backdrop {
  opacity: 1;
}

.modal-open .modal-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.modal-close {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 20px;
  line-height: 1;
}

.modal-close:hover {
  background: #f1f5f7;
}

.modal-form {
  padding: 18px;
  margin: 0;
}

.modal-actions {
  justify-content: flex-end;
}

.toast-content {
  min-width: 0;
}

.toast-title {
  display: block;
  font-size: 14px;
  line-height: 20px;
}

.toast-message {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
  word-break: break-word;
}

.toast-close {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  line-height: 1;
}

.toast-close:hover {
  background: #f1f5f7;
}

.toast-leaving {
  animation: toast-out 180ms ease-in forwards;
}

.alert {
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.alert.error {
  background: #fff0f0;
  color: var(--danger);
  border: 1px solid #f1b8b8;
}

.alert.success {
  background: #ecf8f2;
  color: #16623f;
  border: 1px solid #bbe3cf;
}

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

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.created-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
}

.created-list span {
  background: #edf6f8;
  border: 1px solid #cee4eb;
  border-radius: 999px;
  color: var(--brand-strong);
  padding: 4px 8px;
  font-size: 12px;
}

.actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.actions-cell form {
  margin: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.migration-group + .migration-group {
  margin-top: 20px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: auto;
  background: #eef3f6;
}

.login-panel {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.login-form label,
.stacked-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.login-form input,
.stacked-form input,
.stacked-form textarea,
.inline-form input,
.inline-form select,
.inline-form textarea,
.modal-field-grid input,
.modal-field-grid select,
.modal-field-grid textarea,
.toolbar-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
}

.login-form input,
.stacked-form input,
.inline-form input,
.inline-form select,
.modal-field-grid input,
.modal-field-grid select,
.toolbar-form select {
  height: 40px;
  padding: 0 10px;
}

.stacked-form textarea,
.inline-form textarea,
.modal-field-grid textarea {
  min-height: 96px;
  padding: 9px 10px;
  resize: vertical;
}

.login-form input:focus,
.stacked-form input:focus,
.stacked-form textarea:focus,
.inline-form input:focus,
.inline-form select:focus,
.inline-form textarea:focus,
.modal-field-grid input:focus,
.modal-field-grid select:focus,
.modal-field-grid textarea:focus,
.toolbar-form select:focus {
  border-color: var(--brand);
  outline: 2px solid #c9e4ee;
}

.login-form button {
  height: 40px;
}

.stacked-form {
  display: grid;
  gap: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.inline-form,
.modal-field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.inline-form label,
.modal-field-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.inline-form .wide-field,
.modal-field-grid .wide-field {
  grid-column: span 2;
}

.checkbox-field {
  align-content: end;
  grid-template-columns: 18px 1fr;
  display: grid !important;
  align-items: center;
  color: var(--text) !important;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.inline-actions {
  align-self: end;
  margin: 0;
}

.toolbar-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar-form select {
  height: 32px;
  width: 220px;
  border-radius: 5px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-actions,
.pagination-size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  padding: 0 8px;
}

.discover-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.discover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fbfcfd;
}

.muted-text {
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kv-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: #fbfcfd;
}

.kv-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.kv-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 20px;
}

.json-block {
  max-height: 520px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #0f172a;
  color: #dbeafe;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 18px;
  white-space: pre-wrap;
  word-break: break-word;
}

.two-column-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.ops-form-grid {
  border-top: 0;
  padding-top: 0;
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    min-height: var(--topbar-height);
    padding: 8px 12px;
  }

  .app-body {
    display: block;
    height: auto;
    min-height: 0;
  }

  .sidebar {
    width: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .nav {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 14px;
  }

  .nav-section {
    gap: 4px;
  }

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

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

  .detail-grid,
  .two-column-panels {
    grid-template-columns: 1fr;
  }

  .panel-title {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .page-content {
    padding: 16px;
  }

  .inline-form,
  .modal-field-grid {
    grid-template-columns: 1fr;
  }

  .inline-form .wide-field,
  .modal-field-grid .wide-field {
    grid-column: span 1;
  }

  .toolbar-form {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-form select {
    width: 100%;
  }

  .pagination,
  .pagination-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
