.control,
.form-control {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--slate-800);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  outline: none;
}

.search-box input:focus,
.control:focus,
.form-control:focus {
  border-color: rgba(220, 38, 38, 0.75);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

textarea.form-control {
  min-height: 92px;
  resize: vertical;
}

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

.field {
  display: grid;
  gap: 6px;
}

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

.label {
  color: var(--slate-700);
  font-size: 12px;
  font-weight: 850;
}

.help {
  color: var(--slate-500);
  font-size: 12px;
}

.error-text {
  color: var(--red-600);
  font-size: 12px;
  font-weight: 750;
}

.upload-box {
  display: grid;
  place-items: center;
  min-height: 116px;
  padding: 18px;
  color: var(--slate-500);
  background: var(--slate-50);
  border: 1px dashed var(--slate-300);
  border-radius: 8px;
  text-align: center;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 9px 11px;
  color: var(--slate-700);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  background: var(--navy-800);
  border-radius: 999px;
}

.toggle::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 4px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border-radius: 50%;
}

.admin-filter-bar {
  grid-template-columns: minmax(260px, 1.6fr) repeat(5, minmax(128px, 1fr)) auto;
}

.admin-table {
  min-width: 1100px;
}

.admin-table th:last-child,
.admin-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  background: var(--white);
  box-shadow: -10px 0 18px rgba(15, 23, 42, 0.05);
}

.admin-table th:last-child {
  background: var(--slate-50);
}

.admin-form-card {
  display: grid;
  gap: 18px;
}

.admin-form-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.admin-form-heading {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 12px;
}

.admin-form-heading h4 {
  margin: 0;
  color: var(--slate-950);
  font-size: 14px;
  font-weight: 900;
}

.admin-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-check-grid .choice {
  justify-content: flex-start;
  min-height: 42px;
}

.admin-toggle-field .choice {
  justify-content: flex-start;
}

.admin-fact-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-fact {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.admin-fact span {
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-fact strong {
  color: var(--slate-800);
  font-size: 13px;
  line-height: 1.45;
}

.flow-feedback {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 9px 0 0;
  padding: 6px 10px;
  color: var(--green-600);
  background: var(--green-100);
  border: 1px solid rgba(5, 150, 105, 0.16);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 850;
}

.flow-feedback[hidden] {
  display: none;
}

.btn.is-working {
  opacity: 0.76;
  transform: translateY(0);
}

.config-area-grid {
  align-items: stretch;
}

.config-area-card,
.config-action-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-area-card .section-note,
.config-action-card .section-note {
  flex: 1;
}

.config-area-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-timeline {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.admin-timeline span {
  position: relative;
  padding: 10px 12px 10px 34px;
  color: var(--slate-700);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
}

.admin-timeline span::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--gold-500);
  border-radius: 999px;
  transform: translateY(-50%);
}

.profile-hero .profile-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.permission-editor {
  display: grid;
  gap: 16px;
}

.permission-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 0.9fr) auto auto auto auto;
  gap: 10px;
  align-items: center;
}

.permission-group-list {
  display: grid;
  gap: 12px;
}

.permission-group {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.permission-group[hidden] {
  display: none;
}

.permission-group summary {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  color: var(--slate-950);
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.permission-group summary > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px 14px;
  border-bottom: 1px solid var(--slate-100);
}

.permission-row:last-child {
  border-bottom: 0;
}

.permission-row strong {
  color: var(--slate-800);
  font-size: 13px;
  line-height: 1.4;
}

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

.settings-search {
  max-width: 320px;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(8px);
}

.admin-modal[hidden] {
  display: none;
}

.admin-modal-box {
  position: relative;
  width: min(560px, 94vw);
  max-height: min(760px, 90vh);
  overflow: auto;
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

.admin-modal-box.wide {
  width: min(820px, 94vw);
}

.admin-modal-box .choice-row {
  margin-top: 16px;
}

.strength-meter {
  height: 10px;
  overflow: hidden;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 999px;
}

.strength-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--yellow-600), var(--green-600));
}

.security-notices {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.security-notices p {
  margin: 0;
  padding: 10px 12px;
  color: var(--slate-700);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.profile-sections .admin-form-card {
  gap: 20px;
}

.admin-page-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
  overflow: hidden;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(153, 27, 27, 0.94)),
    radial-gradient(circle at 88% 20%, rgba(245, 158, 11, 0.35), transparent 32%);
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.admin-page-hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -100px;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.admin-page-hero > * {
  position: relative;
  z-index: 1;
}

.admin-page-hero h3 {
  margin: 4px 0 7px;
  color: #ffffff;
  font-size: 25px;
  line-height: 1.18;
}

.admin-page-hero p {
  max-width: 760px;
  margin: 0;
  color: #fecaca;
  font-size: 14px;
  line-height: 1.6;
}

.hero-eyebrow,
.form-step-kicker {
  color: #fbbf24;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-actions,
.permission-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.admin-page-hero .btn-secondary {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.2);
}

.admin-page-hero .btn-primary {
  color: #111827;
  background: #f59e0b;
  box-shadow: none;
}

.admin-form-workspace,
.admin-detail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.admin-form-stage,
.admin-detail-main {
  min-width: 0;
}

.admin-step-rail {
  position: sticky;
  top: 82px;
}

.rail-card,
.side-panel {
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.rail-card h4,
.side-panel h4 {
  margin: 4px 0 12px;
  color: var(--slate-950);
  font-size: 16px;
}

.admin-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 11px 0;
  text-align: left;
  background: transparent;
  border-top: 1px solid var(--slate-200);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
}

.admin-step span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--slate-700);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 950;
}

