:root {
  /* Samakan tone dengan dashboard */
  --line: #2f2f2f;
  --muted: #a1a1aa;
  --text: #ececec;

  --red: #ef4444;
  --green: #22c55e;

  --blue: #3b82f6;
  --blue-dark: #2563eb;

  --card: #1f1f1f;
  --card-2: #171717;
  --bg: #212121;

  --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.24);

  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

/* =========================================================
   Layout utama: disamakan dengan dashboard
   ========================================================= */
.app {
  width: 100%;
  min-width: 840px;
  height: calc(100vh - 16px);
  min-height: calc(100vh - 16px);
  background: var(--card-2);
  border: 1px solid #2a2a2a;
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

.left-rail {
  background: #171717;
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 12px;
  min-height: 0;
}

.rail-bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #2a2a2a;
  width: calc(100% - 16px);
}

.main {
  min-width: 0;
  min-height: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* Active rail dibuat senada dengan dashboard */
.rail-icon.active {
  color: #ffffff;
  background: #2f6fed;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

/* =========================================================
   Header profile -> disamakan rasa visualnya dengan dashboard-header
   ========================================================= */
.topbar {
  height: 60px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: var(--bg);
  flex-shrink: 0;
}

.page-title-wrap {
  min-width: 0;
}

.page-title-wrap h1 {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title-wrap p {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   Area konten -> mengikuti dashboard-content
   ========================================================= */
.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg);
}

.content::-webkit-scrollbar {
  width: 10px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.profile-wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* =========================================================
   Card profile & detail -> dibuat seirama dengan hero-card dashboard
   ========================================================= */
.profile-card,
.detail-card {
  background: #2a2a2a;
  border: 1px solid #343434;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}

.profile-card {
  padding: 24px;
}

.detail-card {
  overflow: hidden;
}

/* =========================================================
   Hero profile
   ========================================================= */
.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.profile-main {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  min-width: 0;
}

.avatar-wrap {
  position: relative;
  width: 108px;
  height: 108px;
  flex-shrink: 0;
}

.avatar-big {
  width: 108px;
  height: 108px;
  border-radius: 24px;
  background: linear-gradient(180deg, #252525 0%, #1d1d1d 100%);
  border: 1px solid #3a3a3a;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

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

.status-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid #2a2a2a;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.add-photo-btn {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: #2f6fed;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: 0.18s ease;
}

.add-photo-btn:hover {
  background: #3b7cff;
  transform: translateY(-1px);
}

.add-photo-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.add-photo-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.role-badge {
  display: inline-flex;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: #232323;
  border: 1px solid #353535;
  color: #ececec;
  font-size: 12px;
  font-weight: 700;
}

.profile-info h2 {
  font-size: 32px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.profile-info p {
  font-size: 16px;
  color: var(--muted);
}

.profile-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* =========================================================
   Tombol -> mapping gaya dashboard ke class profile lama
   ========================================================= */
.primary-btn,
.danger-btn,
.danger-solid-btn,
.modal-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.18s ease;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-btn:hover,
.danger-btn:hover,
.danger-solid-btn:hover,
.modal-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.danger-btn:disabled,
.danger-solid-btn:disabled,
.modal-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.primary-btn {
  background: #2f6fed;
  color: #ffffff;
  box-shadow: none;
}

.primary-btn:hover {
  background: #3b7cff;
}

.danger-btn {
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.22);
}

.danger-btn:hover {
  background: rgba(220, 38, 38, 0.18);
  color: #ffffff;
}

.danger-solid-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.30);
  background: #ff5a5f;
  color: #ffffff;
  cursor: pointer;
  transition: 0.18s ease;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.danger-solid-btn:hover {
  background: #ff6b70;
}

.modal-btn {
  background: #2a2a2a;
  border-color: #3a3a3a;
  color: #ececec;
}

.modal-btn:hover {
  background: #323232;
  color: #ffffff;
  border-color: #474747;
}

.primary-btn svg,
.danger-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.detail-save-btn,
.detail-delete-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* =========================================================
   Head detail
   ========================================================= */
.detail-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #262626;
}

.detail-head-main {
  min-width: 0;
}

.detail-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.detail-head h3 {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.detail-head p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.detail-body {
  padding: 22px;
}

/* =========================================================
   Form
   ========================================================= */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

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

.field-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: #ececec;
}

.field-link {
  font-size: 13px;
  color: #7cb2ff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: 0.18s ease;
}

.field-link:hover {
  color: #9bc6ff;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid #353535;
  background: #1f1f1f;
  color: #ececec;
  outline: none;
  transition: 0.18s ease;
}

.input-wrap input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.input-wrap.readonly input {
  color: #b9bcc5;
  background: #242424;
  cursor: default;
}

.input-wrap.readonly input:focus {
  border-color: #353535;
  box-shadow: none;
}

.input-wrap.readonly.has-lock input {
  padding-right: 48px;
}

.input-lock-icon {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8a8f9c;
  opacity: 0.95;
  pointer-events: none;
  z-index: 1;
}

.input-lock-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-wrap-textarea {
  position: relative;
  min-height: 180px;
  border-radius: 14px;
  border: 1px solid #353535;
  background: #1f1f1f;
  overflow: hidden;
  transition: 0.18s ease;
}

.input-wrap-textarea:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.input-wrap-textarea textarea {
  width: 100%;
  min-height: 180px;
  border: 0;
  outline: none;
  resize: vertical;
  background: transparent;
  color: #ececec;
  padding: 16px;
  line-height: 1.6;
  display: block;
}

.input-wrap-textarea textarea::placeholder {
  color: #8f93a0;
}

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #1b1b1b;
  border: 1px solid #343434;
  color: #ececec;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 9999;
  font-size: 14px;
  font-weight: 600;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.24);
  color: #fecaca;
}

.toast.success {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.24);
  color: #c7f9d8;
}

