/*
 * Nebula Apple-inspired design layer.
 * Semantic tokens and component overrides shared by every staff surface.
 */
:root {
  color-scheme: dark;
  --apple-blue: #0a84ff;
  --apple-blue-hover: #409cff;
  --apple-green: #30d158;
  --apple-orange: #ff9f0a;
  --apple-red: #ff453a;
  --apple-purple: #bf5af2;
  --apple-bg: #08090d;
  --apple-bg-elevated: #111318;
  --apple-surface: rgba(28, 30, 38, 0.72);
  --apple-surface-solid: #1c1e26;
  --apple-surface-raised: rgba(44, 46, 56, 0.82);
  --apple-fill: rgba(255, 255, 255, 0.075);
  --apple-fill-hover: rgba(255, 255, 255, 0.12);
  --apple-separator: rgba(255, 255, 255, 0.1);
  --apple-text: #f5f5f7;
  --apple-text-secondary: rgba(235, 235, 245, 0.68);
  --apple-text-tertiary: rgba(235, 235, 245, 0.42);
  --apple-focus: rgba(10, 132, 255, 0.46);
  --apple-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  --apple-shadow-small: 0 6px 24px rgba(0, 0, 0, 0.2);
  --apple-radius-large: 20px;
  --apple-radius: 14px;
  --apple-radius-small: 10px;
  --apple-sidebar-width: 264px;
  --apple-toolbar-height: 56px;
  --apple-motion: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Compatibility aliases for the existing console components. */
  --ui-bg: var(--apple-bg);
  --ui-surface: var(--apple-bg-elevated);
  --ui-surface-elevated: var(--apple-surface-solid);
  --ui-card: var(--apple-surface-solid);
  --ui-border: var(--apple-separator);
  --ui-text: var(--apple-text);
  --ui-muted: var(--apple-text-secondary);
  --ui-accent: var(--apple-blue);
  --ui-accent-bright: var(--apple-blue-hover);
  --ui-accent-dim: #0066cc;
  --ui-success: var(--apple-green);
  --ui-danger: var(--apple-red);
  --ui-warning: var(--apple-orange);
  --ui-selection: rgba(10, 132, 255, 0.14);
  --ui-selection-strong: rgba(10, 132, 255, 0.22);
  --ui-accent-ring: var(--apple-focus);
  --ui-sidebar-w: var(--apple-sidebar-width);
  --ui-topbar-h: var(--apple-toolbar-height);
  --ui-radius: var(--apple-radius);
  --ui-radius-sm: var(--apple-radius-small);
  --ui-glass-regular: var(--apple-surface);
  --ui-glass-elevated: var(--apple-surface-raised);
  --ui-glass-thick: rgba(22, 24, 30, 0.9);
  --ui-glass-border: var(--apple-separator);
  --ui-glass-shadow: var(--apple-shadow);
  --sc-accent: var(--apple-blue-hover);
  --sc-accent-dim: var(--apple-blue);
  --sc-sub: var(--apple-text-secondary);
  --sc-success: var(--apple-green);
}

.shell-body {
  --ui-surface: var(--apple-bg-elevated);
  --ui-surface-elevated: var(--apple-surface-solid);
  --ui-card: var(--apple-surface-solid);
  --ui-border: var(--apple-separator);
  --ui-fill-subtle: var(--apple-fill);
  --ui-fill-hover: var(--apple-fill-hover);
  --ui-glass-regular: var(--apple-surface);
  --ui-glass-elevated: var(--apple-surface-raised);
  --ui-glass-thick: color-mix(in srgb, var(--apple-surface-solid) 92%, transparent);
  --ui-glass-border: var(--apple-separator);
  --ui-glass-chrome: var(--apple-fill);
  --ui-glass-shadow: var(--apple-shadow-small);
}

html[data-theme="light"] {
  color-scheme: light;
  --apple-blue: #007aff;
  --apple-blue-hover: #006ee6;
  --apple-green: #28a745;
  --apple-orange: #d97706;
  --apple-red: #d70015;
  --apple-purple: #8944ab;
  --apple-bg: #f2f2f7;
  --apple-bg-elevated: #e9e9ef;
  --apple-surface: rgba(255, 255, 255, 0.76);
  --apple-surface-solid: #ffffff;
  --apple-surface-raised: rgba(255, 255, 255, 0.9);
  --apple-fill: rgba(0, 0, 0, 0.045);
  --apple-fill-hover: rgba(0, 0, 0, 0.075);
  --apple-separator: rgba(60, 60, 67, 0.16);
  --apple-text: #1d1d1f;
  --apple-text-secondary: rgba(60, 60, 67, 0.72);
  --apple-text-tertiary: rgba(60, 60, 67, 0.46);
  --apple-focus: rgba(0, 122, 255, 0.34);
  --apple-shadow: 0 18px 55px rgba(30, 35, 45, 0.12);
  --apple-shadow-small: 0 4px 18px rgba(30, 35, 45, 0.08);
  --ui-accent-dim: #005eb8;
  --ui-selection: rgba(0, 122, 255, 0.1);
  --ui-selection-strong: rgba(0, 122, 255, 0.16);
  --ui-glass-thick: rgba(247, 247, 250, 0.92);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    color-scheme: light;
    --apple-blue: #007aff;
    --apple-blue-hover: #006ee6;
    --apple-bg: #f2f2f7;
    --apple-bg-elevated: #e9e9ef;
    --apple-surface: rgba(255, 255, 255, 0.76);
    --apple-surface-solid: #ffffff;
    --apple-surface-raised: rgba(255, 255, 255, 0.9);
    --apple-fill: rgba(0, 0, 0, 0.045);
    --apple-fill-hover: rgba(0, 0, 0, 0.075);
    --apple-separator: rgba(60, 60, 67, 0.16);
    --apple-text: #1d1d1f;
    --apple-text-secondary: rgba(60, 60, 67, 0.72);
    --apple-text-tertiary: rgba(60, 60, 67, 0.46);
    --apple-shadow: 0 18px 55px rgba(30, 35, 45, 0.12);
    --apple-shadow-small: 0 4px 18px rgba(30, 35, 45, 0.08);
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--apple-bg);
  accent-color: var(--apple-blue);
}

.shell-body,
.sc-body {
  color-scheme: inherit;
  background-color: var(--apple-bg);
  background-image:
    radial-gradient(ellipse 90% 58% at 84% -18%, rgba(10, 132, 255, 0.14), transparent 58%),
    radial-gradient(ellipse 72% 48% at 5% 108%, rgba(94, 92, 230, 0.09), transparent 54%),
    radial-gradient(ellipse 110% 80% at 50% 40%, rgba(255, 255, 255, 0.022), transparent 72%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.008) 0 1px, transparent 1px 7px);
  color: var(--apple-text);
}

html[data-theme="light"] .shell-body,
html[data-theme="light"] .sc-body {
  background-image:
    radial-gradient(ellipse 85% 52% at 88% -16%, rgba(0, 122, 255, 0.09), transparent 57%),
    radial-gradient(ellipse 65% 44% at 4% 105%, rgba(94, 92, 230, 0.055), transparent 52%),
    radial-gradient(ellipse 100% 75% at 50% 42%, rgba(255, 255, 255, 0.34), transparent 72%);
}

.shell-skip-link {
  position: fixed;
  z-index: 10000;
  top: 10px;
  left: 12px;
  padding: 0.65rem 0.9rem;
  border-radius: var(--apple-radius-small);
  background: var(--apple-blue);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--apple-motion);
}

.shell-skip-link:focus {
  transform: translateY(0);
}

.shell-topbar {
  min-height: var(--apple-toolbar-height);
  background: color-mix(in srgb, var(--apple-bg-elevated) 76%, transparent);
  border-bottom: 1px solid var(--apple-separator);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  backdrop-filter: blur(24px) saturate(1.4);
}

.shell-topbar__primary {
  min-height: var(--apple-toolbar-height);
  padding-inline: clamp(0.75rem, 2vw, 1.25rem);
}

