:root {
  color-scheme: light;
  --bg: #eef3f4;
  --bg-rail: #f7faf9;
  --panel: #ffffff;
  --panel-soft: #f2f6f6;
  --ink: #142124;
  --ink-soft: #28393d;
  --muted: #66767a;
  --faint: #8a989b;
  --line: #d9e2e3;
  --line-strong: #bdcacc;
  --active: #0f806c;
  --active-soft: #dff2ee;
  --warn: #9a6817;
  --warn-soft: #fff3d8;
  --danger: #b32632;
  --danger-soft: #ffe8ec;
  --accent: #2d6fb3;
  --accent-soft: #e4eff9;
  --violet: #6651b8;
  --shadow: 0 18px 46px rgba(26, 39, 44, 0.12);
  --shadow-soft: 0 10px 28px rgba(26, 39, 44, 0.08);
  --radius: 8px;
  --topbar: 72px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(45, 111, 179, 0.24);
  outline-offset: 2px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-panel {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}

.auth-panel::before {
  content: "P";
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 850;
}

.auth-panel h1,
.page-title h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.auth-panel p,
.page-title p {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  min-width: 192px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  font-weight: 850;
  box-shadow: inset 0 -8px 18px rgba(255, 255, 255, 0.08);
}

.brand strong {
  display: block;
  font-size: 16px;
  line-height: 1.1;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid rgba(217, 226, 227, 0.92);
  border-radius: 10px;
  background: rgba(242, 246, 246, 0.78);
  scrollbar-width: thin;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.nav-group + .nav-group {
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.nav-group-label {
  padding: 0 2px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.nav-group-items {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.nav button {
  width: auto;
  border: 0;
  background: transparent;
  text-align: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: #46565a;
  cursor: pointer;
  font-weight: 680;
  white-space: nowrap;
}

.nav button:hover {
  background: #edf3f3;
  color: var(--ink);
}

.nav button.active {
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow-soft);
}

.main {
  min-width: 0;
}

.topbar {
  min-height: var(--topbar);
  border-bottom: 1px solid rgba(217, 226, 227, 0.88);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
}

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

.admin-identity {
  min-width: 0;
  max-width: 220px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 6px;
  border: 1px solid rgba(217, 226, 227, 0.96);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.admin-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--active-soft);
  color: var(--active);
  font-size: 13px;
  font-weight: 860;
}

.admin-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.admin-copy strong,
.admin-copy em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-copy strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.1;
}

.admin-copy em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
  line-height: 1.1;
}

.content {
  width: 100%;
  padding: 24px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.page-title {
  min-width: 0;
}

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

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-2 {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.44fr);
}

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

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.panel-head {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-head h2,
.drawer-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.panel-body {
  padding: 16px;
}

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

.kpi {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 15px 16px;
  min-height: 92px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}

.overview-shell {
  display: grid;
  gap: 14px;
}

.overview-metric,
.overview-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.overview-panel-head,
.overview-log,
.overview-log-meta {
  display: flex;
  align-items: center;
}

.overview-panel-head,
.overview-log {
  justify-content: space-between;
  gap: 12px;
}

.overview-panel-head h2 {
  margin: 4px 0 0;
  font-size: 16px;
  line-height: 1.25;
}

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

.overview-metrics-compact {
  grid-template-columns: minmax(250px, 1.25fr) repeat(4, minmax(136px, 1fr));
}

.overview-metric {
  min-height: 118px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.overview-metric-health.ok {
  border-color: #acd9cf;
  background: #f6fcfa;
}

.overview-metric-health.warn {
  border-color: #efd188;
  background: #fffdf6;
}

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

.overview-metric strong {
  margin-top: 12px;
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.overview-metric em {
  color: var(--faint);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.overview-panel {
  overflow: hidden;
}

.overview-panel-head {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.overview-log-list {
  display: grid;
}

.overview-log {
  min-height: 66px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.overview-log-list-large .overview-log {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
}

.overview-log:last-child {
  border-bottom: 0;
}

.overview-log:hover {
  background: #f8fbfb;
}

.overview-log-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.overview-log-meta {
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.overview-panel-requests {
  min-height: 520px;
}

.overview-log-main strong,
.overview-log-main span {
  display: block;
}

.overview-log-main strong {
  font-size: 15px;
}

.overview-log-main span {
  margin-top: 4px;
  color: var(--muted);
}

.overview-log-list-large .overview-log-meta {
  min-width: 0;
  flex-wrap: nowrap;
}

.overview-log-list-large .overview-log-meta > span {
  white-space: nowrap;
}

.overview-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--active);
  flex: 0 0 auto;
}

.overview-log.failed .overview-dot {
  background: var(--danger);
}

.surface-empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.account-card-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
  align-items: start;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.static-auth-card-board {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 366px), 366px));
  justify-content: start;
}

.static-auth-file-card {
  min-height: auto;
}

.static-auth-file-card .auth-static-quota-bar.warn i {
  background: #e9b30d;
}

.static-auth-file-card .auth-static-quota-bar.danger i {
  background: #d45349;
}

.account-card-board .surface-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
}

.auth-file-card {
  min-width: 0;
  min-height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid rgba(227, 225, 219, 0.7);
  border-radius: 12px;
  background-color: #fff;
  color: #2d2a26;
  box-shadow: none;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.auth-file-card:hover,
.auth-file-card:focus-within {
  z-index: 2;
  transform: translateY(-4px);
  border-color: color-mix(in srgb, #8f8a82 46%, #e3e1db);
  box-shadow:
    0 16px 34px -20px rgba(20, 33, 36, 0.34),
    0 8px 18px -14px rgba(20, 33, 36, 0.28);
}

.auth-file-card-disabled .auth-provider-avatar,
.auth-file-card-disabled .auth-card-header-content,
.auth-file-card-disabled .auth-card-meta,
.auth-file-card-disabled .auth-health-message,
.auth-file-card-disabled .auth-card-insights {
  opacity: 0.72;
}

.auth-file-card-disabled:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}

.auth-file-card-layout {
  min-height: 100%;
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.auth-file-card-main {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
}

.auth-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.auth-card-selection {
  width: 18px;
  height: 18px;
  display: none;
  place-items: center;
  flex: 0 0 auto;
  margin-top: 8px;
}

.auth-card-selection input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--active);
}

.auth-provider-avatar {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(227, 225, 219, 0.6);
  border-radius: 10px;
  background: transparent;
  color: #3538d4;
}

.auth-provider-mark {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
}

.auth-card-header-content {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
}

.auth-card-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-type-badge,
.auth-state-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  line-height: 1;
  white-space: nowrap;
}

.auth-type-badge {
  padding: 3px 8px;
  border-color: transparent;
  font-size: 11px;
  font-weight: 600;
}

.auth-type-badge.chatgpt {
  background: #f0f0ed;
  color: #2d2a26;
}

.auth-state-badge {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-state-badge.active {
  border-color: #8fe0bd;
  background: #d1fae5;
  color: #065f46;
}

.auth-state-badge.warning {
  border-color: rgba(198, 87, 70, 0.35);
  background: rgba(198, 87, 70, 0.12);
  color: #c65746;
}

.auth-state-badge.danger {
  border-color: rgba(198, 87, 70, 0.42);
  background: rgba(198, 87, 70, 0.16);
  color: #b83d31;
}

.auth-state-badge.disabled {
  border-color: #e3e1db;
  background: #e9e6df;
  color: #706a63;
}

.auth-file-name {
  min-width: 0;
  width: 100%;
  display: block;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: transparent;
  color: #2d2a26;
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-file-name:hover {
  color: #3538d4;
}

.auth-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  padding: 0 2px;
}

.auth-meta-item {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.auth-meta-label {
  color: #a29c95;
  font-size: 11px;
  font-weight: 560;
  line-height: 1.2;
  white-space: nowrap;
}

.auth-meta-label::after {
  content: ":";
}

.auth-meta-value {
  min-width: 0;
  max-width: 124px;
  color: #5d5650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.auth-plan-value {
  max-width: 72px;
  color: #2d2a26;
  font-weight: 760;
}

.auth-priority-value {
  font-variant-numeric: tabular-nums;
}

.auth-health-message {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(198, 87, 70, 0.21);
  border-radius: 8px;
  background: rgba(198, 87, 70, 0.073);
  color: #c65746;
  font-size: 11px;
  word-break: break-word;
}

.auth-health-message .auth-action-icon {
  flex: 0 0 auto;
  margin-top: 1px;
}

.auth-card-insights {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 2px;
}

.auth-card-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.auth-stat-pill {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 999px;
}

.auth-stat-pill span {
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
}

.auth-stat-pill strong {
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.auth-stat-pill.success {
  background: color-mix(in srgb, #d1fae5 50%, transparent);
  color: #065f46;
}

.auth-stat-pill.failure {
  background: color-mix(in srgb, #ffe8ec 50%, transparent);
  color: #b32632;
}

.auth-status-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-status-panel-head {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.auth-status-row {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.auth-status-row .auth-status-bar {
  flex: 1 1 220px;
  width: auto;
}

.auth-status-row .auth-card-stats {
  flex: 0 0 auto;
}

.auth-status-panel-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #a29c95;
  font-size: 10px;
  font-weight: 560;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.auth-status-bar {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
}

.auth-status-blocks {
  min-width: 0;
  display: flex;
  align-items: center;
  flex: 1;
  gap: 3px;
  position: relative;
}

.auth-status-block-wrap {
  flex: 1;
  min-width: 5px;
  position: relative;
  cursor: help;
  -webkit-tap-highlight-color: transparent;
}

.auth-status-block {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.auth-status-block-wrap:hover .auth-status-block {
  opacity: 0.9;
  transform: scaleY(1.6);
}

.auth-status-block.success,
.auth-status-block.ok {
  background: #22c55e;
}

.auth-status-block.failure,
.auth-status-block.bad {
  background: #ef4444;
}

.auth-status-block.mixed {
  background: #facc15;
}

.auth-status-rate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  align-self: center;
  width: auto;
  min-width: 62px;
  max-width: 92px;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  box-sizing: border-box;
  padding: 0 10px;
  border-radius: 999px;
  background: #e9e6df;
  color: #5d5650;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.auth-status-rate.high {
  background: #d1fae5;
  color: #065f46;
}

.auth-status-rate.medium {
  background: #fff3d8;
  color: #8b620d;
}

.auth-status-rate.low {
  background: #ffe8ec;
  color: #b32632;
}

.auth-status-rate.unavailable {
  background: #ffe8ec;
  color: #b32632;
}

.auth-status-rate.no-data {
  background: #f1f3ef;
  color: #8f8a82;
}

.auth-card-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: #5d5650;
  font-size: 12px;
  font-weight: 620;
}

.auth-quota-message {
  width: 100%;
  min-height: 34px;
  display: block;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #a29c95;
  cursor: pointer;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.auth-quota-message:hover {
  color: #2d2a26;
  text-decoration: underline;
}

.auth-image-model-alert {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(217, 151, 43, 0.34);
  border-radius: 8px;
  background: #fff8e7;
  color: #7a4f08;
}

.auth-image-model-alert.danger {
  border-color: rgba(198, 87, 70, 0.34);
  background: #fff1ee;
  color: #aa382d;
}

.auth-image-model-alert.info {
  border-color: #d8d5cf;
  background: #f6f5f1;
  color: #5d5650;
}

.auth-image-model-alert-body {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  flex: 1;
  gap: 7px;
}

.auth-image-model-alert-body .auth-action-icon {
  flex: 0 0 auto;
  margin-top: 1px;
}

.auth-image-model-alert-body div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.auth-image-model-alert-body strong,
.auth-image-model-alert-body span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-image-model-alert-body strong {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.auth-image-model-alert-body span {
  color: color-mix(in srgb, currentColor 78%, #fff);
  font-size: 11px;
  font-weight: 620;
  line-height: 1.35;
}

.auth-image-model-alert-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 5px;
}

.auth-image-model-action {
  border-radius: 7px;
  white-space: nowrap;
}

.auth-static-quota {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 2px;
}

.auth-static-quota-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: baseline;
  column-gap: 18px;
  row-gap: 6px;
  color: #a29c95;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.auth-static-quota-meta span {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.auth-static-quota-meta .auth-static-quota-group {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.auth-static-quota-meta strong {
  color: #2d2a26;
  font-size: 12px;
  font-weight: 800;
}

.auth-static-quota-group strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-static-quota-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-static-quota-hour,
.auth-static-quota-week {
  display: none;
}

.auth-static-quota-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #2d2a26;
}

.auth-static-quota-head > strong {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.auth-static-quota-head .auth-quota-title {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
  gap: 8px;
}

.auth-quota-title strong {
  color: #2d2a26;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.auth-static-quota-head > span {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.auth-static-quota-head > .auth-quota-values {
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 2px;
  min-width: 0;
  white-space: normal;
}

.auth-static-quota-head b {
  color: #2d2a26;
  font-size: 12px;
  font-weight: 800;
}

.auth-static-quota-head em {
  color: #a29c95;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.auth-static-quota-bar {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e0d8;
}

.auth-static-quota-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #16c184;
}

.auth-quota-section .account-limit-row div:first-child {
  color: #5d5650;
}

.auth-quota-section .account-limit-row strong {
  color: #2d2a26;
}

.auth-quota-section .account-limit-bar {
  background: #e5e0d8;
}

.auth-quota-section .account-limit-bar span {
  background: #3538d4;
}

.auth-quota-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px dashed rgba(227, 225, 219, 0.82);
}

.auth-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
}

.auth-card-actions-main {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  gap: 6px;
}

.btn.auth-primary-action {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border-color: #dedbd3;
  border-radius: 8px;
  background: #fff;
  color: #2d2a26;
  font-weight: 600;
  gap: 8px;
  box-shadow: none;
}

.btn.auth-primary-action:hover {
  border-color: #d2cec5;
  background: #ffffff;
}

.auth-model-action {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-model-icon-wrap {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #fff;
}

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

.auth-utility-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding: 2px;
  border-radius: 8px;
  background: transparent;
}

.btn.auth-icon-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-color: #e7e3dc;
  border-radius: 8px;
  background: transparent;
  color: #2d2a26;
  gap: 0;
  font-weight: 600;
  box-shadow: none;
}

.btn.auth-icon-button:hover {
  border-color: #d8d3ca;
  background: transparent;
  transform: none;
}

.btn.auth-sync-button {
  width: auto;
  min-width: 60px;
  height: 32px;
  min-height: 32px;
  padding: 0 9px;
  border-color: #bfe5da;
  border-radius: 8px;
  background: #f0fbf8;
  color: #08715f;
  gap: 5px;
  font-size: 13px;
  font-weight: 720;
  box-shadow: none;
}

.btn.auth-sync-button:hover {
  border-color: #93d5c8;
  background: #e7f7f3;
  transform: none;
}

.btn.auth-icon-button.danger {
  color: #fff;
  border-color: #cf5547;
  background: #cf5547;
}

.btn.auth-icon-button.danger:hover {
  border-color: #bd473a;
  background: #bd473a;
}

.auth-action-icon {
  display: block;
}

.auth-status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.auth-status-toggle > span {
  color: #a29c95;
  font-size: 11px;
  font-weight: 500;
}

.auth-concurrency-pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid #b5d3f4;
  border-radius: 6px;
  background: #eef7ff;
  color: #1f5f9d;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.auth-concurrency-pill strong {
  color: #14548f;
  font-size: 10px;
  font-weight: 800;
}

.auth-concurrency-pill em {
  padding-left: 3px;
  border-left: 1px solid rgba(31, 95, 157, 0.22);
  color: #3f7cb3;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.auth-concurrency-pill:hover {
  border-color: #94bee9;
  background: #e4f2ff;
}

.auth-error-pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid #d8d5cf;
  border-radius: 6px;
  background: #f1f0ec;
  color: #5d5650;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.auth-error-pill .auth-action-icon {
  width: 12px;
  height: 12px;
}

.auth-error-pill strong {
  color: inherit;
  font-size: 10px;
  font-weight: 800;
}

.auth-error-pill.danger {
  border-color: rgba(198, 87, 70, 0.38);
  background: rgba(198, 87, 70, 0.12);
  color: #b83d31;
}

.auth-error-pill.warning {
  border-color: rgba(217, 151, 43, 0.38);
  background: rgba(250, 204, 21, 0.16);
  color: #8b620d;
}

.auth-error-pill.info {
  border-color: #d8d5cf;
  background: #f1f0ec;
  color: #5d5650;
}

.auth-error-pill:hover {
  transform: translateY(-1px);
}

.auth-status-toggle .account-card-switch {
  min-height: 20px;
  padding: 0;
}

@media (max-width: 560px) {
  .auth-card-actions-main,
  .auth-primary-action {
    width: 100%;
  }

  .auth-primary-action {
    flex: 1 1 120px;
  }

  .auth-utility-actions {
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  .auth-image-model-alert {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-image-model-alert-actions {
    justify-content: flex-end;
  }

  .auth-status-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .account-error-fields {
    grid-template-columns: 1fr;
  }
}

.account-card {
  min-width: 0;
  display: grid;
  gap: 11px;
  padding: 14px;
  border: 1px solid #e3e2d8;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbf6 100%);
  box-shadow: 0 8px 22px rgba(26, 39, 44, 0.05);
}

.account-card:hover {
  border-color: #cfd8d5;
  box-shadow: 0 12px 28px rgba(26, 39, 44, 0.08);
}

.account-card.disabled {
  opacity: 0.82;
}

.account-card-top,
.account-card-meta,
.account-card-counts,
.account-card-health-head,
.account-card-facts,
.account-card-footer,
.account-card-actions,
.account-card-switch {
  display: flex;
  align-items: center;
}

.account-card-top {
  gap: 10px;
  min-width: 0;
}

.account-card-check {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.account-card-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--active);
}

.account-card-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid #cfcdf8;
  background: #efefff;
  color: #5f59d5;
  font-size: 13px;
  font-weight: 860;
}

.account-card-title {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.account-card-tags,
.account-card-meta,
.account-card-counts,
.account-card-facts {
  gap: 7px;
  flex-wrap: wrap;
}

.account-card-tags .badge,
.account-card-tags .plan-capsule {
  min-height: 20px;
  padding: 3px 7px;
  font-size: 11px;
}

.account-card-name {
  min-width: 0;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 840;
}

.account-card-name:hover {
  color: var(--active);
}

.account-card-meta,
.account-card-groups {
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.account-card-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card-groups {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid #d9e2e0;
  border-radius: 999px;
  background: #f3f8f6;
  color: #386259;
}

.account-card-error {
  max-height: 68px;
  overflow: hidden;
  padding: 9px 10px;
  border: 1px solid #f0c4bd;
  border-radius: 7px;
  background: #fff0ed;
  color: #bd3d35;
  font-size: 11px;
  line-height: 1.45;
}

.account-card-counts span {
  min-height: 22px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 820;
}

.account-card-counts .ok {
  background: #e6f7ef;
  color: #0f7651;
}

.account-card-counts .bad {
  background: #fff0ed;
  color: #ad463c;
}

.account-card-health {
  display: grid;
  gap: 8px;
}

.account-card-health-head {
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.account-card-health-head strong {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.account-card-health-head strong.good {
  background: #d9fae9;
  color: #0f7651;
}

.account-card-health-head strong.warn {
  background: #fff2cf;
  color: #8b620d;
}

.account-card-health-head strong.bad {
  background: #fff0ed;
  color: #ad463c;
}

.account-card-segments {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 5px;
}

.account-card-segments span {
  height: 5px;
  border-radius: 999px;
  background: #eceee9;
}

.account-card-segments span.ok {
  background: #20c77b;
}

.account-card-segments span.bad {
  background: #e94e45;
}

.account-card-facts {
  padding-top: 4px;
  border-top: 1px dashed #e6e6dc;
}

.account-card-facts span {
  color: #66716c;
  font-size: 11px;
  font-weight: 720;
}

.account-card-limits {
  display: grid;
  gap: 9px;
}

.account-limit-row {
  display: grid;
  gap: 5px;
}

.account-limit-row div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.account-limit-row strong {
  color: var(--ink-soft);
  font-size: 12px;
}

.account-limit-row span {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-limit-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eeeee8;
}

.account-limit-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #19bd78;
}

.account-card-footer {
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid #ecece3;
  flex-wrap: wrap;
}

.account-card-actions {
  gap: 4px;
  min-width: 0;
  flex-wrap: nowrap;
  padding: 3px;
  border: 1px solid #ecece3;
  border-radius: 9px;
  background: rgba(247, 247, 242, 0.82);
}

.account-card-icon {
  min-height: 32px;
  padding: 6px 9px;
  border-color: #dfe3dc;
  background: #fff;
  font-size: 12px;
}

.account-card-model-action {
  min-height: 32px;
  padding: 5px 10px 5px 6px;
  border-color: #d9d5cc;
  background: #fff;
  color: var(--ink);
  font-weight: 820;
  gap: 7px;
  box-shadow: none;
}

.account-card-model-action:hover {
  border-color: #c7bfb3;
  background: #f0ede6;
}

.model-action-icon {
  width: 20px;
  height: 20px;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 7px;
  background: #ebe9e2;
}

.model-action-icon::before,
.model-action-icon::after {
  content: "";
  position: absolute;
  border: 2px solid #29383b;
}

.model-action-icon::before {
  width: 4px;
  height: 4px;
  top: 5px;
  left: 5px;
  border-radius: 3px;
  box-shadow:
    7px 0 0 -2px #ebe9e2,
    7px 0 0 0 #29383b,
    3.5px 7px 0 -2px #ebe9e2,
    3.5px 7px 0 0 #29383b;
}

.model-action-icon::after {
  width: 7px;
  height: 5px;
  left: 6px;
  top: 9px;
  border-width: 0 2px 2px 2px;
  border-radius: 0 0 5px 5px;
}

.account-card-tool {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #536466;
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    transform 0.14s ease;
}

.account-card-tool:hover {
  border-color: #d8ded8;
  background: white;
  color: var(--ink);
  transform: translateY(-1px);
}

.account-card-tool:disabled,
.account-card-tool[aria-busy="true"] {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.account-card-tool.danger {
  color: #b32632;
}

.account-card-tool.danger:hover {
  border-color: #efbac0;
  background: #fff8f9;
  color: #b32632;
}

.tool-icon {
  width: 16px;
  height: 16px;
  position: relative;
  display: inline-block;
  color: currentColor;
}

.refresh-icon {
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
}

.refresh-icon::after {
  content: "";
  width: 5px;
  height: 5px;
  position: absolute;
  right: -1px;
  top: 0;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(22deg);
}

.probe-icon::before,
.probe-icon::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.probe-icon::before {
  inset: 2px;
  border: 2px solid currentColor;
}

.probe-icon::after {
  width: 6px;
  height: 2px;
  right: 0;
  bottom: 1px;
  background: currentColor;
  transform: rotate(45deg);
}

.trash-icon {
  width: 15px;
  height: 14px;
  position: relative;
  display: inline-block;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 4px 4px;
}

.trash-icon::before {
  content: "";
  width: 17px;
  height: 2px;
  position: absolute;
  left: -3px;
  top: -5px;
  border-radius: 2px;
  background: currentColor;
}

.trash-icon::after {
  content: "";
  width: 7px;
  height: 2px;
  position: absolute;
  left: 2px;
  top: -8px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
}

.account-card-switch {
  flex: 0 0 auto;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 760;
}

.account-card-switch i {
  width: 34px;
  height: 20px;
  position: relative;
  border-radius: 999px;
  background: #9b9b96;
}

.account-card-switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: white;
  transition: transform 0.15s ease;
}

.account-card-switch.on i {
  background: #18ae72;
}

.account-card-switch.on i::after {
  transform: translateX(14px);
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.toolbar-main,
.toolbar-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-main {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.toolbar-options {
  flex: 0 0 auto;
  justify-content: flex-start;
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.toolbar-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toolbar-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
  white-space: nowrap;
}

.toolbar input,
.toolbar select {
  width: auto;
  min-width: 112px;
  height: 34px;
  flex: 0 1 136px;
}

.toolbar select {
  max-width: 152px;
}

.toolbar-field-count input {
  width: 72px;
  min-width: 72px;
  flex-basis: 72px;
}

.toolbar-field-sort select {
  width: 132px;
  min-width: 132px;
  max-width: 152px;
  flex-basis: 132px;
}

.toolbar .btn {
  flex: 0 0 auto;
  width: 58px;
  min-height: 34px;
  height: 34px;
  padding: 0 10px;
}

.account-filter-toolbar {
  width: fit-content;
  max-width: 100%;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 251, 0.92));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 12px 28px rgba(13, 27, 38, 0.06);
}

.account-filter-section {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(185, 201, 210, 0.72);
  border-radius: 8px;
  background: rgba(248, 251, 252, 0.82);
}

.account-filter-section-title {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  padding: 0 6px;
  border-right: 1px solid rgba(185, 201, 210, 0.7);
  color: #536875;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.account-filter-control {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.account-filter-control > span:first-child {
  color: #6a7d87;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.account-filter-control select,
.account-filter-control input {
  height: 36px;
  flex: none;
  border-color: rgba(170, 190, 200, 0.92);
  background-color: #fff;
  color: #142532;
  font-size: 13px;
  font-weight: 780;
}

.account-filter-control select {
  width: 100%;
  max-width: none;
  padding-right: 30px;
}

.account-filter-status select {
  min-width: 120px;
}

.account-filter-group select {
  min-width: 142px;
}

.account-filter-image select {
  min-width: 172px;
}

.account-filter-sort select {
  min-width: 120px;
}

.account-filter-number {
  display: inline-grid;
  grid-template-columns: 58px auto;
  align-items: center;
  gap: 5px;
}

.account-filter-number input {
  width: 58px;
  min-width: 58px;
  flex-basis: 58px;
  text-align: center;
}

.account-filter-number em {
  color: #6a7d87;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.account-filter-result {
  display: inline-flex;
  min-width: 72px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 11px;
  border: 1px solid #0d1b28;
  border-radius: 8px;
  background: #0d1b28;
  color: #fff;
}

.account-filter-result strong {
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.account-filter-result span {
  margin-top: 3px;
  color: #b8c9d1;
  font-size: 10px;
  font-weight: 780;
  white-space: nowrap;
}

.account-filter-toolbar .account-filter-clear {
  align-self: center;
  width: auto;
  min-width: 64px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.pagination-info {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

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

.pagination-page.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.pagination-page[aria-current="page"] {
  cursor: default;
  pointer-events: none;
}

.pagination-ellipsis {
  color: var(--faint);
  padding: 0 4px;
  font-weight: 760;
}

.table-wrap {
  overflow: auto;
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1180px;
}

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

th {
  color: var(--muted);
  background: #f7faf9;
  font-size: 12px;
  font-weight: 760;
  position: sticky;
  top: 0;
  z-index: 1;
}

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

tr:hover td {
  background: #f8fbfb;
}

td.actions {
  min-width: 220px;
}

td.actions .btn {
  margin: 2px 2px 2px 0;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: #405155;
  font-size: 12px;
  font-weight: 740;
  line-height: 1;
  min-height: 22px;
}

.badge.ok {
  color: var(--active);
  border-color: #acd9cf;
  background: var(--active-soft);
}

.badge.warn {
  color: var(--warn);
  border-color: #efd188;
  background: var(--warn-soft);
}

.badge.danger {
  color: var(--danger);
  border-color: #efbac0;
  background: var(--danger-soft);
}

.badge.info {
  color: var(--accent);
  border-color: #bed6ec;
  background: var(--accent-soft);
}

.plan-capsule {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 128px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #ccd8dc;
  background: #f7fbfb;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 780;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-free {
  border-color: #cfdde0;
  background: #f4f8f8;
  color: #4f6166;
}

.plan-plus,
.plan-pro,
.plan-team {
  border-color: #b9d9cf;
  background: #e5f4ef;
  color: var(--active);
}

.model-list {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 280px;
  overflow: hidden;
  vertical-align: middle;
}

.model-list-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.model-list-button:hover .model-badge,
.model-list-button:hover .model-more {
  border-color: #8fb4d7;
  background: #e7f2fb;
}

.model-list-button:hover .model-count {
  color: var(--accent);
}

.model-badge {
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-more {
  color: var(--violet);
  border-color: #d3ccec;
  background: #f0eef9;
  flex: 0 0 auto;
}

.model-count {
  color: var(--faint);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
  flex: 0 0 auto;
}

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

.model-rule-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
}

.model-rule-allow {
  border-color: #c7ded7;
}

.model-rule-deny {
  border-color: #efd0d4;
}

.model-rule-head,
.model-rule-custom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-rule-head {
  justify-content: space-between;
}

.model-rule-head label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 820;
}

.model-rule-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.model-rule-selected {
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  padding: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(242, 246, 246, 0.64);
}

.model-rule-empty {
  color: var(--faint);
  font-size: 12px;
  font-weight: 720;
  padding: 2px 3px;
}

.model-rule-selected-chip,
.model-rule-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
}

.model-rule-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 760;
}

.model-rule-selected-chip strong {
  color: var(--faint);
  font-size: 11px;
}

.model-rule-selected-chip:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.model-rule-selected-chip:hover strong {
  color: var(--danger);
}

.model-rule-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.model-rule-option {
  min-height: 50px;
  padding: 8px 9px;
  text-align: left;
}

.model-rule-option strong,
.model-rule-option span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-rule-option strong {
  font-size: 12px;
  line-height: 1.2;
}

.model-rule-option span {
  margin-top: 3px;
  color: var(--faint);
  font-size: 11px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.model-rule-option:hover,
.model-rule-option.selected {
  border-color: #91c6ba;
  background: var(--active-soft);
}

.model-rule-deny .model-rule-option:hover,
.model-rule-deny .model-rule-option.selected {
  border-color: #e5aab2;
  background: var(--danger-soft);
}

.model-rule-custom {
  align-items: stretch;
}

.model-rule-custom input {
  min-width: 0;
  flex: 1 1 auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 9px;
  outline: none;
}

.model-rule-custom .btn {
  flex: 0 0 auto;
}

.group-selector {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #c7ded7;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
}

.group-selector-head,
.group-custom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-selector-head {
  justify-content: space-between;
}

.group-selector-head label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 820;
}

.group-selector-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.group-selected {
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  padding: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(242, 246, 246, 0.64);
}

.group-empty {
  color: var(--faint);
  font-size: 12px;
  font-weight: 720;
  padding: 2px 3px;
}

.group-selected-chip,
.group-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
}

.group-selected-chip {
  display: inline-grid;
  grid-template-columns: minmax(0, auto) minmax(0, auto) auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 760;
}

.group-selected-chip span,
.group-selected-chip em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-selected-chip em {
  color: var(--faint);
  font-style: normal;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.group-selected-chip strong {
  color: var(--faint);
  font-size: 11px;
}

.group-selected-chip:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.group-selected-chip:hover strong {
  color: var(--danger);
}

.group-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.group-option {
  min-height: 52px;
  padding: 9px 10px;
  text-align: left;
}

.group-option strong,
.group-option span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-option strong {
  font-size: 13px;
  line-height: 1.2;
}

.group-option span {
  margin-top: 4px;
  color: var(--faint);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.group-option:hover,
.group-option.selected {
  border-color: #91c6ba;
  background: var(--active-soft);
}

.group-custom {
  align-items: stretch;
}

.group-custom input {
  min-width: 0;
  flex: 1 1 auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 9px;
  outline: none;
}

.group-custom .btn {
  flex: 0 0 auto;
}

.group-name-cell {
  min-width: 220px;
  display: grid;
  gap: 4px;
}

.group-name-cell strong {
  color: var(--ink);
  font-weight: 760;
}

.group-name-cell span {
  max-width: 360px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-delete-blocked {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.group-delete-blocked p {
  margin: 0;
  color: #2d2a26;
  line-height: 1.6;
}

.group-delete-usage {
  padding: 12px 14px;
  border: 1px solid rgba(187, 46, 62, 0.22);
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.5;
}

.readonly-token {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f7faf9;
}

.readonly-token code {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readonly-token .btn {
  flex: 0 0 auto;
}

.token-plain code {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.group-members-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfd;
}

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

.group-members-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.group-members-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.group-member-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.group-member-add select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 10px;
}

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

.group-member-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.group-member-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.group-member-main strong,
.group-member-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-member-main strong {
  color: var(--ink);
  font-size: 14px;
}

.group-member-main span {
  color: var(--faint);
}

.group-member-meta {
  display: flex;
  justify-content: flex-end;
}

.group-member-empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.model-drawer {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.model-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfb;
}

.model-drawer-head strong {
  color: var(--ink);
  font-size: 14px;
}

.model-drawer-grid,
.models-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(54vh, 520px);
  overflow: auto;
  padding: 24px;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: white;
  color: var(--ink-soft);
  font-weight: 760;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.model-item {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid #e3e1db;
  border-radius: 8px;
  background: #fff;
  color: #2d2a26;
  cursor: pointer;
  text-align: left;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    transform 0.14s ease;
}

.model-item:hover {
  border-color: #cfcac2;
  background: #ffffff;
  transform: translateY(-1px);
}

.model-id {
  min-width: 0;
  color: #2d2a26;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.model-display-name {
  flex: 0 1 auto;
  color: #706a63;
  font-size: 12px;
  line-height: 1.3;
}

.model-type {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fff;
  color: #a29c95;
  font-size: 11px;
  line-height: 1.35;
}

.model-item-empty {
  padding: 28px;
  border: 1px dashed #cfcac2;
  border-radius: 10px;
  color: #706a63;
  text-align: center;
}

.model-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #e3e1db;
  background: #fff;
}

.model-modal-footer .btn {
  border-color: #d1cec8;
  background: transparent;
  color: #2d2a26;
  box-shadow: none;
}

.model-modal-footer .btn.primary {
  border-color: #2d2a26;
  background: #2d2a26;
  color: #fff;
}

.drawer.account-error-drawer .drawer-panel {
  width: min(560px, calc(100vw - 32px));
}

.account-error-modal {
  display: flex;
  flex-direction: column;
  background: #fff;
}

.account-error-summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 24px 0;
  padding: 12px 14px;
  border: 1px solid #e3e1db;
  border-radius: 10px;
  background: #f8f7f3;
  color: #2d2a26;
}

.account-error-summary strong {
  display: block;
  color: inherit;
  font-size: 14px;
  line-height: 1.35;
}

.account-error-summary span {
  color: #706a63;
  font-size: 12px;
  line-height: 1.45;
}

.account-error-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 999px;
  background: #9ca3af;
}

.account-error-summary.danger {
  border-color: rgba(198, 87, 70, 0.28);
  background: rgba(198, 87, 70, 0.08);
  color: #b83d31;
}

.account-error-summary.warning {
  border-color: rgba(217, 151, 43, 0.32);
  background: rgba(250, 204, 21, 0.12);
  color: #8b620d;
}

.account-error-summary.danger .account-error-dot,
.account-error-item.danger::before {
  background: #c65746;
}

.account-error-summary.warning .account-error-dot,
.account-error-item.warning::before {
  background: #d9972b;
}

.account-error-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(52vh, 480px);
  overflow: auto;
  padding: 18px 24px 24px;
}

.account-error-item {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  border: 1px solid #e3e1db;
  border-radius: 10px;
  background: #fff;
}

.account-error-item::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: #9ca3af;
}

.account-error-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.account-error-item-head strong {
  min-width: 0;
  color: #2d2a26;
  font-size: 13px;
  line-height: 1.35;
}

.account-error-item-head span {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f0ec;
  color: #706a63;
  font-size: 11px;
  font-weight: 700;
}

.account-error-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.account-error-fields span {
  min-width: 0;
  display: grid;
  gap: 3px;
  color: #5d5650;
  font-size: 12px;
}

.account-error-fields b {
  color: #a29c95;
  font-size: 10px;
  font-weight: 700;
}

.account-error-item pre {
  max-height: 132px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: #f8f7f3;
  color: #3a3630;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.drawer.concurrency-modal .drawer-panel {
  width: min(520px, calc(100vw - 32px));
}

.concurrency-modal-form {
  margin: 0;
}

.concurrency-modal-body {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.concurrency-account-row {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid #e3e1db;
  border-radius: 8px;
  background: #fff;
}

.concurrency-account-row strong {
  min-width: 0;
  overflow: hidden;
  color: #2d2a26;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.concurrency-account-row span {
  flex: 0 0 auto;
  color: #706a63;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-align: right;
}

.concurrency-effective-note {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e3e1db;
  border-radius: 8px;
  background: #fff;
}

.concurrency-effective-note.adjusted {
  border-color: rgba(154, 104, 23, 0.26);
  background: #fffaf0;
}

.concurrency-effective-note div {
  display: grid;
  gap: 3px;
}

.concurrency-effective-note span {
  color: #8a837b;
  font-size: 11px;
  font-weight: 800;
}

.concurrency-effective-note strong {
  color: #2d2a26;
  font-size: 18px;
  font-weight: 900;
}

.concurrency-effective-note p {
  grid-column: 1 / -1;
  margin: 0;
  color: #706a63;
  font-size: 12px;
  line-height: 1.55;
}

.concurrency-effective-note.adjusted p {
  color: #7a4f08;
}

.concurrency-input-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #e3e1db;
  border-radius: 8px;
  background: #fff;
}

.concurrency-input-row span {
  color: #2d2a26;
  font-size: 13px;
  font-weight: 800;
}

.concurrency-stepper {
  display: grid;
  grid-template-columns: 42px minmax(92px, 128px) 42px;
  gap: 8px;
  align-items: center;
}

.concurrency-step-btn {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 18px;
  font-weight: 850;
}

.concurrency-input-row input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #d1cec8;
  border-radius: 8px;
  background: #fff;
  color: #2d2a26;
  font-size: 18px;
  font-weight: 800;
  outline: none;
  text-align: right;
  box-shadow: inset 0 1px 0 rgba(20, 33, 36, 0.03);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.concurrency-input-row input:focus {
  border-color: #94bee9;
  box-shadow:
    0 0 0 3px rgba(148, 190, 233, 0.22),
    inset 0 1px 0 rgba(20, 33, 36, 0.03);
}

.concurrency-input-row input::-webkit-outer-spin-button,
.concurrency-input-row input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.concurrency-input-row input[type="number"] {
  appearance: textfield;
}

.concurrency-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.concurrency-presets .btn {
  min-width: 54px;
}

.concurrency-modal-hint {
  margin: -4px 0 0;
  color: #a29c95;
  font-size: 12px;
  line-height: 1.5;
}

.time-text {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.btn {
  min-height: 36px;
  border: 1px solid #b7c8ca;
  background: #f1f6f6;
  color: #20363b;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 720;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    transform 0.14s ease;
}

.btn:hover {
  border-color: #8fa4a8;
  background: #e7f0f0;
  transform: translateY(-1px);
}

.btn:disabled,
.btn[aria-busy="true"] {
  cursor: wait;
  opacity: 0.68;
  background: var(--panel-soft);
  color: var(--muted);
}

.btn:disabled:hover,
.btn[aria-busy="true"]:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
  transform: none;
}

button.btn[aria-busy="true"] {
  opacity: 1;
  border-color: #ddd8d1;
  background: #f5f3ef;
  color: #7c7f83;
  box-shadow: none;
}

button.btn[aria-busy="true"]:hover {
  border-color: #ddd8d1;
  background: #f5f3ef;
}

.btn-busy-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 4px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  opacity: 0.52;
  animation: btn-busy-spin 0.86s linear infinite;
}

.btn.small .btn-busy-icon {
  width: 13px;
  height: 13px;
  border-width: 3px;
}

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

.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
  box-shadow: 0 8px 18px rgba(20, 33, 36, 0.16);
}

.btn.primary:hover {
  background: #243538;
  border-color: #243538;
}

.btn.edit {
  color: #0d6a5b;
  border-color: #9bd3c7;
  background: #e8f7f3;
}

.btn.edit:hover {
  border-color: #66bdaa;
  background: #d9f1eb;
}

.btn.info {
  color: #255f99;
  border-color: #a7c8e8;
  background: #e8f2fb;
}

.btn.info:hover {
  border-color: #79abd9;
  background: #dcebf8;
}

.btn.success {
  color: #17623c;
  border-color: #a9d9ba;
  background: #e9f8ee;
}

.btn.success:hover {
  border-color: #7bc994;
  background: #def3e7;
}

.btn.warn {
  color: #7a4f08;
  border-color: #e6c06f;
  background: #fff4db;
}

.btn.warn:hover {
  border-color: #d6a844;
  background: #ffebbf;
}

.btn.danger {
  color: var(--danger);
  border-color: #efbac0;
  background: #fff8f9;
}

.btn.danger:hover {
  border-color: #df8e9a;
  background: #ffecef;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.btn.ghost:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.btn.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.btn.icon {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
}

.view-icon {
  width: 18px;
  height: 18px;
  display: grid;
  gap: 3px;
}

.view-icon.cards {
  grid-template-columns: repeat(2, 1fr);
}

.view-icon.cards::before,
.view-icon.cards::after,
.view-icon.cards span {
  content: "";
}

.view-icon.cards::before,
.view-icon.cards::after,
.view-icon.cards {
  background:
    linear-gradient(#244044, #244044) 0 0 / 7px 7px no-repeat,
    linear-gradient(#244044, #244044) 11px 0 / 7px 7px no-repeat,
    linear-gradient(#244044, #244044) 0 11px / 7px 7px no-repeat,
    linear-gradient(#244044, #244044) 11px 11px / 7px 7px no-repeat;
}

.view-icon.list {
  background:
    linear-gradient(#244044, #244044) 0 2px / 18px 3px no-repeat,
    linear-gradient(#244044, #244044) 0 8px / 18px 3px no-repeat,
    linear-gradient(#244044, #244044) 0 14px / 18px 3px no-repeat;
}

.form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  align-content: start;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 760;
}

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

.import-file-field .field-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.import-selected-file {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: #5c6664;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.short-field {
  width: min(220px, 100%);
}

.datetime-field {
  width: min(260px, 100%);
}

.form-compact {
  width: min(560px, 100%);
}

.compact-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 240px));
  gap: 12px;
  align-items: start;
}

.wide-field {
  grid-column: 1 / -1;
  width: min(492px, 100%);
}

.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.field input,
.field textarea,
.field select,
.toolbar input,
.toolbar select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

.field input[type="file"] {
  min-height: 42px;
  padding: 7px;
  cursor: pointer;
}

.field input[type="file"]::file-selector-button {
  min-height: 28px;
  margin-right: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
  cursor: pointer;
  font-weight: 720;
}

.field input[type="file"]::file-selector-button:hover {
  background: #edf3f3;
}

.toolbar input,
.toolbar select {
  width: auto;
  padding: 6px 9px;
}

.field textarea {
  min-height: 132px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.import-content-field textarea {
  min-height: 168px;
  line-height: 1.55;
}

.import-format-note {
  display: grid;
  gap: 6px;
  padding: 12px 13px;
  border: 1px solid rgba(213, 218, 212, 0.95);
  border-radius: 8px;
  background: #fff;
  color: #4f5b58;
  font-size: 12px;
  line-height: 1.58;
}

.import-format-note strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 820;
}

.import-format-list {
  display: grid;
  gap: 10px;
}

.import-format-item {
  display: grid;
  gap: 5px;
}

.import-format-item b {
  color: #263735;
  font-size: 12px;
  line-height: 1.35;
}

.import-format-item span {
  min-width: 0;
}

.import-format-note p {
  margin: 0;
}

.import-format-note code {
  padding: 1px 4px;
  border-radius: 5px;
  background: #f2f5f4;
  color: #263735;
  font-size: 11px;
}

.import-format-example {
  max-width: 100%;
  margin: 2px 0 0;
  padding: 10px 11px;
  overflow-x: auto;
  border: 1px solid rgba(213, 218, 212, 0.9);
  border-radius: 8px;
  background: #f8faf9;
  color: #263735;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre;
}

.import-format-example code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.import-format-note a {
  color: #195f7a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.settings-page {
  display: grid;
  gap: 14px;
}

.settings-shell {
  width: 100%;
}

.settings-shell .page-head {
  width: 100%;
}

.settings-layout {
  display: grid;
  gap: 14px;
  align-items: start;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
  overflow: hidden;
}

.settings-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.settings-card-head.compact {
  padding-bottom: 12px;
}

.settings-card-head h2 {
  margin: 4px 0 0;
  font-size: 16px;
  line-height: 1.25;
}

.settings-card-head p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.settings-kicker {
  display: inline-flex;
  color: var(--active);
  font-size: 12px;
  font-weight: 820;
}

.settings-form-grid {
  display: grid;
  gap: 14px 18px;
  align-items: start;
  padding: 16px;
}

.settings-connection-grid {
  grid-template-columns: minmax(320px, 520px) minmax(360px, 580px) 220px minmax(0, 1fr);
}

.settings-policy-grid {
  grid-template-columns: repeat(5, minmax(150px, 240px)) minmax(0, 1fr);
}

.settings-data-grid {
  grid-template-columns: 180px 180px 180px minmax(360px, 1fr);
}

.settings-url-field {
  min-width: 0;
}

.settings-page .field input,
.settings-page .field select {
  min-height: 40px;
}

.settings-toggle-field {
  min-width: 0;
}

.settings-duration-field,
.settings-number-field {
  min-width: 0;
}

.settings-path-field {
  min-width: 0;
}

.setting-duration-control,
.setting-unit-input {
  display: grid;
  grid-template-columns: minmax(76px, 1fr) minmax(64px, 76px);
  gap: 8px;
  align-items: center;
}

.settings-duration-select {
  width: 100%;
}

.setting-duration-control input,
.setting-duration-control select,
.setting-unit-input input {
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.setting-unit-input span {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  color: var(--muted);
  font-weight: 760;
}

.settings-sensitive-field {
  padding: 10px 12px 12px;
  border: 1px solid rgba(154, 104, 23, 0.24);
  border-radius: 8px;
  background: #fffdf7;
}

.settings-sensitive-field label {
  color: var(--ink-soft);
}

.settings-savebar {
  display: none;
}

@media (max-width: 1320px) {
  .settings-connection-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .settings-sensitive-field {
    width: min(260px, 100%);
  }

  .settings-policy-grid {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

  .settings-data-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .settings-path-field {
    grid-column: 1 / -1;
  }
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(760px, 96vw);
}

.drawer-backdrop {
  background: rgba(20, 33, 36, 0.32);
}

.drawer-panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 50px rgba(0, 0, 0, 0.14);
  padding: 18px;
  overflow: auto;
}

.drawer.model-modal {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 0;
}

.drawer.model-modal .drawer-backdrop,
.drawer.model-modal .drawer-panel {
  grid-area: 1 / 1;
}

.drawer.model-modal .drawer-backdrop {
  position: fixed;
  inset: 0;
}

.drawer.model-modal .drawer-panel {
  width: min(520px, calc(100vw - 32px));
  max-height: min(76vh, 720px);
  position: relative;
  z-index: 1;
  margin: 20px;
  padding: 0;
  border: 1px solid #e3e1db;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.drawer.model-modal .drawer-head {
  align-items: center;
  margin: 0;
  padding: 16px 24px;
  border-bottom: 1px solid #e3e1db;
  background: #fff;
}

.drawer.model-modal .drawer-head h2 {
  margin: 0;
  color: #2d2a26;
  font-size: 18px;
  line-height: 1.5;
}

.drawer.model-modal .drawer-head .btn {
  min-height: 32px;
  border-color: #2d2a26;
  background: #2d2a26;
  color: #fffefa;
  box-shadow: none;
}

.drawer.model-modal .drawer-head .btn:hover {
  border-color: #1f1d1a;
  background: #1f1d1a;
  color: #fff;
}

.drawer.auth-detail-modal {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}

.drawer.auth-detail-modal .drawer-backdrop {
  position: fixed;
  inset: 0;
  grid-area: 1 / 1;
  background: rgba(45, 42, 38, 0.48);
}

.auth-detail-dialog {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 32px));
  max-height: min(80vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e3e1db;
  border-radius: 12px;
  background: #fff;
  color: #2d2a26;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  outline: none;
}

.auth-detail-close {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 2;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e3e1db;
  border-radius: 9999px;
  background: #faf9f5;
  color: #6d6760;
  box-shadow: none;
  cursor: pointer;
}

.auth-detail-close:hover {
  background: #fffefa;
  color: #2d2a26;
}

.auth-detail-header {
  min-height: 60px;
  display: flex;
  align-items: center;
  padding: 16px 58px 16px 24px;
  border-bottom: 1px solid #e3e1db;
  background: #fff;
}

.auth-detail-title {
  min-width: 0;
  color: #2d2a26;
  font-size: 18px;
  font-weight: 700;
  line-height: 27px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  background: #fff;
  scrollbar-gutter: stable;
}

.auth-detail-editor,
.auth-detail-fields {
  display: grid;
  gap: 16px;
}

.auth-detail-fields {
  gap: 14px;
}

.auth-detail-json-wrapper,
.auth-detail-form-group {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.auth-detail-form-group {
  gap: 4px;
}

.auth-detail-hidden {
  display: none;
}

.auth-detail-preview-label {
  color: #6d6760;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
}

.auth-detail-label {
  color: #2d2a26;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.auth-detail-textarea,
.auth-detail-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e3e1db;
  border-radius: 8px;
  background: #fff;
  color: #2d2a26;
  box-shadow: none;
  outline: none;
}

.auth-detail-textarea {
  min-height: 162px;
  padding: 8px 16px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
}

.auth-detail-file-preview {
  min-height: 198px;
}

.auth-detail-input {
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 24px;
}

.auth-detail-headers {
  min-height: 118px;
  resize: vertical;
}

.auth-detail-textarea:focus,
.auth-detail-input:focus {
  border-color: #c9c5bd;
}

.auth-detail-help {
  margin: 0;
  color: #6d6760;
  font-size: 12px;
  line-height: 18px;
}

.auth-detail-switch-line {
  height: 24px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
}

.auth-detail-switch-line input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.auth-detail-switch {
  width: 42px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: #d8d4cc;
  cursor: pointer;
  transition: background 0.14s ease;
}

.auth-detail-switch i {
  width: 20px;
  height: 20px;
  display: block;
  border-radius: 50%;
  background: #fffefa;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  transition: transform 0.14s ease;
}

.auth-detail-switch-line input:checked + .auth-detail-switch {
  background: #8b8680;
}

.auth-detail-switch-line input:checked + .auth-detail-switch i {
  transform: translateX(18px);
}

.auth-detail-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #e3e1db;
  background: #fff;
}

.auth-detail-footer .btn {
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: none;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.auth-detail-secondary {
  border-color: #e3e1db;
  background: #e9e6df;
  color: #2d2a26;
}

.auth-detail-secondary:hover {
  border-color: #d1cec8;
  background: #f4f2ed;
}

.auth-detail-primary {
  border-color: #8b8680;
  background: #8b8680;
  color: #fff;
}

.auth-detail-primary:hover {
  border-color: #77716b;
  background: #77716b;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.maintenance-drawer {
  display: grid;
  gap: 14px;
}

.maintenance-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfb;
}

.maintenance-head h3 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.2;
}

.maintenance-head .btn {
  flex: 0 0 auto;
}

.maintenance-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.maintenance-table .panel {
  box-shadow: none;
}

.maintenance-table table {
  min-width: 680px;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tabs button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  font-weight: 720;
}

.tabs button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.permission-grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, 0.6fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.permission-grid div {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: white;
}

.permission-grid div:nth-child(-n + 5) {
  background: #f7faf9;
  color: var(--muted);
  font-weight: 760;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--ink);
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 100;
  max-width: min(420px, calc(100vw - 28px));
}

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

@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

  .overview-metric {
    min-height: 132px;
  }

  .grid.cols-2,
  .grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .model-policy-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  :root {
    --topbar: auto;
  }

  body {
    background: var(--bg);
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand span {
    display: none;
  }

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

  .admin-identity {
    max-width: 180px;
  }

  .nav {
    grid-column: 1 / -1;
    order: 3;
    width: 100%;
    gap: 6px;
    padding: 4px;
  }

  .nav-group-label {
    display: none;
  }

  .nav-group + .nav-group {
    margin-left: 0;
    padding-left: 6px;
  }

  .nav button {
    padding: 8px 9px;
  }

  .content {
    padding: 14px;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-head .actions .btn {
    width: 100%;
  }

  .toolbar-options {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .toolbar-main {
    width: 100%;
    flex-wrap: wrap;
  }

  .overview-log {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-log-list-large .overview-log {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .overview-log-meta {
    justify-content: flex-start;
  }

  .overview-log-list-large .overview-log-meta {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .actions {
    justify-content: flex-start;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .toolbar input,
  .toolbar select,
  .toolbar .btn {
    flex: none;
    min-width: 0;
    width: 100%;
    max-width: none;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }

  .compact-field-grid {
    grid-template-columns: 1fr;
  }

  .short-field,
  .datetime-field,
  .wide-field,
  .form-compact {
    width: 100%;
  }

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

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

  .group-member-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .group-member-card .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .settings-form-grid {
    gap: 12px;
  }

  .settings-connection-grid,
  .settings-policy-grid,
  .settings-data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-path-field {
    grid-column: 1 / -1;
  }

  .settings-card-head,
  .settings-savebar {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-savebar .btn {
    width: 100%;
  }

  .drawer {
    display: block;
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
  }

  .drawer-panel {
    position: fixed;
    inset: auto 0 0 0;
    max-height: 92vh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 12px 12px 0 0;
  }

  .drawer.model-modal {
    display: grid;
  }

  .drawer.model-modal .drawer-panel {
    width: calc(100vw - 24px);
    max-height: 82vh;
    position: relative;
    inset: auto;
    margin: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .drawer.auth-detail-modal {
    display: grid;
    padding: 12px;
  }

  .auth-detail-dialog {
    width: calc(100vw - 24px);
    max-height: 86vh;
  }

  .auth-detail-title {
    font-size: 16px;
  }

  .auth-detail-body {
    padding: 18px;
  }

  .auth-detail-footer {
    padding: 14px 18px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 13px;
  }

  .auth-shell {
    padding: 14px;
  }

  .auth-panel {
    padding: 22px;
  }

  .kpis {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .overview-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .overview-metric {
    min-height: 118px;
    padding: 13px;
  }

  .overview-metric strong {
    font-size: 28px;
  }

  .overview-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-log-list-large .overview-log {
    padding: 13px;
  }

  .kpi {
    min-height: 82px;
    padding: 12px;
  }

  .kpi strong {
    font-size: 23px;
  }

  .page-title h1 {
    font-size: 22px;
  }

  .btn {
    min-height: 38px;
  }

  .admin-identity {
    max-width: 150px;
    min-height: 36px;
    padding-right: 8px;
  }

  .admin-avatar {
    display: none;
  }

  .actions .btn {
    flex: 1 1 auto;
  }

  .model-rule-options {
    grid-template-columns: 1fr;
  }

  .model-rule-custom {
    flex-wrap: wrap;
  }

  .model-rule-custom input {
    flex-basis: 100%;
  }

  .group-options {
    grid-template-columns: 1fr;
  }

  .settings-connection-grid,
  .settings-policy-grid,
  .settings-data-grid {
    grid-template-columns: 1fr;
  }

  .settings-path-field {
    grid-column: auto;
  }

  .setting-duration-control,
  .setting-unit-input {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  .readonly-token {
    align-items: stretch;
    flex-direction: column;
  }

  .readonly-token .btn {
    width: 100%;
  }

  .group-member-add {
    grid-template-columns: 1fr;
  }

  .group-member-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .group-member-meta {
    justify-content: flex-start;
  }

  .group-custom {
    flex-wrap: wrap;
  }

  .group-custom input {
    flex-basis: 100%;
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 9px 10px;
  }

  .permission-grid {
    min-width: 620px;
  }

  .panel:has(.permission-grid) {
    overflow: auto;
  }
}

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

/* 2026 control-room refresh: tech-forward shell without changing native admin behavior. */
:root {
  --bg: #edf3f7;
  --bg-rail: #0b1724;
  --panel: #ffffff;
  --panel-soft: #f6f9fb;
  --ink: #0e1a22;
  --ink-soft: #23323c;
  --muted: #667783;
  --faint: #8a9ba6;
  --line: #dbe5eb;
  --line-strong: #b9c9d2;
  --active: #008f7c;
  --active-soft: #e1f7f2;
  --warn: #9d650c;
  --warn-soft: #fff2cf;
  --danger: #bb2e3e;
  --danger-soft: #ffeaee;
  --accent: #2f6fb7;
  --accent-soft: #e4eefb;
  --violet: #5f58b6;
  --shadow: 0 26px 68px rgba(13, 27, 38, 0.14);
  --shadow-soft: 0 14px 34px rgba(13, 27, 38, 0.09);
  --radius: 8px;
  --topbar: 82px;
}

body {
  background:
    linear-gradient(90deg, rgba(47, 111, 183, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0, 143, 124, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 44%, #eaf1f5 100%);
  background-size: 36px 36px, 36px 36px, auto;
  color: var(--ink);
}

.app-shell {
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0)), transparent;
}

.topbar {
  min-height: var(--topbar);
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 18px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(123, 150, 164, 0.2);
  background: linear-gradient(90deg, #081421 0%, #102233 48%, #0d1b28 100%);
  box-shadow: 0 16px 42px rgba(8, 20, 33, 0.2);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 210, 184, 0.86), rgba(240, 185, 80, 0.72), transparent);
  pointer-events: none;
}

.brand {
  min-width: 0;
  align-self: center;
  padding: 8px 10px;
  border: 1px solid rgba(169, 195, 207, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.brand-mark {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, rgba(0, 210, 184, 0.95), rgba(47, 111, 183, 0.82));
  color: #efffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 12px 24px rgba(0, 143, 124, 0.28);
}

.brand strong {
  color: #f4fbff;
  font-size: 17px;
}

.brand span {
  color: #8fb0c2;
}

.nav {
  align-self: center;
  gap: 12px;
  padding: 6px;
  border-color: rgba(169, 195, 207, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-group + .nav-group {
  border-left-color: rgba(169, 195, 207, 0.16);
}

.nav-group-label {
  color: #7091a4;
  font-size: 10px;
  font-weight: 820;
}

.nav button {
  min-height: 36px;
  padding: 8px 11px;
  color: #c4d4df;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 760;
}

.nav button:hover {
  border-color: rgba(0, 210, 184, 0.22);
  background: rgba(255, 255, 255, 0.075);
  color: #ffffff;
}

.nav button.active {
  border-color: rgba(0, 210, 184, 0.55);
  background: linear-gradient(180deg, rgba(0, 143, 124, 0.33), rgba(0, 143, 124, 0.18));
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 22px rgba(0, 0, 0, 0.18);
}

.topbar-actions {
  align-self: center;
}

.admin-identity {
  border-color: rgba(169, 195, 207, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #eff7fb;
}

.admin-avatar {
  background: rgba(0, 210, 184, 0.16);
  color: #78f0dd;
}

.admin-copy strong {
  color: #f4fbff;
}

.admin-copy em {
  color: #8fb0c2;
}

.content {
  padding: 26px;
}

.page-head {
  align-items: center;
  margin-bottom: 20px;
  padding: 18px 18px 18px 20px;
  border: 1px solid rgba(185, 201, 210, 0.72);
  border-left: 4px solid var(--active);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(247, 250, 252, 0.86));
  box-shadow: var(--shadow-soft);
}

.page-title h1 {
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 850;
  color: #0b1724;
}

.page-title p {
  max-width: 820px;
  margin-top: 7px;
  color: #647784;
  line-height: 1.55;
}

.panel,
.overview-metric,
.overview-panel,
.settings-card,
.auth-file-card,
.permission-grid {
  border-color: rgba(185, 201, 210, 0.76);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.88), 0 18px 42px rgba(13, 27, 38, 0.07);
}

.panel,
.overview-panel {
  overflow: hidden;
}

.panel-head,
.overview-panel-head,
.settings-card-head,
.drawer-head {
  border-bottom-color: rgba(185, 201, 210, 0.62);
  background: linear-gradient(180deg, rgba(250, 253, 255, 0.96), rgba(244, 249, 251, 0.82));
}

.overview-metrics {
  gap: 14px;
}

.overview-metric {
  position: relative;
  min-height: 126px;
  padding: 17px;
  overflow: hidden;
}

.overview-metric::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--active), var(--accent));
  opacity: 0.84;
}

.overview-metric-health.ok {
  border-color: rgba(0, 143, 124, 0.3);
  background: linear-gradient(180deg, #ffffff, #f1fbf8);
}

.overview-metric-health.warn {
  border-color: rgba(157, 101, 12, 0.3);
  background: linear-gradient(180deg, #ffffff, #fff8e6);
}

.overview-metric span,
.kpi span,
.settings-kicker {
  color: #637985;
  font-weight: 820;
}

.overview-metric strong,
.kpi strong {
  color: #0b1724;
  letter-spacing: 0;
}

.overview-log {
  background: rgba(255, 255, 255, 0.82);
  border-bottom-color: rgba(219, 229, 235, 0.82);
}

.overview-log:hover {
  background: #f3faf9;
}

.overview-dot {
  background: #00a991;
  box-shadow: 0 0 0 4px rgba(0, 169, 145, 0.11);
}

.overview-log.failed .overview-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(187, 46, 62, 0.1);
}

.table-wrap {
  border-radius: 8px;
}

table {
  background: #ffffff;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f8fb;
  color: #526a77;
  border-bottom: 1px solid rgba(185, 201, 210, 0.85);
  font-size: 12px;
  font-weight: 820;
}

td {
  border-bottom-color: rgba(219, 229, 235, 0.82);
}

tbody tr:hover td {
  background: #f7fbfb;
}

.btn {
  border-color: rgba(185, 201, 210, 0.88);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f3f8fb);
  color: #223540;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 8px 18px rgba(13, 27, 38, 0.05);
}

.btn:hover {
  border-color: #9bb2bd;
  background: #ffffff;
  transform: translateY(-1px);
}

.btn.primary {
  border-color: #007f70;
  background: linear-gradient(180deg, #00a991, #008977);
  color: white;
  box-shadow: 0 14px 24px rgba(0, 143, 124, 0.2);
}

.btn.primary:hover {
  border-color: #006f62;
  background: linear-gradient(180deg, #00b49b, #007f70);
}

.btn.info {
  border-color: rgba(47, 111, 183, 0.42);
  background: linear-gradient(180deg, #f7fbff, #e5f0fb);
  color: #245f9f;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
}

.topbar .btn {
  border-color: rgba(169, 195, 207, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #d9e7ee;
  box-shadow: none;
}

.topbar .btn:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.badge {
  border-color: rgba(185, 201, 210, 0.84);
  background: #f6f9fb;
  color: #425662;
  font-weight: 800;
}

.badge.ok,
.badge.success,
.auth-state-badge.active {
  border-color: rgba(0, 143, 124, 0.28);
  background: var(--active-soft);
  color: #007565;
}

.badge.warn,
.badge.warning,
.auth-state-badge.warning {
  border-color: rgba(157, 101, 12, 0.28);
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.danger,
.badge.failed,
.auth-state-badge.danger {
  border-color: rgba(187, 46, 62, 0.26);
  background: var(--danger-soft);
  color: var(--danger);
}

.field input,
.field textarea,
.field select,
.toolbar input,
.toolbar select,
.model-rule-custom input,
.group-custom input {
  border-color: rgba(185, 201, 210, 0.9);
  border-radius: 8px;
  background: #fbfdfe;
  color: #142532;
  box-shadow: inset 0 1px 0 rgba(13, 27, 38, 0.03);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.toolbar input:focus,
.toolbar select:focus {
  border-color: rgba(0, 143, 124, 0.66);
  box-shadow: 0 0 0 4px rgba(0, 143, 124, 0.1);
}

.toolbar,
.tabs,
.model-rule-selected,
.group-selected,
.readonly-token {
  border-color: rgba(185, 201, 210, 0.74);
  background: rgba(255, 255, 255, 0.72);
}

.tabs {
  width: fit-content;
  max-width: 100%;
  padding: 5px;
  border: 1px solid rgba(185, 201, 210, 0.7);
  border-radius: 8px;
}

.tabs button {
  border-color: transparent;
  background: transparent;
}

.tabs button.active {
  background: #0d1b28;
  border-color: #0d1b28;
}

.auth-shell {
  background:
    linear-gradient(90deg, rgba(0, 210, 184, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47, 111, 183, 0.06) 1px, transparent 1px),
    linear-gradient(135deg, #071421 0%, #102235 100%);
  background-size: 38px 38px, 38px 38px, auto;
}

.auth-panel {
  border-color: rgba(169, 195, 207, 0.22);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.25);
}

.auth-panel::before {
  background: linear-gradient(135deg, #00a991, #2f6fb7);
}

.drawer-backdrop {
  background: rgba(8, 20, 33, 0.34);
  backdrop-filter: blur(4px);
}

.drawer-panel {
  border-left-color: rgba(185, 201, 210, 0.86);
  background: #f8fbfc;
  box-shadow: -28px 0 74px rgba(13, 27, 38, 0.2);
}

.empty,
.surface-empty {
  color: #758893;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .brand {
    width: 100%;
  }

  .nav {
    order: 2;
    grid-column: auto;
  }

  .topbar-actions {
    order: 3;
    grid-column: auto;
    justify-content: flex-start;
  }

  .content {
    padding: 14px;
  }

  .page-head {
    align-items: stretch;
    padding: 15px;
  }

  .tabs {
    width: 100%;
  }

  .account-filter-toolbar {
    width: 100%;
  }

  .account-filter-section {
    flex: 1 1 100%;
  }

  .account-filter-main {
    flex-wrap: wrap;
  }

  .account-filter-options {
    flex: 1 1 auto;
  }

  .account-filter-result {
    min-width: 92px;
    margin-left: auto;
  }
}

@media (max-width: 560px) {
  .admin-identity {
    max-width: none;
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1 1 0;
  }

  .page-title h1 {
    font-size: 24px;
  }

  .account-filter-toolbar {
    align-items: stretch;
  }

  .account-filter-section {
    align-items: stretch;
    flex-direction: column;
  }

  .account-filter-section-title {
    align-self: auto;
    min-height: 22px;
    border-right: 0;
    border-bottom: 1px solid rgba(185, 201, 210, 0.7);
  }

  .account-filter-control {
    grid-template-columns: 44px minmax(0, 1fr);
    width: 100%;
  }

  .account-filter-control select,
  .account-filter-status select,
  .account-filter-group select,
  .account-filter-image select,
  .account-filter-sort select {
    min-width: 0;
  }

  .account-filter-number {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .account-filter-number input {
    width: 100%;
    min-width: 0;
  }

  .account-filter-result {
    width: 100%;
    min-width: 0;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    margin-left: 0;
  }

  .account-filter-result span {
    margin-top: 0;
  }

  .account-filter-toolbar .account-filter-clear {
    width: 100%;
  }

  .concurrency-input-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .concurrency-account-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .concurrency-account-row span {
    text-align: left;
  }

  .concurrency-stepper {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }
}

/* PoolGate command-console redesign */
:root {
  --bg: #f4f6f3;
  --bg-rail: #e9efec;
  --panel: #ffffff;
  --panel-soft: #f7f9f7;
  --ink: #15201f;
  --ink-soft: #253331;
  --muted: #667471;
  --faint: #8b9894;
  --line: #dfe5e1;
  --line-strong: #c6d0cb;
  --active: #008f7d;
  --active-soft: #e4f5f0;
  --warn: #956411;
  --warn-soft: #fff3d6;
  --danger: #b52d3a;
  --danger-soft: #ffe8ec;
  --accent: #c77b22;
  --accent-soft: #fff0dd;
  --sidebar: #101817;
  --sidebar-soft: #182321;
  --sidebar-line: rgba(218, 232, 225, 0.13);
  --shadow: 0 18px 42px rgba(20, 31, 29, 0.11);
  --shadow-soft: 0 10px 24px rgba(20, 31, 29, 0.07);
  --radius: 8px;
  --sidebar-width: 268px;
  --workbar: 64px;
}

html {
  background: var(--bg);
}

body {
  min-width: 0;
  background:
    linear-gradient(90deg, rgba(16, 24, 23, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(16, 24, 23, 0.03) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--ink);
}

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px 14px;
  border-right: 1px solid rgba(10, 20, 18, 0.32);
  background:
    linear-gradient(180deg, rgba(0, 143, 125, 0.14), transparent 22%),
    linear-gradient(145deg, #111b19 0%, #0f1514 54%, #1b1812 100%);
  color: #ecf5f1;
  box-shadow: 18px 0 42px rgba(16, 24, 23, 0.18);
}

.brand {
  min-width: 0;
  align-self: start;
  padding: 10px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #00b49d 0%, #008f7d 52%, #c77b22 100%);
  color: #f7fffc;
  box-shadow: 0 12px 26px rgba(0, 143, 125, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.brand strong {
  color: #f5fbf8;
  font-size: 17px;
}

.brand span {
  color: #a2b7b0;
}

.nav {
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
  padding: 2px 2px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.nav-group {
  display: grid;
  gap: 7px;
}

.nav-group + .nav-group {
  margin: 0;
  padding: 16px 0 0;
  border-left: 0;
  border-top: 1px solid var(--sidebar-line);
}

.nav-group-label {
  padding: 0 10px;
  color: #6f8880;
  font-size: 11px;
  font-weight: 820;
}

.nav-group-items {
  display: grid;
  gap: 4px;
}

.nav button {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #cadbd4;
  text-align: left;
  font-weight: 760;
}

.nav button span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-button-mark {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #42524e;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.03);
}

.nav button:hover {
  border-color: rgba(228, 245, 240, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav button.active {
  border-color: rgba(0, 180, 157, 0.34);
  background: linear-gradient(90deg, rgba(0, 143, 125, 0.24), rgba(255, 255, 255, 0.07));
  color: #ffffff;
  box-shadow: inset 3px 0 0 #00b49d;
}

.nav button.active .nav-button-mark {
  background: #00d0b5;
  box-shadow: 0 0 0 4px rgba(0, 208, 181, 0.15);
}

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--sidebar-line);
}

.sidebar .admin-identity {
  width: 100%;
  max-width: none;
  border-color: var(--sidebar-line);
  background: rgba(255, 255, 255, 0.055);
}

.sidebar .admin-avatar {
  background: rgba(0, 180, 157, 0.16);
  color: #89f2df;
}

.sidebar .admin-copy strong {
  color: #f5fbf8;
}

.sidebar .admin-copy em {
  color: #98aea7;
}

.sidebar-backdrop {
  display: none;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: var(--workbar) minmax(0, 1fr);
}

.workbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(198, 208, 203, 0.78);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 22px rgba(20, 31, 29, 0.055);
}

.workbar-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.workbar-title span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 760;
}

.workbar-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 860;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle {
  display: none;
}

.sidebar-toggle span,
.sidebar-toggle span::before,
.sidebar-toggle span::after {
  width: 16px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: currentColor;
}

.sidebar-toggle span {
  position: relative;
}

.sidebar-toggle span::before,
.sidebar-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.sidebar-toggle span::before {
  top: -5px;
}

.sidebar-toggle span::after {
  top: 5px;
}

.topbar-actions {
  align-items: center;
  justify-content: flex-end;
}

.content {
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 24px;
}

.page-head {
  align-items: flex-end;
  margin: 0 0 18px;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid rgba(198, 208, 203, 0.86);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.page-title h1 {
  font-size: 28px;
  font-weight: 880;
  color: var(--ink);
}

.page-title p {
  max-width: 780px;
  color: var(--muted);
}

.panel,
.overview-metric,
.overview-panel,
.settings-card,
.auth-file-card,
.permission-grid {
  border-color: rgba(198, 208, 203, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.86), 0 12px 28px rgba(20, 31, 29, 0.065);
}

.overview-shell {
  gap: 16px;
}

.overview-metrics {
  gap: 12px;
}

.overview-metrics-compact {
  grid-template-columns: minmax(230px, 1.18fr) repeat(4, minmax(132px, 1fr));
}

.overview-metric {
  min-height: 112px;
  padding: 15px;
}

.overview-metric::before {
  background: linear-gradient(90deg, #008f7d, #c77b22);
}

.overview-metric span,
.kpi span,
.settings-kicker {
  color: #5f706c;
}

.overview-metric strong {
  margin-top: 10px;
  color: #111c1a;
  font-size: 30px;
}

.overview-metric em {
  color: #7e8f8a;
}

.overview-panel-head,
.panel-head,
.settings-card-head,
.drawer-head {
  border-bottom-color: rgba(198, 208, 203, 0.78);
  background: linear-gradient(180deg, #fbfcfb, #f3f7f5);
}

.overview-log {
  min-height: 58px;
  background: rgba(255, 255, 255, 0.86);
}

.overview-log-list-large .overview-log {
  min-height: 62px;
  padding: 12px 16px;
}

.overview-dot {
  background: #00a58f;
  box-shadow: 0 0 0 4px rgba(0, 165, 143, 0.12);
}

.toolbar,
.account-filter-toolbar,
.tabs,
.model-rule-selected,
.group-selected,
.readonly-token,
.pagination {
  border-color: rgba(198, 208, 203, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.82);
}

.toolbar {
  gap: 8px;
}

.account-filter-toolbar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 10px;
}

.account-filter-section {
  border-color: rgba(198, 208, 203, 0.78);
  background: #f8faf8;
}

.account-filter-section-title {
  color: #52635f;
}

.account-filter-result {
  border-color: #15201f;
  background: #15201f;
}

.account-card-board {
  gap: 14px;
}

.static-auth-card-board {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
}

.auth-file-card {
  padding: 15px;
  border-color: rgba(198, 208, 203, 0.9);
  color: var(--ink);
}

.auth-file-card:hover,
.auth-file-card:focus-within {
  transform: translateY(-2px);
  border-color: rgba(0, 143, 125, 0.34);
  box-shadow: 0 16px 34px rgba(20, 31, 29, 0.11);
}

.auth-provider-avatar {
  border-color: rgba(198, 208, 203, 0.74);
  background: #f7faf8;
}

.auth-file-name {
  color: var(--ink);
}

.auth-file-name:hover {
  color: var(--active);
}

.auth-type-badge.chatgpt {
  background: #eef3f0;
  color: #263431;
}

.auth-state-badge.active,
.badge.ok,
.badge.success {
  border-color: rgba(0, 143, 125, 0.26);
  background: var(--active-soft);
  color: #007565;
}

.auth-state-badge.warning,
.badge.warn,
.badge.warning {
  border-color: rgba(149, 100, 17, 0.28);
  background: var(--warn-soft);
  color: var(--warn);
}

.auth-state-badge.danger,
.badge.danger,
.badge.failed {
  border-color: rgba(181, 45, 58, 0.26);
  background: var(--danger-soft);
  color: var(--danger);
}

.btn {
  border-color: rgba(185, 198, 192, 0.92);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f3f6f4);
  color: #263431;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 6px 14px rgba(20, 31, 29, 0.045);
}

.btn:hover {
  border-color: #aab8b2;
  background: #ffffff;
  transform: translateY(-1px);
}

.btn.primary {
  border-color: #007d6d;
  background: linear-gradient(180deg, #00a58f, #008f7d);
  color: #ffffff;
  box-shadow: 0 12px 22px rgba(0, 143, 125, 0.18);
}

.btn.info {
  border-color: rgba(0, 143, 125, 0.28);
  background: linear-gradient(180deg, #f5fbf8, #e4f5f0);
  color: #007565;
}

.btn.warn {
  border-color: rgba(199, 123, 34, 0.34);
  background: linear-gradient(180deg, #fffaf1, #fff0dd);
  color: #895717;
}

.btn.danger {
  border-color: rgba(181, 45, 58, 0.28);
  background: linear-gradient(180deg, #fff7f8, #ffe8ec);
  color: var(--danger);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.55);
}

.workbar .btn.ghost {
  background: rgba(255, 255, 255, 0.68);
}

.field input,
.field textarea,
.field select,
.toolbar input,
.toolbar select,
.model-rule-custom input,
.group-custom input {
  border-color: rgba(185, 198, 192, 0.94);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.toolbar input:focus,
.toolbar select:focus {
  border-color: rgba(0, 143, 125, 0.66);
  box-shadow: 0 0 0 4px rgba(0, 143, 125, 0.1);
}

table {
  background: #ffffff;
}

th {
  background: #f1f6f3;
  color: #52635f;
  border-bottom-color: rgba(198, 208, 203, 0.92);
}

td {
  border-bottom-color: rgba(223, 229, 225, 0.9);
}

tbody tr:hover td {
  background: #f8fbf9;
}

.auth-shell {
  background:
    linear-gradient(90deg, rgba(0, 180, 157, 0.065) 1px, transparent 1px),
    linear-gradient(180deg, rgba(199, 123, 34, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #101817 0%, #182321 58%, #211b13 100%);
  background-size: 34px 34px, 34px 34px, auto;
}

.auth-panel {
  border-color: rgba(218, 232, 225, 0.24);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 30px 74px rgba(0, 0, 0, 0.24);
}

.auth-panel::before {
  background: linear-gradient(135deg, #00a58f, #c77b22);
}

@media (max-width: 1280px) {
  :root {
    --sidebar-width: 236px;
  }

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

@media (max-width: 900px) {
  :root {
    --sidebar-width: 282px;
    --workbar: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-width), calc(100vw - 42px));
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }

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

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: none;
    border: 0;
    background: rgba(16, 24, 23, 0.42);
    backdrop-filter: blur(2px);
  }

  .app-shell.nav-open .sidebar-backdrop {
    display: block;
  }

  .main {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .workbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 10px 14px;
  }

  .sidebar-toggle {
    display: inline-grid;
  }

  .content {
    padding: 16px 14px;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .page-head .actions {
    justify-content: flex-start;
  }

  .account-filter-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .account-filter-section {
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .workbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .topbar-actions .btn {
    flex: 1 1 0;
  }

  .overview-metrics,
  .overview-metrics-compact {
    grid-template-columns: 1fr;
  }

  .overview-metric {
    min-height: 98px;
  }

  .page-title h1 {
    font-size: 24px;
  }
}

/* Keep PoolGate navigation on top while preserving the redesigned visual system. */
.top-nav-shell {
  min-height: 100vh;
  display: block;
}

.top-nav-shell .topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(10, 20, 18, 0.32);
  background:
    linear-gradient(90deg, rgba(0, 143, 125, 0.12), transparent 32%),
    linear-gradient(90deg, #101817 0%, #16231f 58%, #211b13 100%);
  box-shadow: 0 16px 42px rgba(16, 24, 23, 0.18);
}

.top-nav-shell .topbar::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 180, 157, 0.78), rgba(199, 123, 34, 0.64), transparent);
  pointer-events: none;
}

.top-nav-shell .brand {
  align-self: center;
  padding: 8px 10px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.top-nav-shell .nav {
  min-width: 0;
  align-self: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  scrollbar-width: thin;
}

.top-nav-shell .nav-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.top-nav-shell .nav-group + .nav-group {
  margin-left: 4px;
  padding: 0 0 0 12px;
  border-top: 0;
  border-left: 1px solid var(--sidebar-line);
}

.top-nav-shell .nav-group-label {
  padding: 0 2px;
  color: #6f8880;
  font-size: 10px;
  white-space: nowrap;
}

.top-nav-shell .nav-group-items {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.top-nav-shell .nav button {
  width: auto;
  min-height: 38px;
  display: grid;
  grid-template-columns: 8px auto;
  gap: 8px;
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
}

.top-nav-shell .main {
  display: block;
}

.top-nav-shell .content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px;
}

.top-nav-shell .admin-identity {
  border-color: var(--sidebar-line);
  background: rgba(255, 255, 255, 0.055);
}

.top-nav-shell .admin-avatar {
  background: rgba(0, 180, 157, 0.16);
  color: #89f2df;
}

.top-nav-shell .admin-copy strong {
  color: #f5fbf8;
}

.top-nav-shell .admin-copy em {
  color: #98aea7;
}

.top-nav-shell .topbar-actions .btn {
  border-color: rgba(218, 232, 225, 0.15);
  background: rgba(255, 255, 255, 0.065);
  color: #dbe9e4;
  box-shadow: none;
}

.top-nav-shell .topbar-actions .btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

@media (max-width: 1120px) {
  .top-nav-shell .topbar {
    grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
  }

  .top-nav-shell .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 760px) {
  .top-nav-shell .topbar {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .top-nav-shell .brand {
    width: 100%;
  }

  .top-nav-shell .nav {
    width: 100%;
  }

  .top-nav-shell .nav-group-label {
    display: none;
  }

  .top-nav-shell .nav-group + .nav-group {
    margin-left: 0;
    padding-left: 6px;
  }

  .top-nav-shell .topbar-actions {
    grid-column: auto;
    justify-content: flex-start;
  }

  .top-nav-shell .content {
    padding: 14px;
  }
}