/* =========================================================
   Modal
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 7, 11, 0.76);
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal-backdrop.show,
.modal-backdrop[aria-hidden="false"] {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: #1f1f1f;
  border: 1px solid #343434;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

.modal-card h3 {
  font-size: 20px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal-card > p {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.modal-alert {
  display: none;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.6;
}

.modal-alert.show {
  display: block;
}

.modal-alert.error {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.24);
  color: #fecaca;
}

.modal-alert.success {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.24);
  color: #c7f9d8;
}

.modal-field {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-label {
  font-size: 13px;
  font-weight: 600;
  color: #ececec;
}

.modal-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #353535;
  background: #1f1f1f;
  color: #ececec;
  outline: none;
  transition: 0.18s ease;
}

.modal-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

select.modal-input {
  cursor: pointer;
}

.modal-note {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #ececec;
}

.modal-note strong {
  font-weight: 800;
}

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

/* =========================================================
   Rail profile avatar
   ========================================================= */
.rail-icon .rail-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.rail-icon.has-avatar {
  padding: 0;
  overflow: hidden;
}

.rail-icon.has-avatar svg {
  display: none;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 980px) {
  body {
    padding: 0;
  }

  .app {
    min-width: 0;
    min-height: 100vh;
    height: 100vh;
    border-radius: 0;
    max-width: none;
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .profile-wrap {
    max-width: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    padding: 12px 14px;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .page-title-wrap h1,
  .page-title-wrap p {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .content {
    padding: 14px;
  }

  .profile-card {
    padding: 16px;
  }

  .detail-head {
    padding: 16px;
  }

  .detail-body {
    padding: 16px;
  }

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

  .profile-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .avatar-wrap {
    width: 96px;
    height: 96px;
  }

  .avatar-big {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    font-size: 30px;
  }

  .profile-info h2 {
    font-size: 28px;
  }

  .profile-info p {
    font-size: 15px;
  }

  .profile-actions,
  .detail-head-actions,
  .modal-actions {
    width: 100%;
  }

  .profile-actions .danger-btn,
  .detail-head-actions .detail-save-btn,
  .detail-head-actions .detail-delete-btn,
  .modal-actions .primary-btn,
  .modal-actions .modal-btn,
  .modal-actions .danger-solid-btn {
    width: 100%;
  }

  .field-top {
    align-items: flex-start;
  }
}