.admin-step strong,
.admin-step em {
  display: block;
  min-width: 0;
}

.admin-step strong {
  color: var(--slate-800);
  font-size: 13px;
}

.admin-step em {
  margin-top: 2px;
  color: var(--slate-500);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.admin-step.active span {
  color: #111827;
  background: #f59e0b;
  border-color: #f59e0b;
}

.admin-step.active strong {
  color: #991b1b;
}

.admin-step:hover strong {
  color: #dc2626;
}

.modern-form-card {
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--white), var(--slate-50));
}

.modern-form-section {
  margin: 0;
  padding: 18px;
  background: var(--white);
  border-width: 0 0 1px;
  border-radius: 0;
}

.modern-form-section[hidden] {
  display: none;
}

.modern-form-section:last-child {
  border-bottom: 0;
}

.modern-form-section .admin-form-heading {
  align-items: center;
  padding-bottom: 14px;
}

.modern-form-section .admin-form-heading h4 {
  margin-top: 3px;
  font-size: 17px;
}

.modern-form-section .form-control,
.modern-form-section .choice,
.branded-tools .control {
  border-color: rgba(220, 38, 38, 0.14);
}

.modern-form-section .form-control:focus,
.branded-tools .control:focus {
  border-color: rgba(245, 158, 11, 0.8);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.form-step-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--slate-200);
}

.form-step-actions .btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.admin-detail-layout {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}

.admin-detail-main,
.admin-detail-side {
  display: grid;
  gap: 16px;
}

.detail-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-status-strip div {
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.detail-status-strip span,
.side-panel p {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 800;
}

.detail-status-strip strong {
  display: block;
  margin-top: 4px;
  color: var(--slate-950);
  font-size: 15px;
}

.modern-detail-card {
  border-top: 4px solid #dc2626;
}

.card-title-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

.modern-fact {
  background:
    linear-gradient(180deg, rgba(249, 250, 251, 0.92), rgba(255, 255, 255, 0.98));
  border-color: rgba(220, 38, 38, 0.13);
}

.modern-fact span {
  color: #991b1b;
}

.side-panel {
  display: grid;
  gap: 8px;
  border-top: 4px solid #f59e0b;
}

.side-panel.critical {
  border-top-color: #dc2626;
}

.side-panel .kpi-icon {
  color: #dc2626;
  background: #fee2e2;
}

.modern-timeline span {
  background: linear-gradient(90deg, rgba(254, 226, 226, 0.64), var(--white));
  border-color: rgba(220, 38, 38, 0.14);
}

.permission-editor-shell {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.permission-filter-card,
.permission-groups-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.permission-filter-card {
  position: sticky;
  top: 72px;
  z-index: 10;
  border-top: 4px solid #f59e0b;
  overflow: hidden;
}

.permission-groups-card {
  overflow: hidden;
  border-top: 4px solid #dc2626;
}

.branded-tools {
  padding: 16px;
  background: var(--white);
  border-bottom: 0;
  box-shadow: none;
}

.branded-tools.permission-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 0.55fr);
  gap: 12px;
  align-items: end;
}

.permission-tool-field {
  display: grid;
  gap: 6px;
}

.permission-tool-actions,
.permission-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.permission-tool-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
  padding-top: 12px;
  border-top: 1px solid var(--slate-200);
}

.permission-groups-title {
  padding: 12px 16px;
  color: #7f1d1d;
  background:
    linear-gradient(90deg, #fff7ed, #fee2e2);
  border-bottom: 1px solid rgba(220, 38, 38, 0.18);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.permission-options-panel {
  --scrollbar-thumb-visible: rgba(100, 116, 139, 0.34);
  --scrollbar-thumb-active: rgba(220, 38, 38, 0.62);
  max-height: min(720px, calc(100vh - 260px));
  overflow: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(249, 250, 251, 0.7), rgba(255, 255, 255, 0.98));
}

.modern-permission-list {
  padding: 18px 16px 16px;
}

.modern-permission-group {
  border: 1px solid rgba(220, 38, 38, 0.14);
  box-shadow: var(--shadow-sm);
}

.modern-permission-group summary {
  background: linear-gradient(90deg, rgba(254, 226, 226, 0.72), var(--white));
}

.modern-permission-group summary span {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.modern-permission-group summary i {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #ffffff;
  background: #dc2626;
  border-radius: 8px;
  font-style: normal;
}

.modern-permission-group.tone-2 summary i {
  background: #f59e0b;
}

.modern-permission-group.tone-3 summary i {
  background: #2563eb;
}

.modern-permission-group.tone-4 summary i {
  background: #16a34a;
}

.modern-permission-row {
  grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1fr);
  padding: 15px;
}

.modern-permission-row small {
  display: block;
  margin-top: 3px;
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 800;
}

.permission-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  color: var(--slate-700);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 850;
}

