/* Page styles for the infra area (admin redesign, DEC-181). Scoped to body.admin-shell.
   Boards: OvhHub (/admin/ovh, /admin/ovh/purchases), CatalogHub (/admin/provider-plans
   and the other catalog tabs), CloudflareZones (/admin/cloudflare). */

/* ── Page frame: header, tabs and sections 18px apart, as on the boards ── */

.admin-shell .infra-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.admin-shell .infra-page > .dashboard-hero,
.admin-shell .infra-page > .ui-tabs,
.admin-shell .infra-page > .alert,
.admin-shell .infra-page > .ui-card {
  margin: 0;
}

.admin-shell .infra-hero {
  align-items: center;
}

.admin-shell .infra-hero .dashboard-hero__text {
  margin-top: 4px;
  font-size: 14px;
}

.admin-shell .infra-hero__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-shell .infra-hero__actions form {
  margin: 0;
}

.admin-shell .infra-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 6px;
  font-size: 13px;
}

/* ── Table card: white card, toolbar row, edge-to-edge table, footer ───── */

.admin-shell .infra-table-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--tdo-color-border);
  border-radius: 16px;
  overflow: hidden;
}

.admin-shell .infra-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border-bottom: 1px solid var(--tdo-color-border);
}

.admin-shell .infra-toolbar__title {
  flex: 1 1 auto;
  font-weight: 600;
}

.admin-shell .infra-toolbar__lead {
  display: flex;
  flex: 1 1 320px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-shell .infra-toolbar__lead .muted {
  font-size: 13px;
}

.admin-shell .infra-toolbar__meta {
  font-size: 12px;
}

.admin-shell .infra-toolbar__spacer {
  flex: 1 1 0;
}

.admin-shell .infra-toolbar .ui-menu {
  margin-left: 0;
}

.admin-shell .infra-filter {
  flex: 1 1 260px;
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--tdo-color-border-strong);
  border-radius: 10px;
  font: 400 13px var(--tdo-font-body);
}

.admin-shell .infra-scroll {
  overflow-x: auto;
}

.admin-shell .infra-table-card .admin-users-table td {
  padding: 12px;
}

.admin-shell .infra-table-card .admin-users-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-shell .infra-card-foot {
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid #eef2f5;
  font-size: 12px;
}

.admin-shell .infra-card-alert {
  margin: 14px 14px 0;
}

.admin-shell .infra-pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid #eef2f5;
  font-size: 13px;
}

.admin-shell .infra-pager-wrap .admin-users-pagination {
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid #eef2f5;
}

/* ── Filter chips (same look as the servers list board) ─────────────────── */

.admin-shell .infra-chips {
  display: contents;
}

.admin-shell .infra-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--tdo-color-border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--tdo-color-text);
  font: 500 13px var(--tdo-font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.admin-shell .infra-chip:hover {
  background: var(--tdo-color-hover);
  color: var(--tdo-color-text);
}

.admin-shell .infra-chip--on,
.admin-shell .infra-chip[aria-pressed="true"],
.admin-shell .infra-chip--on:hover,
.admin-shell .infra-chip[aria-pressed="true"]:hover {
  background: #2d3139;
  border-color: #2d3139;
  color: #fff;
}

.admin-shell .infra-chip--select {
  position: relative;
  padding: 0;
}

.admin-shell .infra-chip--select select {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  appearance: none;
}

.admin-shell .infra-chip--on select option {
  color: var(--tdo-color-text);
}

/* ── Small text helpers ─────────────────────────────────────────────────── */

.admin-shell .infra-mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
}

.admin-shell .infra-small {
  font-size: 12px;
}

.admin-shell .infra-num {
  text-align: right;
  white-space: nowrap;
}

.admin-shell .infra-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tdo-color-muted);
}

.admin-shell .infra-arrow {
  padding: 0 4px;
}

.admin-shell .infra-warn-text {
  margin-top: 2px;
  color: var(--tdo-tone-warning-fg);
  font-size: 12px;
}

.admin-shell .infra-error-text {
  margin-top: 4px;
  color: var(--tdo-tone-danger-fg);
  font-size: 12px;
}

.admin-shell .infra-alts {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: 12.5px;
}

.admin-shell .infra-alts li.is-chosen {
  font-weight: 700;
}

.admin-shell .infra-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-shell td.infra-row-actions {
  display: table-cell;
  white-space: nowrap;
  text-align: right;
}

.admin-shell td.infra-row-actions > form,
.admin-shell td.infra-row-actions > .ui-menu {
  display: inline-flex;
  vertical-align: middle;
  margin: 0 0 0 6px;
}

.admin-shell .infra-row-actions form {
  margin: 0;
}

.admin-shell .infra-row-menu {
  width: 44px;
  text-align: right;
}

/* ── OVH hub ────────────────────────────────────────────────────────────── */

/* "N waiting" on the Scheduled purchases tab: an info badge. */
.admin-shell .infra-ovh .ui-tabs__count {
  height: 18px;
  min-height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--tdo-tone-info-bg);
  color: var(--tdo-tone-info-fg);
  font-size: 11px;
  font-weight: 600;
}

.admin-shell .infra-split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
}

.admin-shell .infra-split__main {
  flex: 999 1 640px;
}