.shell-topbar__brand {
  gap: 0.65rem;
  color: var(--apple-text);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.shell-topbar__brand-logo {
  background: linear-gradient(145deg, #64d2ff, var(--apple-blue) 55%, #5e5ce6);
  box-shadow: 0 5px 18px rgba(10, 132, 255, 0.3);
}

.shell-topbar__sub:empty {
  display: none;
}

.shell-mobile-nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: var(--apple-fill);
  color: var(--apple-text);
}

.shell-history-back {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--apple-separator);
  border-radius: 11px;
  background: var(--apple-fill);
  color: var(--apple-text);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.shell-history-back:hover {
  background: var(--apple-fill-hover);
}

.shell-sidebar {
  position: relative;
  z-index: 40;
  background: color-mix(in srgb, var(--apple-bg-elevated) 88%, transparent);
  border-right-color: var(--apple-separator);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  backdrop-filter: blur(24px) saturate(1.25);
}

.shell-sidebar__mobile-head {
  display: none;
}

.shell-sidebar__nav {
  padding: 0.75rem;
}

.shell-nav-group {
  padding: 0;
  margin: 0 0 1rem;
  border: 0;
  background: transparent;
}

.shell-nav-group__label {
  padding: 0.35rem 0.65rem 0.3rem;
  color: var(--apple-text-tertiary);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.shell-nav__link {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 0.7rem;
  margin: 2px 0;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  color: var(--apple-text-secondary);
  font-size: 0.88rem;
  font-weight: 560;
  transition:
    color var(--apple-motion),
    background var(--apple-motion),
    transform var(--apple-motion);
}

.shell-nav__link:hover {
  color: var(--apple-text);
  background: var(--apple-fill-hover);
}

.shell-nav__link:active {
  transform: scale(0.985);
}

.shell-nav__link.is-active {
  padding-left: 0.65rem;
  border-left: 0;
  background: var(--ui-selection-strong);
  color: var(--apple-blue-hover);
  font-weight: 650;
}

.shell-nav__icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.sc-ctx-sidebar__back {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  margin: 0 0 0.65rem;
  padding: 0.35rem 0.55rem;
  border-radius: 9px;
  color: var(--apple-blue-hover);
  font-size: 0.82rem;
  font-weight: 620;
  text-decoration: none;
}

.sc-ctx-sidebar__back:hover {
  background: var(--apple-fill-hover);
}

.sc-ctx-sidebar__subgroup {
  display: grid;
  gap: 2px;
  margin-top: 0.3rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--apple-separator);
}

.sc-ctx-sidebar__sublabel {
  padding: 0.35rem 0.65rem 0.2rem;
  color: var(--apple-text-tertiary);
  font-size: 0.7rem;
  font-weight: 650;
}

.sc-ctx-sidebar__link--nested {
  padding-left: 1.15rem;
  font-size: 0.82rem;
}

/* Контекстная боковая панель — тот же Apple-nav, что и на главном экране */
.shell-body .sc-ctx-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.shell-body .sc-ctx-sidebar__top {
  margin-bottom: 0.35rem;
  padding: 0.35rem 0.65rem 0.55rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.shell-body .sc-ctx-sidebar__badge {
  margin: 0 0 0.2rem;
  color: var(--apple-text-tertiary);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: none;
}

.shell-body .sc-ctx-sidebar__title {
  margin: 0;
  color: var(--apple-text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.shell-body .sc-ctx-sidebar__context-note {
  margin: 0.25rem 0 0;
  color: var(--apple-text-secondary);
  font-size: 0.78rem;
}

.shell-body .sc-ctx-sidebar__service-home-link {
  color: inherit;
  text-decoration: none;
}

.shell-body .sc-ctx-sidebar__service-home-link:hover {
  color: var(--apple-blue-hover);
}

.shell-body .sc-ctx-sidebar__group {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.shell-body .sc-ctx-sidebar__group + .sc-ctx-sidebar__group {
  margin-top: 0;
}

.shell-body .sc-ctx-sidebar__group summary {
  padding: 0.35rem 0.65rem 0.3rem;
  color: var(--apple-text-tertiary);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: none;
  background: transparent;
}

.shell-body .sc-ctx-sidebar__group summary:hover {
  color: var(--apple-text-secondary);
  background: transparent;
}

.shell-body .sc-ctx-sidebar__group summary::after {
  width: 0.4rem;
  height: 0.4rem;
  opacity: 0.45;
}

.shell-body .sc-ctx-sidebar__stack {
  gap: 2px;
  padding: 0;
}

.shell-body .sc-ctx-sidebar__link {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin: 2px 0;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  color: var(--apple-text-secondary);
  font-size: 0.88rem;
  font-weight: 560;
  text-decoration: none;
  transition:
    color var(--apple-motion),
    background var(--apple-motion),
    transform var(--apple-motion);
}

.shell-body .sc-ctx-sidebar__link:hover {
  color: var(--apple-text);
  background: var(--apple-fill-hover);
}

.shell-body .sc-ctx-sidebar__link:active {
  transform: scale(0.985);
}

.shell-body .sc-ctx-sidebar__link.is-active {
  background: var(--ui-selection-strong);
  color: var(--apple-blue-hover);
  font-weight: 650;
  box-shadow: none;
}

.shell-body .sc-ctx-sidebar__catalog-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.shell-body .sc-ctx-sidebar__catalog-nav .shell-nav-group {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  background: transparent;
}

.shell-body .sc-ctx-sidebar__catalog-nav .shell-nav__link {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 0.7rem;
  margin: 2px 0;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border-left: 0;
  color: var(--apple-text-secondary);
  font-size: 0.88rem;
  font-weight: 560;
  box-shadow: none;
}

.shell-body .sc-ctx-sidebar__catalog-nav .shell-nav__link:hover {
  color: var(--apple-text);
  background: var(--apple-fill-hover);
}

.shell-body .sc-ctx-sidebar__catalog-nav .shell-nav__link.is-active {
  background: var(--ui-selection-strong);
  color: var(--apple-blue-hover);
  font-weight: 650;
  box-shadow: none;
}

.shell-sidebar__footer {
  background: transparent;
  border-top-color: var(--apple-separator);
}

.shell-sidebar-toggle {
  border-radius: 10px;
}

.shell-workspace {
  background: transparent;
}

.shell-main {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding: clamp(1rem, 2.2vw, 2rem);
  outline: none;
  box-sizing: border-box;
}

body.shell-unified-services .shell-main,
body.shell-context-services .shell-main,
body.shell-integration .shell-main {
  max-width: none;
  width: 100%;
}

body.shell-unified-services .ui-app-hero,
body.shell-integration .ui-app-hero,
.staff-db-hub > .ui-page-title {
  padding: clamp(1rem, 2vw, 1.4rem);
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-large);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 76%, transparent), var(--apple-surface));
  box-shadow: var(--apple-shadow-small);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
}

body.shell-context-services {
  --ui-sidebar-w: 252px;
}

.shell-sidebar-backdrop {
  display: none;
}

.shell-navigation-progress {
  position: fixed;
  z-index: 10000;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  pointer-events: none;
  opacity: 0;
}

.shell-navigation-progress::after {
  content: "";
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 999px;
  background: var(--apple-blue);
  box-shadow: 0 0 12px var(--apple-blue);
  transform: translateX(-110%);
}

.shell-navigation-progress.is-active {
  opacity: 1;
}

.shell-navigation-progress.is-active::after {
  animation: apple-progress 1s ease-in-out infinite;
}

@keyframes apple-progress {
  50% { transform: translateX(145%); width: 55%; }
  100% { transform: translateX(300%); width: 30%; }
}

/* Shared surfaces: existing templates gain one consistent visual language. */
.sc-card,
.sc-panel,
.staff-form-card,
.ui-glass-surface,
.ui-resource-section,
.ios-inset-group,
.sc-ios-inset,
.module,
.inline-group {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 78%, transparent), var(--apple-surface));
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-large);
  box-shadow: var(--apple-shadow-small);
  -webkit-backdrop-filter: blur(18px) saturate(1.22);
  backdrop-filter: blur(18px) saturate(1.22);
}

.sc-prompt-item,
.sc-dola-item,
.staff-db-hub-card,
.sc-api-catalog-card,
.sc-service-tile,
.sc-dialog {
  border: 1px solid var(--apple-separator);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 82%, transparent), var(--apple-surface));
  box-shadow: var(--apple-shadow-small);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  backdrop-filter: blur(20px) saturate(1.25);
}

.staff-db-hub-card {
  border-left: 3px solid color-mix(in srgb, var(--apple-blue) 72%, transparent);
}

.sc-pv-cat-list {
  border-color: var(--apple-separator) !important;
  background: transparent !important;
}

.sc-pv-cat-row {
  border-color: var(--apple-separator) !important;
  background: var(--apple-surface) !important;
}

.sc-btn.sc-btn--pv-on {
  background: var(--apple-green) !important;
}

.sc-btn.sc-btn--pv-off {
  background: var(--apple-red) !important;
}

.sc-dialog {
  color: var(--apple-text);
}

.sc-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.sc-dialog__head {
  border-bottom-color: var(--apple-separator);
  background: color-mix(in srgb, var(--apple-surface-raised) 86%, transparent);
}

.sc-dialog__body {
  background: transparent;
}

