/*
 * ARGems frontend design system foundation.
 *
 * This file intentionally defines opt-in, prefixed component classes only.
 * It does not restyle existing pages by tag name, does not alter header/footer
 * behavior and is safe to adopt page-by-page during later polish packages.
 */

:root {
  --ar-ds-color-brand: #003986;
  --ar-ds-color-brand-strong: #002056;
  --ar-ds-color-brand-soft: #eef5ff;
  --ar-ds-color-brand-border: #c9dcf5;
  --ar-ds-color-surface: #ffffff;
  --ar-ds-color-surface-soft: #f7faff;
  --ar-ds-color-ink: #102033;
  --ar-ds-color-muted: #66778f;
  --ar-ds-color-border: #dbe5f2;
  --ar-ds-color-border-strong: #c6d7ec;
  --ar-ds-color-success: #17613d;
  --ar-ds-color-success-soft: #eefaf2;
  --ar-ds-color-warning: #8a5a0a;
  --ar-ds-color-warning-soft: #fff7e8;
  --ar-ds-color-danger: #8a2020;
  --ar-ds-color-danger-soft: #fff4f4;
  --ar-page-bg-control-room: #f5f7fb;
  --ar-page-bg-commerce: #f6f9fd;
  --ar-page-bg-cart: #eef2f8;
  --ar-ds-shadow-card: 0 18px 42px rgba(18, 51, 88, 0.08);
  --ar-ds-radius-xs: 6px;
  --ar-ds-radius-sm: 8px;
  --ar-ds-radius-md: 12px;
  --ar-ds-radius-lg: 18px;
  --ar-ds-radius-pill: 999px;
  --ar-ds-space-1: 4px;
  --ar-ds-space-2: 8px;
  --ar-ds-space-3: 12px;
  --ar-ds-space-4: 16px;
  --ar-ds-space-5: 20px;
  --ar-ds-space-6: 24px;
  --ar-ds-space-8: 32px;
  --ar-ds-space-10: 40px;
  --ar-ds-font-sans: var(--platform-font-sans, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  --ar-ds-focus-ring: 0 0 0 3px rgba(0, 57, 134, 0.14);
}

.ar-ds-stack {
  display: grid;
  gap: var(--ar-ds-space-4);
}

.site-shell {
  display: flow-root;
}

.site-shell--page-soft {
  --ar-page-bg: var(--ar-page-bg-control-room);
}

.site-shell--commerce-soft {
  --ar-page-bg: var(--ar-page-bg-commerce);
}

.site-shell--cart-soft {
  --ar-page-bg: var(--ar-page-bg-cart);
}

.ar-ds-stack--tight { gap: var(--ar-ds-space-2); }
.ar-ds-stack--loose { gap: var(--ar-ds-space-6); }

.ar-ds-cluster {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--ar-ds-space-3);
}

.ar-ds-container {
  margin-inline: auto;
  max-width: 1180px;
  padding-inline: var(--ar-ds-space-5);
  width: 100%;
}

