/**
 * XELO Cabinet / Admin — visual language matched to SberBusiness (Triplex) shell.
 * Branding: XELO (not Sber). Tokens extracted from saved SberBusiness UI host theme.
 */
:root {
  --xc-bg: #f2f4f7;
  --xc-bg-elevated: #eaedf1;
  --xc-surface: #ffffff;
  --xc-surface-secondary: #f2f4f7;
  --xc-text: rgba(31, 31, 34, 1);
  --xc-text-secondary: rgba(31, 31, 34, 0.55);
  --xc-text-muted: rgba(31, 31, 34, 0.35);
  --xc-border: #e3e6ea;
  --xc-border-soft: rgba(31, 31, 34, 0.08);

  --xc-brand: #21a19a;
  --xc-brand-hover: #19bdb0;
  --xc-brand-active: #007777;
  --xc-brand-deep: #008985;
  --xc-brand-soft: #e3fffa;
  --xc-brand-soft-2: #a8f5e9;

  --xc-success: #00c075;
  --xc-warning: #fd6508;
  --xc-danger: #e60037;
  --xc-info: #1371e4;
  --xc-focus: #ffd169;

  --xc-sidebar-w: 250px;
  --xc-topbar-h: 60px;
  --xc-radius-card: 24px;
  --xc-radius-btn: 6px;
  --xc-radius-input: 8px;
  --xc-radius-sm: 6px;
  --xc-shadow-card: 0 2px 12px 0 rgba(31, 31, 34, 0.12);
  --xc-shadow-card-hover: 0 4px 12px 0 rgba(31, 31, 34, 0.16);
  --xc-font: "SBSansText", "Segoe UI", Arial, Helvetica, sans-serif;
  --xc-font-display: "SBSansDisplay", "Segoe UI", Arial, Helvetica, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.xc-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--xc-font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--xc-text);
  background: var(--xc-bg);
  -webkit-font-smoothing: antialiased;
}

.xc-body--sidebar-open {
  overflow: hidden;
}

/* ── App shell ── */
.xc-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.xc-topbar {
  position: sticky;
  top: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--xc-topbar-h);
  min-height: var(--xc-topbar-h);
  padding: 0 16px 0 20px;
  background: var(--xc-bg-elevated);
  border-bottom: 1px solid transparent;
}

.xc-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--xc-text);
  flex-shrink: 0;
  min-width: calc(var(--xc-sidebar-w) - 20px);
}

.xc-topbar__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #0a0a0a;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  overflow: hidden;
}

.xc-topbar__mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.xc-topbar__title {
  font-family: var(--xc-font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.xc-topbar__title-muted {
  font-weight: 400;
  color: var(--xc-text-secondary);
  margin-left: 4px;
}

.xc-topbar__toggle {
  display: none;
  border: none;
  background: transparent;
  color: var(--xc-text);
  width: 40px;
  height: 40px;
  border-radius: var(--xc-radius-btn);
  cursor: pointer;
  flex-shrink: 0;
}

.xc-topbar__toggle:hover {
  background: rgba(31, 31, 34, 0.06);
}

.xc-topbar__spacer {
  flex: 1;
  min-width: 8px;
}

.xc-topbar__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  margin-right: 8px;
}

.xc-topbar__meta-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--xc-text);
}

.xc-topbar__meta-label {
  font-size: 12px;
  color: var(--xc-text-secondary);
}

.xc-topbar__user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  max-width: 240px;
}

.xc-topbar__user-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
}

.xc-topbar__user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.xc-topbar__user-sub {
  font-size: 12px;
  color: var(--xc-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.xc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e3e6ea;
  color: var(--xc-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.xc-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.xc-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--xc-topbar-h);
  background: rgba(31, 31, 34, 0.35);
  z-index: 1040;
}

.xc-sidebar-backdrop.is-visible {
  display: block;
}

.xc-sidebar {
  width: var(--xc-sidebar-w);
  flex-shrink: 0;
  background: var(--xc-surface);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--xc-topbar-h);
  height: calc(100vh - var(--xc-topbar-h));
  height: calc(100dvh - var(--xc-topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1050;
  border-right: 1px solid var(--xc-border);
}

.xc-nav {
  flex: 1;
  padding: 8px 8px 16px;
  display: flex;
  flex-direction: column;
}

.xc-nav__section {
  margin-bottom: 4px;
}

.xc-nav__section--bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--xc-border);
}

.xc-nav__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--xc-text-muted);
  padding: 12px 12px 6px;
}