.sc-console-toolbar,
.ui-page-title,
.sc-page-header {
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

.sc-title,
.ui-page-title__heading,
.sc-console-toolbar h1 {
  color: var(--apple-text);
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  font-weight: 720;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.sc-sub,
.help,
.helptext {
  color: var(--apple-text-secondary);
}

.sc-btn,
.shell-body button,
.shell-body input[type="submit"],
.shell-body input[type="button"],
.shell-body .button,
.shell-body a.button {
  min-height: 38px;
  border-radius: var(--apple-radius-small);
  font-family: inherit;
  font-weight: 620;
  transition:
    transform var(--apple-motion),
    background var(--apple-motion),
    border-color var(--apple-motion),
    box-shadow var(--apple-motion);
}

.sc-btn:active,
.shell-body button:active,
.shell-body .button:active {
  transform: scale(0.975);
}

.sc-btn--primary,
.apple-admin .submit-row input.default,
.apple-admin input[type="submit"].default {
  border-color: transparent;
  background: var(--apple-blue);
  color: #fff;
  box-shadow: 0 5px 16px rgba(10, 132, 255, 0.2);
}

.sc-btn--primary:hover,
.apple-admin .submit-row input.default:hover,
.apple-admin input[type="submit"].default:hover {
  background: var(--apple-blue-hover);
}

.sc-btn--secondary,
.sc-filter-pill,
.shell-body .button,
.shell-body a.button {
  border-color: var(--apple-separator);
  background: var(--apple-fill);
  color: var(--apple-text);
}

.sc-btn--secondary:hover,
.sc-filter-pill:hover,
.shell-body .button:hover,
.shell-body a.button:hover {
  background: var(--apple-fill-hover);
}

.shell-body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
.shell-body select,
.shell-body textarea {
  min-height: 40px;
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-small);
  background: var(--apple-fill);
  color: var(--apple-text);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.shell-body input:hover,
.shell-body select:hover,
.shell-body textarea:hover {
  border-color: color-mix(in srgb, var(--apple-text-secondary) 52%, transparent);
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--apple-focus);
  outline-offset: 2px;
}

.sc-table-wrap,
.results,
.table-responsive {
  overflow: auto;
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius);
  background: var(--apple-surface);
  box-shadow: var(--apple-shadow-small);
}

.sc-table,
#result_list {
  border-collapse: collapse;
}

.sc-table th,
#result_list th {
  background: var(--apple-fill);
  color: var(--apple-text-secondary);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.sc-table td,
.sc-table th,
#result_list td,
#result_list th {
  border-color: var(--apple-separator);
}

.sc-table tbody tr,
#result_list tbody tr {
  transition: background var(--apple-motion);
}

.sc-table tbody tr:hover,
#result_list tbody tr:hover {
  background: var(--apple-fill);
}

.shell-messages {
  position: fixed;
  z-index: 200;
  top: calc(var(--apple-toolbar-height) + 12px);
  right: 16px;
  width: min(380px, calc(100vw - 32px));
}

.shell-msg {
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius);
  background: var(--apple-surface-raised);
  color: var(--apple-text);
  box-shadow: var(--apple-shadow);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  backdrop-filter: blur(24px) saturate(1.3);
  animation: apple-toast-in 240ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

@keyframes apple-toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
}

.sc-drawer__panel {
  background: var(--apple-surface-raised);
  border-left: 1px solid var(--apple-separator);
  box-shadow: var(--apple-shadow);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
  backdrop-filter: blur(28px) saturate(1.35);
}

.sc-drawer__backdrop,
.shell-sidebar-backdrop {
  background: rgba(0, 0, 0, 0.34);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sc-deferred-host--pending {
  opacity: 0.76;
}

.sc-empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 2rem;
  border: 1px dashed var(--apple-separator);
  border-radius: var(--apple-radius-large);
  background: var(--apple-fill);
  text-align: center;
}

.sc-empty-state strong {
  font-size: 1.05rem;
}

.sc-empty-state p {
  max-width: 34rem;
  margin: 0.3rem 0 0;
}

[data-live-error]::before,
[data-submit-error]::before {
  content: attr(data-live-error);
  display: block;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--apple-red) 45%, transparent);
  border-radius: var(--apple-radius-small);
  background: color-mix(in srgb, var(--apple-red) 12%, transparent);
  color: var(--apple-red);
  font-size: 0.86rem;
}

.staff-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.sc-definition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0;
}

.sc-definition-grid > div {
  padding: 0.8rem;
  border-radius: var(--apple-radius-small);
  background: var(--apple-fill);
}

.sc-definition-grid dt {
  color: var(--apple-text-secondary);
  font-size: 0.75rem;
}

.sc-definition-grid dd {
  margin: 0.2rem 0 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.sc-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 1rem;
}

.sc-account-card {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.sc-account-links {
  display: grid;
  gap: 0.5rem;
}

.sc-account-link-row,
.sc-account-bind-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--apple-radius-small);
  background: var(--apple-fill);
}

.sc-account-bind-form select {
  min-width: 0;
  flex: 1;
}

.sc-compact-details summary {
  cursor: pointer;
  color: var(--apple-blue-hover);
  font-weight: 620;
}

.sc-compact-details__body {
  display: grid;
  gap: 0.35rem;
  min-width: 220px;
  padding: 0.55rem 0;
}

.sc-compact-details__body a {
  display: block;
  padding: 0.42rem 0.55rem;
  border: 1px solid var(--apple-separator);
  border-radius: 8px;
  background: var(--apple-fill);
  text-decoration: none;
}

.sc-account-link-row + .sc-account-link-row {
  margin-top: 0.55rem;
}

.sc-divider {
  margin: 1.25rem 0;
  border: 0;
  border-top: 1px solid var(--apple-separator);
}

.sc-dialog--wide {
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
}

.sc-dialog--wide .sc-dialog__body {
  overflow-y: auto;
}

.sc-lab-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.4fr);
  gap: 1rem;
  align-items: start;
}

.sc-lab-builder,
.sc-lab-response {
  display: grid;
  gap: 0.9rem;
  border-color: color-mix(in srgb, var(--apple-blue) 22%, var(--apple-separator));
  background:
    radial-gradient(circle at 100% 0, rgba(10, 132, 255, 0.11), transparent 18rem),
    linear-gradient(145deg, var(--apple-surface-raised), var(--apple-surface));
  box-shadow: var(--apple-shadow);
}

.sc-json-view {
  max-height: 65vh;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  border-radius: var(--apple-radius-small);
  background: color-mix(in srgb, var(--apple-bg) 80%, transparent);
  color: var(--apple-text);
  font: 0.8rem/1.55 ui-monospace, "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sc-lab-error {
  border-color: color-mix(in srgb, var(--apple-red) 48%, transparent);
  color: var(--apple-red);
}

.sc-lab-history {
  display: grid;
  gap: 0.3rem;
  padding-top: 0.5rem;
}

.sc-lab-history__item {
  padding: 0.55rem;
  border-radius: 8px;
  background: var(--apple-fill);
  color: var(--apple-text-secondary);
  text-decoration: none;
}

.shell-integration .ios-footnote,
.shell-integration .ios-caption,
.shell-integration .ios-section-footer {
  color: var(--apple-text-secondary);
}

.shell-integration .ios-back,
.shell-integration .shell-back-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  color: var(--apple-blue-hover);
  text-decoration: none;
}

.shell-integration .ios-back:hover,
.shell-integration .shell-back-link:hover {
  background: var(--apple-fill-hover);
}

.shell-integration .ios-inset-group,
.shell-integration .ios-result-card,
.shell-integration .ios-result {
  margin-bottom: 1rem;
  padding: 1rem;
}

.shell-integration .ios-form-stack {
  display: grid;
  gap: 0.8rem;
}

.shell-integration .ios-inset-pad,
.shell-integration .ios-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.shell-integration .ios-section-header {
  margin: 1.25rem 0 0.45rem;
  color: var(--apple-text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.shell-integration .ios-primary-btn {
  width: 100%;
  margin-top: 1rem;
  border: 0;
  background: var(--apple-blue);
  color: #fff;
}

.shell-integration .ios-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.shell-integration .ios-switch input {
  position: absolute;
  opacity: 0;
}

.shell-integration .ios-switch__track {
  display: inline-flex;
  width: 46px;
  height: 28px;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: var(--apple-text-tertiary);
  transition: background var(--apple-motion);
}

.shell-integration .ios-switch__thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.28);
  transition: transform var(--apple-motion);
}

.shell-integration .ios-switch input:checked + .ios-switch__track {
  background: var(--apple-green);
}

.shell-integration .ios-switch input:checked + .ios-switch__track .ios-switch__thumb {
  transform: translateX(18px);
}

html[data-theme="light"] .sc-ios-switch__thumb,
html[data-theme="light"] .shell-integration .ios-switch__thumb {
  background: var(--apple-surface-solid);
}

.shell-integration .ios-segmented ul {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 3px;
  list-style: none;
  border-radius: var(--apple-radius-small);
  background: var(--apple-fill);
}

.shell-integration .ios-segmented label {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
}

.shell-integration .ios-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius);
  background: var(--apple-fill);
}

@media (max-width: 900px) {
  .sc-lab-layout {
    grid-template-columns: 1fr;
  }
}

.staff-form-grid .sc-form-row {
  display: grid;
  gap: 0.35rem;
}