.ar-ds-grid {
  display: grid;
  gap: var(--ar-ds-space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.ar-ds-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ar-ds-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.ar-ds-button {
  align-items: center;
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--ar-ds-radius-pill);
  cursor: pointer;
  display: inline-flex;
  font-family: var(--ar-ds-font-sans);
  font-size: 14px;
  font-weight: 750;
  gap: var(--ar-ds-space-2);
  justify-content: center;
  line-height: 1.2;
  min-height: 42px;
  padding: 0 var(--ar-ds-space-5);
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
  user-select: none;
}

.ar-ds-button:hover { text-decoration: none; transform: translateY(-1px); }
.ar-ds-button:focus-visible { box-shadow: var(--ar-ds-focus-ring); outline: 0; }
.ar-ds-button:disabled,
.ar-ds-button[aria-disabled="true"] { cursor: not-allowed; opacity: .58; transform: none; }

.ar-ds-button--primary { background: var(--ar-ds-color-brand); color: #fff; }
.ar-ds-button--primary:hover { background: var(--ar-ds-color-brand-strong); color: #fff; }
.ar-ds-button--secondary { background: var(--ar-ds-color-brand-soft); border-color: var(--ar-ds-color-brand-border); color: var(--ar-ds-color-brand-strong); }
.ar-ds-button--secondary:hover { background: #e4efff; color: var(--ar-ds-color-brand-strong); }
.ar-ds-button--ghost { background: transparent; border-color: var(--ar-ds-color-border); color: var(--ar-ds-color-ink); }
.ar-ds-button--danger { background: var(--ar-ds-color-danger-soft); border-color: rgba(138, 32, 32, .22); color: var(--ar-ds-color-danger); }
.ar-ds-button--sm { font-size: 12px; min-height: 34px; padding-inline: var(--ar-ds-space-4); }
.ar-ds-button--block { width: 100%; }

.ar-ds-form-grid {
  display: grid;
  gap: var(--ar-ds-space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ar-ds-field {
  display: grid;
  gap: var(--ar-ds-space-2);
  min-width: 0;
}

.ar-ds-field--full { grid-column: 1 / -1; }

.ar-ds-label {
  color: #203854;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.2;
}

.ar-ds-input,
.ar-ds-select,
.ar-ds-textarea {
  appearance: none;
  background: var(--ar-ds-color-surface);
  border: 1px solid var(--ar-ds-color-border);
  border-radius: var(--ar-ds-radius-sm);
  color: var(--ar-ds-color-ink);
  display: block;
  font: inherit;
  font-family: var(--ar-ds-font-sans);
  font-size: 14px;
  min-height: 42px;
  outline: 0;
  padding: 0 13px;
  width: 100%;
}

.ar-ds-textarea {
  line-height: 1.5;
  min-height: 110px;
  padding-block: 12px;
  resize: vertical;
}

.ar-ds-input:focus,
.ar-ds-select:focus,
.ar-ds-textarea:focus {
  border-color: var(--ar-ds-color-brand);
  box-shadow: var(--ar-ds-focus-ring);
}

.ar-ds-field[aria-invalid="true"] .ar-ds-input,
.ar-ds-field[aria-invalid="true"] .ar-ds-select,
.ar-ds-field[aria-invalid="true"] .ar-ds-textarea,
.ar-ds-input[aria-invalid="true"],
.ar-ds-select[aria-invalid="true"],
.ar-ds-textarea[aria-invalid="true"] {
  border-color: rgba(138, 32, 32, .45);
  box-shadow: 0 0 0 3px rgba(138, 32, 32, .08);
}

.ar-ds-inline-error {
  align-items: flex-start;
  color: var(--ar-ds-color-danger);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  gap: var(--ar-ds-space-2);
  line-height: 1.35;
}

.ar-ds-help-text {
  color: var(--ar-ds-color-muted);
  font-size: 12px;
  line-height: 1.45;
}

.ar-ds-card {
  background: var(--ar-ds-color-surface);
  border: 1px solid var(--ar-ds-color-border);
  border-radius: var(--ar-ds-radius-lg);
  box-shadow: var(--ar-ds-shadow-card);
  overflow: hidden;
}

.ar-ds-card__header,
.ar-ds-card__body,
.ar-ds-card__footer { padding: var(--ar-ds-space-5); }

.ar-ds-card__header {
  align-items: flex-start;
  border-bottom: 1px solid var(--ar-ds-color-border);
  display: flex;
  gap: var(--ar-ds-space-4);
  justify-content: space-between;
}

.ar-ds-card__title {
  color: var(--ar-ds-color-ink);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.2;
  margin: 0;
}

.ar-ds-card__meta {
  color: var(--ar-ds-color-muted);
  font-size: 13px;
  line-height: 1.45;
  margin: var(--ar-ds-space-1) 0 0;
}

.ar-ds-table-wrap {
  border: 1px solid var(--ar-ds-color-border);
  border-radius: var(--ar-ds-radius-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ar-ds-table {
  border-collapse: collapse;
  color: var(--ar-ds-color-ink);
  font-size: 14px;
  min-width: 640px;
  width: 100%;
}

.ar-ds-table th,
.ar-ds-table td {
  border-bottom: 1px solid var(--ar-ds-color-border);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

.ar-ds-table th {
  background: var(--ar-ds-color-surface-soft);
  color: #334760;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.ar-ds-table tr:last-child td { border-bottom: 0; }

.ar-ds-badge {
  align-items: center;
  background: var(--ar-ds-color-brand-soft);
  border: 1px solid var(--ar-ds-color-brand-border);
  border-radius: var(--ar-ds-radius-pill);
  color: var(--ar-ds-color-brand-strong);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  line-height: 1;
  min-height: 26px;
  padding: 0 10px;
  white-space: nowrap;
}

.ar-ds-badge--success { background: var(--ar-ds-color-success-soft); border-color: rgba(23, 97, 61, .2); color: var(--ar-ds-color-success); }
.ar-ds-badge--warning { background: var(--ar-ds-color-warning-soft); border-color: rgba(138, 90, 10, .22); color: var(--ar-ds-color-warning); }
.ar-ds-badge--danger { background: var(--ar-ds-color-danger-soft); border-color: rgba(138, 32, 32, .22); color: var(--ar-ds-color-danger); }
.ar-ds-badge--neutral { background: #f2f5f9; border-color: var(--ar-ds-color-border); color: #46576d; }

.ar-ds-alert {
  border: 1px solid var(--ar-ds-color-border);
  border-radius: var(--ar-ds-radius-md);
  color: var(--ar-ds-color-ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.55;
  padding: var(--ar-ds-space-4);
}

.ar-ds-alert--info { background: var(--ar-ds-color-brand-soft); border-color: var(--ar-ds-color-brand-border); color: var(--ar-ds-color-brand-strong); }
.ar-ds-alert--success { background: var(--ar-ds-color-success-soft); border-color: rgba(23, 97, 61, .2); color: var(--ar-ds-color-success); }
.ar-ds-alert--warning { background: var(--ar-ds-color-warning-soft); border-color: rgba(138, 90, 10, .22); color: var(--ar-ds-color-warning); }
.ar-ds-alert--danger { background: var(--ar-ds-color-danger-soft); border-color: rgba(138, 32, 32, .22); color: var(--ar-ds-color-danger); }

.ar-ds-empty-state {
  align-items: center;
  background: var(--ar-ds-color-surface-soft);
  border: 1px dashed var(--ar-ds-color-border-strong);
  border-radius: var(--ar-ds-radius-lg);
  color: var(--ar-ds-color-muted);
  display: grid;
  gap: var(--ar-ds-space-3);
  justify-items: center;
  padding: var(--ar-ds-space-10) var(--ar-ds-space-5);
  text-align: center;
}

.ar-ds-empty-state__title {
  color: var(--ar-ds-color-ink);
  font-size: 18px;
  font-weight: 850;
  margin: 0;
}

.ar-ds-dropdown {
  display: inline-block;
  position: relative;
}

.ar-ds-dropdown__menu {
  background: var(--ar-ds-color-surface);
  border: 1px solid var(--ar-ds-color-border);
  border-radius: var(--ar-ds-radius-md);
  box-shadow: var(--ar-ds-shadow-card);
  min-width: 220px;
  padding: var(--ar-ds-space-2);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
}

.ar-ds-dropdown__item {
  align-items: center;
  border-radius: var(--ar-ds-radius-sm);
  color: var(--ar-ds-color-ink);
  display: flex;
  gap: var(--ar-ds-space-2);
  min-height: 38px;
  padding: 0 var(--ar-ds-space-3);
  text-decoration: none;
}

.ar-ds-dropdown__item:hover { background: var(--ar-ds-color-brand-soft); color: var(--ar-ds-color-brand-strong); }

.ar-ds-modal-backdrop {
  align-items: center;
  background: rgba(4, 20, 44, .48);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: var(--ar-ds-space-5);
  position: fixed;
  z-index: 1000;
}

.ar-ds-modal {
  background: var(--ar-ds-color-surface);
  border-radius: var(--ar-ds-radius-lg);
  box-shadow: 0 24px 72px rgba(4, 20, 44, .26);
  max-height: min(760px, 92vh);
  max-width: 640px;
  overflow: auto;
  width: 100%;
}

.ar-ds-skeleton {
  animation: ar-ds-skeleton-pulse 1.2s ease-in-out infinite;
  background: linear-gradient(90deg, #eef3f8 0%, #f8fbff 50%, #eef3f8 100%);
  background-size: 200% 100%;
  border-radius: var(--ar-ds-radius-sm);
  min-height: 16px;
}

.site-message-region {
  background: var(--ar-page-bg, transparent);
  display: flow-root;
}

.site-message-region--inset {
  background: transparent;
}

.site-message-band {
  --site-message-max-width: 1180px;
  --site-message-gutter: 24px;
  box-sizing: border-box;
  display: grid;
  gap: 10px;
  margin: 20px auto;
  max-width: var(--site-message-max-width);
  width: calc(100% - (var(--site-message-gutter) * 2));
}

.site-message-band--inset {
  margin: 0 0 20px;
  max-width: none;
  width: 100%;
}

.site-message-band--1100 { --site-message-max-width: 1100px; }
.site-message-band--1180 { --site-message-max-width: 1180px; }
.site-message-band--1200 { --site-message-max-width: 1200px; }
.site-message-band--1248 { --site-message-max-width: 1248px; }
.site-message-band--1440 { --site-message-max-width: 1440px; }
.site-message-band--1500 { --site-message-max-width: 1500px; }
.site-message-band--1520 { --site-message-max-width: 1520px; }

.site-message-band--fluid {
  max-width: none;
  width: calc(100% - 120px);
}

.site-message {
  align-items: flex-start;
  border-radius: var(--ar-ds-radius-sm);
  border-width: 1px;
  box-shadow: 0 1px 2px rgba(16, 40, 80, .04);
  box-sizing: border-box;
  display: flex;
  font-family: var(--ar-ds-font-sans);
  font-size: 14px;
  font-weight: 600;
  gap: 16px;
  justify-content: space-between;
  line-height: 1.45;
  margin: 0;
  padding: 16px 20px;
  transition: opacity .18s ease, transform .18s ease;
}

.site-message.is-dismissing {
  opacity: 0;
  transform: translateY(-4px);
}

.site-message__body {
  min-width: 0;
}

.site-message__close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: currentColor;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  height: 26px;
  justify-content: center;
  line-height: 1;
  margin: -3px -6px -3px 0;
  opacity: .72;
  padding: 0;
  width: 26px;
}

.site-message__close:hover {
  opacity: 1;
}

.site-message__close:focus-visible {
  box-shadow: var(--ar-ds-focus-ring);
  outline: 0;
}

.site-message--success {
  background: #e6f6ec;
  border-color: #bde8cd;
  color: #17613d;
}

.site-message--error {
  background: #fdeceb;
  border-color: #efc4bf;
  color: #8a2020;
}

.site-message--warning {
  background: #fff7e8;
  border-color: #f1d59a;
  color: #7a4a03;
}

.site-message--info {
  background: #eef5ff;
  border-color: #c9dcf5;
  color: #003986;
}

@keyframes ar-ds-skeleton-pulse {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 900px) {
  .ar-ds-grid--two,
  .ar-ds-grid--three,
  .ar-ds-form-grid {
    grid-template-columns: 1fr;
  }

  .ar-ds-card__header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 1500px) {
  .site-message-band--fluid {
    width: calc(100% - 50px);
  }
}

@media (max-width: 1300px) {
  .site-message-band--fluid {
    width: calc(100% - 30px);
  }
}

@media (max-width: 1199.98px) {
  .site-message-band--fluid {
    width: calc(100% - 15px);
  }
}

@media (max-width: 991.98px) {
  .site-message-band--fluid {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .ar-ds-container { padding-inline: var(--ar-ds-space-4); }
  .ar-ds-button { min-height: 40px; padding-inline: var(--ar-ds-space-4); }
  .ar-ds-card__header,
  .ar-ds-card__body,
  .ar-ds-card__footer { padding: var(--ar-ds-space-4); }
  .ar-ds-modal-backdrop { align-items: flex-end; padding: var(--ar-ds-space-3); }
  .site-message-band,
  .site-message-band--fluid {
    --site-message-gutter: 16px;
    width: calc(100% - (var(--site-message-gutter) * 2));
  }
  .site-message {
    padding: 14px 16px;
  }
}
