@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap");

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

body {
  font-family: "DM Sans", sans-serif;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-light) 100%
  );
  min-height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════════
    APP SHELL  (dashboard-identical outer frame)
   ══════════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  padding: 20px;
  gap: 0;
}

/* ── Sidebar ───────────────────────────────── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: linear-gradient(
    180deg,
    var(--sidebar-bg-start) 0%,
    var(--sidebar-bg-end) 100%
  );
  border-radius: 20px 0 0 20px;
  border: 3px solid var(--accent-dark);
  border-right: none;
  display: flex;
  flex-direction: column;
  transition:
    width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.35s;
  overflow: hidden;
  z-index: 10;
}
.sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-width: 0;
}

.sidebar-header {
  padding: 28px 25px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.sidebar-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: 0 0 34px;
}
.sidebar-header h2 {
  color: var(--surface);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  overflow: hidden;
}
.nav-item {
  padding: 12px 25px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  transition:
    background-color 0.2s,
    color 0.2s,
    padding-left 0.2s;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--surface);
  color: var(--sidebar-bg-start);
  padding-left: 32px;
}
.nav-item.active {
  background: var(--surface);
  color: var(--sidebar-bg-start);
  font-weight: 700;
}
.nav-item.nav-locked {
  opacity: 0.5;
  cursor: not-allowed;
}
.nav-item.nav-locked:hover {
  background: rgba(244, 67, 54, 0.08);
  color: rgba(255, 255, 255, 0.88);
  padding-left: 25px;
}
.nav-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 18px 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  white-space: nowrap;
}

/* ── Main content ──────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 0 20px 20px 0;
  border: 3px solid var(--accent-dark);
  border-left: none;
  overflow: hidden;
  transition: border-radius 0.35s;
  min-width: 0;
}
.main-content.full-radius {
  border-radius: 20px;
  border-left: 3px solid var(--accent-dark);
}

/* ── Top bar ───────────────────────────────── */
.top-bar {
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-light) 100%
  );
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--accent-dark);
  flex-shrink: 0;
  gap: 16px;
}
.sidebar-toggle {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-radius: 10px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}
.bar {
  width: 20px;
  height: 2px;
  background: var(--surface);
  border-radius: 2px;
  transition: all 0.3s;
  transform-origin: center;
}
.sidebar-toggle.open .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.sidebar-toggle.open .bar:nth-child(2) {
  opacity: 0;
}
.sidebar-toggle.open .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.top-bar-title {
  flex: 1;
}
.top-bar-title h1 {
  color: var(--surface);
  font-size: 24px;
  font-weight: 700;
}
.subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  margin-top: 2px;
}

/* user chip */
.user-menu {
  position: relative;
}
.user-chip {
  background: var(--text-muted);
  padding: 10px 20px;
  border-radius: 25px;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}
.user-chip:hover {
  background: var(--text-muted);
}
.user-chip .arrow {
  font-size: 11px;
  transition: transform 0.3s;
}
.user-chip.active .arrow {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
  z-index: 1000;
  overflow: hidden;
  border: 1.5px solid var(--surface-alt);
}
.user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid var(--surface-alt);
  transition: all 0.2s;
}
.dd-item:last-child {
  border-bottom: none;
}
.dd-item:hover {
  background: var(--accent);
  color: var(--surface);
}

/* ══════════════════════════════════════════════
   PAGE BODY
   ══════════════════════════════════════════════ */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  background: linear-gradient(
    160deg,
    var(--surface-alt) 0%,
    var(--surface-alt) 100%
  );
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--surface-alt);
}
.page-body::-webkit-scrollbar {
  width: 6px;
}
.page-body::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

/* ══════════════════════════════════════════════
   HERO CARD
   ══════════════════════════════════════════════ */
.hero-card {
  background: var(--surface);
  border-radius: 20px;
  border: 1.5px solid var(--surface-alt);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 22px;
  position: relative;
  animation: heroIn 0.4s ease both;
}
@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* decorative stripe — using border-top now (no overflow needed) */
.hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(
    90deg,
    var(--sidebar-bg-start),
    var(--accent),
    var(--accent-light)
  );
  border-radius: 20px 20px 0 0;
}