.staff-form-grid .sc-form-row.has-error input,
.staff-form-grid .sc-form-row.has-error select {
  border-color: var(--apple-red);
}

.errorlist {
  color: var(--apple-red);
  font-size: 0.8rem;
}

.pagination__disabled {
  color: var(--apple-text-tertiary);
}

/* Django Admin visual bridge. */
body.apple-admin {
  background-color: var(--apple-bg);
  background-image:
    radial-gradient(ellipse 90% 58% at 84% -18%, rgba(10, 132, 255, 0.13), transparent 58%),
    radial-gradient(ellipse 72% 48% at 5% 108%, rgba(94, 92, 230, 0.08), transparent 54%),
    radial-gradient(ellipse 110% 80% at 50% 40%, rgba(255, 255, 255, 0.02), transparent 72%);
  color: var(--apple-text);
  font-family: var(--ui-font);
}

.apple-admin #header {
  background: color-mix(in srgb, var(--apple-bg-elevated) 84%, transparent);
  border-bottom: 1px solid var(--apple-separator);
  color: var(--apple-text);
  -webkit-backdrop-filter: blur(24px) saturate(1.35);
  backdrop-filter: blur(24px) saturate(1.35);
}

.apple-admin #branding h1 a,
.apple-admin #branding h1 a:visited,
.apple-admin #site-name a {
  color: var(--apple-text);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.apple-admin div.breadcrumbs {
  background: var(--apple-bg-elevated);
  border-bottom: 1px solid var(--apple-separator);
  color: var(--apple-text-secondary);
}

.apple-admin div.breadcrumbs a,
.apple-admin a:link,
.apple-admin a:visited {
  color: var(--apple-blue-hover);
}

.apple-admin #content {
  padding: clamp(1rem, 2.5vw, 2rem);
}

.apple-admin .module,
.apple-admin .inline-group,
.apple-admin .submit-row,
.apple-admin #changelist-filter {
  overflow: hidden;
  background: var(--apple-surface);
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-large);
  box-shadow: var(--apple-shadow-small);
}

.apple-admin .module h2,
.apple-admin .module caption,
.apple-admin .inline-group h2 {
  background: var(--apple-fill);
  color: var(--apple-text);
}

.apple-admin #content h1,
.apple-admin #content h2,
.apple-admin #content h3,
.apple-admin label {
  color: var(--apple-text);
}

.apple-admin .form-row,
.apple-admin .submit-row,
.apple-admin table thead th,
.apple-admin table tbody td,
.apple-admin table tbody th {
  border-color: var(--apple-separator);
}

.apple-admin table tbody tr {
  background: transparent;
}

.apple-admin table tbody tr:nth-child(odd) {
  background: var(--apple-fill);
}

.apple-admin #changelist-filter h2,
.apple-admin #changelist-filter h3 {
  background: transparent;
  color: var(--apple-text);
}

.apple-admin .object-tools a {
  border-radius: var(--apple-radius-small);
  background: var(--apple-blue);
  color: #fff;
}

.sc-badge {
  border-radius: 999px;
}

@media (max-width: 900px) {
  .shell-topbar {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .shell-topbar__primary {
    min-height: calc(var(--apple-toolbar-height) + env(safe-area-inset-top, 0px));
    padding-inline: max(0.75rem, env(safe-area-inset-left, 0px)) max(0.75rem, env(safe-area-inset-right, 0px));
    gap: 0.5rem;
    flex-wrap: nowrap;
  }

  .shell-topbar__brand-text {
    display: none;
  }

  .shell-mobile-nav-toggle,
  .shell-history-back {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
  }

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

  .shell-topbar__tools {
    margin-left: auto;
    gap: 0.35rem;
  }

  .shell-body-row {
    flex-direction: row !important;
  }

  .shell-sidebar {
    position: fixed !important;
    z-index: 45;
    top: calc(var(--apple-toolbar-height) + env(safe-area-inset-top, 0px)) !important;
    left: 0 !important;
    right: auto !important;
    bottom: 0 !important;
    width: min(19.5rem, calc(100vw - 2.5rem)) !important;
    max-height: none !important;
    min-height: 0 !important;
    height: auto !important;
    border-right: 1px solid var(--apple-separator) !important;
    border-bottom: none !important;
    transform: translateX(-105%);
    box-shadow: var(--apple-shadow);
    transition: transform var(--apple-motion);
    padding-left: env(safe-area-inset-left, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body.shell-mobile-nav-is-open {
    overflow: hidden;
    touch-action: none;
  }

  .shell-mobile-nav-is-open .shell-sidebar {
    display: flex !important;
    transform: translateX(0);
  }

  body.shell-sidebar-is-collapsed .shell-sidebar {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .shell-sidebar__mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.85rem 0.9rem 0.65rem;
    border-bottom: 1px solid var(--apple-separator);
    background: color-mix(in srgb, var(--apple-bg-elevated) 92%, transparent);
  }

  .shell-sidebar__mobile-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--apple-text);
  }

  .shell-sidebar__mobile-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--apple-fill);
    color: var(--apple-text);
    font-size: 1.65rem;
    line-height: 1;
  }

  .shell-sidebar__nav {
    display: block !important;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.65rem 0.75rem 1rem !important;
  }

  .shell-sidebar-backdrop {
    position: fixed;
    z-index: 35;
    inset: calc(var(--apple-toolbar-height) + env(safe-area-inset-top, 0px)) 0 0;
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  .shell-mobile-nav-is-open .shell-sidebar-backdrop {
    display: block;
  }

  .shell-sidebar__footer,
  .shell-sidebar-expand {
    display: none !important;
  }

  .shell-main {
    padding: max(0.85rem, env(safe-area-inset-left, 0px)) max(0.85rem, env(safe-area-inset-right, 0px))
      max(1rem, env(safe-area-inset-bottom, 0px));
  }

  .shell-nav__link {
    min-height: 48px;
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
  }

  .shell-body .sc-ctx-sidebar__back {
    display: flex;
    align-items: center;
    min-height: 48px;
    margin: 0 0 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
  }

  .shell-body .sc-ctx-sidebar__link {
    min-height: 48px;
    padding: 0.7rem 0.8rem;
    font-size: 0.94rem;
    border-radius: 12px;
  }

  .shell-body .sc-ctx-sidebar__group summary {
    min-height: 48px;
    padding: 0.7rem 0.8rem;
    font-size: 0.9rem;
  }

  .sc-console-toolbar {
    align-items: flex-start;
    gap: 0.85rem;
  }

  .sc-console-toolbar__actions {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .sc-console-toolbar__actions::-webkit-scrollbar {
    display: none;
  }

  .sc-filter-pill,
  .sc-btn {
    min-height: 44px;
  }

  .sc-filter-pill {
    padding-inline: 0.85rem;
  }

  .sc-drawer__panel {
    width: min(100vw, 28rem);
    max-width: 100%;
  }

  .sc-api-shell .sc-api-aside {
    position: static;
    padding: 0;
    margin-bottom: 0.85rem;
    border: none;
    background: transparent;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sc-api-shell .sc-api-aside::-webkit-scrollbar {
    display: none;
  }

  .sc-api-aside__block {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .sc-api-aside__block + .sc-api-aside__block {
    margin-top: 0.45rem;
    padding-top: 0;
    border-top: 0;
  }

  .sc-api-aside__heading {
    display: none;
  }

  .sc-api-aside__link {
    flex: 0 0 auto;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--apple-separator);
    border-radius: 999px;
    white-space: nowrap;
    font-size: 0.86rem;
    background: var(--apple-fill);
  }

  .sc-api-aside__link.is-active {
    border-color: rgba(10, 132, 255, 0.35);
    background: var(--ui-selection-strong);
  }
}

/* Desktop-only: hide mobile sidebar chrome */
@media (min-width: 901px) {
  .shell-sidebar__mobile-head {
    display: none;
  }
}

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

/* Dola personas + i18n cards (global CSS — survives SPA navigation) */
.shell-body .sc-dola-avatar-key {
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--apple-text-secondary);
}

.shell-body .sc-dola-item__thumb {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  max-width: 2.5rem;
  min-height: 2.5rem;
  max-height: 2.5rem;
  aspect-ratio: 1;
  border-radius: 0.55rem;
  overflow: hidden;
  position: relative;
  background: var(--apple-fill-secondary, var(--ui-fill-subtle));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--apple-separator) 70%, transparent);
}

.shell-body .sc-dola-item__thumb--sm {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  min-height: 2rem;
  max-height: 2rem;
  border-radius: 0.45rem;
}

.shell-body .sc-dola-item__thumb-img,
.shell-body .sc-dola-item__thumb img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover;
  object-position: center;
  display: block;
}

.shell-body .sc-dola-item__thumb-ph {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  color: var(--apple-text-secondary, var(--ui-muted));
}

