.profile-section { padding: 42px 0 100px; min-height: 70vh; }
.profile-loading { padding: 60px 0; color: var(--ink-soft); font-size: 15px; text-align: center; }

/* ---------- Shell: sidebar + main content ---------- */
.profile-shell { display: grid; grid-template-columns: 264px 1fr; gap: 26px; align-items: start; }

/* ---------- Sidebar ---------- */
.profile-sidebar {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 20px; position: sticky; top: 96px;
}
.sidebar-identity { text-align: center; padding-bottom: 20px; border-bottom: 1px solid rgba(19,41,32,0.1); }
.profile-big-avatar {
  width: 72px; height: 72px; border-radius: 50%; background: var(--forest); color: var(--gold);
  font-family: var(--serif); font-weight: 700; font-size: 28px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; margin: 0 auto 14px;
}
.sidebar-identity h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.sidebar-identity p { font-size: 13px; margin-top: 3px; word-break: break-word; }
.profile-badges { display: flex; justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.profile-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 5px 12px; border-radius: 999px;
  background: rgba(217,164,65,0.18); color: var(--gold-2);
}
.sidebar-member-since { font-size: 11.5px; color: var(--ink-soft); margin-top: 10px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; margin: 18px 0 4px; }
.sidebar-link {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 13px; border-radius: 10px; font-family: var(--sans); font-size: 14px; font-weight: 600;
  color: var(--ink-soft); background: transparent; border: none; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--paper-2); color: var(--forest); }
.sidebar-link.active { background: var(--forest); color: var(--cream-text); }
.sidebar-count {
  margin-left: auto; background: var(--coral); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.sidebar-link.active .sidebar-count { background: var(--gold); color: var(--forest); }

.sidebar-logout {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 13px; border-radius: 10px; font-family: var(--sans); font-size: 14px; font-weight: 600;
  color: var(--coral); background: transparent; border: none; cursor: pointer; margin-top: 14px;
  border-top: 1px solid rgba(19,41,32,0.1); padding-top: 18px;
}
.sidebar-logout svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-logout:hover { background: rgba(232,101,74,0.08); }

/* ---------- Main content ---------- */
.profile-main { min-width: 0; }
.profile-tab h1 {
  font-family: var(--serif); font-size: clamp(26px, 3.4vw, 38px); font-weight: 600;
  color: var(--forest); margin: 6px 0 26px;
}
#welcomeName { color: var(--coral); }

.profile-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; margin-bottom: 22px;
}
.profile-card h3 {
  font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--forest);
}
.card-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 10px; }
.card-head-sub { font-size: 13px; color: var(--ink-soft); }
.link-btn {
  background: none; border: none; color: var(--coral); font-weight: 700; font-size: 13.5px;
  cursor: pointer; font-family: var(--sans); white-space: nowrap;
}
.link-btn:hover { text-decoration: underline; }

/* Stats */
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 22px; }
.stat-card {
  background: var(--forest); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--cream-text);
}
.stat-num { display: block; font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--gold); }
.stat-label { font-size: 12.5px; color: rgba(244,239,226,0.7); margin-top: 6px; display: block; }

/* Forms (settings + billing address) */
#profileForm input[type="text"], #profileForm input[type="email"], #profileForm input[type="password"],
#billingForm input[type="text"], #billingForm input[type="tel"], #billingForm select {
  width: 100%; padding: 13px 16px; border-radius: 10px; border: 1.5px solid rgba(19,41,32,0.15);
  font-family: var(--sans); font-size: 14.5px; margin-bottom: 16px; background: var(--paper); color: var(--ink);
}
#profileForm input:disabled, #billingForm input:disabled { color: var(--ink-soft); cursor: not-allowed; opacity: 0.7; }
#billingForm select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A4A42' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 14px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field-hint { font-size: 12.5px; color: var(--ink-soft); margin: -6px 0 16px; }
#profileForm .pw-wrap, #billingForm .pw-wrap { margin-bottom: 16px; }
#profileForm .pw-wrap input { margin-bottom: 0; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-error {
  display: none; font-size: 13.5px; color: #b3372a; background: rgba(232,101,74,0.1);
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px;
}
.form-error.show { display: block; }
.form-success {
  display: none; font-size: 13.5px; color: #2f7a4d; background: rgba(47,122,77,0.12);
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px;
}
.form-success.show { display: block; }

/* Order history */
.order-list { display: flex; flex-direction: column; gap: 12px; }
.order-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; background: var(--paper); border-radius: 10px;
}
.order-row-main { display: flex; flex-direction: column; gap: 4px; }
.order-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; color: var(--gold-2); }
.order-title { font-family: var(--serif); font-size: 15.5px; font-weight: 600; color: var(--ink); }
.order-date { font-size: 12px; color: var(--ink-soft); }
.order-price { font-family: var(--serif); font-size: 16px; font-weight: 700; color: var(--forest); white-space: nowrap; }
.empty-orders { text-align: center; padding: 30px 10px; }
.empty-orders p { margin-bottom: 16px; }

@media (max-width: 900px) {
  .profile-shell { grid-template-columns: 1fr; }
  .profile-sidebar { position: static; }
  .sidebar-identity { padding-bottom: 16px; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; gap: 6px; margin: 16px 0 0; padding-bottom: 2px; }
  .sidebar-link { flex: 0 0 auto; white-space: nowrap; }
  .sidebar-logout { border-top: none; margin-top: 10px; padding-top: 0; justify-content: center; }
}
@media (max-width: 680px) {
  .profile-stats { grid-template-columns: 1fr; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .order-row { flex-direction: column; align-items: flex-start; }
  .card-head-row { flex-direction: column; align-items: flex-start; }
}