.admin-shell .infra-split__side {
  display: flex;
  flex: 1 1 300px;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.admin-shell .infra-matrix th.infra-matrix__dc {
  text-align: left;
}

.admin-shell .infra-matrix th.infra-matrix__action,
.admin-shell .infra-matrix td.infra-matrix__action {
  width: 110px;
  text-align: right;
}

.admin-shell .infra-matrix td.infra-matrix__action .button {
  height: 30px;
  min-height: 30px;
  font-size: 12px;
}

/* Round icon cell: ✓ / ◷ / ✕ / ? */
.admin-shell .infra-dc {
  justify-content: center;
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
}

.admin-shell .infra-dc--preferred {
  box-shadow: inset 0 0 0 1px currentColor;
}

.admin-shell .infra-side-card {
  margin: 0;
  padding: 20px;
  border-radius: 16px;
}

.admin-shell .infra-side-card h3 {
  margin: 0 0 4px;
  font: 700 16px var(--tdo-font-body);
}

.admin-shell .infra-side-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-shell .infra-side-card__head h3 {
  flex: 1;
  margin: 0;
}

.admin-shell .infra-side-card__sub {
  font-size: 12px;
  font-weight: 500;
}

.admin-shell .infra-side-card__text {
  margin: 4px 0 10px;
  font-size: 13px;
}

.admin-shell .infra-wait-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.admin-shell .infra-wait {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid #eef2f5;
  border-radius: 12px;
  background: #fff;
}

.admin-shell .infra-wait__top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-shell .infra-wait__top strong {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-shell .infra-wait__line {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.admin-shell .infra-empty-line {
  margin: 0;
  font-size: 13px;
}

.admin-shell .infra-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-shell .infra-link-button {
  margin-top: 8px;
  padding-left: 0;
}

/* Skeletons while the stock matrix loads from FastAPI. */
.admin-shell .ovh-skel {
  display: inline-block;
  height: 1em;
  min-width: 3.5rem;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef2f5 0%, #dce4e9 50%, #eef2f5 100%);
  background-size: 200% 100%;
  animation: infra-shimmer 1.1s linear infinite;
  vertical-align: middle;
}

.admin-shell .ovh-skel--wide {
  min-width: 6rem;
}

.admin-shell .ovh-skel--dot {
  width: 26px;
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
}

@keyframes infra-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.admin-shell .ovh-fade-in {
  animation: infra-fade-in 0.35s ease-out;
}

@keyframes infra-fade-in {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-shell .ovh-loading-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-shell .ovh-loading-pulse::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tdo-color-secondary, #836fff);
  animation: infra-pulse 1.2s ease-in-out infinite;
}

@keyframes infra-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.4); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-shell .ovh-skel,
  .admin-shell .ovh-fade-in,
  .admin-shell .ovh-loading-pulse::before {
    animation: none;
  }
}

/* Scheduled purchases: request forms side by side. */
.admin-shell .infra-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
  scroll-margin-top: 80px;
}

.admin-shell .infra-form-card {
  margin: 0;
}

.admin-shell .infra-form-card > .muted {
  margin: 4px 0 14px;
}

.admin-shell .infra-form-card .field {
  margin-bottom: 14px;
}

.admin-shell .infra-checklist {
  max-height: 16rem;
  overflow-y: auto;
  padding: 6px 10px;
  border: 1px solid var(--tdo-color-border);
  border-radius: 10px;
}

.admin-shell .infra-checklist label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  cursor: pointer;
}

.admin-shell .infra-two-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.admin-shell .infra-check {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
}

/* ── Catalog hub ────────────────────────────────────────────────────────── */

.admin-shell .infra-formula {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--tdo-color-border);
  border-radius: 14px;
  font-size: 13px;
}

/* On/off switch around a real checkbox (Offered to customers, Active). */
.admin-shell .infra-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.admin-shell .infra-switch input {
  position: absolute;
  width: 36px;
  height: 20px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.admin-shell .infra-switch__track {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--tdo-color-border-strong);
  transition: background 0.15s;
}

.admin-shell .infra-switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
}

.admin-shell .infra-switch input:checked + .infra-switch__track {
  background: #36a151;
}

.admin-shell .infra-switch input:checked + .infra-switch__track::after {
  left: 18px;
}

.admin-shell .infra-switch input:focus-visible + .infra-switch__track {
  outline: 2px solid var(--tdo-color-secondary, #836fff);
  outline-offset: 2px;
}

.admin-shell .infra-switch input:disabled + .infra-switch__track {
  opacity: 0.6;
}

.admin-shell .infra-switch__no {
  color: var(--tdo-color-muted);
}

.admin-shell .infra-switch input:checked ~ .infra-switch__label .infra-switch__no,
.admin-shell .infra-switch input:not(:checked) ~ .infra-switch__label .infra-switch__yes {
  display: none;
}

.admin-shell .infra-price-input {
  max-width: 10rem;
}

.admin-shell .infra-catalog .ui-menu__item--danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Cloudflare zones ───────────────────────────────────────────────────── */

.admin-shell .infra-zone-id {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
}

.admin-shell .infra-copy {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--tdo-color-muted);
  font: inherit;
  cursor: pointer;
}

.admin-shell .infra-copy:hover {
  color: var(--tdo-color-text);
}

.admin-shell .infra-cf__actions {
  width: 140px;
  text-align: right;
  white-space: nowrap;
}

.admin-shell td.infra-cf__actions > .ui-menu {
  display: inline-flex;
  vertical-align: middle;
}

.admin-shell .infra-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #4a5160;
  text-decoration: none;
  vertical-align: middle;
}

.admin-shell .infra-icon-link:hover {
  background: var(--tdo-tone-neutral-bg);
  color: var(--tdo-color-text);
}

/* ── Phone ──────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .admin-shell .infra-hero__actions {
    width: 100%;
  }

  .admin-shell .infra-filter {
    flex-basis: 100%;
  }

  .admin-shell .infra-table-card .admin-users-table.ui-table-cards {
    padding: 10px;
  }

  .admin-shell .infra-cf__actions,
  .admin-shell .infra-row-menu,
  .admin-shell .infra-matrix td.infra-matrix__action {
    width: auto;
  }
}
