:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #6b7785;
  --line: #dfe5eb;
  --brand: #1d4ed8;
  --brand-strong: #1e40af;
  --brand-soft: #e8f1ff;
  --brand-line: #d7e5ff;
  --brand-ring: #bfd7ff;
  --accent: #2f8f6b;
  --danger: #b42318;
  --warning: #b65b00;
  --card-shadow: 0 1px 2px rgba(15, 35, 52, 0.05), 0 6px 18px rgba(15, 35, 52, 0.07);
  --radius: 6px;
  --control-height: 34px;
  --control-height-sm: 28px;
  --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: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand-line);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand);
}

.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-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;
}

.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-storage::before {
  left: 3px;
  right: 3px;
  top: 2px;
  height: 5px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.nav-icon-storage::after {
  left: 2px;
  right: 2px;
  top: 7px;
  bottom: 2px;
  border: 2px solid currentColor;
  border-radius: 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: var(--brand);
  box-shadow: inset 0 2px 0 var(--brand);
}

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

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

.service-config-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - var(--topbar-height) - 36px);
  min-height: 0;
}

.service-config-layout > .content-card {
  margin-bottom: 0;
}

.service-config-selector {
  flex: none;
}

.service-config-selector .content-card-title {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.service-config-selector .content-card-title h2 {
  margin: 0;
}

.service-config-selector-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.service-config-expand-all {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 13px;
  line-height: 20px;
  cursor: pointer;
}

.service-config-expand-all[hidden] {
  display: none;
}

.service-config-expand-all:hover {
  text-decoration: underline;
}

.service-config-expand-icon {
  width: 14px;
  height: 14px;
  transition: transform 200ms ease;
}

.service-config-expand-all[aria-expanded="true"] .service-config-expand-icon {
  transform: rotate(180deg);
}

.service-config-search {
  width: 260px;
  max-width: 100%;
  min-height: var(--control-height);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}

.service-config-search:focus {
  outline: 2px solid var(--brand-ring);
  border-color: var(--brand);
}

.service-config-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow: hidden;
  transition: max-height 200ms ease;
}

.service-config-item {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: #f4f7fa;
  color: #526170;
  text-decoration: none;
  font-size: 14px;
  line-height: 20px;
}

.service-config-item:hover {
  color: #17212b;
  background: #e9eef4;
}

.service-config-item.active {
  color: #fff;
  background: var(--brand);
  font-weight: 600;
}

.service-config-item.service-config-item-clipped {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 200ms ease,
    visibility 200ms ease;
}

.service-config-item[hidden] {
  display: none;
}

