/* ═══════════════════════════════════════════════════════════
   SmgGrid — Data Grid Component
   ════════════════════════════════════════════════════════════ */

/* ── Table Base ─────────────────────────────────────────── */
.smg-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem; /* text-sm */
}

.smg-data-table thead tr {
  border-bottom: 1px solid var(--border-default);
}

.smg-data-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.75rem;   /* text-xs */
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
  background-color: var(--bg-surface);
}

.smg-data-table tbody tr {
  border-bottom: 1px solid var(--border-default);
  transition: background-color 0.1s ease;
}

.smg-data-table tbody tr:last-child {
  border-bottom: none;
}

.smg-data-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.smg-data-table td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* ── Frozen Column ──────────────────────────────────────── */
.smg-col-frozen {
  background-color: var(--bg-surface);
}

.dark .smg-col-frozen {
  background-color: var(--bg-surface);
}

.smg-data-table tbody tr:hover .smg-col-frozen {
  background-color: var(--bg-hover);
}

/* ── Sort Button ────────────────────────────────────────── */
.smg-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
  transition: color 0.15s ease;
}

.smg-sort-btn:hover {
  color: var(--text-primary);
}

/* ── Custom Checkbox ────────────────────────────────────── */
.smg-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-default);
  border-radius: 4px;
  background-color: var(--bg-surface);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.smg-checkbox:checked {
  background-color: #FE5000;
  border-color: #FE5000;
  /* ::after doesn't work on <input> (replaced elements). Use background-image SVG checkmark instead. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3 3 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 11px;
}

.smg-checkbox:hover:not(:checked) {
  border-color: #FE5000;
}

.smg-checkbox:focus-visible {
  outline: 2px solid rgba(254, 80, 0, 0.4);
  outline-offset: 2px;
}

/* ── Pagination Buttons ─────────────────────────────────── */
.smg-pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.smg-pg-btn:hover:not(:disabled) {
  background-color: var(--bg-hover);
  border-color: var(--border-strong, #d1d5db);
  color: var(--text-primary);
}

.smg-pg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.smg-pg-btn-active {
  background-color: #FE5000;
  border-color: #FE5000;
  color: #ffffff;
  font-weight: 600;
}

.smg-pg-btn-active:hover {
  background-color: #e04600;
  border-color: #e04600;
  color: #ffffff;
}

/* ── Loading Spinner ────────────────────────────────────── */
@keyframes smgSpin {
  to { transform: rotate(360deg); }
}

.smg-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-default);
  border-top-color: #FE5000;
  border-radius: 50%;
  animation: smgSpin 0.7s linear infinite;
}

/* ── Grid shell · toolbar · search · states · cards · pagination (plain CSS, no Tailwind) ── */
.smg-grid { border: 1px solid var(--border-default); border-radius: 16px; background: var(--bg-surface); overflow: hidden; }

.smg-grid__toolbar { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-default); }
@media (min-width: 640px) { .smg-grid__toolbar { flex-direction: row; align-items: center; justify-content: space-between; } }