/* avatar */
.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.avatar-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent), var(--sidebar-bg-end));
  box-shadow: 0 0 0 3px rgba(107, 124, 80, 0.15);
}
.avatar-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: var(--surface);
  cursor: default;
  transition: filter 0.2s;
  background: linear-gradient(135deg, var(--accent), var(--sidebar-bg-end));
}
.avatar-edit-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.avatar-edit-btn:hover {
  background: var(--accent);
  color: var(--surface);
}

/* colour picker — fixed so it escapes all overflow:hidden parents */
.avatar-colour-picker {
  position: fixed;
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  border: 1.5px solid var(--surface-alt);
  z-index: 9999;
  display: none;
  min-width: 180px;
}
.avatar-colour-picker.open {
  display: block;
  animation: pickerIn 0.2s ease;
}
@keyframes pickerIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.picker-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
}
.colour-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.colour-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: all 0.18s;
}
.colour-swatch:hover,
.colour-swatch.active {
  border-color: var(--text);
  transform: scale(1.15);
}

/* hero identity */
.hero-identity {
  flex: 1;
}
.hero-identity h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-dark);
  margin-bottom: 8px;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.role-pill {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.active {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}
.status-dot.inactive {
  background: var(--danger);
}
.status-dot.suspended {
  background: var(--warning);
}
#heroStatusLabel {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}
.hero-email,
.hero-pharmacy {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.hero-email i,
.hero-pharmacy i {
  color: var(--accent);
  font-size: 12px;
}

/* quick stats */
.hero-stats {
  display: flex;
  gap: 0;
  background: var(--surface-alt);
  border-radius: 14px;
  border: 1.5px solid var(--surface-alt);
  overflow: hidden;
  flex-shrink: 0;
}
.stat-box {
  padding: 16px 24px;
  text-align: center;
  border-right: 1.5px solid var(--surface-alt);
  min-width: 90px;
}
.stat-box:last-child {
  border-right: none;
}
.stat-val {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--sidebar-bg-start);
  line-height: 1;
}
.stat-lbl {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════
   TAB BAR
   ══════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 14px;
  padding: 6px;
  border: 1.5px solid var(--surface-alt);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar {
  display: none;
}
.tab {
  padding: 10px 18px;
  background: none;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: inherit;
}
.tab i {
  font-size: 13px;
}
.tab:hover {
  background: var(--surface-alt);
  color: var(--sidebar-bg-start);
}
.tab.active {
  background: linear-gradient(135deg, var(--sidebar-bg-start), var(--accent));
  color: var(--surface);
  box-shadow: 0 3px 10px rgba(45, 80, 22, 0.25);
}

/* ══════════════════════════════════════════════
   TAB PANELS
   ══════════════════════════════════════════════ */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
  animation: panelIn 0.25s ease both;
}
@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ══════════════════════════════════════════════
   PROFILE CARDS
   ══════════════════════════════════════════════ */
.profile-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1.5px solid var(--surface-alt);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.danger-card {
  border-color: var(--border);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--surface-alt);
}
.card-head-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--sidebar-bg-end));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  font-size: 18px;
}
.locked-icon {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.card-head h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: 3px;
}
.card-head p {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* edit toggle */
.edit-toggle-btn {
  margin-left: auto;
  padding: 8px 16px;
  background: var(--surface-alt);
  border: 1.5px solid var(--accent-light);
  border-radius: 8px;
  color: var(--sidebar-bg-start);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
  font-family: inherit;
  flex-shrink: 0;
}
.edit-toggle-btn:hover {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}
.edit-toggle-btn.active {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}

/* ── Field grid ────────────────────────────── */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-group.span-2 {
  grid-column: 1/-1;
}

.field-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-view {
  font-size: 14.5px;
  color: var(--text);
  font-weight: 500;
  padding: 10px 13px;
  background: var(--surface-alt);
  border: 1.5px solid var(--surface-alt);
  border-radius: 9px;
  min-height: 42px;
  display: flex;
  align-items: center;
}
.field-input {
  padding: 10px 13px;
  border: 1.5px solid var(--surface-alt);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  width: 100%;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107, 124, 80, 0.12);
}
textarea.field-input {
  resize: vertical;
  min-height: 80px;
}
select.field-input {
  cursor: pointer;
}

