* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-rounded, 'SF Pro Rounded', 'Avenir Next', 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* A calm backdrop for the glass to sit on. Tints stay under 15%. */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg::before, .bg::after { content: ''; position: absolute; border-radius: 50%; filter: blur(70px); }
.bg::before { width: 60vmax; height: 60vmax; left: -22vmax; top: -26vmax; background: rgba(88, 27, 108, 0.14); }
.bg::after { width: 52vmax; height: 52vmax; right: -20vmax; bottom: -24vmax; background: rgba(217, 54, 134, 0.12); }
@media (prefers-color-scheme: dark) {
  .bg::before { background: rgba(120, 50, 150, 0.22); }
  .bg::after { background: rgba(217, 54, 134, 0.14); }
}

h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0; }
a { color: var(--purple); }
@media (prefers-color-scheme: dark) { a { color: #e3b6f2; } }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar (glass) */
.topbar {
  position: sticky; top: 8px; z-index: 20;
  margin: 8px 16px 0; padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  border-radius: 18px;
  max-width: 1040px; margin-inline: auto; width: calc(100% - 32px);
}
.topbar[hidden] { display: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.01em; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  display: grid; place-items: center;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand small { font-weight: 600; color: var(--muted); }
.spacer { flex: 1; }
.who { font-size: 0.9rem; color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .who { display: none; } }

/* Buttons and fields */
.btn {
  font: inherit; font-weight: 650; cursor: pointer;
  min-height: 44px; padding: 0 20px; border-radius: 14px;
  border: 1px solid transparent; background: var(--btn); color: var(--btn-text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 16px rgba(88, 27, 108, 0.28);
}
.btn:hover:not(:disabled) { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 22px rgba(217, 54, 134, 0.35); }
.btn:disabled { opacity: 0.65; cursor: default; }
.btn { white-space: nowrap; }
.btn.block { width: 100%; }
.short { display: none; }
@media (max-width: 520px) {
  .long { display: none; }
  .short { display: inline; }
  .topbar { padding: 8px 10px; gap: 8px; }
}
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 0.9rem; border-radius: 12px; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); box-shadow: none; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--purple); text-decoration: underline; cursor: pointer; min-height: 32px; }
@media (prefers-color-scheme: dark) { .link { color: #e3b6f2; } }
.link:disabled { color: var(--muted); text-decoration: none; cursor: default; }

label { display: block; font-weight: 650; margin-bottom: 6px; }
input[type='email'], input[type='text'], input[type='password'], input[inputmode='numeric'] {
  width: 100%; min-height: 48px; padding: 0 14px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
input:focus { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(217, 54, 134, 0.16); outline: none; }
input.code { font-size: 1.8rem; letter-spacing: 0.45em; text-align: center; font-weight: 700; padding-left: 0.45em; }
input[aria-invalid='true'] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 0.92rem; min-height: 1.4em; margin-top: 6px; }

/* Layout */
main { max-width: 1040px; margin: 0 auto; padding: 28px 16px 56px; }
.page-head { margin: 8px 0 22px; }
.page-head h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); font-weight: 750; }
.page-head h1 span { background: linear-gradient(90deg, var(--purple), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (prefers-color-scheme: dark) { .page-head h1 span { background: linear-gradient(90deg, #d9a6ec, var(--pink)); -webkit-background-clip: text; background-clip: text; } }
.page-head p { margin-top: 6px; }

/* Sign in */
.signin { max-width: 440px; margin: 7vh auto 0; padding: 28px 24px; }
.signin h1 { font-size: 1.6rem; margin-bottom: 6px; }
.signin .row { margin-top: 18px; }
.signin .small-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 0.92rem; flex-wrap: wrap; }
.success { display: grid; place-items: center; gap: 12px; padding: 28px 0 8px; text-align: center; }
.success svg { width: 64px; height: 64px; }
.success circle { fill: none; stroke: var(--ok); stroke-width: 3; opacity: 0.35; }
.success path { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tile {
  --glass-bg: rgba(255, 255, 255, 0.74);
  position: relative; text-align: left; font: inherit; color: var(--text);
  padding: 18px; display: grid; gap: 14px; cursor: pointer; width: 100%;
}
@media (prefers-color-scheme: dark) { .tile { --glass-bg: rgba(38, 31, 52, 0.7); } }
.tile .icon {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow: 0 6px 14px rgba(88, 27, 108, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.tile .icon svg { width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile h2 { font-size: 1.08rem; font-weight: 700; }
.tile p { color: var(--muted); font-size: 0.93rem; margin-top: 2px; }
.tile .go { position: absolute; right: 16px; top: 18px; opacity: 0.55; transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease); }
.tile .go svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .tile:hover:not([aria-disabled='true']) .go { transform: translateX(3px); opacity: 1; } }
.tile .badge { display: inline-block; font-size: 0.8rem; font-weight: 650; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tile[aria-disabled='true'] { cursor: default; opacity: 0.82; }
.tile[aria-disabled='true'] .icon { filter: grayscale(0.7); }
.tile[aria-disabled='true'] .go { display: none; }
.tile.busy { pointer-events: none; }
.tile.busy .go { opacity: 1; }

.empty { padding: 28px 22px; text-align: center; }
.empty h2 { font-size: 1.15rem; margin-bottom: 6px; }

/* Panels (solid: content never sits on glass) */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.panel h2 { font-size: 1.1rem; margin-bottom: 12px; }
.tabs { position: relative; display: inline-flex; gap: 2px; padding: 4px; border-radius: 16px; margin-bottom: 16px; max-width: 100%; overflow-x: auto; }
.tab {
  position: relative; z-index: 1; font: inherit; font-weight: 650; color: var(--muted); background: none; border: 0;
  min-height: 40px; padding: 0 16px; border-radius: 12px; cursor: pointer; white-space: nowrap;
}
.tab[aria-selected='true'] { color: var(--btn-text); }
.tab-pill {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 12px; background: var(--btn);
  transition: transform var(--t-med) var(--ease), width var(--t-med) var(--ease);
}
.rows { display: grid; gap: 0; }
.row-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.row-item:first-child { border-top: 0; }
.row-item .meta { font-size: 0.88rem; color: var(--muted); }
.row-item .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: 6px; }
.pill.bad { background: rgba(168, 45, 26, 0.12); color: var(--danger); }
.pill.good { background: rgba(25, 120, 63, 0.14); color: var(--ok); }
.tick { font-weight: 800; margin-right: 8px; }
.tick.ok { color: var(--ok); }
.tick.no { color: var(--danger); }
.fix { grid-column: 1 / -1; font-size: 0.92rem; color: var(--muted); }
@media (max-width: 560px) { .row-item { grid-template-columns: 1fr; } .row-item .actions { justify-content: flex-start; } }

/* Sheet (re-confirm) */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(20, 10, 30, 0.45); animation: fade var(--t-med) var(--ease) both; }
.sheet { --glass-bg: rgba(255, 255, 255, 0.94); width: min(420px, 100%); padding: 24px; animation: pop var(--t-med) var(--ease) both; }
@media (prefers-color-scheme: dark) { .sheet { --glass-bg: rgba(34, 28, 48, 0.94); } }
.sheet h2 { margin-bottom: 6px; }
.sheet .row { margin-top: 16px; }
.sheet .btns { display: flex; gap: 10px; margin-top: 16px; }
.sheet .btns .btn { flex: 1; }

/* Toasts */
#toasts { position: fixed; z-index: 60; left: 0; right: 0; bottom: 18px; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; padding: 12px 18px; border-radius: 16px; max-width: 460px; font-weight: 600; animation: toast-in var(--t-med) var(--ease) both; }
.toast.error { border-color: var(--danger); }

.footer { text-align: center; color: var(--muted); font-size: 0.88rem; padding: 0 16px 28px; }
.footer a { margin: 0 8px; }
.doc { max-width: 720px; margin: 0 auto; padding: 24px 16px 56px; }
.doc h1 { margin: 12px 0; font-size: 1.8rem; }
.doc h2 { margin: 24px 0 8px; font-size: 1.2rem; }
.doc p, .doc li { margin: 8px 0; }