.xc-nav__link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px;
  margin: 0;
  border-radius: 8px;
  color: var(--xc-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.xc-nav__link i {
  width: 20px;
  text-align: center;
  font-size: 16px;
  color: rgba(31, 31, 34, 0.65);
  flex-shrink: 0;
}

.xc-nav__link:hover {
  background: #f2f4f7;
  color: var(--xc-text);
  text-decoration: none;
}

.xc-nav__link.is-active {
  background: var(--xc-brand-soft);
  color: var(--xc-brand-deep);
  font-weight: 600;
}

.xc-nav__link.is-active i {
  color: var(--xc-brand-deep);
}

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

.xc-nav__badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--xc-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.xc-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.xc-content {
  flex: 1;
  width: 100%;
  padding: 16px 20px 32px;
}

/* ── Cards / panels ── */
.xc-card {
  background: var(--xc-surface);
  border-radius: var(--xc-radius-card);
  box-shadow: none;
  padding: 24px;
  border: none;
}

.xc-card--flush {
  padding: 0;
  overflow: hidden;
}

.xc-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.xc-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--xc-text);
}

.xc-card__subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--xc-text-secondary);
}

.xc-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(12, 1fr);
}

.xc-col-12 { grid-column: span 12; }
.xc-col-8 { grid-column: span 8; }
.xc-col-6 { grid-column: span 6; }
.xc-col-4 { grid-column: span 4; }
.xc-col-3 { grid-column: span 3; }

@media (max-width: 1199px) {
  .xc-col-8, .xc-col-6, .xc-col-4, .xc-col-3 { grid-column: span 12; }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .xc-col-6 { grid-column: span 6; }
  .xc-col-3 { grid-column: span 6; }
}

/* Stat tiles inside cards */
.xc-stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.xc-stat {
  background: var(--xc-surface-secondary);
  border-radius: 16px;
  padding: 16px 18px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.xc-stat__label {
  font-size: 12px;
  color: var(--xc-text-secondary);
  margin-bottom: 6px;
}

.xc-stat__value {
  font-size: 18px;
  font-weight: 600;
  color: var(--xc-text);
  word-break: break-word;
}

.xc-stat__value--ok { color: var(--xc-success); }
.xc-stat__value--muted { color: var(--xc-text-secondary); font-weight: 500; }
.xc-stat__value--mono {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-size: 13px;
  font-weight: 500;
}

/* ── Buttons ── */
.xc-btn,
.xc-body .btn,
.admin-body .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--xc-radius-btn);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.xc-btn:focus-visible,
.xc-body .btn:focus-visible,
.admin-body .btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--xc-focus) inset;
}

.xc-btn--primary,
.xc-body .btn-primary,
.admin-body .btn-primary,
.admin-body .btn-success {
  background: var(--xc-brand) !important;
  border-color: var(--xc-brand) !important;
  color: #fff !important;
  background-image: none !important;
}

.xc-btn--primary:hover,
.xc-body .btn-primary:hover,
.admin-body .btn-primary:hover,
.admin-body .btn-success:hover {
  background: var(--xc-brand-hover) !important;
  border-color: var(--xc-brand-hover) !important;
  color: #fff !important;
}

.xc-btn--primary:active,
.xc-body .btn-primary:active,
.admin-body .btn-primary:active {
  background: var(--xc-brand-active) !important;
  border-color: var(--xc-brand-active) !important;
}

.xc-btn--secondary,
.xc-body .btn-outline-primary,
.xc-body .btn-outline-secondary,
.admin-body .btn-outline-primary,
.admin-body .btn-outline-secondary,
.admin-body .btn-secondary {
  background: var(--xc-surface-secondary) !important;
  border-color: var(--xc-surface-secondary) !important;
  color: var(--xc-brand-deep) !important;
  background-image: none !important;
}

.xc-btn--secondary:hover,
.xc-body .btn-outline-primary:hover,
.xc-body .btn-outline-secondary:hover,
.admin-body .btn-outline-primary:hover,
.admin-body .btn-outline-secondary:hover {
  background: #eaedf1 !important;
  color: var(--xc-brand) !important;
}

.xc-btn--light {
  background: #fff !important;
  border-color: var(--xc-border) !important;
  color: var(--xc-brand-deep) !important;
}

.xc-btn--danger,
.admin-body .btn-danger {
  background: var(--xc-danger) !important;
  border-color: var(--xc-danger) !important;
  color: #fff !important;
}

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

/* ── Forms ── */
.xc-body .form-control,
.xc-body .form-select,
.admin-body .form-control,
.admin-body .form-select {
  border-radius: var(--xc-radius-input);
  border-color: var(--xc-border);
  min-height: 40px;
  font-size: 14px;
  color: var(--xc-text);
  background: #fff;
}

.xc-body .form-control:focus,
.xc-body .form-select:focus,
.admin-body .form-control:focus,
.admin-body .form-select:focus {
  border-color: var(--xc-brand);
  box-shadow: 0 0 0 1px var(--xc-focus);
}

.xc-body .form-label,
.admin-body .form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--xc-text);
  margin-bottom: 6px;
}

/* ── Auth ── */
.xc-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--xc-bg);
}

.xc-auth__card {
  width: 100%;
  max-width: 400px;
  background: var(--xc-surface);
  border-radius: var(--xc-radius-card);
  padding: 32px 28px;
  box-shadow: var(--xc-shadow-card);
}

.xc-auth__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  justify-content: center;
}

.xc-auth__title {
  margin: 0 0 6px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
}