/* lock tag */
.lock-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--danger);
  color: var(--danger);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.hint-label {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.required {
  color: var(--danger);
}

/* card actions */
.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-alt);
}

/* lock notice */
.lock-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-alt);
  border: 1.5px solid var(--primary-light);
  border-left: 5px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 18px;
  color: var(--primary-dark);
  font-size: 13px;
}
.lock-notice i {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.lock-notice strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13.5px;
}
.lock-notice p {
  margin: 0;
  line-height: 1.55;
  color: var(--primary);
}
.lock-notice a {
  color: var(--primary-dark);
  font-weight: 600;
}

/* info banner */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-alt);
  border: 1.5px solid var(--accent-light);
  border-left: 5px solid var(--accent);
  border-radius: 10px;
  padding: 13px 16px;
  margin-bottom: 18px;
  color: var(--sidebar-bg-start);
  font-size: 13px;
  line-height: 1.55;
}
.info-banner i {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--accent);
}
.info-banner a {
  color: var(--sidebar-bg-start);
  font-weight: 600;
}

/* status pill */
.status-pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.status-pill.active {
  background: var(--surface-alt);
  color: var(--success);
}
.status-pill.inactive {
  background: var(--danger);
  color: var(--danger);
}
.status-pill.suspended {
  background: var(--surface-alt);
  color: var(--warning);
}

/* superuser badge chip */
.superuser-badge-chip {
  margin-left: auto;
  flex-shrink: 0;
  background: var(--surface-alt);
  border: 1.5px solid var(--warning);
  color: var(--warning);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.read-only-chip {
  margin-left: auto;
  flex-shrink: 0;
  background: var(--surface-alt);
  border: 1.5px solid var(--success);
  color: var(--success);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.coming-soon-chip {
  margin-left: auto;
  flex-shrink: 0;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

/* ══════════════════════════════════════════════
   PASSWORD TAB
   ══════════════════════════════════════════════ */
.pw-wrap {
  position: relative;
  display: flex;
}
.pw-wrap .field-input {
  padding-right: 42px;
}
.pw-toggle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 42px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pw-toggle:hover {
  color: var(--accent);
}

/* strength */
.pw-strength-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.pw-strength-bar {
  flex: 1;
  height: 5px;
  background: var(--surface-alt);
  border-radius: 3px;
  overflow: hidden;
}
.pw-strength-fill {
  height: 100%;
  border-radius: 3px;
  transition:
    width 0.3s,
    background 0.3s;
}
.pw-strength-label {
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* rules */
.pw-rules {
  list-style: none;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pw-rules li {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}
.pw-rules li.ok {
  color: var(--success);
}
.pw-rules li.ok i {
  color: var(--success);
}
.pw-rules li i {
  color: var(--border);
  transition: color 0.2s;
}
.pw-match-msg {
  font-size: 12px;
  margin-top: 5px;
  display: block;
}
.pw-match-msg.ok {
  color: var(--success);
}
.pw-match-msg.err {
  color: var(--danger);
}

.tfa-placeholder {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.55;
}
.tfa-placeholder i {
  font-size: 36px;
  flex-shrink: 0;
  color: var(--surface-alt);
}

/* sessions */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.session-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--surface-alt);
}
.session-row:last-child {
  border-bottom: none;
}
.session-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
  flex-shrink: 0;
}
.session-info {
  flex: 1;
}
.session-info strong {
  font-size: 13.5px;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}
.session-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}
.session-current-tag {
  background: var(--accent);
  color: var(--surface);
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 700;
  margin-left: 6px;
}

/* ══════════════════════════════════════════════
    PERMISSIONS TAB
   ══════════════════════════════════════════════ */
.perm-categories {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.perm-category-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--surface-alt);
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 10px;
}
.perm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.perm-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
}
.perm-chip.has {
  background: var(--surface-alt);
  color: var(--success);
  border: 1.5px solid var(--accent-light);
}
.perm-chip.has i {
  color: var(--success);
}
.perm-chip.no {
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1.5px dashed var(--surface-alt);
}
.perm-chip.no i {
  color: var(--border);
}
.perm-chip.superuser {
  background: linear-gradient(135deg, var(--surface-alt), var(--surface-alt));
  color: var(--warning);
  border: 1.5px solid var(--warning);
}
.perm-chip.superuser i {
  color: var(--warning);
}

