:root {
  --bg: #f2f6fb;
  --panel: #ffffff;
  --text: #10263f;
  --muted: #58708b;
  --line: #dbe5ef;
  --primary: #0c6de8;
  --danger: #c23f2a;
  --ok: #0f7f5f;
  --radius: 18px;
  --shadow: 0 20px 40px rgba(12, 30, 61, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Tajawal", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
}

.ambient {
  display: none;
}

.ambient-a {
  width: 280px;
  height: 280px;
  top: -60px;
  right: -80px;
  background: #78c8ff;
}

.ambient-b {
  width: 300px;
  height: 300px;
  left: -90px;
  bottom: -80px;
  background: #7af0c0;
}

.page-header,
.page-content {
  width: min(1260px, 94%);
  margin-inline: auto;
}

.page-header {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1px solid rgba(15, 43, 70, 0.08);
  border-radius: calc(var(--radius) + 4px);
  padding: 14px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid rgba(15, 43, 70, 0.12);
  background: #fff;
  box-shadow: 0 8px 18px rgba(8, 50, 110, 0.14);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-kicker {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.brand h1 {
  margin: 2px 0 0;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

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

.back-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.page-content {
  margin-top: 16px;
  margin-bottom: 28px;
}

.auth-card,
.panel,
.sub-panel {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid rgba(16, 38, 63, 0.08);
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth-card {
  width: min(520px, 100%);
  margin-inline: auto;
}

.auth-card h2 {
  margin: 0;
  font-size: 1.18rem;
}

.auth-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.auth-form {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.auth-form label,
.create-user-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #1f3f5e;
}

input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 0.95rem;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(12, 109, 232, 0.16);
}

.panel {
  display: grid;
  gap: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.sub-panel h3 {
  margin: 0 0 12px;
}

.panel-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.create-user-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.field-settings-form {
  display: grid;
  gap: 14px;
}

.field-settings-container {
  display: grid;
  gap: 14px;
}

.settings-step {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fbfdff;
}

.settings-step h4,
.settings-section h5 {
  margin: 0;
}

.settings-section {
  margin-top: 12px;
}

.settings-section h5 {
  color: #23486d;
  margin-bottom: 10px;
}

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

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.setting-copy {
  display: grid;
  gap: 4px;
}

.setting-copy small {
  color: var(--muted);
  font-weight: 600;
  direction: ltr;
  text-align: right;
}

.setting-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 700;
  color: #1f3f5e;
}

.setting-toggle input {
  width: 18px;
  height: 18px;
}

.field-settings-actions {
  display: flex;
  justify-content: flex-start;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: right;
  vertical-align: middle;
}

th {
  color: #264a6d;
  font-size: 0.92rem;
}

td {
  font-size: 0.93rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.83rem;
  font-weight: 700;
}

.status-active {
  background: #e7f9f3;
  color: var(--ok);
}

.status-inactive {
  background: #fff4e6;
  color: #9b5d00;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--primary), #4b9bff);
}

.btn-ghost {
  color: #174a78;
  background: #eaf3ff;
}

.btn-danger {
  color: #fff;
  background: linear-gradient(120deg, #d44537, #b92f26);
}

.state {
  margin-top: 12px;
  font-weight: 700;
  color: var(--muted);
}

.state.ok {
  color: var(--ok);
}

.state.error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .create-user-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .setting-item {
    flex-direction: column;
    align-items: flex-start;
  }
}