.smg-grid__search { position: relative; width: 100%; }
@media (min-width: 640px) { .smg-grid__search { max-width: 20rem; } }
.smg-grid__search-icon { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); display: flex; align-items: center; color: var(--text-tertiary); pointer-events: none; }
.smg-grid__search-input { width: 100%; background: var(--bg-surface-alt); border: 1px solid var(--border-default); border-radius: 12px; color: var(--text-primary); font-family: inherit; font-size: 0.875rem; padding: 8px 14px 8px 36px; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
.smg-grid__search-input::placeholder { color: var(--text-tertiary); }
.smg-grid__search-input:focus { border-color: #FE5000; box-shadow: 0 0 0 3px rgba(254,80,0,.25); }

.smg-grid__toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.smg-grid__selected { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }

.smg-grid__loading { display: flex; align-items: center; justify-content: center; padding: 64px 0; }
.smg-grid__empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 24px; text-align: center; }
.smg-grid__empty-icon { color: var(--text-tertiary); margin-bottom: 12px; }
.smg-grid__empty-text { font-size: 0.875rem; color: var(--text-tertiary); }

.smg-grid__table-wrap { display: none; overflow-x: auto; }
.smg-grid__cards { display: block; }
.smg-grid__cards > * + * { border-top: 1px solid var(--border-default); }
@media (min-width: 1024px) { .smg-grid__table-wrap { display: block; } .smg-grid__cards { display: none; } }

.smg-grid__card { padding: 16px; }
.smg-grid__card--clickable { cursor: pointer; }
.smg-grid__card:hover { background: var(--bg-hover); }
.smg-grid__card-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.smg-grid__card-row + .smg-grid__card-row { margin-top: 8px; }
.smg-grid__card-label { font-size: 0.75rem; color: var(--text-tertiary); flex-shrink: 0; }
.smg-grid__card-value { font-size: 0.875rem; color: var(--text-primary); font-weight: 500; text-align: right; max-width: 65%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smg-grid__card-actions { display: flex; justify-content: flex-end; align-items: center; gap: 2px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-default); }

.smg-grid__footer { padding: 12px 16px; border-top: 1px solid var(--border-default); background: var(--bg-surface-alt); }

.smg-align-left { text-align: left; }
.smg-align-center { text-align: center; }
.smg-align-right { text-align: right; }
.smg-row-clickable { cursor: pointer; }
.smg-sort-active { color: #FE5000; }
.smg-sort-idle { color: var(--text-tertiary); opacity: .5; }

.smg-grid__pg { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border-default); }
@media (min-width: 640px) { .smg-grid__pg { flex-direction: row; justify-content: space-between; } }
.smg-grid__pg-left { display: flex; align-items: center; gap: 16px; }
.smg-grid__pg-info { font-size: 0.75rem; color: var(--text-tertiary); }
.smg-grid__pg-size { display: flex; align-items: center; gap: 6px; }
.smg-grid__pg-size-label { font-size: 0.75rem; color: var(--text-tertiary); }
.smg-pg-select { font-size: 0.75rem; background: var(--bg-surface-alt); border: 1px solid var(--border-default); color: var(--text-primary); border-radius: 8px; padding: 4px 8px; outline: none; cursor: pointer; font-family: inherit; }
.smg-pg-select:focus { border-color: #FE5000; box-shadow: 0 0 0 3px rgba(254,80,0,.25); }
.smg-grid__pg-pages { display: flex; align-items: center; gap: 2px; }
.smg-grid__pg-dots { padding: 0 6px; font-size: 0.75rem; color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════════════════
   SMG Form components — ported from VA1, themed with --vx-* tokens
   SmgSelect · SmgStoreSelect · SmgPills
   Keeps VA1's structure/spacing/interaction; SMG palette.
   ════════════════════════════════════════════════════════════ */

/* ── shared dropdown animation ──────────────────────────── */
@keyframes smgVxDrop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* transparent full-viewport backdrop that captures the outside-click */
.smg-select__backdrop,
.smg-store__backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: transparent;
}

/* ════════════════ SmgSelect ════════════════ */
.smg-select { position: relative; display: inline-block; min-width: 180px; }

.smg-select__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px 0 12px;
  background: var(--vx-surface);
  border: 1px solid var(--vx-border);
  border-radius: 10px;
  color: var(--vx-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.smg-select__trigger:hover:not(:disabled) { border-color: var(--vx-neutral-300); }
.smg-select--open .smg-select__trigger {
  border-color: var(--vx-primary);
  box-shadow: var(--vx-focus-ring);
}
.smg-select__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smg-select__label--placeholder { color: var(--vx-text-3); }
.smg-select__trigger-icon { color: var(--vx-text-2); flex-shrink: 0; }
.smg-select__chevron { color: var(--vx-text-3); flex-shrink: 0; transition: transform .18s ease; }
.smg-select--open .smg-select__chevron { transform: rotate(180deg); }
.smg-select--disabled { opacity: .55; }
.smg-select--disabled .smg-select__trigger { cursor: not-allowed; }

.smg-select__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 100%;
  background: var(--vx-surface);
  border: 1px solid var(--vx-border);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(22, 32, 58, .16);
  z-index: 91;
  overflow: hidden;
  animation: smgVxDrop .15s ease-out;
}
/* AutoWidth: popup grows to fit the widest option (capped) so long labels aren't truncated.
   --start (default) keeps left:0 and grows right; --end anchors right:0 and grows left. */
.smg-select__panel--auto { right: auto; width: max-content; min-width: 100%; max-width: min(420px, 92vw); }
.smg-select__panel--auto.smg-select__panel--end { left: auto; right: 0; }
.smg-select__list { max-height: 280px; overflow-y: auto; padding: 6px; }
.smg-select__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--vx-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color .12s ease;
}
.smg-select__item:hover { background: var(--vx-surface-2); }
.smg-select__item-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smg-select__item--selected { background: var(--vx-brand-50); color: var(--vx-primary-hover); font-weight: 600; }
.smg-select__item--selected:hover { background: var(--vx-brand-50); }
.smg-select__check { color: var(--vx-primary); flex-shrink: 0; }
.smg-select__empty { padding: 16px 10px; text-align: center; font-size: 12.5px; color: var(--vx-text-3); }

/* search box inside the popup */
.smg-select__search { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-bottom: 1px solid var(--vx-border); }
.smg-select__search-icon { color: var(--vx-text-3); flex-shrink: 0; }
.smg-select__search-input { flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--vx-text); font-family: inherit; font-size: 13px; }
.smg-select__search-input::placeholder { color: var(--vx-text-3); }

