body {
  background:
    linear-gradient(180deg, rgba(246, 248, 251, 0.98), rgba(238, 243, 248, 0.94)),
    #f6f8fb;
}

.admin-topbar {
  background: rgba(255, 255, 255, 0.86);
}

.admin-shell {
  display: grid;
  gap: 16px;
  width: min(1380px, calc(100vw - 32px));
  margin: 20px auto 36px;
}

.admin-empty {
  display: grid;
  gap: 14px;
  place-items: center;
  width: min(560px, calc(100vw - 32px));
  margin: 78px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.admin-empty svg {
  width: 38px;
  height: 38px;
  color: var(--primary);
}

.admin-empty p {
  color: var(--muted);
  line-height: 1.6;
}

.admin-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

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

.metric-card {
  display: grid;
  gap: 5px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

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

.metric-card strong {
  color: var(--text);
  font-size: 26px;
  line-height: 1.1;
}

.admin-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 4px;
  justify-self: start;
  max-width: 520px;
  border: 1px solid rgba(161, 195, 239, 0.56);
  border-radius: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.8);
}

.admin-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.admin-tabs button.active {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 8px 18px rgba(28, 78, 142, 0.1);
}

.admin-tabs button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.admin-tabs svg,
.admin-toolbar svg {
  width: 17px;
  height: 17px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(380px, 0.9fr) minmax(520px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.compact-grid {
  grid-template-columns: minmax(480px, 0.85fr) minmax(360px, 0.65fr);
}

.admin-list-panel,
.admin-detail-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  padding: 16px;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 150px) minmax(120px, 150px) 42px auto;
  gap: 8px;
  align-items: center;
}

.search-field {
  position: relative;
  min-width: 0;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-field input,
.admin-toolbar select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: inherit;
}

.search-field input {
  padding: 0 12px 0 36px;
}

.admin-toolbar select {
  padding: 0 10px;
}

.admin-rows {
  display: grid;
  gap: 8px;
  max-height: min(64vh, 760px);
  overflow: auto;
  padding-right: 2px;
}

.admin-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 66px;
  border: 1px solid rgba(201, 214, 229, 0.78);
  border-radius: 8px;
  background: rgba(250, 252, 255, 0.8);
  color: var(--text);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.admin-row.active,
.admin-row:hover {
  border-color: rgba(24, 113, 255, 0.46);
  background: #fff;
}

.row-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(169, 201, 246, 0.68);
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary-strong);
  font-weight: 900;
}

.worker-avatar svg {
  width: 19px;
  height: 19px;
}

.row-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.row-main strong,
.row-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-main small {
  color: var(--muted);
}

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

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

.admin-switches,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-switches label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--text);
  font-weight: 700;
}

.admin-switches input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.danger-text {
  color: #b42318;
}

.detail-summary,
.detail-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid rgba(185, 207, 232, 0.58);
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.detail-facts div {
  min-width: 0;
}

.detail-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-facts dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

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

.mini-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border: 1px solid rgba(201, 214, 229, 0.72);
  border-radius: 8px;
  background: rgba(250, 252, 255, 0.82);
  padding: 9px 10px;
}

.mini-list strong,
.mini-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.command-box {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(156, 184, 218, 0.62);
  border-radius: 8px;
  background: rgba(246, 249, 253, 0.9);
  padding: 12px;
}

.command-box code {
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #1f2937;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.admin-error {
  justify-self: start;
}

@media (max-width: 1100px) {
  .admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .admin-rows {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .admin-shell {
    width: min(100vw - 24px, 720px);
    margin-top: 14px;
  }

  .admin-metrics,
  .detail-grid,
  .detail-summary,
  .detail-facts {
    grid-template-columns: 1fr;
  }

  .admin-tabs {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: none;
  }

  .admin-toolbar {
    grid-template-columns: 1fr;
  }

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

  .mini-list article {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-row .state-pill,
  .admin-row .status-badge {
    grid-column: 2;
    justify-self: start;
  }

  .mini-list .icon-button {
    grid-column: 1;
    justify-self: start;
  }
}