.permission-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.permission-chip.checked,
.permission-chip:has(input:checked) {
  color: #7f1d1d;
  background: #fee2e2;
  border-color: rgba(220, 38, 38, 0.3);
}

.permission-chip span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  background: var(--slate-300);
  border-radius: 999px;
  vertical-align: 1px;
}

.permission-chip.checked span::before,
.permission-chip:has(input:checked) span::before {
  background: #dc2626;
}

.permission-role-selector {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(150px, 0.8fr));
  gap: 12px;
  align-items: end;
  margin-top: 16px;
  padding: 16px;
  background: var(--white);
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.permission-role-selector span {
  display: block;
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.permission-role-selector strong {
  display: block;
  margin-top: 7px;
  color: var(--slate-950);
  font-size: 13px;
}

.profile-modern-hero {
  grid-template-columns: minmax(0, 1fr) auto;
}

.profile-hero-identity {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.profile-hero-photo,
.side-user-photo {
  overflow: hidden;
  background: #ffffff;
  border: 2px solid rgba(245, 158, 11, 0.55);
  border-radius: 8px;
}

.profile-hero-photo {
  width: 86px;
  height: 86px;
  flex: 0 0 86px;
}

.profile-hero-photo img,
.side-user-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-user-photo {
  width: 70px;
  height: 70px;
  margin-right: auto;
  margin-left: auto;
}

.side-user-photo.large {
  width: 98px;
  height: 98px;
}

.user-side-card,
.profile-side-card {
  justify-items: center;
  align-items: center;
  text-align: center;
}

.user-side-card .choice-row,
.profile-side-card .choice-row {
  justify-content: center;
}

.profile-detail-layout {
  align-items: start;
}

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

.profile-access-grid > div {
  padding: 14px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.profile-access-grid h4 {
  margin: 0 0 10px;
  color: var(--slate-950);
  font-size: 14px;
}

.profile-access-grid p {
  margin: 7px 0 0;
  color: var(--slate-600);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

body.dark-mode .admin-page-hero {
  background:
    linear-gradient(135deg, #061426, #0b2e4a),
    radial-gradient(circle at 88% 20%, rgba(199, 154, 59, 0.28), transparent 32%);
}

body.dark-mode .modern-fact,
body.dark-mode .modern-timeline span,
body.dark-mode .modern-permission-group summary {
  background: linear-gradient(90deg, rgba(20, 34, 56, 0.96), var(--white));
}

body.dark-mode .permission-chip.checked,
body.dark-mode .permission-chip:has(input:checked) {
  color: #fff3d6;
  background: rgba(199, 154, 59, 0.18);
  border-color: rgba(199, 154, 59, 0.42);
}

@media (max-width: 1200px) {
  .admin-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

  .branded-tools.permission-tools {
    grid-template-columns: 1fr;
  }

  .branded-tools {
    position: static;
  }

  .permission-filter-card {
    position: static;
  }

  .permission-options-panel {
    max-height: min(640px, calc(100vh - 220px));
  }

  .permission-tool-actions,
  .permission-group-actions {
    justify-content: flex-start;
  }

  .admin-form-workspace,
  .admin-detail-layout,
  .permission-role-selector {
    grid-template-columns: 1fr;
  }

  .admin-step-rail,
  .branded-tools {
    position: static;
  }
}

@media (max-width: 760px) {
  .admin-step-rail {
    display: none;
  }

  .admin-form-workspace {
    display: block;
  }

  .admin-check-grid,
  .config-area-grid,
  .profile-hero .profile-card,
  .permission-tools,
  .permission-row {
    grid-template-columns: 1fr;
  }

  .admin-form-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-header > div,
  .admin-form-heading > * {
    min-width: 0;
  }

  .section-note,
  .admin-form-heading .help {
    overflow-wrap: anywhere;
  }

  .profile-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .permission-group summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-page-hero,
  .detail-status-strip,
  .modern-fact-grid,
  .profile-modern-hero,
  .profile-access-grid {
    grid-template-columns: 1fr;
  }

  .profile-hero-identity {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions,
  .permission-summary {
    justify-content: flex-start;
  }

  .admin-page-hero h3 {
    font-size: 21px;
  }
}