/* filter tabs (e.g. Hepsi / Kadın / Erkek) */
.smg-select__filters { display: flex; flex-wrap: wrap; gap: 5px; padding: 9px 11px; border-bottom: 1px solid var(--vx-border); }
.smg-select__filter { height: 26px; padding: 0 11px; border: 1px solid var(--vx-border); background: var(--vx-surface); border-radius: 999px; color: var(--vx-text-2); font-family: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: background-color .12s ease, color .12s ease, border-color .12s ease; }
.smg-select__filter:hover:not(.smg-select__filter--on) { background: var(--vx-surface-2); color: var(--vx-text); }
.smg-select__filter--on { background: var(--vx-primary); border-color: var(--vx-primary); color: #fff; }

/* two-line option (text + muted sub) */
.smg-select__item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.smg-select__item-sub { font-size: 11px; color: var(--vx-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smg-select__item-icon { color: var(--vx-text-3); flex-shrink: 0; }

/* ════════════════ SmgStoreSelect ════════════════ */
.smg-store { position: relative; display: inline-block; }

.smg-store__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px 0 12px;
  background: var(--vx-surface);
  border: 1px solid var(--vx-border);
  border-radius: 10px;
  color: var(--vx-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  max-width: 320px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.smg-store__trigger:hover:not(:disabled) { border-color: var(--vx-neutral-300); }
.smg-store--open .smg-store__trigger {
  border-color: var(--vx-primary);
  box-shadow: var(--vx-focus-ring);
}
.smg-store__trigger-icon { color: var(--vx-text-2); flex-shrink: 0; }
.smg-store__label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smg-store__label--placeholder { color: var(--vx-text-3); }
.smg-store__chevron { color: var(--vx-text-3); flex-shrink: 0; transition: transform .18s ease; }
.smg-store--open .smg-store__chevron { transform: rotate(180deg); }
.smg-store--disabled { opacity: .55; }
.smg-store--disabled .smg-store__trigger { cursor: not-allowed; }

.smg-store__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--vx-surface);
  border: 1px solid var(--vx-border);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(22, 32, 58, .16);
  z-index: 91;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: smgVxDrop .15s ease-out;
}

.smg-store__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--vx-border);
}
.smg-store__search-icon { color: var(--vx-text-3); flex-shrink: 0; }
.smg-store__search-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--vx-text);
  font-family: inherit;
  font-size: 13px;
}
.smg-store__search-input::placeholder { color: var(--vx-text-3); }
.smg-store__search-clear {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border: none;
  background: none;
  border-radius: 6px;
  color: var(--vx-text-3);
  cursor: pointer;
  flex-shrink: 0;
}
.smg-store__search-clear:hover { background: var(--vx-surface-2); color: var(--vx-text); }

.smg-store__list { max-height: 320px; overflow-y: auto; padding: 6px; }

.smg-store__all {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: none;
  border: none;
  border-bottom: 1px dashed var(--vx-border);
  border-radius: 8px 8px 0 0;
  color: var(--vx-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  margin-bottom: 4px;
}
.smg-store__all:hover { background: var(--vx-surface-2); }

.smg-store__group {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--vx-text-3);
  padding: 9px 8px 4px 8px;
}

.smg-store__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--vx-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color .12s ease;
}
.smg-store__item:hover { background: var(--vx-surface-2); }
.smg-store__check {
  width: 16px; height: 16px;
  border: 1.5px solid var(--vx-border);
  border-radius: 5px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--vx-surface);
  transition: background-color .12s ease, border-color .12s ease;
}
.smg-store__check-icon { color: #fff; display: none; }
.smg-store__item--on .smg-store__check { background: var(--vx-primary); border-color: var(--vx-primary); }
.smg-store__item--on .smg-store__check-icon { display: block; }
.smg-store__item-icon { color: var(--vx-text-3); flex-shrink: 0; }
.smg-store__item-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smg-store__item-sub { margin-left: auto; font-size: 10.5px; color: var(--vx-text-3); white-space: nowrap; flex-shrink: 0; }
.smg-store__empty { padding: 18px 10px; text-align: center; font-size: 12.5px; color: var(--vx-text-3); }

.smg-store__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--vx-border);
}
.smg-store__count { font-size: 11.5px; color: var(--vx-text-2); }
.smg-store__spacer { flex: 1; }
.smg-store__btn {
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--vx-border);
  background: var(--vx-surface);
  border-radius: 8px;
  color: var(--vx-text-2);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.smg-store__btn:hover:not(:disabled) { background: var(--vx-surface-2); color: var(--vx-text); border-color: var(--vx-neutral-300); }
