/* ===== Drawer overlay ===== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.drawer-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* ===== Drawer panel ===== */
.drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 300px;
  max-width: 88vw;
  background: var(--color-white);
  z-index: 201;
  box-shadow: 6px 0 32px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer.is-open {
  transform: translateX(0);
}

/* ===== Header ===== */
.drawer-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xl);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.drawer-user-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.drawer-user-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}

.drawer-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}
.drawer-close:hover {
  color: var(--color-text);
  background: var(--color-border);
}

/* ===== Nav list ===== */
.drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) 0;
}

/* ===== Accordion item ===== */
.drawer-item-head {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 14px var(--space-xl);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}
.drawer-item-head:hover {
  background: var(--color-bg);
}

.drawer-item-label {
  flex: 1;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--color-text);
}

.drawer-chevron {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  transition: transform 0.22s ease;
  line-height: 1;
}
.drawer-item.is-open .drawer-chevron {
  transform: rotate(90deg);
}

.drawer-item-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.drawer-item.is-open .drawer-item-body {
  max-height: 700px;
}

.drawer-body-inner {
  padding: var(--space-md) var(--space-xl) var(--space-xl);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

/* ===== Settings stepper ===== */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}
.setting-row:last-child { border-bottom: none; }

.setting-label {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.setting-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 2px 6px;
}

.stepper-btn {
  width: 24px; height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition-fast);
  line-height: 1;
}
.stepper-btn:hover { background: var(--navy-pale); }

.stepper-val {
  width: 46px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text);
  border: none;
  background: transparent;
  outline: none;
  -moz-appearance: textfield;
  padding: 0;
}
.stepper-val::-webkit-inner-spin-button,
.stepper-val::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-val:focus { color: var(--navy); }
.stepper-val.is-invalid { color: var(--danger); }

.settings-save-btn {
  width: 100%;
  margin-top: var(--space-md);
  padding: 9px 0;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-cn);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.settings-save-btn:hover:not(:disabled) { background: var(--navy-hover); }
.settings-save-btn:disabled { opacity: 0.6; cursor: default; }

/* ===== Account: avatar picker ===== */
.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-md);
}

.avatar-preview-btn {
  position: relative;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 2rem;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity var(--transition-fast);
  overflow: hidden;
}
.avatar-preview-btn:hover { opacity: 0.85; }

.avatar-change-hint {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 600;
  text-align: center;
  padding: 3px 0;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xs);
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  width: 100%;
}

.emoji-option {
  font-size: 1.5rem;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: all var(--transition-fast);
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1;
}
.emoji-option:hover,
.emoji-option.is-selected {
  border-color: var(--navy);
  background: var(--navy-pale);
}

/* ===== Account: info rows ===== */
.account-info-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--color-border);
}
.account-info-row:last-child { border-bottom: none; }
.account-info-label { color: var(--color-text-muted); }
.account-info-value { color: var(--color-text); font-weight: 500; }

/* ===== Help text ===== */
.drawer-help-text {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.75;
  margin: 0;
}
.drawer-help-text a {
  color: var(--color-primary);
  word-break: break-all;
}

/* ===== My data stats ===== */
.data-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--color-border);
}
.data-stat-row:last-child { border-bottom: none; }
.data-stat-label { color: var(--color-text-muted); }
.data-stat-value { color: var(--color-text); font-weight: 600; }

/* ===== Share options ===== */
.share-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.share-opt-btn {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 8px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-white);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  color: var(--navy);
  transition: border-color 0.18s ease, background 0.18s ease;
}
.share-opt-btn:hover {
  border-color: var(--navy);
  background: var(--navy-pale);
}
.share-opt-btn:active {
  background: var(--color-border);
}

.share-opt-icon {
  display: block;
  flex-shrink: 0;
}

.share-opt-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.share-unsupported {
  margin-top: var(--space-sm);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* ===== Footer ===== */
.drawer-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}