.shell-body .sc-dola-item__avatar-preview {
  width: 5.5rem;
  height: 5.5rem;
  margin: 0 0 0.75rem;
  border-radius: 0.65rem;
  overflow: hidden;
  position: relative;
  background: var(--apple-fill-secondary, var(--ui-fill-subtle));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--apple-separator) 70%, transparent);
}

.shell-body .sc-dola-item__avatar-preview img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover;
  object-position: center;
  display: block;
}

.shell-body .sc-dola-new-pt {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--apple-separator);
  border-radius: var(--apple-radius-small);
  background: var(--apple-fill);
}

.shell-body .sc-dola-new-pt legend {
  font-weight: 600;
  padding: 0 0.35rem;
}

.shell-body .sc-dola-i18n {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 0.5px solid var(--apple-separator);
}

.shell-body .sc-dola-i18n__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.shell-body .sc-dola-i18n__lead {
  margin: 0 0 0.85rem;
  line-height: 1.45;
}

.shell-body .sc-dola-i18n__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
  align-items: stretch;
}

.shell-body .sc-dola-i18n-card {
  border: 0.5px solid var(--apple-separator);
  border-radius: var(--apple-radius-small);
  padding: 1rem 1.15rem 1.1rem;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 82%, transparent), var(--apple-surface));
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  box-shadow: var(--apple-shadow-small);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

.shell-body .sc-dola-i18n-card.is-filled {
  border-color: rgba(50, 215, 75, 0.4);
  box-shadow: 0 8px 28px rgba(30, 150, 55, 0.1);
}

.shell-body .sc-dola-i18n-card__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.75rem;
  min-width: 0;
  min-height: 3.5rem;
}

.shell-body .sc-dola-i18n-card__lang {
  font-size: 0.95rem;
}

.shell-body .sc-dola-i18n-card__native {
  font-size: 0.8rem;
  color: var(--apple-text-secondary);
  margin-left: 0.25rem;
}

.shell-body .sc-dola-i18n-card__code {
  grid-column: 1;
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  color: var(--apple-text-secondary);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: var(--apple-fill);
  width: fit-content;
}

.shell-body .sc-dola-i18n-card__badge {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(50, 215, 75, 0.15);
  color: var(--apple-green);
  flex-shrink: 0;
}

.shell-body .sc-dola-i18n-card__badge--empty {
  background: var(--apple-fill);
  color: var(--apple-text-secondary);
}

.shell-body .sc-dola-i18n-card__body {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

.shell-body .sc-dola-i18n-card__form {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.shell-body .sc-dola-i18n-card__field {
  margin: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.shell-body .sc-dola-i18n-card__field label {
  display: block;
  font-size: 0.8125rem;
  color: var(--apple-text-secondary);
  margin: 0;
}

.shell-body .sc-dola-i18n-card__field input,
.shell-body .sc-dola-i18n-card__field textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.92rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--apple-radius-small);
  border: 1px solid var(--apple-separator);
  background: var(--apple-fill);
  color: var(--apple-text);
}

.shell-body .sc-dola-i18n-card__field input:focus,
.shell-body .sc-dola-i18n-card__field textarea:focus {
  outline: none;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px var(--apple-focus);
}

.shell-body .sc-dola-i18n-card__field textarea {
  resize: vertical;
  min-height: 5.5rem;
  max-height: 14rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.shell-body .sc-dola-i18n-card__field--desc {
  flex: 1 1 auto;
}

.shell-body .sc-dola-i18n-card__field--desc textarea {
  flex: 1 1 auto;
}

.shell-body .sc-dola-i18n-card__footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
}

.shell-body .sc-dola-i18n-card__footer .sc-btn {
  width: 100%;
}

.shell-body .sc-dola-i18n-card__delete {
  width: 100%;
  margin: 0;
}

.shell-body .sc-dola-i18n-card__delete-spacer {
  display: block;
  min-height: 2rem;
}

.shell-body .sc-btn--small {
  min-height: 34px;
  padding: 0.38rem 0.7rem;
  font-size: 0.82rem;
}

.shell-body .sc-dola-item__body > form .sc-form-row input,
.shell-body .sc-dola-item__body > form .sc-form-row select,
.shell-body .sc-dola-item__body > form .sc-form-row textarea {
  max-width: 100%;
}

.shell-body .sc-dola-tr-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--apple-blue) 18%, transparent);
  color: var(--apple-blue);
  margin-left: 0.35rem;
}

@media (max-width: 640px) {
  .shell-body .sc-dola-i18n__grid {
    grid-template-columns: 1fr;
  }

  .shell-body .sc-dola-i18n-card__delete-spacer {
    display: none;
  }
}

/* Prompts console */
.shell-body .sc-prompt-list {
  width: 100%;
  max-width: none;
}

.shell-body .sc-prompt-list > p.sc-sub {
  margin-bottom: 1rem;
}

.shell-body .sc-prompt-usages {
  margin: 0;
  padding: 0;
  list-style: none;
}

.shell-body .sc-prompt-usages li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 0.5px solid var(--apple-separator);
}

.shell-body .sc-prompt-usages li:last-child {
  border-bottom: none;
}

.shell-body .sc-prompt-usages__main {
  flex: 1;
  min-width: 12rem;
}

.shell-body .sc-prompt-bindings {
  margin-top: 1.1rem;
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-small);
  background: linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 76%, transparent), var(--apple-surface));
  overflow: hidden;
}

.shell-body .sc-prompt-bindings > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  font-weight: 650;
}

/* Unified surfaces across dashboards and cards */
.shell-body .sc-service-tile,
.shell-body .sc-ios-section,
.shell-body .sc-card,
.shell-body .staff-form-card,
.shell-body .sc-dashboard-catalog .sc-service-tile,
.shell-body .sc-ios-inset,
.shell-body .sc-filter-bar {
  border-color: var(--apple-separator);
  background: linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 78%, transparent), var(--apple-surface));
  box-shadow: var(--apple-shadow-small);
}

/* Full-width form controls in staff console */
.shell-body .sc-form-row input,
.shell-body .sc-form-row select,
.shell-body .sc-form-row textarea,
.shell-body .ui-form-row input,
.shell-body .ui-form-row select,
.shell-body .ui-form-row textarea,
.shell-body .staff-form-card .sc-form-row input,
.shell-body .staff-form-card .sc-form-row select,
.shell-body .staff-form-card .sc-form-row textarea {
  max-width: none;
  width: 100%;
}

.shell-body .ui-app-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.shell-body .ui-app-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.shell-body .sc-ios-page,
.shell-body .sc-dashboard-page,
.shell-body .sc-console-page,
.shell-body .sc-api-shell {
  width: 100%;
  max-width: none;
}

.shell-body .sc-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .shell-body .ui-app-hero {
    flex-direction: column;
  }

  .shell-body .ui-app-hero__actions {
    width: 100%;
  }

  .shell-body .ui-app-hero__actions .sc-btn,
  .shell-body .ui-app-hero__actions form {
    width: 100%;
  }

  .shell-body .ui-app-hero__actions .sc-btn {
    justify-content: center;
  }

  .shell-body .sc-filter-bar__grid,
  .shell-body .staff-form-card.sc-filter-bar__grid {
    grid-template-columns: 1fr;
  }

  .shell-body .sc-console-toolbar,
  .shell-body .sc-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .shell-body .sc-dola-i18n__grid {
    grid-template-columns: 1fr;
  }

  .shell-body .sc-dialog {
    width: calc(100vw - 1.5rem);
    max-width: calc(100vw - 1.5rem);
    margin: auto;
  }

  .shell-body .sc-pagination {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* ----- Единая палитра: перекрываем legacy-токены admin_shell.css ----- */
.shell-body {
  --ui-bg: var(--apple-bg);
  --ui-surface: var(--apple-bg-elevated);
  --ui-surface-elevated: var(--apple-surface-solid);
  --ui-card: var(--apple-surface-solid);
  --ui-border: var(--apple-separator);
  --ui-separator: var(--apple-separator);
  --ui-separator-strong: color-mix(in srgb, var(--apple-separator) 140%, white);
  --ui-text: var(--apple-text);
  --ui-muted: var(--apple-text-secondary);
  --ui-accent: var(--apple-blue);
  --ui-accent-bright: var(--apple-blue-hover);
  --ui-accent-dim: var(--apple-blue);
  --ui-accent-ring: var(--apple-focus);
  --ui-success: var(--apple-green);
  --ui-danger: var(--apple-red);
  --ui-warning: var(--apple-orange);
  --ui-fill-subtle: var(--apple-fill);
  --ui-fill: var(--apple-fill);
  --ui-fill-hover: var(--apple-fill-hover);
  --ui-fill-pressed: color-mix(in srgb, var(--apple-fill) 80%, transparent);
  --ui-selection: rgba(10, 132, 255, 0.14);
  --ui-selection-strong: rgba(10, 132, 255, 0.22);
  --ui-shadow-sm: var(--apple-shadow-small);
  --ui-shadow-md: var(--apple-shadow);
  --ui-inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --ui-glass-regular: var(--apple-surface);
  --ui-glass-elevated: var(--apple-surface-raised);
  --ui-glass-thick: color-mix(in srgb, var(--apple-surface-solid) 92%, transparent);
  --ui-glass-chrome: var(--apple-fill);
  --ui-glass-border: var(--apple-separator);
  --ui-glass-shadow: var(--apple-shadow-small);
  --sc-bg: var(--apple-bg);
  --sc-surface: var(--apple-surface-solid);
  --sc-card: var(--apple-surface-solid);
  --sc-border: var(--apple-separator);
  --sc-text: var(--apple-text);
  --sc-muted: var(--apple-text-secondary);
  --sc-accent: var(--apple-blue-hover);
  --sc-accent-dim: var(--apple-blue);
  --sc-success: var(--apple-green);
}

.shell-body .shell-topbar {
  background: color-mix(in srgb, var(--apple-bg-elevated) 76%, transparent);
  border-bottom-color: var(--apple-separator);
  box-shadow: none;
}

.shell-body .shell-sidebar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apple-bg-elevated) 94%, transparent) 0%, color-mix(in srgb, var(--apple-bg) 88%, transparent) 100%);
  border-right: 1px solid var(--apple-separator);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.shell-body .shell-sidebar__nav {
  padding: 0.85rem 0.7rem 0.5rem;
  scrollbar-gutter: stable;
}