.smg-store__btn:disabled { opacity: .45; cursor: not-allowed; }
.smg-store__btn--apply { background: var(--vx-primary); border-color: var(--vx-primary); color: #fff; }
.smg-store__btn--apply:hover:not(:disabled) { background: var(--vx-primary-hover); border-color: var(--vx-primary-hover); color: #fff; }

/* group filter tabs (Hepsi / …) */
.smg-store__tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 9px 11px 7px; border-bottom: 1px solid var(--vx-border); }
.smg-store__tab { height: 28px; padding: 0 12px; border: 1px solid var(--vx-border); background: var(--vx-surface); border-radius: 999px; color: var(--vx-text-2); font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: background-color .12s ease, color .12s ease, border-color .12s ease; }
.smg-store__tab:hover:not(.smg-store__tab--on) { background: var(--vx-surface-2); color: var(--vx-text); }
.smg-store__tab--on { background: var(--vx-brand-50); border-color: var(--vx-primary); color: var(--vx-primary-hover); }

/* esc hint chip in the search row */
.smg-store__esc { font-size: 10px; font-weight: 600; color: var(--vx-text-3); border: 1px solid var(--vx-border); border-radius: 5px; padding: 1px 6px; flex-shrink: 0; }

/* single-select: render the check box as a radio */
.smg-store__check--radio { border-radius: 50%; }

/* ════════════════ SmgPills ════════════════ */
.smg-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.smg-pills__pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--vx-border);
  background: var(--vx-surface);
  border-radius: 999px;
  color: var(--vx-text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.smg-pills__pill:hover:not(:disabled):not(.smg-pills__pill--active) {
  color: var(--vx-text);
  background: var(--vx-surface-2);
  border-color: var(--vx-neutral-300);
}
.smg-pills__pill--active {
  background: var(--vx-primary);
  border-color: var(--vx-primary);
  color: #fff;
}
.smg-pills__pill--active:hover:not(:disabled) { background: var(--vx-primary-hover); border-color: var(--vx-primary-hover); }
.smg-pills__pill:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 768px) {
  .smg-store__panel {
    position: fixed;
    left: 12px; right: 12px; top: auto;
    width: auto;
  }
  .smg-store__list { max-height: 50vh; }
}

/* ═══════════════════════════════════════════════════════════
   Library components — Button · Badge · Alert (--vx-* themed)
   ════════════════════════════════════════════════════════════ */

