/* Sangai Express — Profile / Account page */
.profile-page {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  color: var(--text-primary, #1a1a1a);
  font-family: var(--font-ui, Inter, sans-serif);
  padding: 0 0 24px;
}

.profile-page [hidden] { display: none !important; }

.profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 114px;
  padding: 24px 22px;
  margin: 0 0 18px;
  background: linear-gradient(120deg, #262626 0%, #3a3a3a 100%);
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 3px 8px rgba(0,0,0,.12);
}

.profile-avatar {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e0ad19, #b98508);
  border: 2px solid rgba(255,255,255,.22);
  color: #fff;
  font: 700 25px/1 var(--font-ui, Inter, sans-serif);
}

.profile-info { min-width: 0; }
.profile-info h1 {
  font: 700 20px/1.25 var(--font-serif, 'Playfair Display', Georgia, serif);
  color: #fff;
  margin: 0 0 3px;
}
.profile-email {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  font: 400 11px/1.5 var(--font-ui, Inter, sans-serif);
  color: rgba(255,255,255,.76);
  margin: 0 0 8px;
}
.profile-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 2px;
  background: var(--gold, #d4a017);
  color: #171717;
  font: 700 9px/1.2 var(--font-ui, Inter, sans-serif);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.profile-stat {
  min-width: 0;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--border, #dedede);
  border-radius: 5px;
  background: var(--bg-card, #fff);
  color: inherit;
  text-align: center;
  text-decoration: none;
}
.profile-stat-link { cursor: pointer; transition: border-color .15s, background .15s; }
.profile-stat-link:hover { border-color: var(--primary-mid, #555); background: var(--bg-alt, #f5f5f5); }
.profile-stat-num {
  font: 700 18px/1.1 var(--font-serif, 'Playfair Display', Georgia, serif);
  color: var(--text-primary, #1a1a1a);
  margin-bottom: 3px;
}
.profile-stat-label {
  color: var(--text-muted, #888);
  font: 500 8px/1.3 var(--font-ui, Inter, sans-serif);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.profile-section {
  padding: 16px 16px 10px;
  margin: 0 0 14px;
  border: 1px solid var(--border, #dedede);
  border-radius: 5px;
  background: var(--bg-card, #fff);
}
.profile-section > h2 {
  margin: 0 0 6px;
  padding: 0 0 9px;
  border-bottom: 1px solid var(--border-light, #eee);
  color: var(--text-muted, #888);
  font: 700 9px/1.25 var(--font-ui, Inter, sans-serif);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.profile-rows { width: 100%; }
.profile-row {
  width: 100%;
  min-height: 37px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid var(--border-pale, #f4f4f4);
  background: transparent;
  color: var(--text-primary, #1a1a1a);
  text-align: left;
  text-decoration: none;
  font: inherit;
}
.profile-rows > :last-child { border-bottom: 0; }
.profile-row-action { cursor: pointer; }
.profile-row-action:hover,
.profile-row[href]:hover {
  background: var(--bg-alt, #f5f5f5);
  box-shadow: 10px 0 0 var(--bg-alt, #f5f5f5), -10px 0 0 var(--bg-alt, #f5f5f5);
}
.profile-row:focus-visible,
.profile-stat-link:focus-visible,
.profile-switch:focus-visible,
.profile-signout:focus-visible {
  outline: 2px solid var(--primary, #222);
  outline-offset: 2px;
}
.profile-row-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-primary, #1a1a1a);
  font: 500 10px/1.35 var(--font-ui, Inter, sans-serif);
}
.profile-row-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--bg-alt, #f5f5f5);
  font-size: 12px;
}
.profile-row-value {
  flex: 0 0 auto;
  max-width: 44%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary, #555);
  font: 400 9px/1.4 var(--font-ui, Inter, sans-serif);
}
.profile-row-chev { flex: 0 0 auto; color: var(--text-faded, #aaa); font-size: 18px; line-height: 1; }

.profile-switch {
  position: relative;
  width: 24px;
  height: 14px;
  flex: 0 0 24px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: #ccc;
  cursor: pointer;
  transition: background .16s ease;
}
.profile-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
  transition: transform .16s ease;
}
.profile-switch.is-on { background: #27ae60; }
.profile-switch.is-on::after { transform: translateX(10px); }

.profile-signout {
  width: 100%;
  min-height: 31px;
  padding: 8px 12px;
  border: 1px solid #c92e2e;
  border-radius: 4px;
  background: transparent;
  color: #b51e1e;
  font: 500 10px/1.3 var(--font-ui, Inter, sans-serif);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.profile-signout:hover { background: #b51e1e; color: #fff; }

.profile-dialog {
  width: min(460px, calc(100% - 32px));
  max-width: 460px;
  padding: 0;
  border: 1px solid var(--border, #ddd);
  border-radius: 8px;
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a1a1a);
  box-shadow: 0 18px 60px rgba(0,0,0,.22);
}
.profile-dialog::backdrop { background: rgba(0,0,0,.42); }
.profile-dialog form { padding: 20px; }
.profile-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-dialog-header h2 { margin: 0; font: 700 19px/1.25 var(--font-serif, 'Playfair Display', Georgia, serif); }
.profile-dialog-x { border: 0; background: transparent; color: var(--text-secondary, #555); font-size: 25px; cursor: pointer; }
.profile-dialog-message { margin: 12px 0 0; color: var(--text-secondary, #555); font: 400 13px/1.65 var(--font-ui, Inter, sans-serif); }
.profile-edit-fields { display: grid; gap: 12px; margin-top: 16px; }
.profile-edit-fields label { display: grid; gap: 5px; color: var(--text-secondary, #555); font: 600 11px/1.4 var(--font-ui, Inter, sans-serif); }
.profile-edit-fields input { width: 100%; padding: 10px 11px; border: 1px solid var(--border, #ddd); border-radius: 4px; background: var(--bg-page, #fafafa); color: var(--text-primary, #1a1a1a); font: 400 13px/1.4 var(--font-ui, Inter, sans-serif); }
.profile-edit-fields input:focus { outline: 2px solid var(--primary, #222); outline-offset: 1px; }
.profile-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.profile-dialog-close-btn,
.profile-dialog-save-btn { padding: 9px 13px; border: 1px solid var(--border, #ddd); border-radius: 4px; background: transparent; color: var(--text-primary, #222); font: 600 11px/1.2 var(--font-ui, Inter, sans-serif); cursor: pointer; }
.profile-dialog-save-btn { border-color: var(--primary, #222); background: var(--primary, #222); color: #fff; }

[data-mode="dark"] .profile-page .profile-section,
[data-mode="dark"] .profile-page .profile-stat { background: var(--bg-card, #1a1a1a); }
[data-mode="dark"] .profile-page .profile-row-action:hover,
[data-mode="dark"] .profile-page .profile-row[href]:hover { background: var(--bg-alt, #222); box-shadow: 10px 0 0 var(--bg-alt, #222), -10px 0 0 var(--bg-alt, #222); }

@media (min-width: 1000px) {
  .profile-page { padding-top: 0; }
  .profile-hero { min-height: 114px; }
}
@media (max-width: 640px) {
  .profile-hero { gap: 13px; min-height: 96px; padding: 18px 14px; }
  .profile-avatar { width: 52px; height: 52px; flex-basis: 52px; font-size: 21px; }
  .profile-info h1 { font-size: 18px; }
  .profile-email { font-size: 10px; }
  .profile-stats { gap: 7px; margin-bottom: 14px; }
  .profile-stat { min-height: 54px; padding: 8px 5px; }
  .profile-stat-num { font-size: 17px; }
  .profile-stat-label { font-size: 7px; letter-spacing: .08em; }
  .profile-section { padding: 14px 12px 8px; margin-bottom: 12px; }
  .profile-row { min-height: 39px; gap: 8px; }
  .profile-row-label { gap: 7px; font-size: 10px; }
  .profile-row-value { max-width: 36%; font-size: 8px; }
}
