#adminStoreManagement {
  --asm-ink: var(--navy, #231b5c);
  --asm-muted: var(--slate, #64748b);
  --asm-line: var(--line, #e2e8f0);
  --asm-accent: var(--teal, #d32027);
  --asm-surface: var(--white, #ffffff);
  --asm-soft: #f8fafc;
  margin: 18px 0 28px;
}

.asm-shell {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--asm-line);
  border-radius: 20px;
  color: var(--asm-ink);
  background:
    radial-gradient(circle at 100% 0, rgba(211, 32, 39, 0.08), transparent 26rem),
    var(--asm-soft);
}

.asm-header,
.asm-section-head,
.asm-card-head,
.asm-header-actions,
.asm-editor-actions {
  display: flex;
  align-items: center;
}

.asm-header {
  justify-content: space-between;
  gap: 20px;
}

.asm-header-copy {
  min-width: 0;
  max-width: 760px;
}

.asm-kicker {
  margin: 0 0 5px;
  color: var(--asm-accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.asm-title {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.15;
}

.asm-description,
.asm-section-note,
.asm-card-subtitle,
.asm-field-help,
.asm-assignment-note {
  color: var(--asm-muted);
}

.asm-description {
  margin: 6px 0 0;
  max-width: 70ch;
}

.asm-header-actions,
.asm-editor-actions {
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.asm-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.asm-button:focus-visible,
.asm-editor input:focus-visible,
.asm-editor select:focus-visible,
.asm-user-card select:focus-visible {
  outline: 3px solid rgba(211, 32, 39, 0.28);
  outline: 3px solid color-mix(in srgb, var(--asm-accent) 28%, transparent);
  outline-offset: 2px;
}

.asm-button-primary {
  color: #fff;
  background: var(--asm-accent);
}

.asm-button-ghost {
  border-color: var(--asm-line);
  color: var(--asm-ink);
  background: #fff;
}

.asm-button-danger {
  border-color: #fecaca;
  color: #991b1b;
  background: #fff1f2;
}

.asm-button-small {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 11px;
}

.asm-button:disabled,
.asm-shell[aria-busy="true"] .asm-button {
  cursor: wait;
  opacity: 0.55;
}

.asm-status {
  min-height: 22px;
  margin: -6px 0;
  padding: 0 2px;
  color: var(--asm-muted);
  font-size: 12px;
  font-weight: 800;
}

.asm-status.is-success {
  color: #047857;
}

.asm-status.is-error {
  color: #b91c1c;
}

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

.asm-metric {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--asm-line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.88);
}

.asm-metric-label,
.asm-metric-detail {
  display: block;
  color: var(--asm-muted);
}

.asm-metric-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.asm-metric-value {
  display: block;
  margin-top: 5px;
  font-size: 24px;
  line-height: 1.1;
}

.asm-metric-detail {
  margin-top: 4px;
  font-size: 11px;
}

.asm-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--asm-line);
  border-radius: 17px;
  background: var(--asm-surface);
}

.asm-section-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.asm-section-title {
  margin: 0;
  font-size: 17px;
}

.asm-count,
.asm-code,
.asm-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.asm-count {
  padding: 5px 9px;
  color: var(--asm-muted);
  background: var(--asm-soft);
}

.asm-section-note {
  max-width: 82ch;
  margin: -2px 0 14px;
  font-size: 12px;
}

.asm-editor {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: var(--asm-soft);
}

.asm-editor[hidden] {
  display: none;
}

.asm-editor-title {
  margin: 0 0 12px;
  font-size: 15px;
}

.asm-editor-grid,
.asm-assignment-grid,
.asm-activation-fields {
  display: grid;
  gap: 10px;
}

.asm-editor-grid {
  grid-template-columns: 0.8fr 1.5fr 0.7fr;
}

.asm-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.asm-field-label {
  color: var(--asm-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.asm-editor input,
.asm-editor select,
.asm-user-card select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--asm-line);
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--asm-ink);
  background: #fff;
  font: inherit;
}

.asm-field-help {
  margin: 7px 0 12px;
  font-size: 11px;
}

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

.asm-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--asm-line);
  border-radius: 14px;
  background: linear-gradient(145deg, #fff, #fbfcfe);
}

.asm-card-head {
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.asm-card-identity {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.asm-card-title,
.asm-card-subtitle {
  overflow-wrap: anywhere;
}

.asm-card-title {
  font-size: 14px;
}

.asm-card-subtitle {
  font-size: 11px;
}

.asm-code {
  margin-top: 3px;
  padding: 4px 8px;
  color: #4338ca;
  background: #eef2ff;
}

.asm-state {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: #475569;
  background: #f1f5f9;
}

.asm-state.is-active,
.asm-state.is-approved {
  color: #166534;
  background: #dcfce7;
}

.asm-state.is-inactive,
.asm-state.is-pending,
.asm-state.is-rejected,
.asm-state.is-blocked,
.asm-state.is-revoked {
  color: #991b1b;
  background: #fee2e2;
}

.asm-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.asm-facts > div {
  padding: 9px;
  border-radius: 10px;
  background: var(--asm-soft);
}

.asm-facts dt {
  color: var(--asm-muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.asm-facts dd {
  margin: 2px 0 0;
  font-weight: 900;
}

.asm-user-card {
  display: grid;
  gap: 12px;
}

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

.asm-activation-section {
  border-color: #d8d1ee;
  background:
    radial-gradient(circle at 100% 0, rgba(35, 27, 92, 0.07), transparent 23rem),
    #fff;
}

.asm-activation-form {
  display: grid;
  gap: 8px;
}

.asm-activation-fields {
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.2fr) auto;
  align-items: end;
}

.asm-activation-fields .asm-button {
  min-height: 42px;
}

.asm-secret-panel {
  display: grid;
  gap: 11px;
  margin-top: 15px;
  padding: 16px;
  border: 1px solid #f0c36b;
  border-radius: 14px;
  background: #fff9ec;
}

.asm-secret-panel[hidden] {
  display: none;
}

.asm-secret-title {
  margin: 0;
  font-size: 15px;
}

.asm-secret-warning {
  margin: 0;
  color: #7c4a03;
  font-size: 12px;
  font-weight: 800;
}

.asm-secret-panel input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d6b15e;
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--asm-ink);
  background: #fff;
  font-family: "DM Mono", Consolas, monospace;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.asm-secret-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.asm-secret-expiry,
.asm-copy-status {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
}

.asm-secret-expiry {
  color: #9a3412;
}

.asm-copy-status {
  min-height: 18px;
  color: var(--asm-muted);
}

.asm-copy-buffer {
  position: fixed !important;
  inset: auto auto 0 -10000px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.asm-assignment-note {
  min-height: 36px;
  margin: 0;
  font-size: 11px;
}

.asm-assignment-note.is-warning {
  color: #92400e;
}

.asm-empty {
  grid-column: 1 / -1;
  padding: 28px 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 13px;
  text-align: center;
  color: var(--asm-muted);
}

.asm-empty strong {
  display: block;
  color: var(--asm-ink);
}

.asm-empty p {
  margin: 4px 0 0;
}

.asm-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--asm-line);
  border-radius: 13px;
  -webkit-overflow-scrolling: touch;
}

.asm-device-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.asm-device-table th,
.asm-device-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--asm-line);
  text-align: left;
  vertical-align: top;
}