/* ── SmgButton ── */
.smg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 18px; border: 1px solid transparent; border-radius: 10px; font-family: var(--vx-font-sans); font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color .15s ease, border-color .15s ease, color .15s ease, filter .15s ease; }
.smg-btn:disabled { opacity: .5; cursor: not-allowed; }
.smg-btn--sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.smg-btn--lg { height: 44px; padding: 0 22px; font-size: 14px; }
.smg-btn--block { width: 100%; }
.smg-btn--primary { background: var(--vx-primary); border-color: var(--vx-primary); color: #fff; }
.smg-btn--primary:hover:not(:disabled) { background: var(--vx-primary-hover); border-color: var(--vx-primary-hover); }
.smg-btn--secondary { background: var(--vx-surface); border-color: var(--vx-border); color: var(--vx-text); }
.smg-btn--secondary:hover:not(:disabled) { background: var(--vx-surface-2); border-color: var(--vx-neutral-300); }
.smg-btn--ghost { background: transparent; border-color: transparent; color: var(--vx-text-2); }
.smg-btn--ghost:hover:not(:disabled) { background: var(--vx-neutral-100); color: var(--vx-text); }
.smg-btn--danger { background: var(--vx-danger); border-color: var(--vx-danger); color: #fff; }
.smg-btn--danger:hover:not(:disabled) { filter: brightness(.94); }

/* ── SmgBadge ── */
.smg-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-family: var(--vx-font-sans); font-size: 11.5px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.smg-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.smg-badge--neutral { background: var(--vx-neutral-100); color: var(--vx-text-2); }
.smg-badge--brand { background: var(--vx-brand-50); color: var(--vx-brand-700); }
.smg-badge--success { background: var(--vx-success-bg); color: var(--vx-success-text); }
.smg-badge--warning { background: var(--vx-warning-bg); color: var(--vx-warning-text); }
.smg-badge--danger { background: var(--vx-danger-bg); color: var(--vx-danger-text); }
.smg-badge--info { background: var(--vx-info-bg); color: var(--vx-info-text); }

/* ── SmgAlert (ported from VA1 VaAlert) ── */
.smg-alert { display: flex; gap: 11px; align-items: flex-start; border: 1px solid var(--vx-border); border-radius: 12px; padding: 12px 14px; background: var(--vx-surface); font-size: 13px; line-height: 1.55; }
.smg-alert__icon { flex-shrink: 0; margin-top: 1px; }
.smg-alert__body { min-width: 0; flex: 1; }
.smg-alert__title { font-weight: 600; font-size: 13px; margin-bottom: 2px; color: var(--vx-text); }
.smg-alert__text { color: var(--vx-text-2); }
.smg-alert__close { flex-shrink: 0; width: 22px; height: 22px; display: grid; place-items: center; background: none; border: none; border-radius: 6px; color: var(--vx-text-3); cursor: pointer; transition: background-color .12s, color .12s; }
.smg-alert__close:hover { background: var(--vx-neutral-100); color: var(--vx-text); }
.smg-alert--info { border-color: var(--vx-info); background: var(--vx-info-bg); }
.smg-alert--info .smg-alert__icon { color: var(--vx-info); }
.smg-alert--success { border-color: var(--vx-success); background: var(--vx-success-bg); }
.smg-alert--success .smg-alert__icon { color: var(--vx-success); }
.smg-alert--warning { border-color: var(--vx-warning); background: var(--vx-warning-bg); }
.smg-alert--warning .smg-alert__icon { color: var(--vx-warning); }
.smg-alert--danger { border-color: var(--vx-danger); background: var(--vx-danger-bg); }
.smg-alert--danger .smg-alert__icon { color: var(--vx-danger); }

/* ═══════════════════════════════════════════════════════════
   Library — Form (Input/Textarea · Field · Checkbox · Radio · Switch). Ported from VA1 VaForm.
   ════════════════════════════════════════════════════════════ */

/* ── SmgInput / textarea ── */
.smg-input-wrap { position: relative; display: flex; align-items: center; width: 100%; }
.smg-input { width: 100%; height: 38px; background: var(--vx-surface); border: 1px solid var(--vx-border); border-radius: 10px; color: var(--vx-text); font-family: var(--vx-font-sans); font-size: 13px; padding: 0 12px; outline: none; transition: border-color .12s ease, box-shadow .12s ease; }
.smg-input::placeholder { color: var(--vx-text-3); }
.smg-input:focus { border-color: var(--vx-primary); box-shadow: var(--vx-focus-ring); }
.smg-input:disabled { opacity: .5; cursor: not-allowed; }
.smg-input--area { height: auto; min-height: 84px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.smg-input--has-icon { padding-left: 36px; }
.smg-input--has-eye { padding-right: 38px; }
.smg-input-wrap.is-invalid .smg-input { border-color: var(--vx-danger); }
.smg-input-icon { position: absolute; left: 12px; color: var(--vx-text-3); pointer-events: none; }
.smg-input-eye { position: absolute; right: 6px; width: 28px; height: 28px; display: grid; place-items: center; background: none; border: none; border-radius: 7px; color: var(--vx-text-3); cursor: pointer; }
.smg-input-eye:hover { color: var(--vx-text); background: var(--vx-surface-2); }

/* ── SmgField ── */
.smg-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.smg-field__label { font-size: 12px; font-weight: 500; color: var(--vx-text-2); }
.smg-field__req { color: var(--vx-danger); }
.smg-field__hint { font-size: 11px; color: var(--vx-text-3); }
.smg-field__msg { font-size: 11px; display: flex; align-items: center; gap: 5px; }
.smg-field--error .smg-field__msg { color: var(--vx-danger); }
.smg-field--success .smg-field__msg { color: var(--vx-success); }
.smg-field--error .smg-input { border-color: var(--vx-danger); }
.smg-field--success .smg-input { border-color: var(--vx-success); }

/* ── SmgCheckbox / SmgRadio ── */
/* position:relative is REQUIRED: the hidden native input below is position:absolute. Without a
   positioned ancestor its containing block is the initial containing block (html), so on a long
   page (e.g. the roles matrix with ~90 checkboxes) every input escapes the .vx-main overflow:auto
   clip and stretches documentElement.scrollHeight — producing a phantom second scrollbar and a big
   empty gap below the shell. Relative here pins each input inside its own label. */
.smg-check { position: relative; display: inline-flex; align-items: center; gap: 9px; font-family: var(--vx-font-sans); font-size: 12.5px; color: var(--vx-text); cursor: pointer; user-select: none; }
.smg-check input { position: absolute; opacity: 0; pointer-events: none; }
.smg-check__box { width: 17px; height: 17px; border: 1.5px solid var(--vx-border); border-radius: 5px; display: grid; place-items: center; color: #fff; flex-shrink: 0; background: var(--vx-surface); transition: background-color .12s, border-color .12s; }
.smg-check__tick { opacity: 0; }
.smg-check input:checked + .smg-check__box { background: var(--vx-primary); border-color: var(--vx-primary); }
.smg-check input:checked + .smg-check__box .smg-check__tick { opacity: 1; }
.smg-check input:focus-visible + .smg-check__box { box-shadow: var(--vx-focus-ring); }
.smg-check--radio .smg-check__box { border-radius: 50%; }
.smg-check--radio .smg-check__box::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; opacity: 0; transition: opacity .12s; }
.smg-check--radio input:checked + .smg-check__box { background: var(--vx-primary); border-color: var(--vx-primary); }
.smg-check--radio input:checked + .smg-check__box::after { opacity: 1; }
.smg-check--disabled { opacity: .5; cursor: not-allowed; }

/* ── SmgSwitch ── */
.smg-switch { width: 38px; height: 22px; border-radius: 999px; background: var(--vx-neutral-300); border: none; position: relative; flex-shrink: 0; cursor: pointer; padding: 0; transition: background-color .16s ease; }
.smg-switch--on { background: var(--vx-primary); }
.smg-switch--disabled { opacity: .5; cursor: not-allowed; }
.smg-switch__knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(20,22,26,.2); transition: left .16s ease; }
.smg-switch--on .smg-switch__knob { left: 18px; }

/* ═══════════════════════════════════════════════════════════
   SmgToast (live notifications) · SmgMsg (modal). Ported from VA1 VaToast/VaMsg.
   ════════════════════════════════════════════════════════════ */

/* ── SmgToast ── */
.smg-toast-stack { position: fixed; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.smg-toast-stack--bottom-right { right: 20px; bottom: 20px; align-items: flex-end; }
.smg-toast-stack--bottom-left { left: 20px; bottom: 20px; align-items: flex-start; }
.smg-toast-stack--top-right { right: 20px; top: 20px; align-items: flex-end; }
.smg-toast-stack--top-left { left: 20px; top: 20px; align-items: flex-start; }
.smg-toast-stack--top-center { left: 50%; transform: translateX(-50%); top: 20px; align-items: center; }
.smg-toast-stack--bottom-center { left: 50%; transform: translateX(-50%); bottom: 20px; align-items: center; }
.smg-toast { display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 380px; background: var(--vx-surface); border: 1px solid var(--vx-border); border-radius: 11px; padding: 11px 12px; box-shadow: 0 14px 40px rgba(22,32,58,.18); pointer-events: auto; animation: smgVxToastIn .18s ease; }
[data-theme="dark"] .smg-toast { box-shadow: 0 14px 40px rgba(0,0,0,.45); }
@keyframes smgVxToastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.smg-toast-stack--top-right .smg-toast, .smg-toast-stack--top-left .smg-toast, .smg-toast-stack--top-center .smg-toast { animation-name: smgVxToastInTop; }
@keyframes smgVxToastInTop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .smg-toast { animation: none; } }
.smg-toast--closing { opacity: 0; transition: opacity .18s ease; }
.smg-toast__icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.smg-toast--info .smg-toast__icon { background: var(--vx-info-bg); color: var(--vx-info); }
.smg-toast--success .smg-toast__icon { background: var(--vx-success-bg); color: var(--vx-success); }
.smg-toast--warning .smg-toast__icon { background: var(--vx-warning-bg); color: var(--vx-warning); }
.smg-toast--danger .smg-toast__icon { background: var(--vx-danger-bg); color: var(--vx-danger); }
.smg-toast__body { min-width: 0; flex: 1; }
.smg-toast__title { font-size: 12.5px; font-weight: 700; font-family: var(--vx-font-display); color: var(--vx-text); }
.smg-toast__msg { font-size: 12px; color: var(--vx-text-2); line-height: 1.5; }
.smg-toast__title + .smg-toast__msg { margin-top: 2px; }
.smg-toast__x { width: 22px; height: 22px; display: grid; place-items: center; background: none; border: none; border-radius: 6px; color: var(--vx-text-3); cursor: pointer; flex-shrink: 0; }
.smg-toast__x:hover { background: var(--vx-surface-2); color: var(--vx-text); }
@media (max-width: 768px) { .smg-toast-stack { left: 12px !important; right: 12px !important; transform: none !important; align-items: stretch; } .smg-toast { max-width: none; } }

/* ── SmgMsg (modal confirm / alert) ── */
.smg-msg-backdrop { position: fixed; inset: 0; background: rgba(22,32,58,.4); z-index: 300; display: grid; place-items: center; padding: 20px; animation: smgVxMsgFade .15s ease; }
[data-theme="dark"] .smg-msg-backdrop { background: rgba(4,7,14,.62); }
@keyframes smgVxMsgFade { from { opacity: 0; } to { opacity: 1; } }
.smg-msg { width: 100%; max-width: 400px; background: var(--vx-surface); border: 1px solid var(--vx-border); border-radius: 16px; padding: 26px 24px 20px; text-align: center; box-shadow: 0 30px 80px rgba(22,32,58,.25); animation: smgVxMsgPop .18s ease; }
[data-theme="dark"] .smg-msg { box-shadow: 0 30px 80px rgba(0,0,0,.55); }
@keyframes smgVxMsgPop { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .smg-msg, .smg-msg-backdrop { animation: none; } }
.smg-msg__icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; border: 2px solid; }
.smg-msg__icon--info { color: var(--vx-info); border-color: var(--vx-info); background: var(--vx-info-bg); }
.smg-msg__icon--success { color: var(--vx-success); border-color: var(--vx-success); background: var(--vx-success-bg); }
.smg-msg__icon--warning { color: var(--vx-warning); border-color: var(--vx-warning); background: var(--vx-warning-bg); }
.smg-msg__icon--danger { color: var(--vx-danger); border-color: var(--vx-danger); background: var(--vx-danger-bg); }
.smg-msg__icon--question { color: var(--vx-primary); border-color: var(--vx-primary); background: var(--vx-brand-50); }
.smg-msg__title { font-family: var(--vx-font-display); font-size: 17px; font-weight: 700; color: var(--vx-text); }
.smg-msg__text { font-size: 13px; color: var(--vx-text-2); line-height: 1.6; margin-top: 8px; }
.smg-msg__text b { color: var(--vx-text); }
.smg-msg__btns { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.smg-msg__btns .smg-btn { min-width: 96px; }

/* ═══════════════════════════════════════════════════════════
   Faz D — Spinner · Skeleton · Progress · Tooltip · Card · Metric
   ════════════════════════════════════════════════════════════ */

/* ── SmgSpinner ── */
.smg-spinner { display: inline-flex; align-items: center; gap: 9px; color: var(--vx-text-2); font-family: var(--vx-font-sans); font-size: 13px; }
.smg-spinner__ring { display: inline-block; border-radius: 50%; border: 2.5px solid var(--vx-neutral-200); border-top-color: var(--vx-primary); animation: smgVxSpin .7s linear infinite; flex-shrink: 0; }
.smg-spinner--sm .smg-spinner__ring { width: 16px; height: 16px; border-width: 2px; }
.smg-spinner--md .smg-spinner__ring { width: 22px; height: 22px; }
.smg-spinner--lg .smg-spinner__ring { width: 32px; height: 32px; border-width: 3px; }
@keyframes smgVxSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .smg-spinner__ring { animation-duration: 2s; } }

/* ── SmgSkeleton ── */
.smg-skeleton { display: block; position: relative; overflow: hidden; background: var(--vx-neutral-100); border-radius: 6px; }
.smg-skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: smgVxShimmer 1.4s infinite; }
[data-theme="dark"] .smg-skeleton { background: var(--vx-neutral-800); }
[data-theme="dark"] .smg-skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
@keyframes smgVxShimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .smg-skeleton::after { animation: none; } }
.smg-skeleton--line { width: var(--smg-sk-w, 100%); height: 12px; }
.smg-skeleton--title { width: var(--smg-sk-w, 60%); height: 18px; border-radius: 7px; }
.smg-skeleton--block { width: var(--smg-sk-w, 100%); height: 80px; border-radius: 12px; }
.smg-skeleton--circle { width: var(--smg-sk-w, 40px); height: var(--smg-sk-w, 40px); border-radius: 50%; }
.smg-skeleton--avatar { width: var(--smg-sk-w, 44px); height: var(--smg-sk-w, 44px); border-radius: 50%; }