/* ══════════════════════════════════════════════
   ACTIVITY TAB
   ══════════════════════════════════════════════ */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.activity-timeline::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--surface-alt);
}
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  position: relative;
  animation: timelineIn 0.3s ease both;
}
@keyframes timelineIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.tl-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--surface);
  z-index: 1;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.tl-dot.sale {
  background: linear-gradient(135deg, var(--success), var(--success));
}
.tl-dot.login {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.tl-dot.perm {
  background: linear-gradient(135deg, var(--primary), var(--primary));
}
.tl-dot.stock {
  background: linear-gradient(135deg, var(--warning), var(--warning));
}
.tl-dot.user {
  background: linear-gradient(135deg, var(--primary), var(--primary));
}
.tl-dot.alert {
  background: linear-gradient(135deg, var(--danger), var(--danger));
}

.tl-body {
  flex: 1;
  background: var(--surface-alt);
  border: 1px solid var(--surface-alt);
  border-radius: 10px;
  padding: 12px 14px;
}
.tl-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.tl-title strong {
  color: var(--sidebar-bg-start);
}
.tl-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.tl-meta i {
  color: var(--border);
}

/* ══════════════════════════════════════════════
   PREFERENCES TAB
   ══════════════════════════════════════════════ */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--surface-alt);
}
.toggle-row:last-child {
  border-bottom: none;
}
.toggle-info {
  flex: 1;
}
.toggle-info strong {
  font-size: 14px;
  color: var(--text);
  display: block;
  margin-bottom: 3px;
}
.toggle-info p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  display: none;
}
.slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.25s;
}
.slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--surface);
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.toggle-switch input:checked + .slider {
  background: var(--accent);
}
.toggle-switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* danger rows */
.danger-row-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.danger-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--surface-alt);
}
.danger-row:last-child {
  border-bottom: none;
}
.danger-row-info {
  flex: 1;
}
.danger-row-info strong {
  font-size: 14px;
  color: var(--text);
  display: block;
  margin-bottom: 3px;
}
.danger-row-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: var(--surface);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(107, 124, 80, 0.3);
}
.btn-ghost {
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1.5px solid var(--surface-alt);
}
.btn-ghost:hover {
  background: var(--surface-alt);
}
.btn-warning {
  background: var(--warning);
  color: var(--surface);
}
.btn-warning:hover {
  background: var(--warning);
}
.btn-danger {
  background: var(--danger);
  color: var(--surface);
}
.btn-danger:hover {
  background: var(--danger);
}
.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ══════════════════════════════════════════════
   TOASTS
   ══════════════════════════════════════════════ */
#toastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toastOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .hero-stats {
    display: none;
  }
  .hero-card {
    gap: 22px;
  }
}
@media (max-width: 900px) {
  body {
    overflow: auto;
  }
  .app-shell {
    flex-direction: column;
    height: auto;
  }
  .sidebar {
    width: 100%;
    min-width: 100%;
    border-radius: 20px 20px 0 0;
    border-right: 3px solid var(--accent-dark);
    border-bottom: none;
  }
  .main-content {
    border-radius: 0 0 20px 20px;
    border-left: 3px solid var(--accent-dark);
    border-top: none;
    overflow: visible;
  }
  .hero-card {
    flex-direction: column;
    text-align: center;
  }
  .hero-identity {
    text-align: center;
  }
  .hero-meta {
    justify-content: center;
  }
  .hero-email,
  .hero-pharmacy {
    justify-content: center;
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .field-group.span-2 {
    grid-column: 1;
  }
}
@media (max-width: 600px) {
  .page-body {
    padding: 16px;
  }
  .hero-card {
    padding: 20px 18px;
  }
  .profile-card {
    padding: 18px;
  }
  .tab {
    padding: 9px 12px;
    font-size: 12px;
  }
  .card-actions {
    flex-direction: column;
  }
  .card-actions .btn {
    width: 100%;
    justify-content: center;
  }
}