.shell-body .shell-nav-group {
  padding: 0;
  margin: 0 0 1.1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.shell-body .shell-nav-group__label {
  padding: 0.4rem 0.7rem 0.35rem;
  color: var(--apple-text-tertiary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shell-body .shell-nav__link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 40px;
  margin: 2px 0;
  padding: 0.5rem 0.7rem;
  border-radius: 11px;
  border-left: 0;
  color: var(--apple-text-secondary);
  font-size: 0.88rem;
  font-weight: 560;
  box-shadow: none;
  transition:
    color var(--apple-motion),
    background var(--apple-motion),
    transform var(--apple-motion);
}

.shell-body .shell-nav__link:hover {
  color: var(--apple-text);
  background: var(--apple-fill-hover);
}

.shell-body .shell-nav__link.is-active {
  padding-left: 0.7rem;
  border-left: 0;
  color: var(--apple-blue-hover);
  font-weight: 650;
  background: var(--ui-selection-strong);
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.18);
}

.shell-body .shell-nav__link.is-active .shell-nav__icon {
  color: var(--apple-blue-hover);
}

.shell-body .shell-sidebar__footer {
  padding: 0.7rem 0.7rem 0.9rem;
  border-top: 1px solid var(--apple-separator);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--apple-fill) 40%, transparent));
}

.shell-body .shell-sidebar-toggle--panel {
  min-height: 42px;
  border: 1px solid var(--apple-separator);
  border-radius: 11px;
  background: var(--apple-fill);
  color: var(--apple-text-secondary);
}

.shell-body .shell-sidebar-toggle--panel:hover {
  border-color: color-mix(in srgb, var(--apple-separator) 160%, white);
  background: var(--apple-fill-hover);
  color: var(--apple-text);
}

.shell-body .shell-sidebar-expand {
  background: color-mix(in srgb, var(--apple-bg-elevated) 90%, transparent);
  border-right-color: var(--apple-separator);
  color: var(--apple-text-secondary);
}

.shell-body .shell-sidebar-expand:hover {
  background: var(--ui-selection);
  color: var(--apple-text);
}

/* Контекстная панель — тот же материал, без «коробок» admin_shell */
.shell-body .sc-ctx-sidebar__top {
  margin-bottom: 0.35rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--apple-separator);
  border-radius: 12px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 70%, transparent), var(--apple-surface));
  box-shadow: var(--apple-shadow-small);
}

.shell-body .sc-ctx-sidebar__badge {
  color: var(--apple-text-tertiary);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.shell-body .sc-ctx-sidebar__title {
  color: var(--apple-text);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.shell-body .sc-ctx-sidebar__group {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.shell-body .sc-ctx-sidebar__group + .sc-ctx-sidebar__group {
  margin-top: 0.15rem;
}

.shell-body .sc-ctx-sidebar__group summary {
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  color: var(--apple-text-tertiary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shell-body .sc-ctx-sidebar__group summary:hover {
  background: var(--apple-fill);
  color: var(--apple-text-secondary);
}

.shell-body .sc-ctx-sidebar__link {
  min-height: 38px;
  margin: 2px 0;
  padding: 0.48rem 0.7rem;
  border-radius: 10px;
  border-left: 0;
  color: var(--apple-text-secondary);
  font-size: 0.86rem;
  font-weight: 560;
  box-shadow: none;
}

.shell-body .sc-ctx-sidebar__link:hover {
  color: var(--apple-text);
  background: var(--apple-fill-hover);
}

.shell-body .sc-ctx-sidebar__link.is-active {
  padding-left: 0.7rem;
  border-left: 0;
  color: var(--apple-blue-hover);
  font-weight: 650;
  background: var(--ui-selection-strong);
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.18);
}

.shell-body .sc-ctx-sidebar__back {
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  color: var(--apple-blue-hover);
  font-weight: 620;
}

/* Дашборд и карточки — один материал */
.shell-body .sc-kpi,
.shell-body .ui-kpi,
.shell-body .sc-card,
.shell-body .ui-card,
.shell-body .ui-glass-surface {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 78%, transparent), var(--apple-surface));
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-large);
  box-shadow: var(--apple-shadow-small);
  -webkit-backdrop-filter: blur(18px) saturate(1.22);
  backdrop-filter: blur(18px) saturate(1.22);
}

.shell-body .sc-service-tile {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 82%, transparent), var(--apple-surface));
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius);
  box-shadow: var(--apple-shadow-small);
}

.shell-body .sc-service-tile:hover {
  border-color: color-mix(in srgb, var(--apple-separator) 150%, white);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 90%, transparent), var(--apple-surface));
  box-shadow: var(--apple-shadow-small);
}

.shell-body .sc-dashboard-catalog-link {
  border-color: rgba(10, 132, 255, 0.28);
  background: var(--ui-selection);
  color: var(--apple-blue-hover);
}

.shell-body .sc-dashboard-catalog-link:hover {
  border-color: rgba(10, 132, 255, 0.42);
  background: var(--ui-selection-strong);
  color: var(--apple-text);
}

.shell-body .sc-btn--primary,
.shell-body .sc-btn.sc-btn--primary {
  background: var(--apple-blue);
  border-color: color-mix(in srgb, var(--apple-blue) 80%, white);
  color: #fff;
}

.shell-body .sc-btn--primary:hover,
.shell-body .sc-btn.sc-btn--primary:hover {
  background: var(--apple-blue-hover);
}

.shell-body .sc-btn--secondary {
  border-color: var(--apple-separator);
  background: var(--apple-fill);
  color: var(--apple-text);
}

.shell-body .sc-btn--secondary:hover {
  background: var(--apple-fill-hover);
}

/* ----- Каталог и БД: сетка карточек ----- */
.shell-body .staff-db-hub {
  width: 100%;
  max-width: none;
  display: grid;
  gap: 1.75rem;
}

.shell-body .staff-db-hub__hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.shell-body .staff-db-hub__hero-copy {
  flex: 1 1 18rem;
  min-width: 0;
}

.shell-body .staff-db-hub__eyebrow {
  margin: 0 0 0.35rem;
  color: var(--apple-text-tertiary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.shell-body .staff-db-hub__intro {
  margin: 0.5rem 0 0;
  max-width: 42rem;
  line-height: 1.55;
}

.shell-body .staff-db-hub__section {
  margin: 0;
}

.shell-body .staff-db-hub__section--admin {
  scroll-margin-top: calc(var(--apple-toolbar-height) + 1rem);
  padding-top: 0.25rem;
}

.shell-body .staff-db-hub__section-head {
  margin-bottom: 1rem;
}

.shell-body .staff-db-hub__h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.1rem, 0.95rem + 0.45vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--apple-text);
}

.shell-body .staff-db-hub__h3 {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--apple-text-tertiary);
}

.shell-body .staff-db-hub__section-lead {
  margin: 0;
  max-width: 44rem;
  color: var(--apple-text-secondary);
  line-height: 1.5;
}

.shell-body .staff-db-hub__category + .staff-db-hub__category {
  margin-top: 1.35rem;
}

.shell-body .staff-db-hub__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
  gap: 0.85rem;
}

.shell-body .staff-db-hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 8.5rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-large);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 82%, transparent), var(--apple-surface));
  box-shadow: var(--apple-shadow-small);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  backdrop-filter: blur(20px) saturate(1.25);
  transition:
    border-color var(--apple-motion),
    transform var(--apple-motion),
    box-shadow var(--apple-motion);
}