/* ── SmgProgress ── */
.smg-progress { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.smg-progress__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.smg-progress__label { font-size: 12px; font-weight: 500; color: var(--vx-text-2); }
.smg-progress__value { font-size: 12px; font-weight: 600; color: var(--vx-text); font-variant-numeric: tabular-nums; }
.smg-progress__track { height: 8px; border-radius: 999px; background: var(--vx-neutral-200); overflow: hidden; }
.smg-progress__bar { width: var(--smg-pg, 0%); height: 100%; border-radius: 999px; transition: width .3s ease; }
.smg-progress__bar--brand { background: var(--vx-primary); }
.smg-progress__bar--success { background: var(--vx-success); }
.smg-progress__bar--warning { background: var(--vx-warning); }
.smg-progress__bar--danger { background: var(--vx-danger); }
.smg-progress--indeterminate .smg-progress__bar { width: 35%; animation: smgVxIndet 1.1s ease-in-out infinite; }
@keyframes smgVxIndet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
@media (prefers-reduced-motion: reduce) { .smg-progress--indeterminate .smg-progress__bar { animation-duration: 2.6s; } }

/* ── SmgTooltip ── */
.smg-tip { position: relative; display: inline-flex; outline: none; }
.smg-tip__bubble { position: absolute; z-index: 120; pointer-events: none; opacity: 0; white-space: nowrap; max-width: 240px; background: var(--vx-neutral-900); color: #fff; font-family: var(--vx-font-sans); font-size: 11.5px; font-weight: 500; line-height: 1.4; padding: 6px 9px; border-radius: 7px; box-shadow: 0 6px 20px rgba(22,32,58,.22); transition: opacity .12s ease, transform .12s ease; }
[data-theme="dark"] .smg-tip__bubble { background: var(--vx-neutral-100); color: var(--vx-neutral-900); }
.smg-tip:hover .smg-tip__bubble, .smg-tip:focus-visible .smg-tip__bubble { opacity: 1; }
.smg-tip--top .smg-tip__bubble { bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%) translateY(3px); }
.smg-tip--top:hover .smg-tip__bubble, .smg-tip--top:focus-visible .smg-tip__bubble { transform: translateX(-50%); }
.smg-tip--bottom .smg-tip__bubble { top: calc(100% + 7px); left: 50%; transform: translateX(-50%) translateY(-3px); }
.smg-tip--bottom:hover .smg-tip__bubble, .smg-tip--bottom:focus-visible .smg-tip__bubble { transform: translateX(-50%); }
.smg-tip--left .smg-tip__bubble { right: calc(100% + 7px); top: 50%; transform: translateY(-50%) translateX(3px); }
.smg-tip--left:hover .smg-tip__bubble, .smg-tip--left:focus-visible .smg-tip__bubble { transform: translateY(-50%); }
.smg-tip--right .smg-tip__bubble { left: calc(100% + 7px); top: 50%; transform: translateY(-50%) translateX(-3px); }
.smg-tip--right:hover .smg-tip__bubble, .smg-tip--right:focus-visible .smg-tip__bubble { transform: translateY(-50%); }

/* ── SmgCard (ported from VA1 .card) ── */
.smg-card { background: var(--vx-surface); border: 1px solid var(--vx-border); border-radius: 14px; overflow: hidden; }
.smg-card__head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 0; }
.smg-card__heading { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.smg-card__head-icon { color: var(--vx-text-3); margin-top: 1px; flex-shrink: 0; }
.smg-card__title { font-family: var(--vx-font-display); font-size: 14px; font-weight: 600; color: var(--vx-text); }
.smg-card__sub { font-size: 11.5px; color: var(--vx-text-3); margin-top: 2px; }
.smg-card__head-right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.smg-card__body { padding: 16px; }
.smg-card__footer { padding: 12px 16px; border-top: 1px solid var(--vx-border); background: var(--vx-surface-2); }

/* ── SmgMetric ── */
.smg-metric { display: flex; flex-direction: column; gap: 7px; background: var(--vx-surface); border: 1px solid var(--vx-border); border-radius: 14px; padding: 16px; min-width: 0; }
.smg-metric__top { display: flex; align-items: center; gap: 8px; }
.smg-metric__label { font-size: 12px; font-weight: 500; color: var(--vx-text-2); }
.smg-metric__icon { color: var(--vx-text-3); margin-left: auto; flex-shrink: 0; }
.smg-metric__value { font-family: var(--vx-font-display); font-size: 26px; font-weight: 700; color: var(--vx-text); line-height: 1.1; letter-spacing: -.5px; }
.smg-metric__delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.smg-metric__delta--up { color: var(--vx-success); }
.smg-metric__delta--down { color: var(--vx-danger); }
.smg-metric__delta--neutral { color: var(--vx-text-3); }
