.admin-shell {
  margin-bottom: 48px;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 30px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 90% 10%, rgba(242, 200, 107, 0.18), transparent 20rem),
    radial-gradient(circle at 10% 90%, rgba(223, 244, 233, 0.08), transparent 16rem),
    var(--green-dark);
  color: white;
  box-shadow: 0 14px 36px rgba(20, 61, 51, 0.2);
}

.admin-hero h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1.2;
}

.admin-hero p:last-child {
  margin: 0;
  color: #cfe0da;
}

.admin-hero h2 {
  letter-spacing: -0.02em;
}

.stat-pills {
  display: flex;
  gap: 12px;
}

.stat-pills > div {
  min-width: 106px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.06));
  text-align: center;
}

.stat-pills strong,
.stat-pills span {
  display: block;
}

.stat-pills strong {
  color: var(--gold);
  font-size: 2rem;
}

.stat-pills span {
  color: #cfe0da;
  font-size: 0.8rem;
}

.section-tabs {
  display: none;
  gap: 8px;
  margin-top: 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.tab-button {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab-button.active {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 18px;
}

.role-section {
  grid-column: 1 / -1;
}

.admin-form-card {
  align-self: start;
}

.database-tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #eef3f0, #dde8e2);
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide-field {
  grid-column: 1 / -1;
}

.required {
  color: #b64040;
}

.status-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf9;
}

.status-switch input {
  flex: 0 0 auto;
  width: 20px;
  min-height: 20px;
}

.status-switch span,
.status-switch strong,
.status-switch small {
  display: block;
}

.permission-fieldset {
  display: block;
  margin-top: 16px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.permission-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8faf9, #f4f8f6);
}

.permission-option input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.permission-option strong,
.permission-option small {
  display: block;
}

.permission-option small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 400;
}

.role-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.role-card {
  display: grid;
  align-content: space-between;
  min-height: 154px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfcfb, #f8faf9);
}

.role-card h3 {
  margin: 0;
  font-size: 1rem;
}

.role-card p {
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.role-card button {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 800;
}

.status-switch small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 400;
}

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

.ghost-button {
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid #cbd8d2;
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font-weight: 800;
}

.records-card {
  margin-top: 18px;
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.records-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.records-grid h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.record-list {
  display: grid;
  gap: 9px;
}

.record-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #fbfcfb);
}

.record-row-product .role-badge {
  background: #eef8f3;
  color: var(--green-dark);
}

.record-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--mint);
  color: var(--green);
  font-weight: 900;
}

.record-main {
  min-width: 0;
}

.record-main strong,
.record-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-main small {
  margin-top: 2px;
  color: var(--muted);
}

.role-badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f2f4f3;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.role-badge.owner {
  background: #fff0c9;
  color: #78560b;
}

.role-badge.manager {
  background: #e5edff;
  color: #34528c;
}

.record-actions {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.record-edit-button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
}

.record-empty {
  margin: 0;
  padding: 24px 12px;
  border: 1px dashed #ccd9d3;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.schema-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #ead7a4;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff8e8, #fff3d6);
  color: #6c571f;
  font-size: 0.82rem;
}

.schema-note code {
  font-weight: 800;
}

.product-form-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #d6e2dc;
  border-radius: 14px;
  background: #f8fbf9;
  color: var(--muted);
  font-size: 0.84rem;
}

.account-fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px;
  border: 1px solid #bad5ca;
  border-radius: 16px;
  background: linear-gradient(180deg, #f3faf7, #ecf8f2);
}

.account-fieldset legend {
  color: var(--green-dark);
}

.account-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid #c8ded5;
  border-radius: 12px;
  background: white;
  box-shadow: 0 6px 16px rgba(20, 61, 51, 0.04);
}

.account-toggle input {
  width: 22px;
  min-height: 22px;
}

.account-toggle span,
.account-toggle small {
  display: block;
}

.account-toggle small,
.field-help {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

@media (max-width: 820px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-card {
    display: none;
  }

  .admin-form-card.active-section {
    display: block;
  }

  .section-tabs {
    display: flex;
  }

  .permission-grid,
  .role-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .admin-hero {
    align-items: flex-end;
    padding: 22px 18px;
  }

  .admin-hero p:last-child {
    display: none;
  }

  .stat-pills {
    gap: 7px;
  }

  .stat-pills > div {
    min-width: 72px;
    padding: 12px 8px;
  }

  .stat-pills strong {
    font-size: 1.55rem;
  }

  .admin-form-grid,
  .records-grid,
  .records-grid-3 {
    grid-template-columns: 1fr;
  }

  .permission-grid,
  .role-list {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }

  .schema-note {
    grid-template-columns: 1fr;
  }

  .account-fieldset {
    grid-template-columns: 1fr;
  }

  .form-actions button {
    flex: 1;
  }
}