.asm-device-table th {
  color: var(--asm-muted);
  background: var(--asm-soft);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.asm-device-table td {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.asm-device-table tbody tr:last-child td {
  border-bottom: 0;
}

.asm-device-name,
.asm-device-code,
.asm-device-warning,
.asm-device-locked {
  display: block;
}

.asm-device-code,
.asm-device-warning,
.asm-device-locked {
  margin-top: 3px;
  color: var(--asm-muted);
  font-size: 10px;
}

.asm-device-warning,
.asm-device-locked {
  color: #991b1b;
  font-weight: 800;
}

.asm-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 900px) {
  .asm-card-list {
    grid-template-columns: 1fr;
  }

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

  .asm-activation-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .asm-activation-fields .asm-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .asm-editor-grid .asm-field:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  #adminStoreManagement {
    margin-left: -10px;
    margin-right: -10px;
  }

  .asm-shell {
    gap: 14px;
    padding: 13px;
    border-radius: 16px;
  }

  .asm-header {
    display: grid;
  }

  .asm-header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .asm-header-actions .asm-button,
  .asm-user-card > .asm-button {
    width: 100%;
  }

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

  .asm-metric {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px 12px;
    padding: 12px;
  }

  .asm-metric-value {
    grid-row: 1 / 3;
    grid-column: 2;
    margin: 0;
  }

  .asm-section {
    padding: 13px;
  }

  .asm-editor-grid,
  .asm-assignment-grid,
  .asm-activation-fields {
    grid-template-columns: 1fr;
  }

  .asm-editor-grid .asm-field:last-child {
    grid-column: auto;
  }

  .asm-activation-fields .asm-button {
    grid-column: auto;
  }

  .asm-editor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .asm-store-card .asm-button {
    width: 100%;
  }

  .asm-secret-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .asm-table-wrap {
    overflow: visible;
    border: 0;
  }

  .asm-device-table,
  .asm-device-table tbody,
  .asm-device-table tr,
  .asm-device-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .asm-device-table thead {
    display: none;
  }

  .asm-device-table tbody {
    display: grid;
    gap: 10px;
  }

  .asm-device-table tr {
    overflow: hidden;
    border: 1px solid var(--asm-line);
    border-radius: 13px;
    background: #fff;
  }

  .asm-device-table td {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 8px;
    border-bottom: 1px solid var(--asm-line);
  }

  .asm-device-table td::before {
    content: attr(data-label);
    color: var(--asm-muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .asm-device-table td .asm-button {
    width: 100%;
  }
}

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

@media (forced-colors: active) {
  .asm-shell,
  .asm-section,
  .asm-card,
  .asm-metric,
  .asm-editor {
    border: 1px solid CanvasText;
  }

  .asm-button:focus-visible {
    outline: 3px solid Highlight;
  }
}
