:root {
  --bg: #f7f7f6;
  --card: #fff;
  --ink: #0b0b0b;
  --muted: #737373;
  --line: #e6e6e4;
  --soft: #f2f2f1;
  --blue: #1677d2;
  --green: #159a55;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(0,0,0,.045);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell { min-height: 100vh; background: var(--bg); }
.header {
  height: 62px; display: grid; grid-template-columns: 52px 1fr 96px; align-items: center;
  gap: 6px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { text-align: center; font-size: 20px; font-weight: 650; letter-spacing: .32em; padding-left: .32em; }
.header-actions { display:flex; justify-content:flex-end; gap: 12px; align-items:center; }
.icon-button { width: 38px; height: 38px; border: 0; background: transparent; display:grid; place-items:center; border-radius: 50%; color:#111; padding:0; cursor:pointer; }
.icon-button:hover { background: var(--soft); }
.icon { width: 21px; height: 21px; display:block; }

.main { width: min(100%, 620px); margin: 0 auto; padding: 20px 14px max(28px, env(safe-area-inset-bottom)); }

.profile-hero { display:grid; grid-template-columns: 102px 1fr auto; align-items:center; gap: 16px; padding: 8px 0 18px; }
.avatar-wrap { width: 102px; height: 102px; position:relative; }
.avatar { width: 102px; height: 102px; border-radius: 50%; background: radial-gradient(circle at 30% 20%, #323232 0, #171717 40%, #050505 100%); color:#fff; display:grid; place-items:center; font-family: Georgia, serif; font-size: 52px; font-weight: 300; letter-spacing:-.06em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.avatar-camera { position:absolute; right:-2px; bottom:6px; width:34px; height:34px; border-radius:50%; background:#fff; box-shadow:0 1px 7px rgba(0,0,0,.15); display:grid; place-items:center; }
.profile-name { font-size: 23px; font-weight: 740; line-height:1.05; margin:0 0 5px; }
.profile-email { color:var(--muted); font-size: 14px; margin-bottom:10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.member-badge { display:inline-flex; align-items:center; gap:7px; min-height:29px; border-radius:5px; padding:5px 10px; background:#ececeb; font-size:10px; font-weight:700; letter-spacing:.24em; text-transform:uppercase; white-space:nowrap; }
.edit-btn { border:1px solid #dadad8; border-radius:10px; background:#fff; height:43px; padding:0 13px; font-size:13px; font-weight:650; display:flex; align-items:center; gap:8px; cursor:pointer; }

.tabs { display:grid; grid-template-columns: repeat(5, 1fr); border-bottom:1px solid var(--line); background:#fff; margin:0 -14px 14px; padding:0 14px; }
.tab { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; min-height:63px; border:0; background:transparent; color:#252525; font-size:11px; cursor:pointer; padding:7px 2px 9px; }
.tab .icon { width:19px; height:19px; }
.tab.active { font-weight:700; }
.tab.active::after { content:""; position:absolute; height:3px; left:9px; right:9px; bottom:-1px; background:var(--blue); border-radius:3px 3px 0 0; }

.stack { display:grid; gap:12px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.card-pad { padding:13px 14px; }
.card-title-row { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:9px; }
.card-title { font-size:15px; line-height:1.2; font-weight:760; }
.card-link { border:0; background:transparent; padding:0; color:#2c2c2c; font-size:11px; cursor:pointer; display:flex; align-items:center; gap:4px; text-decoration:none; }

.order-body { display:grid; grid-template-columns:75px 1fr 126px; gap:10px; align-items:center; }
.product-thumb { width:75px; height:75px; border-radius:10px; background:var(--soft); object-fit:cover; }
.product-thumb.placeholder { display:grid; place-items:center; color:#777; }
.order-number { font-size:13px; font-weight:800; margin-bottom:3px; }
.order-product { font-size:12px; margin-bottom:4px; }
.order-meta { font-size:10px; color:var(--muted); }
.order-status { justify-self:end; min-width:118px; }
.status-live { display:flex; align-items:center; gap:6px; color:var(--green); font-size:12px; font-weight:760; margin-bottom:3px; }
.status-dot { width:8px; height:8px; border-radius:50%; background:var(--green); flex:0 0 auto; }
.status-sub { font-size:10px; color:var(--muted); }
.progress { display:grid; grid-template-columns: repeat(4, 1fr); margin:14px 4px 2px; position:relative; }
.progress::before { content:""; position:absolute; left:9%; right:9%; height:2px; top:6px; background:#d4d4d2; }
.progress-fill { position:absolute; left:9%; height:2px; top:6px; background:var(--blue); width:0; z-index:1; }
.progress-step { position:relative; z-index:2; display:flex; flex-direction:column; align-items:center; gap:5px; text-align:center; font-size:8px; color:#929292; }
.progress-dot { width:13px; height:13px; border-radius:50%; border:2px solid #d0d0ce; background:#fff; }
.progress-step.done, .progress-step.active { color:#222; }
.progress-step.done .progress-dot, .progress-step.active .progress-dot { border-color:var(--blue); background:#fff; box-shadow:inset 0 0 0 3px #fff; }
.progress-step.active .progress-dot { background:var(--blue); }
.track-row { display:flex; justify-content:flex-end; margin-top:7px; }
.black-btn { height:36px; background:#121212; color:#fff; border:0; border-radius:8px; padding:0 14px; font-size:11px; font-weight:700; display:flex; align-items:center; gap:8px; text-decoration:none; }
.empty-order { display:grid; grid-template-columns: 48px 1fr auto; align-items:center; gap:10px; }
.empty-icon { width:48px; height:48px; border-radius:10px; background:var(--soft); display:grid; place-items:center; color:#777; }
.empty-title { font-size:13px; font-weight:750; margin-bottom:4px; }
.empty-copy { color:var(--muted); font-size:11px; }
.outline-btn { height:37px; padding:0 12px; border:1px solid #d9d9d7; background:#fff; border-radius:9px; font-size:11px; font-weight:650; cursor:pointer; text-decoration:none; display:flex; align-items:center; gap:6px; }

.saved-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:9px; }
.saved-item { min-width:0; }
.saved-image { position:relative; aspect-ratio:1/1.1; border-radius:10px; background:var(--soft); overflow:hidden; display:grid; place-items:center; }
.saved-image img { width:100%; height:100%; object-fit:cover; }
.heart { position:absolute; right:6px; top:6px; width:27px; height:27px; background:#fff; border-radius:50%; display:grid; place-items:center; box-shadow:0 1px 5px rgba(0,0,0,.09); }
.saved-name { margin-top:6px; font-size:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.saved-price { margin-top:2px; font-size:9px; font-weight:650; }
.saved-empty { grid-column:1/-1; color:var(--muted); font-size:11px; padding:2px 0 1px; }

.preferences { display:grid; grid-template-columns:repeat(4,1fr); }
.pref { min-width:0; padding:3px 12px 2px; border-right:1px solid var(--line); }
.pref:first-child { padding-left:0; }
.pref:last-child { border-right:0; padding-right:0; }
.pref-icon { color:#222; margin-bottom:6px; }
.pref-label { font-size:9px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pref-value { margin-top:3px; font-size:11px; font-weight:760; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.support { display:grid; grid-template-columns:38px 1fr auto; gap:10px; align-items:center; }
.support-icon { display:grid; place-items:center; }
.support-title { font-size:13px; font-weight:760; }
.support-copy { color:var(--muted); font-size:10px; margin-top:2px; }
.logout { width:100%; height:40px; border:1px solid #d9d9d7; border-radius:10px; background:#fff; font-size:11px; font-weight:650; display:flex; justify-content:center; align-items:center; gap:8px; cursor:pointer; }

.section-page { display:grid; gap:12px; }
.page-heading { font-size:21px; font-weight:780; margin:2px 0 2px; }
.order-list { display:grid; gap:10px; }
.order-list-item { display:grid; grid-template-columns:58px 1fr auto; gap:10px; align-items:center; padding:12px; background:#fff; border:1px solid var(--line); border-radius:13px; }
.order-list-item img { width:58px; height:58px; object-fit:cover; border-radius:8px; background:var(--soft); }
.order-list-title { font-weight:750; font-size:12px; }
.order-list-meta { color:var(--muted); font-size:10px; margin-top:3px; }
.order-list-price { font-size:11px; font-weight:750; text-align:right; }
.profile-card { padding:14px; }
.field-label { font-size:10px; color:var(--muted); margin-bottom:4px; }
.field-value { font-size:12px; font-weight:650; }
.divider { height:1px; background:var(--line); margin:12px 0; }
.address { font-size:11px; line-height:1.45; }
.marketing-row { display:flex; justify-content:space-between; align-items:center; gap:16px; }
.switch { width:45px; height:25px; border-radius:99px; border:0; padding:3px; background:#d6d6d4; cursor:pointer; transition:.2s; }
.switch::after { content:""; display:block; width:19px; height:19px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.2); transition:.2s; }
.switch.on { background:var(--blue); }
.switch.on::after { transform:translateX(20px); }

.drawer-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.3); z-index:50; opacity:0; pointer-events:none; transition:.2s; }
.drawer { position:fixed; left:0; top:0; bottom:0; width:min(82vw,330px); background:#fff; z-index:51; transform:translateX(-105%); transition:.25s ease; padding:20px; }
.drawer-backdrop.open { opacity:1; pointer-events:auto; }
.drawer.open { transform:translateX(0); }
.drawer-brand { font-weight:760; letter-spacing:.22em; margin-bottom:26px; }
.drawer a { display:block; text-decoration:none; padding:12px 0; border-bottom:1px solid var(--line); font-size:14px; }

.modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:70; display:grid; place-items:end center; }
.modal { width:min(100%,620px); background:#fff; border-radius:18px 18px 0 0; padding:20px 18px max(22px, env(safe-area-inset-bottom)); box-shadow:0 -8px 30px rgba(0,0,0,.15); }
.modal-title { font-size:18px; font-weight:780; margin-bottom:16px; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.input-wrap label { display:block; font-size:10px; color:var(--muted); margin-bottom:5px; }
.input-wrap input { width:100%; height:43px; border:1px solid #d8d8d6; border-radius:9px; padding:0 11px; background:#fff; }
.modal-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:16px; }
.primary-btn { height:40px; border:0; border-radius:9px; background:#111; color:#fff; padding:0 15px; font-weight:700; cursor:pointer; }
.secondary-btn { height:40px; border:1px solid #d8d8d6; border-radius:9px; background:#fff; padding:0 15px; cursor:pointer; }

.loading, .auth-screen, .error-screen { min-height:calc(100vh - 62px); display:grid; place-items:center; padding:28px; text-align:center; }
.auth-card { max-width:380px; background:#fff; border:1px solid var(--line); border-radius:16px; padding:24px; box-shadow:var(--shadow); }
.auth-logo { font-size:21px; font-weight:700; letter-spacing:.3em; margin:0 0 12px; padding-left:.3em; }
.auth-copy { color:var(--muted); font-size:13px; line-height:1.5; margin-bottom:18px; }
.login-btn { width:100%; height:44px; border:0; border-radius:9px; background:#111; color:#fff; font-weight:720; cursor:pointer; }
.spinner { width:30px; height:30px; border:3px solid #ddd; border-top-color:#111; border-radius:50%; animation:spin .8s linear infinite; margin:0 auto 12px; }
@keyframes spin { to { transform:rotate(360deg); } }

.toast { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); background:#111; color:#fff; padding:10px 14px; border-radius:9px; font-size:12px; z-index:90; box-shadow:0 8px 24px rgba(0,0,0,.2); }

@media (max-width: 520px) {
  .main { padding-left:12px; padding-right:12px; }
  .tabs { margin-left:-12px; margin-right:-12px; padding-left:8px; padding-right:8px; }
  .profile-hero { grid-template-columns:82px minmax(0,1fr) auto; gap:11px; }
  .avatar-wrap, .avatar { width:82px; height:82px; }
  .avatar { font-size:42px; }
  .avatar-camera { width:31px; height:31px; right:-3px; bottom:2px; }
  .profile-name { font-size:19px; }
  .profile-email { font-size:12px; }
  .member-badge { font-size:8.5px; letter-spacing:.18em; padding:5px 7px; }
  .edit-btn { padding:0 10px; font-size:11px; height:39px; }
  .order-body { grid-template-columns:64px 1fr; }
  .product-thumb { width:64px; height:64px; }
  .order-status { grid-column:2; justify-self:start; margin-top:-3px; }
  .track-row { margin-top:9px; }
  .saved-grid { gap:7px; }
  .preferences .pref { padding-left:7px; padding-right:7px; }
  .pref-label { font-size:8px; }
  .pref-value { font-size:10px; }
  .support { grid-template-columns:34px 1fr auto; }
}

@media (max-width: 375px) {
  .brand { font-size:17px; }
  .header { grid-template-columns:42px 1fr 82px; padding:0 10px; }
  .header-actions { gap:4px; }
  .profile-hero { grid-template-columns:72px minmax(0,1fr); }
  .avatar-wrap, .avatar { width:72px; height:72px; }
  .avatar { font-size:36px; }
  .edit-btn { grid-column:2; justify-self:start; height:34px; margin-top:-4px; }
  .member-badge { white-space:normal; }
  .tab { font-size:9.5px; }
  .saved-name, .saved-price { font-size:8px; }
  .card-pad { padding:12px 10px; }
}
