/* ALY Settings — the glass dialog and its two sections.
   Same LUX/NEO tokens as the rest of ALY; nothing here invents a colour, a
   radius or a shadow. The card is the pattern the Plan & usage dialog set:
   fixed, centred, OPAQUE `var(--surface)` (a translucent overlay let the page
   read straight through it in NEO), one hairline, and a bottom sheet on a
   phone where a thumb is. */

.aly-settings-dialog-backdrop {
  position: fixed; inset: 0; z-index: 60; background: var(--scrim);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.aly-settings-dialog-backdrop[hidden] { display: none; }

.aly-settings-dialog {
  position: fixed; z-index: 61; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(760px, calc(100vw - 32px)); max-height: min(84vh, 760px);
  display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 16px; padding: 22px;
  border: 1px solid var(--surface-line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .38);
  font-size: 13px;
}
.aly-settings-dialog[hidden] { display: none; }

.aly-settings-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.aly-settings-dialog-title {
  margin: 2px 0 0; font-size: 20px; font-weight: 300; letter-spacing: .08em; color: var(--text);
}
.aly-settings-dialog-close { flex: none; min-height: 34px; min-width: 34px; }

/* Nav beside content on desktop; the whole body scrolls its own overflow rather
   than the page behind it. */
.aly-settings-dialog-body {
  display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 22px;
  min-height: 0;
}
.aly-settings-dialog-nav {
  display: grid; align-content: start; gap: 4px;
  border-right: 1px solid var(--surface-line); padding-right: 16px;
}
.aly-settings-dialog-tab {
  appearance: none; width: 100%; text-align: left; cursor: pointer;
  padding: 10px 12px; min-height: 38px;
  border: 1px solid transparent; border-radius: 6px; background: none;
  font: inherit; font-size: 11px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.aly-settings-dialog-tab:hover, .aly-settings-dialog-tab:focus-visible {
  color: var(--text); background: var(--glass-2); border-color: var(--hair-2);
}
.aly-settings-dialog-tab.is-active {
  color: var(--text); background: var(--glass); border-color: var(--hair-2);
}

.aly-settings-dialog-content { min-width: 0; min-height: 0; overflow-y: auto; }
.aly-settings-dialog-tabpanel { display: grid; gap: 16px; align-content: start; }
.aly-settings-dialog-tabpanel[hidden] { display: none; }

/* --- Account -------------------------------------------------------------- */

.aly-settings-dialog-section-head { display: grid; gap: 2px; }
.aly-settings-dialog-section-title {
  margin: 0; font-size: 16px; font-weight: 400; letter-spacing: .04em; color: var(--text);
}

.aly-settings-dialog-identity {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 12px 14px; border: 1px solid var(--hair-2); border-radius: 6px; background: var(--glass);
}
.aly-settings-dialog-avatar {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--glass-2); color: var(--text);
  font-size: 16px; font-weight: 600; line-height: 1;
}
.aly-settings-dialog-identity-text { min-width: 0; display: grid; gap: 2px; }
.aly-settings-dialog-identity-name {
  margin: 0; font-size: 14px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aly-settings-dialog-identity-sub { margin: 0; font-size: 12px; color: var(--muted); }

.aly-settings-dialog-fields { display: grid; gap: 14px; }
.aly-settings-dialog-field { display: grid; gap: 3px; }
.aly-settings-dialog-field-label {
  margin: 0; font-size: 10px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.aly-settings-dialog-field-value { margin: 0; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.aly-settings-dialog-field-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }

.aly-settings-dialog-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  border-top: 1px solid var(--surface-line); padding-top: 14px;
}
.aly-settings-dialog-actions .btn { letter-spacing: .06em; font-size: 12px; font-weight: 600; }
.aly-settings-dialog-foot { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* --- narrow: tabs across the top, dialog becomes a sheet ------------------ */

@media (max-width: 640px) {
  .aly-settings-dialog-body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .aly-settings-dialog-nav {
    grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px;
    border-right: none; border-bottom: 1px solid var(--surface-line);
    padding-right: 0; padding-bottom: 12px;
  }
  .aly-settings-dialog-tab { text-align: center; padding: 10px 8px; letter-spacing: .1em; }
}

@media (max-width: 560px) {
  .aly-settings-dialog {
    top: auto; bottom: 0; left: 0; transform: none;
    width: 100%; max-height: 88vh;
    border-radius: var(--radius) var(--radius) 0 0; border-bottom: none;
    padding-bottom: calc(22px + max(env(safe-area-inset-bottom, 0px), var(--alyssiun-safe-bottom, 0px)));
  }
}
