body {
  background: var(--admin-bg);
  color: var(--admin-text);
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: var(--admin-card);
  border-bottom: 1px solid var(--admin-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 15px;
  margin-right: auto;
}

.topbar__logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--primary), #a855f7);
  color: #fff;
  font-size: 16px;
}

.topbar__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 20px;
  padding: 20px 24px 60px;
  align-items: start;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.col {
  display: grid;
  gap: 20px;
  min-width: 0;
}

/* ---------- Card ---------- */

.card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
}

.card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  margin-right: auto;
}

.card__body {
  padding: 18px 20px;
}

.card__body--flush {
  padding: 0;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--admin-border);
  background: var(--admin-card);
  color: var(--admin-text);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover {
  background: #f8f8fc;
  border-color: #d7d9e0;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn--ghost {
  background: transparent;
}

.btn--block {
  width: 100%;
  justify-content: center;
}

.btn--sm {
  padding: 6px 10px;
  font-size: 12.5px;
}

.btn--icon {
  padding: 6px 9px;
}

.btn--danger {
  color: var(--danger);
  border-color: #f3c7c7;
  background: var(--danger-soft);
}

.btn--danger:hover {
  background: #fbd5d5;
  border-color: #eab0b0;
}

.btn--edit {
  color: var(--primary);
  border-color: #d9d0ff;
  background: var(--primary-soft);
}

.btn--edit:hover {
  background: #e4dcff;
}

/* ---------- Table ---------- */

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 640px;
}

thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--admin-text-muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--admin-border);
  background: #fafbfd;
  white-space: nowrap;
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f2f6;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr.is-editing {
  background: var(--primary-soft);
}

.cell-index {
  color: var(--admin-text-muted);
  width: 40px;
}

.cell-name {
  font-weight: 600;
}

.cell-actions {
  white-space: nowrap;
  text-align: right;
}

.cell-actions .btn + .btn {
  margin-left: 6px;
}

.thumb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--neutral-soft);
}

.thumb--empty {
  display: grid;
  place-items: center;
  color: #9aa1ad;
  font-size: 13px;
  font-weight: 700;
}

.rate {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.rate__weight {
  font-weight: 700;
}

.rate__percent {
  font-size: 12px;
  color: var(--admin-text-muted);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--active {
  background: var(--success-soft);
  color: #07875f;
}

.badge--off {
  background: var(--neutral-soft);
  color: #5b6270;
}

.badge--out {
  background: var(--warning-soft);
  color: #a76200;
}

.empty-row {
  text-align: center;
  color: var(--admin-text-muted);
  padding: 40px 16px;
}

/* ---------- Forms ---------- */

.field {
  display: block;
  margin-bottom: 14px;
}

.field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field__hint {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-top: 5px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-sm);
  background: var(--admin-input-bg);
  color: var(--admin-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.15);
}

.textarea {
  resize: vertical;
  min-height: 130px;
  line-height: 1.6;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

/* Image dropzone */

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 22px;
  border: 1.5px dashed #d3d6de;
  border-radius: var(--radius);
  background: #fafbfd;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 14px;
}

.dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone__icon {
  font-size: 22px;
}

.dropzone__title {
  font-weight: 600;
  font-size: 13.5px;
}

.dropzone__hint {
  font-size: 12px;
  color: var(--admin-text-muted);
}

.dropzone__preview {
  width: 84px;
  height: 84px;
  border-radius: var(--radius);
  object-fit: cover;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* Toggle switch */

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
}

.switch-row__label {
  font-size: 13.5px;
  font-weight: 600;
  margin-right: auto;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch__track {
  position: absolute;
  inset: 0;
  background: #d5d8e0;
  border-radius: 999px;
  transition: background 0.18s;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease-out);
}

.switch input:checked + .switch__track {
  background: var(--primary);
}

.switch input:checked + .switch__track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch__track {
  box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.25);
}

/* ---------- Stats & notes ---------- */

.stat-list {
  display: grid;
  gap: 10px;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13.5px;
}

.stat__label {
  color: var(--admin-text-muted);
  margin-right: auto;
}

.stat__value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.note {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  margin-top: 14px;
}

.note--info {
  background: var(--primary-soft);
  color: #4a32b8;
}

.note--warn {
  background: var(--warning-soft);
  color: #8a5200;
}

.note--danger {
  background: var(--danger-soft);
  color: #a52020;
}

.note[hidden] {
  display: none;
}

/* ---------- Toast ---------- */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 100;
  max-width: min(380px, calc(100vw - 40px));
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #1b1b2f;
  color: #fff;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.22s var(--ease-out);
}

.toast--ok {
  background: #0f7a58;
}

.toast--error {
  background: #b32626;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
  .switch__track::after {
    transition: none;
  }
}
