/**
 * ACCOUNT-SETTINGS · account-hub.css · owner spec 2026-08-30.
 * ChatGPT/Claude spacing patterns · PixelMinify tokens · consumes pm-menu.
 * All tokens from public/app.css. No new colour introduced.
 */

.ah-app { color: var(--text); font-family: inherit; }
.ah-wrap { max-width: 1000px; margin: 0 auto; padding: 32px var(--page-gutter) 96px; }

.ah-page-head { margin-bottom: 36px; }
.ah-page-title { font-size: 26px; font-weight: 700; letter-spacing: -.025em; margin-bottom: 4px; }
.ah-page-sub   { font-size: 14px; color: var(--muted); }

/* Section head */
.ah-section-head { margin-bottom: 20px; }
.ah-section-title { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 4px; }
.ah-section-sub   { font-size: 13.5px; color: var(--muted); }

/* Layout */
.ah-layout { display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: start; }
.ah-nav { position: sticky; top: 110px; }
.ah-rail-list { list-style: none; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; }
.ah-rail-list-danger { margin-top: 0; }
.ah-rail-divider { height: 1px; background: var(--line); margin: 12px 8px; }

/* Rail items · CONSUME pm-menu tokens · zero drift */
.ah-rail-item {
  display: flex; align-items: center;
  gap: var(--pm-menu-item-gap);
  min-height: var(--pm-menu-item-h);
  padding: var(--pm-menu-item-py) var(--pm-menu-item-px);
  border-radius: var(--pm-menu-item-r);
  font-size: var(--pm-menu-item-fs); font-weight: var(--pm-menu-item-fw);
  color: var(--muted);
  transition: background .16s var(--ease), color .16s var(--ease);
  width: 100%; text-align: left;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.ah-rail-item svg {
  width: var(--pm-menu-icon-size); height: var(--pm-menu-icon-size);
  color: var(--muted-2); flex-shrink: 0; transition: color .16s var(--ease);
}
.ah-rail-item:hover { background: var(--pm-menu-hover-bg); color: var(--text); }
.ah-rail-item[aria-current="page"] { background: var(--pm-menu-active-bg); color: var(--text); font-weight: var(--pm-menu-item-fw-on); }
.ah-rail-item[aria-current="page"] svg { color: var(--pm-menu-active-icon); }
.ah-rail-item.danger { color: var(--bad); }
.ah-rail-item.danger svg { color: var(--bad); }
.ah-rail-item.danger:hover { background: color-mix(in oklab, var(--bad) 10%, transparent); color: var(--bad); }
.ah-rail-item.danger[aria-current="page"] { background: color-mix(in oklab, var(--bad) 12%, transparent); color: var(--bad); }

/* Main content column */
.ah-main { min-width: 0; max-width: 640px; }
.ah-main > * + * { margin-top: 0; }
.ah-main > .ah-section-head + * { margin-top: 0; }

/* Cards */
.ah-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 24px;
}
.ah-card + .ah-card { margin-top: 16px; }
.ah-card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.ah-card-desc  { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* Row */
.ah-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.ah-row:first-of-type { border-top: 0; padding-top: 4px; }
.ah-row-lbl { color: var(--muted); }
.ah-row-val { font-weight: 500; font-variant-numeric: tabular-nums; }
.ah-val-strong { font-weight: 600; }
.ah-val-mono   { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; }
.ah-val-good   { color: var(--good); }
.ah-val-warn   { color: var(--warn); }
.ah-val-muted  { color: var(--muted-2); }

/* Profile hero */
.ah-profile-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 16px;
}
.ah-avatar-lg {
  width: 68px; height: 68px; font-size: 24px; border-radius: 50%;
  background: var(--grad); display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; flex-shrink: 0; overflow: hidden;
}
.ah-avatar-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ah-who { flex: 1; min-width: 0; }
.ah-who-name  { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.ah-who-email { font-size: 13.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-provider-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted-2); padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 100px;
}

/* Plan hero */
.ah-plan-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 16px; position: relative; overflow: hidden;
}
.ah-plan-hero.is-pro { border-color: color-mix(in oklab, var(--brand) 40%, var(--line)); }
.ah-plan-name { display: flex; align-items: center; gap: 12px; }
.ah-plan-tag  {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 100px;
  background: var(--surface-3); color: var(--muted-2); border: 1px solid var(--line);
}
.ah-plan-hero.is-pro .ah-plan-tag {
  background: color-mix(in oklab, var(--brand) 18%, transparent);
  color: var(--brand-2);
  border-color: color-mix(in oklab, var(--brand) 45%, var(--line));
}
.ah-plan-n { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.ah-plan-price { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ah-plan-price em { font-style: normal; color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: 0; }

/* Compare (Free vs Pro) */
.ah-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.ah-compare-col {
  padding: 20px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.ah-compare-col.pro { border-color: color-mix(in oklab, var(--brand) 42%, var(--line)); }
.ah-compare-col h4 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; }
.ah-compare-col.pro h4 { color: var(--brand-2); }
.ah-compare-p { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.ah-compare-p em { font-style: normal; color: var(--muted); font-size: 13px; font-weight: 500; }
.ah-compare-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; padding: 0; flex: 1; }
.ah-compare-col li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.5; }
.ah-compare-col li svg { flex-shrink: 0; margin-top: 3px; color: var(--good); width: 14px; height: 14px; }
.ah-compare-col li.dim { color: var(--muted-2); }
.ah-compare-col li.dim svg { color: var(--muted-2); }

/* Buttons · consumes app tokens · min-height 40 for touch */
.ah-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  cursor: pointer; font-family: inherit; min-height: 40px;
  transition: all .18s var(--ease); white-space: nowrap;
}
.ah-btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.ah-btn:disabled { cursor: not-allowed; }
.ah-btn.primary {
  background: var(--brand); color: #fff; border-color: transparent;
  box-shadow: none;
}
.ah-btn.primary:hover { background: color-mix(in oklab, var(--brand) 88%, black); }
.ah-btn.ghost { background: transparent; }
.ah-btn.danger { color: var(--bad); border-color: color-mix(in oklab, var(--bad) 30%, var(--line)); background: color-mix(in oklab, var(--bad) 4%, var(--surface)); }
.ah-btn.danger:hover { background: color-mix(in oklab, var(--bad) 10%, var(--surface)); }
.ah-btn-block { width: 100%; justify-content: center; }
.ah-btn.is-dashed { border-style: dashed; }
.ah-btn-add { margin-top: 12px; }
.ah-btn-signout { margin-top: 20px; color: var(--muted); }