.xc-auth__sub {
  margin: 0 0 24px;
  text-align: center;
  font-size: 13px;
  color: var(--xc-text-secondary);
}

.xc-note {
  background: #e3f6ff;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--xc-text-secondary);
}

.xc-note--warn {
  background: #fff4db;
}

.xc-note--ok {
  background: var(--xc-brand-soft);
}

.xc-content .form-control:disabled {
  background: #f2f4f7;
  color: rgba(31, 31, 34, 0.55);
  opacity: 1;
}

.xc-content .xc-note + .xc-note {
  margin-top: 8px;
}

.xc-content form .mb-3:last-of-type,
.xc-content form .mb-4 {
  margin-bottom: 1rem;
}

.xc-license-key-row {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  max-width: 100%;
  width: auto;
  padding: 14px 16px;
  background: var(--xc-surface-secondary);
  border-radius: 16px;
}

.xc-license-key-row__main {
  min-width: 0;
  flex: 0 1 auto;
}

.xc-license-key-value {
  margin-top: 6px;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--xc-text);
  white-space: nowrap;
}

@media (max-width: 575px) {
  .xc-license-key-row {
    flex-wrap: wrap;
  }

  .xc-license-key-value {
    white-space: normal;
    word-break: break-all;
  }
}

.xc-product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.xc-product-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  background: var(--xc-surface-secondary);
  border-radius: 16px;
}

.xc-product-item__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.xc-product-item__meta {
  font-size: 13px;
  color: var(--xc-text-secondary);
  margin-bottom: 10px;
}

.xc-product-item__hw .xc-license-key-value {
  font-size: 13px;
}

.xc-product-item__actions {
  flex-shrink: 0;
}

#xc-copy-license-key.is-copied {
  background: var(--xc-brand-soft) !important;
  color: var(--xc-brand-deep) !important;
  border-color: var(--xc-brand-soft) !important;
}

.xc-fm__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--xc-text-secondary);
}

.xc-fm__path {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--xc-text);
}

.xc-fm__table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  background: var(--xc-surface-secondary);
}

.xc-fm__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.xc-fm__table th,
.xc-fm__table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--xc-border);
  vertical-align: middle;
}

.xc-fm__table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--xc-text-secondary);
  font-weight: 600;
}

.xc-fm__table tr:last-child td {
  border-bottom: none;
}

.xc-fm__file {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
}

.xc-fm__file > .fa {
  margin-top: 2px;
  color: #008985;
  font-size: 18px;
}

.xc-fm__file-sub {
  display: block;
  font-size: 12px;
  color: var(--xc-text-secondary);
  font-weight: 400;
  margin-top: 2px;
}

.xc-fm__actions {
  white-space: nowrap;
  text-align: right;
}

.xc-fm__preview {
  margin-top: 16px;
}

.xc-fm__preview-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.xc-fm__preview-body {
  margin: 0;
  padding: 14px 16px;
  max-height: 240px;
  overflow: auto;
  background: #1f1f22;
  color: #e8eaef;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.45;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

/* ── Responsive ── */
@media (max-width: 991px) {
  .xc-topbar__brand {
    min-width: 0;
  }

  .xc-topbar__title-muted {
    display: none;
  }

  .xc-topbar__meta {
    display: none;
  }

  .xc-topbar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .xc-sidebar {
    position: fixed;
    left: 0;
    top: var(--xc-topbar-h);
    bottom: 0;
    height: auto;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(31, 31, 34, 0.12);
  }

  .xc-sidebar.is-open {
    transform: translateX(0);
  }

  .xc-content {
    padding: 12px 12px 28px;
  }

  .xc-card {
    border-radius: 16px;
    padding: 18px;
  }
}

.xc-tariff-group {
  margin-top: 8px;
}

.xc-tariff-group + .xc-tariff-group {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid rgba(31, 31, 34, 0.08);
}

.xc-tariff-group__title {
  font-family: var(--xc-font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--xc-text);
}

.xc-tariff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.xc-tariff-card {
  border: 1px solid rgba(31, 31, 34, 0.1);
  border-radius: 16px;
  padding: 18px 18px 16px;
  background: #fff;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.xc-tariff-card--featured {
  border-color: #21a19a;
  box-shadow: 0 0 0 1px rgba(33, 161, 154, 0.25);
}

.xc-tariff-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.xc-tariff-card__name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.xc-tariff-card__badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(33, 161, 154, 0.12);
  color: #0f766e;
}

.xc-tariff-card__price {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--xc-text);
  line-height: 1.2;
}

.xc-tariff-card__period {
  font-size: 13px;
  font-weight: 500;
  color: var(--xc-text-secondary);
  margin-left: 2px;
}

.xc-tariff-card__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--xc-text-secondary);
}

.xc-tariff-card__features {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.xc-tariff-card__features li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--xc-text);
}

.xc-tariff-card__features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #21a19a;
}

@media (max-width: 575px) {
  .xc-topbar__user-text {
    display: none;
  }

  .xc-topbar {
    padding: 0 10px 0 12px;
  }
}