.shell-body .staff-db-hub-card--link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.shell-body .staff-db-hub-card--link:hover {
  border-color: color-mix(in srgb, var(--apple-blue) 35%, var(--apple-separator));
  transform: translateY(-2px);
  box-shadow: var(--apple-shadow);
}

.shell-body .staff-db-hub-card--link:focus-visible {
  outline: 2px solid var(--apple-focus);
  outline-offset: 2px;
}

.shell-body .staff-db-hub-card__table {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--apple-blue) 14%, transparent);
  color: var(--apple-blue-hover);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  line-height: 1.35;
}

.shell-body .staff-db-hub-card__title {
  color: var(--apple-text);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.shell-body .staff-db-hub-card--link:hover .staff-db-hub-card__title {
  color: var(--apple-blue-hover);
}

.shell-body .staff-db-hub-card__desc {
  margin: 0;
  color: var(--apple-text-secondary);
  font-size: 0.84rem;
  line-height: 1.45;
}

.shell-body .admin-home-app-list {
  margin-top: 0.25rem;
}

.shell-body .admin-app-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 0.9rem;
}

.shell-body .admin-app-card.module {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-large);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 82%, transparent), var(--apple-surface));
  box-shadow: var(--apple-shadow-small);
  -webkit-backdrop-filter: blur(18px) saturate(1.22);
  backdrop-filter: blur(18px) saturate(1.22);
}

.shell-body .admin-app-card.module h2.admin-app-card__title {
  margin: 0;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--apple-separator);
  background: color-mix(in srgb, var(--apple-fill) 55%, transparent);
  font-size: 0.95rem;
  font-weight: 650;
}

.shell-body .admin-app-card__title-link {
  color: var(--apple-text);
  text-decoration: none;
}

.shell-body .admin-app-card__title-link:hover {
  color: var(--apple-blue-hover);
}

.shell-body .admin-app-card__models {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.shell-body .admin-app-card__model {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--apple-separator) 65%, transparent);
}

.shell-body .admin-app-card__model:last-child {
  border-bottom: 0;
}

.shell-body .admin-app-card__model-name a {
  color: var(--apple-text);
  font-size: 0.88rem;
  font-weight: 560;
  text-decoration: none;
}

.shell-body .admin-app-card__model-name a:hover {
  color: var(--apple-blue-hover);
}

.shell-body .admin-app-card__model-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.shell-body .admin-app-card__model-actions a {
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--apple-separator);
  border-radius: 999px;
  background: var(--apple-fill);
  color: var(--apple-text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
}

.shell-body .admin-app-card__model-actions a:hover {
  background: var(--apple-fill-hover);
  color: var(--apple-text);
}

@media (max-width: 768px) {
  .shell-body .staff-db-hub__hero {
    flex-direction: column;
  }

  .shell-body .staff-db-hub__hero .ui-app-hero__actions {
    width: 100%;
  }

  .shell-body .staff-db-hub__hero .ui-app-hero__actions .sc-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* ----- Каталог: навигация в шапке, без боковой панели ----- */
body.shell-topnav-services:not(.shell-topnav-services--ctx-sidebar) #shell-sidebar,
body.shell-topnav-services:not(.shell-topnav-services--ctx-sidebar) .shell-sidebar-expand,
body.shell-topnav-services:not(.shell-topnav-services--ctx-sidebar) .shell-sidebar-backdrop,
body.shell-topnav-services:not(.shell-topnav-services--ctx-sidebar) .shell-mobile-nav-toggle {
  display: none !important;
}

body.shell-topnav-services:not(.shell-topnav-services--ctx-sidebar) .shell-workspace,
body.shell-topnav-services:not(.shell-topnav-services--ctx-sidebar) .shell-main {
  width: 100%;
  max-width: none;
}

body.shell-topnav-services .shell-topbar__sub {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0.45rem clamp(0.75rem, 2vw, 1.25rem) 0.55rem;
  border-top: 1px solid var(--apple-separator);
  background: color-mix(in srgb, var(--apple-bg-elevated) 72%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  backdrop-filter: blur(20px) saturate(1.25);
}

.shell-catalog-topnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.shell-catalog-topnav__link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.35rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--apple-text-secondary);
  font-size: 0.84rem;
  font-weight: 560;
  text-decoration: none;
  transition:
    color var(--apple-motion),
    background var(--apple-motion),
    border-color var(--apple-motion);
}

.shell-catalog-topnav__link:hover {
  color: var(--apple-text);
  background: var(--apple-fill-hover);
}

.shell-catalog-topnav__link.is-active {
  color: var(--apple-blue-hover);
  background: var(--ui-selection-strong);
  border-color: rgba(10, 132, 255, 0.22);
  font-weight: 650;
}

/* Единый фон и топбар — перекрываем legacy-градиент admin_shell.css */
.shell-body {
  background-color: var(--apple-bg) !important;
  background-image:
    radial-gradient(ellipse 90% 58% at 84% -18%, rgba(10, 132, 255, 0.14), transparent 58%),
    radial-gradient(ellipse 72% 48% at 5% 108%, rgba(94, 92, 230, 0.09), transparent 54%),
    radial-gradient(ellipse 110% 80% at 50% 40%, rgba(255, 255, 255, 0.022), transparent 72%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.008) 0 1px, transparent 1px 7px) !important;
  background-attachment: fixed;
}

.shell-body .shell-topbar {
  background: color-mix(in srgb, var(--apple-bg-elevated) 76%, transparent) !important;
  border-bottom-color: var(--apple-separator) !important;
  box-shadow: none !important;
}

.shell-body.shell-topnav-services .sc-console-toolbar,
.shell-body.shell-topnav-services .sc-card,
.shell-body.shell-topnav-services .sc-kpi,
.shell-body.shell-topnav-services .ui-kpi,
.shell-body.shell-topnav-services .sc-service-tile,
.shell-body.shell-topnav-services .ui-glass-surface {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--apple-surface-raised) 78%, transparent), var(--apple-surface)) !important;
  border: 1px solid var(--apple-separator) !important;
  border-radius: var(--apple-radius-large) !important;
  box-shadow: var(--apple-shadow-small) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.22) !important;
  backdrop-filter: blur(18px) saturate(1.22) !important;
}

@media (max-width: 900px) {
  body.shell-topnav-services .shell-topbar__sub {
    position: sticky;
    top: calc(var(--apple-toolbar-height) + env(safe-area-inset-top, 0px));
    z-index: 30;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    padding-inline: max(0.75rem, env(safe-area-inset-left, 0px)) max(0.75rem, env(safe-area-inset-right, 0px));
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, transparent 0, #000 0.75rem, #000 calc(100% - 0.75rem), transparent 100%);
  }

  body.shell-topnav-services .shell-topbar__sub::-webkit-scrollbar {
    display: none;
  }

  .shell-catalog-topnav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0.4rem;
    min-width: max-content;
    padding-bottom: 0.15rem;
  }

  .shell-catalog-topnav__link {
    min-height: 40px;
    padding: 0.5rem 0.95rem;
    font-size: 0.88rem;
    flex-shrink: 0;
  }
}

.sc-service-link-picker__primary {
  margin-top: 0.15rem;
}

.sc-dialog-form {
  display: grid;
  gap: 1rem;
}

.sc-dialog-form__section {
  display: grid;
  gap: 0.15rem;
}

.sc-dialog-form__section-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--apple-text);
}

.sc-dialog-form__checks {
  display: grid;
  gap: 0.15rem;
  margin-top: 0.15rem;
}

.sc-dialog-form__checks .sc-form-row {
  margin-bottom: 0;
}

.sc-dialog-form__ack label {
  align-items: flex-start;
}

.sc-dialog-form__actions {
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
  padding-top: 0.15rem;
}

.sc-dialog__lead {
  margin: 0 0 1rem;
  color: var(--apple-text-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.sc-input-action-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.sc-input-action-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.sc-form-row--flush {
  margin-bottom: 0;
}

dialog.sc-dialog .sc-dialog-form .sc-form-row input,
dialog.sc-dialog .sc-dialog-form .sc-form-row select,
dialog.sc-dialog .sc-dialog-form .sc-form-row textarea,
dialog.sc-dialog .sc-ms-dropdown__toggle {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.sc-ms-dropdown {
  display: grid;
  gap: 0.45rem;
}

.sc-form-row .sc-ms-dropdown__field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  color: var(--apple-text-secondary);
}

.sc-ms-dropdown__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-small);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apple-surface-raised) 55%, transparent), var(--apple-fill));
  color: var(--apple-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color var(--apple-motion),
    background var(--apple-motion),
    box-shadow var(--apple-motion);
}

.sc-ms-dropdown__toggle:hover,
.sc-ms-dropdown.is-open .sc-ms-dropdown__toggle {
  border-color: rgba(10, 132, 255, 0.34);
  background: color-mix(in srgb, var(--ui-selection) 72%, var(--apple-fill));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(10, 132, 255, 0.08);
}