.ah-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Usage */
.ah-usage-primary { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; }
.ah-usage-n { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.ah-usage-n .big { font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ah-usage-n .tot { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ah-usage-track { width: 100%; height: 8px; background: var(--surface-3); border-radius: 100px; overflow: hidden; }
.ah-usage-fill  { height: 100%; background: var(--grad); border-radius: 100px; transition: width .5s var(--ease); }
.ah-usage-meta { display: flex; justify-content: space-between; margin-top: 12px; font-size: 12.5px; color: var(--muted-2); }

.ah-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 16px; }
.ah-stat { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.ah-stat-k { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.ah-stat-v { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ah-stat-s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* Brand */
.ah-brand-row { display: flex; align-items: center; gap: 16px; }
.ah-brand-thumb {
  width: 56px; height: 56px; border-radius: 10px; background: var(--surface-3);
  display: flex; align-items: center; justify-content: center; color: var(--muted-2); flex-shrink: 0;
}
.ah-brand-info { flex: 1; min-width: 0; }
.ah-brand-name { font-weight: 600; font-size: 15px; }
.ah-brand-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Danger */
.ah-danger-card {
  padding: 22px 24px; border-radius: var(--r-lg);
  background: color-mix(in oklab, var(--bad) 5%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--bad) 22%, var(--line));
}
.ah-danger-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.ah-danger-card .ah-card-title { color: var(--bad); }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE · edge-to-edge cards + horizontal-scroll rail (no wrap under)
   Owner rule 2026-08-30: cards nearly touch the screen edges, rail becomes
   a swipe carousel when translated labels would otherwise stack.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  /* Every mobile surface inside .ah-app aligns to --page-gutter exactly.
     The prior extra insets (page-head 4px, section-head 4px, rail-list 8px)
     added up so the rail zone rendered wider than the header/footer and
     the whole shell looked mismatched. Now every child aligns edge-flush
     to the wrap, and the wrap itself aligns to the canonical site-header
     and site-footer via the shared --page-gutter token. */
  .ah-wrap { padding: 16px var(--page-gutter) 40px; }
  .ah-page-head { margin-bottom: 20px; padding: 0; }
  .ah-page-title { font-size: 22px; }
  .ah-page-sub { font-size: 13.5px; }

  .ah-layout { grid-template-columns: 1fr; gap: 0; }

  /* Rail = true horizontal carousel. Never wraps regardless of label
     length (translation-safe: 'Facturación' or 'Datenschutzeinstellungen'
     scroll horizontally, they don't stack below). No internal padding —
     first chip aligns to the wrap's left edge, last chip runs off the
     right edge and reveals via scroll. Snap-to-item on release. */
  .ah-nav { position: static; margin-bottom: 20px; overflow: hidden; }
  .ah-rail-list, .ah-rail-list-danger {
    display: flex; flex-direction: row; flex-wrap: nowrap;
    gap: 6px; overflow-x: auto;
    padding: 4px 0 12px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    /* Fade the right edge so users see there's more to scroll — a common
       carousel affordance that adds no dependency. */
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
  }
  .ah-rail-list::-webkit-scrollbar, .ah-rail-list-danger::-webkit-scrollbar { display: none; }
  .ah-rail-list, .ah-rail-list-danger { scrollbar-width: none; }
  .ah-rail-list li { flex-shrink: 0; scroll-snap-align: start; }
  .ah-rail-item {
    padding: 10px 14px; min-height: 40px; white-space: nowrap; flex-shrink: 0;
  }
  .ah-rail-divider { display: none; }
  .ah-rail-list-danger { display: none; } /* Danger accessed via #danger hash */

  /* Section head aligns flush with the wrap edge */
  .ah-section-head { padding: 0; }

  .ah-main { max-width: none; }
  .ah-card, .ah-profile-hero, .ah-plan-hero, .ah-usage-primary, .ah-danger-card { padding: 18px 18px; }
  .ah-plan-price { font-size: 20px; }
  .ah-plan-n { font-size: 18px; }
  .ah-compare { grid-template-columns: 1fr; }
  .ah-profile-hero { flex-direction: column; align-items: flex-start; }
  .ah-avatar-lg { width: 52px; height: 52px; font-size: 19px; }

  .ah-section-head { margin-bottom: 14px; }
  .ah-section-title { font-size: 20px; }
  .ah-usage-n .big { font-size: 26px; }
}

/* Very narrow (≤400px) — squeeze inside padding a touch more.
   Keep parity with .site-header, which stays at 12px per app.css. */
@media (max-width: 400px) {
  .ah-wrap { padding: 12px var(--page-gutter) 32px; }
  .ah-card, .ah-profile-hero, .ah-plan-hero, .ah-usage-primary, .ah-danger-card { padding: 16px 14px; }
}