.service-config-empty {
  padding: 8px 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.service-config-content {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.service-config-content-viewport::-webkit-scrollbar {
  display: none;
  width: 0;
}

.service-config-content-viewport {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  scrollbar-width: none;
}

.service-config-scrollbar {
  position: absolute;
  top: 18px;
  bottom: 18px;
  right: 0;
  width: 10px;
  display: none;
  pointer-events: none;
}

.service-config-scrollbar.visible {
  display: block;
}

.service-config-scrollbar-thumb {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 0;
  border-radius: 5px;
  background: rgba(23, 33, 43, 0.28);
  pointer-events: auto;
  cursor: pointer;
}

.service-config-scrollbar-thumb:hover {
  background: rgba(23, 33, 43, 0.42);
}

.service-config-scrollbar-thumb.dragging {
  background: rgba(23, 33, 43, 0.5);
}

.service-config-content .content-card {
  padding: 0;
  margin-bottom: 12px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.service-config-content .metric {
  background: #fbfcfd;
  box-shadow: none;
}

@media (max-width: 1024px) {
  .service-config-layout {
    height: auto;
  }

  .service-config-selector .content-card-title {
    flex-direction: column;
    align-items: stretch;
  }

  .service-config-search {
    width: 100%;
  }

  .service-config-content {
    overflow: visible;
  }

  .service-config-content-viewport {
    height: auto;
    overflow: visible;
    padding-right: 0;
  }

  .service-config-scrollbar,
  .service-config-scrollbar.visible {
    display: none;
  }
}

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

.page-content {
  width: 100%;
  max-width: none;
  padding: 18px;
}

.content-card-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: var(--brand-soft);
  color: var(--brand);
  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: var(--control-height);
  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 var(--brand-ring);
  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-danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #9f1f16;
  border-color: #9f1f16;
}

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

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

.btn-with-spinner {
  gap: 0;
}

.btn-spinner {
  box-sizing: border-box;
  flex: 0 0 0;
  width: 0;
  height: 14px;
  margin-right: 0;
  border: 0 solid rgba(255, 255, 255, 0.55);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  overflow: hidden;
  transform: rotate(0deg);
  transition:
    border-width 120ms ease,
    flex-basis 120ms ease,
    margin-right 120ms ease,
    opacity 120ms ease,
    width 120ms ease;
}

.btn-loading .btn-spinner {
  flex-basis: 14px;
  width: 14px;
  margin-right: 8px;
  border-width: 2px;
  opacity: 1;
  animation: btn-spinner-rotate 720ms linear infinite;
}

.btn-loading,
.btn-loading:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  cursor: progress;
}

.btn-loading:disabled {
  opacity: 1;
}

.btn-sm {
  min-height: var(--control-height-sm);
  padding: 0 8px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

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

.upstream-log-copy-toolbar {
  align-items: flex-start;
  justify-content: space-between;
}

.upstream-log-copy-toolbar > div {
  min-width: 0;
}

.upstream-log-copy-toolbar h2 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 18px;
}

.upstream-log-copy-toolbar p {
  margin: 0;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

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

.metric,
.content-card,
.task-card {
  background: var(--panel);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.metric {
  padding: 16px;
}

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

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

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

.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;
}

.content-card {
  padding: 18px;
  margin-bottom: 12px;
}

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

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

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

.storage-summary-grid {
  margin-bottom: 12px;
}

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

.storage-form-grid .wide-field {
  grid-column: span 2;
}

.upstream-config-note {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(26, 115, 232, 0.16);
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f8ff 100%);
}

.upstream-config-note strong {
  color: #1d4f91;
  font-size: 13px;
  line-height: 1.5;
}

.upstream-config-note p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.storage-cors-editor {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.storage-cors-sidebar {
  display: grid;
  gap: 12px;
  align-content: start;
}

.storage-cors-field {
  min-width: 0;
}

.storage-cors-field textarea {
  height: 100%;
  min-height: 148px;
}

.storage-cors-actions {
  margin-top: 0;
}

.storage-cors-actions .btn {
  width: 100%;
}

.storage-state-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.source-config-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 12px;
  align-items: start;
}

.source-config-form-panel {
  min-width: 0;
}

.service-config-content .source-config-form-panel,
.service-config-content .source-config-result-stack > .content-card {
  padding: 18px;
  background: var(--panel);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

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

.source-config-form-grid .wide-field {
  grid-column: 1 / -1;
}

.source-config-result-stack {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.source-config-current-panel .content-card-title {
  margin-bottom: 10px;
}

.source-config-current-panel .content-card-title h2 {
  font-size: 15px;
}

.source-config-current-panel .storage-summary-grid {
  gap: 8px;
  margin-bottom: 8px;
}

.source-config-current-panel .metric {
  padding: 8px 10px;
}

.source-config-current-panel .metric span {
  font-size: 12px;
}

.source-config-current-panel .metric strong {
  margin-top: 2px;
  font-size: 15px;
}

.source-config-current-panel .storage-info-grid {
  gap: 8px;
}

.source-config-current-panel .profile-item {
  padding: 7px 10px;
}

.source-config-current-panel .profile-item span {
  margin-bottom: 2px;
  font-size: 12px;
}

.source-config-current-panel .profile-item strong {
  min-height: 18px;
  font-size: 13px;
}

.source-config-check-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
  text-align: center;
}

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

.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;
}

.content-card-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;
}

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

.table-wrap {
  overflow: auto;
  border: 0;
  border-radius: var(--radius);
}

.table-loading-container {
  position: relative;
}

.table-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 160px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.table-loading-overlay[hidden] {
  display: none;
}