.sc-ms-dropdown__summary {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.94rem;
  font-weight: 520;
  letter-spacing: -0.01em;
}

.sc-ms-dropdown__chevron {
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid var(--apple-text-tertiary);
  border-bottom: 1.5px solid var(--apple-text-tertiary);
  transform: rotate(45deg);
  margin-top: -0.22rem;
  transition: transform var(--apple-motion), margin-top var(--apple-motion);
}

.sc-ms-dropdown.is-open .sc-ms-dropdown__chevron {
  transform: rotate(-135deg);
  margin-top: 0.12rem;
}

.sc-ms-dropdown__panel {
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-small);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apple-surface-raised) 68%, transparent), var(--apple-surface-solid));
  box-shadow: var(--apple-shadow-small);
  overflow: hidden;
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

.sc-ms-dropdown__list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(20rem, 42vh);
  overflow: auto;
  padding: 0.35rem 0;
}

.sc-form-row .sc-ms-dropdown__option {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  min-height: 2.75rem;
  margin: 0 0.45rem;
  padding: 0 0.75rem;
  border-radius: 10px;
  color: var(--apple-text);
  font-size: 0.94rem;
  font-weight: 520;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background var(--apple-motion);
}

.sc-ms-dropdown__option:hover {
  background: var(--apple-fill-hover);
}

.sc-ms-dropdown__option:has(input:checked) {
  background: var(--ui-selection);
}

.sc-ms-dropdown__option-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sc-ms-dropdown__check,
.sc-ms-dropdown__option input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.25rem !important;
  height: 1.25rem !important;
  max-width: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1.5px solid color-mix(in srgb, var(--apple-text-tertiary) 88%, transparent);
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  transition:
    border-color var(--apple-motion),
    background var(--apple-motion),
    box-shadow var(--apple-motion);
}

.sc-ms-dropdown__check:checked,
.sc-ms-dropdown__option input[type="checkbox"]:checked {
  border-color: var(--apple-blue);
  background-color: var(--apple-blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2 6.4 11 12.5 5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.72rem;
  box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.18);
}

.sc-ms-dropdown__check:focus-visible,
.sc-ms-dropdown__option input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--apple-focus);
  outline-offset: 2px;
}

.sc-ms-dropdown__empty {
  margin: 0.65rem 0.9rem;
}

.sc-service-link-picker__hint {
  margin: 0.35rem 0 0;
}

.sc-dialog__section--collapsible {
  margin-top: 0.15rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--apple-separator);
  border-radius: var(--apple-radius-medium);
  background: color-mix(in srgb, var(--apple-surface) 72%, transparent);
  overflow: visible;
}

.sc-dialog__section-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
}

.sc-dialog__section-summary::-webkit-details-marker {
  display: none;
}

.sc-dialog__section-summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.7;
  transition: transform var(--apple-motion);
}

.sc-dialog__section--collapsible[open] > .sc-dialog__section-summary::before {
  transform: rotate(45deg);
}

.sc-dialog__section-title {
  font-weight: 650;
  color: var(--apple-text);
}

.sc-dialog__section-note {
  color: var(--apple-text-tertiary);
  font-size: 0.82rem;
}

.sc-dialog__section-body {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--apple-separator);
  overflow: visible;
}

.sc-service-link-picker,
.sc-service-link-picker .sc-ms-dropdown {
  overflow: visible;
}

/* ----- Mobile polish (≤900px): tables, forms, dialogs — desktop unchanged ----- */
@media (max-width: 900px) {
  .shell-body .sc-table-wrap {
    margin-inline: -0.15rem;
    padding-inline: 0.15rem;
  }

  .shell-body .sc-table th,
  .shell-body .sc-table td {
    padding: 0.65rem 0.55rem;
    font-size: 0.84rem;
  }

  .shell-body .sc-table--usage-events {
    min-width: 52rem;
  }

  .shell-body .sc-usage-events-form {
    grid-template-columns: 1fr !important;
  }

  .shell-body .sc-filter-bar__actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 0.5rem -0.25rem 0;
    padding: 0.65rem 0.25rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--apple-bg) 88%, transparent) 28%);
    backdrop-filter: blur(8px);
  }

  .shell-body .sc-filter-bar__actions .sc-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  dialog.sc-dialog,
  dialog.sc-drd {
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    margin: auto;
  }

  .shell-user-menu__panel {
    position: fixed;
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    left: max(0.75rem, env(safe-area-inset-left, 0px));
    width: auto;
    max-width: none;
  }

  .shell-user-menu__summary {
    min-height: 44px;
    max-width: 9.5rem;
    padding-inline: 0.75rem;
  }

  .shell-user-menu__action {
    min-height: 48px;
  }

  .shell-search input[type="search"],
  .shell-search input[type="text"] {
    min-height: 44px;
    font-size: 16px;
  }

  .shell-body .sc-form-row input,
  .shell-body .sc-form-row select,
  .shell-body .sc-form-row textarea {
    min-height: 44px;
    font-size: 16px;
  }
}

/* Bulk actions + Dola persona thumbnails */
.sc-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--apple-radius-md, 12px);
  border: 1px solid var(--apple-separator);
  background: color-mix(in srgb, var(--apple-surface-raised) 88%, transparent);
}

.sc-bulk-bar__form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin: 0;
  width: 100%;
}

.sc-bulk-bar__all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  cursor: pointer;
}

.sc-bulk-bar__count {
  font-size: 0.88rem;
  color: var(--apple-text-secondary);
}

.sc-bulk-bar__action,
.sc-bulk-bar__target {
  min-width: 10rem;
}

.sc-wh-bulk-bar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  margin: 0;
}

.sc-bulk-job-host {
  position: fixed;
  z-index: 12000;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  pointer-events: none;
  max-width: min(92vw, 28rem);
}

.sc-bulk-job {
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--apple-shadow-medium);
  border: 1px solid var(--apple-separator);
  background: var(--apple-surface-raised);
  color: var(--apple-text);
}

.sc-bulk-job--ok {
  border-color: color-mix(in srgb, var(--apple-green) 55%, transparent);
  background: color-mix(in srgb, var(--apple-green) 12%, var(--apple-surface-raised));
}

.sc-bulk-job--error,
.sc-bulk-job--warn {
  border-color: color-mix(in srgb, var(--apple-red) 45%, transparent);
  background: color-mix(in srgb, var(--apple-red) 10%, var(--apple-surface-raised));
}

.sc-dola-item--inactive > summary {
  opacity: 0.78;
}

.sc-dola-item > summary.sc-dola-item__summary,
.sc-dola-item > summary {
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.sc-dola-item__pick {
  display: inline-flex;
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.sc-dola-item__thumb {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  max-width: 2.5rem;
  min-height: 2.5rem;
  max-height: 2.5rem;
  aspect-ratio: 1;
  border-radius: 0.55rem;
  overflow: hidden;
  position: relative;
  background: var(--apple-fill-secondary, var(--ui-fill-subtle));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--apple-separator) 70%, transparent);
}

.sc-dola-item__thumb--sm {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  min-height: 2rem;
  max-height: 2rem;
  border-radius: 0.45rem;
}

.sc-dola-item__thumb-img,
.sc-dola-item__thumb img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover;
  object-position: center;
  display: block;
}

.sc-dola-item__thumb-ph {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--apple-text-secondary, var(--ui-muted));
}

.sc-dola-item__head {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.sc-dola-item__head .sc-dola-item__title {
  flex: none;
  min-width: 0;
}

.sc-dola-item__quick-actions {
  margin-left: auto;
  flex: 0 0 auto;
}

.sc-dola-item__toggle-form {
  display: inline-flex;
  margin: 0;
}

.sc-dola-item__toggle-btn {
  min-width: 3.25rem;
}

.sc-bulk-bar__target-wrap[hidden] {
  display: none !important;
}

.sc-bulk-bar__submit {
  margin-left: auto;
}

.sc-dialog__foot,
.sc-bulk-dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--apple-separator, var(--ui-separator));
}

.sc-dola-bind-list {
  margin-top: 0.5rem;
}

.sc-dola-bind-list__items {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  max-height: 22rem;
  overflow: auto;
  border: 1px solid var(--apple-separator, var(--ui-separator));
  border-radius: var(--apple-radius-md, 10px);
}

.sc-dola-bind-list__item label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}

.sc-dola-bind-list__item + .sc-dola-bind-list__item {
  border-top: 1px solid var(--apple-separator, var(--ui-separator));
}

.sc-dola-bind-list__item:hover {
  background: color-mix(in srgb, var(--apple-fill-secondary, #000) 4%, transparent);
}

@media (max-width: 720px) {
  .sc-bulk-bar__submit {
    margin-left: 0;
    width: 100%;
  }

  .sc-dola-item__quick-actions {
    width: 100%;
    margin-left: 0;
    padding-left: 3.35rem;
  }
}
