/* Account page. Builds on /lib/base.css tokens. */

/* Same page backdrop and column as the builder (public/app/app.css). */
body {
  background-image: radial-gradient(ellipse at 50% 0%, rgba(230, 16, 13, 0.22), transparent 60%);
  background-repeat: no-repeat;
  min-height: 100vh;
  overflow-x: hidden;
}
.acct { max-width: 680px; margin: 0 auto; padding: 0 var(--space-2) calc(80px + env(safe-area-inset-bottom)); overflow-wrap: anywhere; }
.acct > .top { padding-left: 0; padding-right: 0; }
.acct [hidden] { display: none !important; }

/* Every account screen uses the builder's .step card. */
.acct-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: var(--space-3) var(--space-2);
  margin: 0 0 var(--space-3);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
}
.acct-card > h2 { margin: 0; }
.acct-card > p { margin: 0; }
.acct-text { margin: 0; max-width: 46ch; text-align: center; color: var(--muted); }
.acct-prose { width: 100%; max-width: 420px; text-align: left; }
/* Content blocks fill the card's centered 420px column. */
.acct-card > .stack, .acct-card > .code-box, .acct-card > .notice,
.acct-card > .acct-problem, .acct-card > .name-form { width: 100%; max-width: 420px; margin: 0; }
.acct-card > .wide { width: 100%; }
.acct-problem:empty, .stack > div:empty { display: none; }
.acct-loading { margin-top: 30vh; }
.acct h1:focus, .acct h2:focus { outline: none; }

@media (min-width: 900px) {
  .acct, .acct > .top { max-width: 760px; }
  .acct-card { padding: 28px 28px 30px; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.small { font-size: 0.92rem; }
.stack { display: grid; gap: var(--space-2); }
.stack > p { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.row .btn { flex: 1 1 140px; width: auto; margin: 0; }


/* Text-style button and link, still a big touch target. */
.link {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 14px;
  background: none; border: 0; color: var(--accent-hi);
  font: 600 1.05rem var(--font-body); text-decoration: underline; text-underline-offset: 4px;
  cursor: pointer;
}
.link:hover { color: var(--accent); }

/* Form fields */
.field { display: grid; gap: 4px; }
.field-label { font: 600 0.95rem var(--font-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); text-align: center; }
.field-help { color: var(--muted); font-size: 0.95rem; margin-bottom: 4px; text-align: center; }
.field input { font-size: 1.1rem; min-height: 52px; }
.code-input { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.08em; text-transform: uppercase; }

/* Notices */
.notice {
  border: 1px solid var(--line); background: var(--panel-2);
  border-radius: var(--radius); padding: 14px 16px; margin: 0;
  display: grid; gap: 12px;
}
.notice p { margin: 0; }
.notice-bad { border-color: var(--bad); }
.notice-bad p { color: var(--bad); }

/* Backup code */
.code-box {
  background: var(--panel-2); border: 2px solid var(--accent);
  border-radius: var(--radius); padding: var(--space-2);
  display: grid; gap: var(--space-2);
}
.code-box .label { margin: 0; }
.code-box .row .btn { flex-basis: 110px; font-size: 1rem; padding: 12px 12px; }
.code {
  font: 600 clamp(1.15rem, 5.4vw, 1.8rem)/1.2 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.04em; text-align: center; margin: 0;
  user-select: all; -webkit-user-select: all; overflow-wrap: anywhere;
}
.tick {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 48px; margin: 0; font-size: 1.1rem; font-weight: 600; cursor: pointer;
}
.tick input { width: 26px; height: 26px; }

/* Dashboard: header like the builder's, then the same cards. */
.dash-head { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.dash-head h1 { margin: 0; }
.dash-head .top-dates { margin: 0; }
.dash-head .link { margin: calc(-1 * var(--space-1)) 0; }
.name-form { width: 100%; max-width: 420px; display: grid; gap: var(--space-2); }
.name-form .row .btn { flex: 1 1 120px; }

.acct-card > .link-text {
  width: 100%; max-width: 420px;
  font: 600 clamp(0.85rem, 3.5vw, 1.05rem)/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin: 0; text-align: center; overflow-wrap: anywhere;
}
.acct-card > .small { max-width: 46ch; text-align: center; }

#stats { display: grid; gap: var(--space-1); }
#stats p { margin: 0; }
.big-num { font: 400 3.2rem/1 var(--font-head); text-align: center; color: var(--accent-hi); }

.bars {
  list-style: none; margin: var(--space-1) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  height: 150px; align-items: end;
}
.bar { display: grid; grid-template-rows: auto 1fr auto; height: 100%; justify-items: center; text-align: center; }
.bar-num { font-weight: 600; font-size: 0.95rem; }
.bar-fill {
  align-self: end; width: 100%; max-width: 40px;
  height: max(4px, var(--h)); border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
}
.bar-day { font-size: 0.78rem; color: var(--muted); margin-top: 6px; white-space: nowrap; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { text-align: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 6px; }
.tile-num { font: 400 2.2rem/1 var(--font-head); margin: 0 0 6px; }
.tile-label { margin: 0; font: 600 0.82rem var(--font-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.empty { text-align: center; display: grid; gap: 12px; justify-items: center; }
.empty p { margin: 0; color: var(--muted); max-width: 40ch; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
@media (min-width: 820px) { .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
.card {
  position: relative; width: 100%; display: grid; gap: 4px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 8px 12px; color: var(--text); font: inherit; cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: var(--accent-lo); }
.card:active { transform: scale(0.98); }
.card-img { display: block; aspect-ratio: 1; background: #000; border-radius: 10px; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card-title { font-weight: 600; line-height: 1.25; margin-top: 4px; }
.card-sub { color: var(--muted); font-size: 0.88rem; }
.card .badge { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font: 600 0.76rem var(--font-label); letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.st-private { background: #2a2424; color: var(--text); }
.st-pending { background: var(--accent); color: var(--ink); }
.st-approved { background: var(--ok); color: var(--ink); }
.st-rejected { background: var(--bad); color: var(--ink); }
.st-new { background: var(--brand); color: var(--text); }

/* On/off switch */
.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 0; cursor: pointer; width: 100%;
}
.switch-text { display: grid; gap: 2px; }
.switch-title { font-weight: 600; font-size: 1.05rem; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 60px; height: 36px; border-radius: 999px; margin: 0;
  background: #3a2a2a; border: 1px solid var(--line); position: relative; cursor: pointer;
  transition: background 0.25s ease;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px;
  border-radius: 50%; background: var(--text); transition: transform 0.25s ease;
}
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(24px); }
.switch input:focus-visible { outline: 3px solid var(--accent-hi); outline-offset: 3px; }
.settings-buttons p { margin: 0; }

/* Large image viewer */
.viewer {
  width: min(94vw, 720px); max-height: 94dvh; padding: 0;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 18px;
}
.viewer::backdrop { background: rgba(0, 0, 0, 0.8); }
.viewer-inner { padding: 20px 16px; display: grid; gap: 14px; }
.viewer-title { margin: 0; }
.viewer-sub { margin: -8px 0 0; }
.viewer-media { background: #000; border-radius: 12px; overflow: hidden; display: grid; place-items: center; }
.viewer-media img { max-width: 100%; max-height: 58dvh; object-fit: contain; display: block; }
.viewer-actions { display: grid; gap: 12px; }
.viewer-actions .row .btn { flex: 1 1 140px; }
.confirm { display: grid; gap: 12px; }
.confirm p { margin: 0; font-weight: 600; }