.table-loading-spinner {
  box-sizing: border-box;
  width: 26px;
  height: 26px;
  border: 3px solid var(--brand-line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: table-loading-spin 800ms linear infinite;
}

.table-loading-hint {
  font-size: 12px;
  opacity: 0.85;
}

@keyframes table-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

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

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

.runtime-log-list-table table {
  min-width: 960px;
  table-layout: fixed;
}

.runtime-log-list-table th:nth-child(1),
.runtime-log-list-table td:nth-child(1) {
  width: 148px;
}

.runtime-log-list-table th:nth-child(2),
.runtime-log-list-table td:nth-child(2) {
  width: 88px;
}

.runtime-log-list-table th:nth-child(3),
.runtime-log-list-table td:nth-child(3) {
  width: 132px;
}

.runtime-log-list-table th:nth-child(4),
.runtime-log-list-table td:nth-child(4) {
  width: 188px;
}

.runtime-log-list-table th:nth-child(6),
.runtime-log-list-table td:nth-child(6) {
  width: 110px;
}

.runtime-log-list-table th:nth-child(7),
.runtime-log-list-table td:nth-child(7) {
  width: 112px;
}

.runtime-log-primary {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

.runtime-log-secondary {
  min-width: 0;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.runtime-log-code-line code {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-log-summary-cell {
  min-width: 0;
}

.runtime-log-message-compact {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 20px;
  word-break: break-word;
}

.runtime-log-summary-meta-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.runtime-log-message {
  max-width: 360px;
  white-space: normal;
  word-break: break-word;
}

.runtime-log-link-cell {
  max-width: 220px;
  overflow-wrap: anywhere;
}

.runtime-log-filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.runtime-log-filter-chips-label {
  color: var(--muted);
  font-size: 13px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  max-width: 280px;
  min-height: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #334155;
  padding: 0 10px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.filter-chip:hover {
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.filter-chip-emphasis {
  border-color: var(--brand-line);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 600;
}

.runtime-log-toolbar {
  justify-content: space-between;
  align-items: flex-start;
}

.runtime-log-logql {
  display: block;
  min-width: 0;
  max-width: min(820px, 100%);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: #334155;
  padding: 8px 10px;
  white-space: nowrap;
}

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

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: 0;
  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));
}

.upstream-log-detail-modal {
  width: 85vw;
  max-width: 85vw;
  height: min(820px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.upstream-log-detail-body,
.runtime-log-detail-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.upstream-log-detail-tabs,
.runtime-log-detail-tabs {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
  background: #fff;
}

.upstream-log-detail-tabs button,
.runtime-log-detail-tabs button {
  min-height: var(--control-height);
  flex: 0 0 auto;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.upstream-log-detail-tabs button:hover,
.runtime-log-detail-tabs button:hover {
  border-color: transparent;
  border-bottom-color: #cbd5e1;
  background: transparent;
  color: var(--text);
}

.upstream-log-detail-tabs button:focus-visible,
.runtime-log-detail-tabs button:focus-visible {
  outline-offset: -3px;
}

.upstream-log-detail-tabs button[aria-selected="true"],
.runtime-log-detail-tabs button[aria-selected="true"] {
  border-bottom-color: var(--brand);
  background: transparent;
  color: var(--brand);
  font-weight: 600;
}

.upstream-log-tab-panel,
.runtime-log-tab-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 18px;
}

.upstream-log-tab-panel[hidden],
.runtime-log-tab-panel[hidden] {
  display: none;
}

.upstream-log-load-status {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.upstream-log-load-status.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.upstream-log-exchange-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #f8fafc;
  overflow-wrap: anywhere;
}

.upstream-log-exchange-meta strong {
  flex: 0 0 auto;
  border-radius: 4px;
  padding: 2px 7px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  line-height: 20px;
}

.upstream-log-exchange-meta code {
  min-width: 0;
  color: #334155;
  font-size: 13px;
}

.upstream-log-code-stack {
  display: grid;
  gap: 16px;
}

.upstream-log-client-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.upstream-log-client-grid h2 {
  margin-top: 0;
  font-size: 16px;
}

.upstream-log-client-state {
  padding: 32px 16px;
}

.http-code-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #263349;
  border-radius: 6px;
  background: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.http-code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 7px 8px 7px 13px;
  border-bottom: 1px solid #263349;
  background: #182235;
}

.http-code-block-title,
.http-code-block-actions {
  display: flex;
  align-items: center;
  min-width: 0;
}

.http-code-block-title {
  gap: 8px;
}

.http-code-block-title strong {
  color: #f8fafc;
  font-size: 13px;
}

.http-code-block-title > span:not(.status) {
  color: #94a3b8;
  font-size: 12px;
}

.http-code-block-actions {
  flex: 0 0 auto;
  gap: 4px;
}

.http-code-language {
  padding: 0 7px;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 26px;
}

.http-code-copy {
  position: relative;
  width: 30px;
  min-height: 30px;
  border-color: transparent;
  padding: 0;
  background: transparent;
  color: #cbd5e1;
}

.http-code-copy:hover,
.http-code-copy:focus-visible {
  border-color: #475569;
  background: #263349;
  color: #fff;
}

.http-code-copy-icon,
.http-code-copy-icon::after {
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.http-code-copy-icon {
  position: relative;
  display: block;
  margin: 2px 0 0 2px;
}

.http-code-copy-icon::after {
  position: absolute;
  top: -4px;
  left: -4px;
  background: #182235;
  content: "";
}

.http-code-copy:hover .http-code-copy-icon::after,
.http-code-copy:focus-visible .http-code-copy-icon::after {
  background: #263349;
}

.http-code-block-content.json-block {
  max-height: 360px;
  border: 0;
  border-radius: 0;
  padding: 14px 16px 16px;
  background: #0f172a;
  color: #dbeafe;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  tab-size: 2;
}

.http-code-block-content code {
  font: inherit;
}

.code-token-key {
  color: #7dd3fc;
}

.code-token-string {
  color: #a7f3d0;
}

.code-token-number {
  color: #fbbf24;
}

.code-token-boolean {
  color: #c4b5fd;
}

.code-token-null {
  color: #94a3b8;
  font-style: italic;
}

.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: var(--brand-soft);
  border: 1px solid var(--brand-line);
  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: 0;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--card-shadow);
}

.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 textarea,
.modal-field-grid input,
.modal-field-grid textarea,
.toolbar-form select,
.select-control {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background-color: #fff;
}

.stacked-form input,
.inline-form input,
.modal-field-grid input,
.select-control {
  height: var(--control-height);
  padding: 0 10px;
}

.login-form input {
  height: 40px;
  padding: 0 10px;
}

.select-control {
  min-width: 0;
  padding-right: 34px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%236b7785' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.select-control:hover {
  border-color: #c5d0dc;
  background-color: #fbfdff;
}

.select-control:disabled {
  color: #96a1ad;
  cursor: not-allowed;
  background-color: #f5f7f9;
}

.select-control-sm {
  height: var(--control-height-sm);
  min-width: 116px;
  width: auto;
  border-radius: 5px;
  padding-left: 9px;
  padding-right: 32px;
  background-position: right 8px center;
  font-size: 13px;
  line-height: 20px;
}

.custom-select {
  display: block;
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select-sm {
  display: inline-block;
  width: auto;
  min-width: 116px;
}

.custom-select-native {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--control-height);
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 400;
  line-height: 20px;
  text-align: left;
}

.custom-select-trigger:hover {
  border-color: #c5d0dc;
  background: #fbfdff;
}

.custom-select-trigger:focus-visible,
.custom-select-open .custom-select-trigger {
  border-color: var(--brand);
  outline: 2px solid var(--brand-ring);
  outline-offset: 0;
}

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

.custom-select-caret {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 1.5px solid #6b7785;
  border-bottom: 1.5px solid #6b7785;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 120ms ease;
}

.custom-select-open .custom-select-caret {
  transform: translateY(2px) rotate(225deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 70;
  box-sizing: border-box;
  min-width: 100%;
  width: max-content;
  max-height: 260px;
  max-width: var(--custom-select-max-menu-width, min(200%, calc(100vw - 32px)));
  overflow: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 35, 52, 0.16);
  animation: custom-select-in 120ms ease-out;
}

.custom-select-drop-up .custom-select-menu {
  top: auto;
  bottom: calc(100% + 4px);
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-option {
  display: flex;
  width: 100%;
  min-height: 32px;
  justify-content: flex-start;
  padding: 6px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  user-select: none;
}

.custom-select-option:hover,
.custom-select-option.active {
  background: #f1f5f9;
  color: #17212b;
}

.custom-select-option.selected {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.custom-select-option.selected:hover,
.custom-select-option.selected.active {
  background: #dceaff;
  color: var(--brand-strong);
}

.custom-select-option[aria-disabled="true"] {
  color: #a3adb8;
  cursor: not-allowed;
}

.custom-select-disabled .custom-select-trigger,
.custom-select-disabled .custom-select-trigger:hover {
  color: #96a1ad;
  cursor: not-allowed;
  background: #f5f7f9;
  border-color: var(--line);
}

.custom-select-sm .custom-select-trigger {
  min-height: var(--control-height-sm);
  border-radius: 5px;
  padding: 0 9px;
  font-size: 13px;
}

.custom-select-sm .custom-select-option {
  min-height: 30px;
  font-size: 13px;
}

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

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

.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);
}

.runtime-log-filter {
  display: block;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.runtime-log-filter-primary,
.runtime-log-filter-advanced-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.runtime-log-filter-panel {
  border: 0;
}

.upstream-log-filter-primary,
.upstream-log-filter-advanced-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.runtime-log-filter .compact-filter-field {
  display: block;
  min-width: 0;
}

.runtime-log-filter .compact-filter-field input,
.runtime-log-filter .compact-filter-field .select-control {
  border-radius: 5px;
  font-size: 13px;
}

.runtime-log-filter .filter-actions {
  align-self: end;
  align-items: center;
  gap: 8px;
}

.runtime-log-filter .filter-actions .btn {
  font-size: 13px;
}

.compact-date-field {
  position: relative;
}

.compact-date-field .compact-date-label {
  position: absolute;
  top: 50%;
  left: 10px;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
  transform: translateY(-50%);
}

.runtime-log-filter .compact-date-field input {
  padding-left: 44px;
}

.upstream-log-advanced-filter,
.runtime-log-advanced-filter {
  margin-top: 8px;
  border-top: 1px solid #edf1f5;
}

.upstream-log-advanced-filter summary,
.runtime-log-advanced-filter summary {
  width: fit-content;
  padding: 7px 2px 0;
  color: #526170;
  font-size: 12px;
  line-height: 20px;
  cursor: pointer;
  user-select: none;
}

.upstream-log-advanced-filter summary:hover,
.upstream-log-advanced-filter summary:focus-visible,
.runtime-log-advanced-filter summary:hover,
.runtime-log-advanced-filter summary:focus-visible {
  color: var(--brand);
}

.upstream-log-advanced-filter[open] summary,
.runtime-log-advanced-filter[open] summary {
  margin-bottom: 8px;
}

.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;
}

.checkbox-field.light {
  align-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  color: var(--text) !important;
  font-size: 14px;
}

.checkbox-field.light input {
  width: 16px;
  height: 16px;
}

.field-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

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

.toolbar-form select {
  height: var(--control-height);
  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-size {
  margin: 0;
}

.page-size-field {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.page-size-select-control {
  background-color: #fbfcfd;
  color: #334155;
  font-weight: 500;
}

.page-size-select-control:hover,
.page-size-select-control:focus {
  background-color: #fff;
}

.custom-select-page-size .custom-select-trigger {
  background: #fbfcfd;
  color: #334155;
  font-weight: 500;
}

.custom-select-page-size .custom-select-trigger:hover,
.custom-select-page-size.custom-select-open .custom-select-trigger {
  background: #fff;
}

.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;
}

.runtime-log-filter-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.runtime-log-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.runtime-log-detail-modal {
  width: 85vw;
  max-width: 85vw;
  height: 90vh;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.runtime-log-summary-title {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.runtime-log-summary-title strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.runtime-log-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

.runtime-log-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.runtime-log-detail-section-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.runtime-log-tab-panel .runtime-log-detail-section + .runtime-log-detail-section {
  margin-top: 18px;
}

.runtime-log-tab-panel .json-block {
  max-height: none;
}

.runtime-log-detail-message {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfcfd;
}

.runtime-log-detail-message span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.runtime-log-detail-message p {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 22px;
}

.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;
}

.rbac-workbench {
  display: grid;
  grid-template-columns: minmax(420px, 43%) minmax(0, 1fr);
  gap: 16px;
  min-height: 560px;
}

.rbac-role-pane,
.rbac-permission-pane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.rbac-role-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rbac-role-filter {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.rbac-role-filter label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.rbac-role-filter input,
.rbac-permission-toolbar input {
  width: 100%;
  height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

.rbac-role-filter input:focus,
.rbac-permission-toolbar input:focus {
  border-color: var(--brand);
  outline: 2px solid var(--brand-ring);
}

.rbac-role-table {
  min-height: 0;
  max-height: 560px;
  overflow: auto;
  border: 0;
  border-radius: 0;
}

.rbac-role-table table {
  min-width: 0;
  table-layout: fixed;
}

.rbac-role-table th,
.rbac-role-table td {
  padding: 10px 12px;
}

.rbac-role-table tbody tr[data-row-href] {
  cursor: pointer;
}

.rbac-role-table th:nth-child(3),
.rbac-role-table td:nth-child(3) {
  width: 74px;
}

.rbac-role-select-col,
.rbac-role-select-cell {
  width: 42px;
  padding-right: 4px !important;
  text-align: center;
}

.rbac-role-table tbody tr:hover td {
  background: #f7fafc;
}

.rbac-role-table .selected-row td {
  background: var(--brand-soft);
}

.rbac-role-selector {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  vertical-align: middle;
}

.rbac-role-selector:hover,
.rbac-role-selector:focus-visible {
  background: #eef2f6;
  outline: none;
}

.rbac-role-radio {
  display: block;
  width: 14px;
  height: 14px;
  border: 1px solid #b7c2cd;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 3px #fff;
}

.rbac-role-selector[aria-current="true"] .rbac-role-radio {
  border-color: var(--brand);
  background: var(--brand);
}

.rbac-role-link {
  display: inline-flex;
  max-width: 220px;
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.rbac-role-link:hover,
.rbac-role-link[aria-current="true"] {
  color: var(--brand);
}

.rbac-role-link:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 2px;
}

.rbac-role-actions-col {
  width: 166px;
}

.rbac-role-actions-cell {
  gap: 6px;
  overflow: visible;
}

.rbac-role-pane .pagination {
  flex-wrap: wrap;
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.rbac-permission-pane {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.rbac-permission-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.rbac-permission-head h3 {
  margin: 0;
  font-size: 17px;
}

.rbac-permission-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}

.rbac-permission-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
}

.rbac-permission-form {
  min-height: 0;
  margin: 0;
  overflow: auto;
}

.permission-tree {
  display: grid;
  gap: 3px;
  padding: 12px 16px 16px;
}

.permission-tree-readonly {
  padding: 0;
}

.permission-tree-node {
  min-width: 0;
}

.permission-tree-node.hidden-by-search {
  display: none;
}

.permission-tree-node.no-search-match > .permission-tree-row {
  display: none;
}

.permission-tree-row {
  display: grid;
  grid-template-columns: 18px auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 6px;
  border-radius: 4px;
  background: transparent;
}

.permission-tree-row:hover {
  background: #f7fafc;
}

.permission-tree-readonly .permission-tree-row {
  grid-template-columns: 18px minmax(0, 1fr);
}

.level-0 > .permission-tree-row {
  color: #1f2f3f;
  font-weight: 600;
}

.permission-tree-check {
  display: grid;
  min-height: 20px;
  place-items: center;
}

.permission-tree-toggle,
.permission-tree-toggle-spacer {
  width: 18px;
  height: 18px;
}

.permission-tree-toggle {
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #6b7785;
}

.permission-tree-toggle:hover,
.permission-tree-toggle:focus-visible {
  background: #eef2f6;
  color: var(--text);
}

.permission-tree-toggle::before {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  content: "";
  transform: rotate(90deg);
  transition: transform 120ms ease;
}

.permission-tree-node.collapsed > .permission-tree-row .permission-tree-toggle::before {
  transform: rotate(0deg);
}

.permission-tree-node.collapsed > .permission-tree-children {
  display: none;
}

.permission-tree-check input {
  width: 16px;
  height: 16px;
}

.permission-tree-content {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.permission-tree-title {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.permission-tree-title strong {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.permission-tree-children {
  display: grid;
  gap: 3px;
  margin: 2px 0 2px 24px;
  padding-left: 12px;
  border-left: 1px solid #e4eaf0;
}

.permission-type {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}

.permission-type-group {
  background: var(--brand-soft);
  color: var(--brand);
}

.permission-type-page {
  background: #eef2f6;
  color: #526170;
}

.permission-type-action {
  background: #e8f5ef;
  color: var(--accent);
}

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

.rbac-empty-state strong {
  color: var(--text);
  font-size: 16px;
}

.ops-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  border-top: 0;
  padding-top: 0;
}

.ops-form-grid .wide-field {
  grid-column: 1 / -1;
}

@keyframes btn-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 820px) {

  .upstream-log-detail-modal {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }

  .upstream-log-detail-body {
    min-height: 0;
  }

  .upstream-log-client-grid {
    grid-template-columns: 1fr;
  }
  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;
  }

  .storage-summary-grid,
  .storage-info-grid,
  .storage-cors-summary,
  .storage-form-grid {
    grid-template-columns: 1fr;
  }

  .source-config-main {
    grid-template-columns: 1fr;
  }

  .source-config-form-grid {
    grid-template-columns: 1fr;
  }

  .source-config-form-grid .wide-field,
  .storage-form-grid .wide-field {
    grid-column: span 1;
  }

  .storage-cors-editor {
    grid-template-columns: 1fr;
  }

  .storage-cors-field textarea {
    min-height: 132px;
  }

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

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

  .page-content {
    padding: 16px;
  }

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

  .upstream-log-filter-primary,
  .upstream-log-filter-advanced-grid,
  .runtime-log-filter-primary,
  .runtime-log-filter-advanced-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;
  }
}
