/* SavAccount — on top of SavComponents (Tilt): square shapes whose background leans a little, text always upright. */
* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body { min-height: 100vh; min-height: 100dvh; }
#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
a, .link { color: color-mix(in oklab, var(--sav-color-primary) var(--sav-tint, 52%), var(--sav-color-text)); }
h1 { margin: 0; font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
h2 { margin: 0; font-size: 1.1rem; letter-spacing: -.01em; }
h3 { margin: 0; font-size: .95rem; }
p { margin: 0; }
img { display: block; }
code { font-family: var(--sav-font-mono); font-size: .88em; padding: .1em .35em; background: var(--sav-color-surface-2); overflow-wrap: anywhere; }
.muted { color: var(--sav-color-text-muted); }
.small { font-size: var(--sav-font-size-sm); }
.break { overflow-wrap: anywhere; }
.grow { flex: 1; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 50; padding: .5rem 1rem; background: var(--sav-color-primary); color: var(--sav-color-on-primary); }
.skip:focus { top: .5rem; }
.stack { display: grid; gap: 1.1rem; min-width: 0; }
.stack.tight { gap: .65rem; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1.1rem; }
.between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .7rem; }
.actions.start { justify-content: flex-start; }
.actions > .muted { margin-right: auto; }
.links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.link { padding: .2rem 0; border: 0; background: none; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link:disabled { opacity: .5; cursor: default; }
:is(a, .link, main):focus-visible { outline: 2px solid var(--sav-color-focus); outline-offset: 3px; }
main:focus { outline: none; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .25rem; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0 0 .5rem; font-weight: var(--sav-font-weight-bold); }

/* a box with a tinted plate leaning behind it */
.layered { position: relative; isolation: isolate; }
.layered::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--sav-color-surface); border: 1px solid var(--sav-color-border); }
.layered::before { content: ""; position: absolute; inset: 0; z-index: -2; background: color-mix(in oklab, var(--sav-color-primary) 20%, transparent); transform: rotate(var(--lean, -.7deg)); transition: transform .3s var(--sav-easing); }
.layered:nth-of-type(even)::before { --lean: .6deg; }

/* ---------- frame */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; padding: .4rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in oklab, var(--sav-color-bg) 86%, transparent); backdrop-filter: saturate(1.5) blur(12px); -webkit-backdrop-filter: saturate(1.5) blur(12px); border-bottom: 1px solid var(--sav-color-border); }
.top-actions, .corner { display: flex; align-items: center; gap: .5rem; }
.corner { position: absolute; top: .8rem; right: 1rem; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--sav-color-text); text-decoration: none; font-size: 1.15rem; letter-spacing: -.01em; }
.brand b { font-weight: 800; }
.brand img { transition: transform .3s var(--sav-easing); }
.brand:hover img { transform: rotate(-10deg); }
.page, .shell { flex: 1; width: 100%; }
.page > main.public { max-width: 1080px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 4rem) clamp(1rem, 4vw, 2.5rem); }
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); max-width: 1120px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 4rem; }
.shell > main { display: grid; align-content: start; gap: 1.8rem; }
.side { position: sticky; top: 96px; align-self: start; display: grid; gap: .3rem; }
.side a { position: relative; isolation: isolate; display: flex; align-items: center; gap: .7rem; padding: .6rem .85rem; color: var(--sav-color-text); text-decoration: none; }
.side a::before { content: ""; position: absolute; inset: 0; z-index: -1; transition: background .15s; }
.side a:hover::before { background: var(--sav-color-surface-2); }
.side a[aria-current] { color: var(--sav-color-on-primary); font-weight: var(--sav-font-weight-semibold); }
.side a[aria-current]::before { background: var(--sav-color-primary); transform: rotate(-1.4deg); }
.side hr { width: 100%; margin: .6rem 0; border: 0; border-top: 1px solid var(--sav-color-border); }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem 2rem; padding: 1.2rem clamp(1rem, 4vw, 2.5rem); border-top: 1px solid var(--sav-color-border); font-size: var(--sav-font-size-sm); color: var(--sav-color-text-muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.wait { display: grid; place-items: center; min-height: 40vh; }

.lang { width: 11.5rem; }

/* ---------- landing */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; gap: 2rem; }
.hero h1 { font-size: clamp(2rem, 1.3rem + 3.4vw, 3.4rem); line-height: 1.06; }
.lead { margin: 1.2rem 0 1.8rem; max-width: 34rem; font-size: 1.1rem; color: var(--sav-color-text-muted); }
.hero-art { position: relative; display: grid; place-items: center; }
.hero-art::before, .hero-art::after { content: ""; position: absolute; width: 62%; aspect-ratio: 1; background: color-mix(in oklab, var(--sav-color-primary) 13%, transparent); transform: rotate(-8deg) translate(-9%, 7%); z-index: -1; }
.hero-art::after { transform: rotate(22deg) translate(10%, 4%); }
.hero-art img { width: min(100%, 320px); height: auto; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1.6rem; margin-top: clamp(2.5rem, 6vw, 4.5rem); }
.feature { display: grid; align-content: start; gap: .5rem; padding: 1.4rem; }
.feature:nth-of-type(even)::before { --lean: 1.2deg; }
.feature > sav-icon { font-size: 1.6rem; color: color-mix(in oklab, var(--sav-color-primary) var(--sav-tint), var(--sav-color-text)); }

/* ---------- centred card: sign in, consent… */
.auth { display: grid; justify-items: center; align-content: center; gap: 1.4rem; min-height: calc(100vh - 70px); padding: 4.5rem 1rem 2.5rem; }
.auth-card { display: grid; gap: 1.1rem; width: min(100%, 27rem); padding: clamp(1.4rem, 5vw, 2.2rem); }
.auth-card::before { --lean: -1.6deg; background: color-mix(in oklab, var(--sav-color-primary) 34%, transparent); }
.auth-foot { text-align: center; }
.pair { display: flex; align-items: center; gap: .8rem; }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: var(--sav-font-size-sm); overflow-wrap: anywhere; }
.scopes { display: grid; gap: .5rem; margin: .6rem 0 0; padding: 0; list-style: none; }
.scopes li { display: flex; gap: .6rem; }
.scopes sav-icon { flex: none; margin-top: .2rem; color: color-mix(in oklab, var(--sav-color-success) 75%, var(--sav-color-text)); }
.scopes small { display: block; color: var(--sav-color-text-muted); overflow-wrap: anywhere; }
.consent h2 { margin-bottom: .5rem; font-size: .95rem; }
.svc-logo { flex: none; width: 56px; height: 56px; object-fit: contain; }
.svc-logo.tile { position: relative; isolation: isolate; display: grid; place-items: center; font-size: 1.4rem; font-weight: 800; color: var(--sav-color-on-primary); text-transform: uppercase; }
.svc-logo.tile::before { content: ""; position: absolute; inset: 5px; z-index: -1; background: var(--sav-color-primary); transform: rotate(10deg); }

/* ---------- account */
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; }
.page-head p { margin-top: .35rem; max-width: 44rem; }
.panel { display: grid; gap: 1rem; padding: clamp(1.1rem, 3vw, 1.6rem); }
.panel.center { justify-items: center; max-width: 36rem; margin: 2rem auto; }
.rows { margin: 0; padding: 0; list-style: none; }
.rows li { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; padding: .85rem 0; }
.rows li + li { border-top: 1px solid var(--sav-color-border); }
.rows li:first-child { padding-top: 0; }
.rows li:last-child { padding-bottom: 0; }
.rows li > sav-icon { flex: none; font-size: 1.25rem; color: var(--sav-color-text-muted); }
.rows .grow { flex: 1 1 12rem; }
.row-actions { display: flex; align-items: center; gap: .4rem; }
.app-head { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; }
.app-head .grow { flex: 1 1 10rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 1.4rem; }
.stat { display: grid; padding: 1rem 1.2rem; }
.stat b { font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--sav-font-size-sm); color: var(--sav-color-text-muted); }
.key { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.key > span { flex: none; }
.key code { flex: 0 1 auto; min-width: 0; padding: .35em .6em; }
.key sav-copy-button { flex: none; }
/* several keys: names, values and buttons line up in columns */
.keys { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .9rem .8rem; }
.keys .key { display: contents; }
sav-dialog:has(.keys) { --width: 37rem; }   /* a whole secret on one line */
.qr { width: min(100%, 200px); margin: 0 auto; border: 1px solid var(--sav-color-border); }
.qr svg { display: block; width: 100%; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0; padding: 0; list-style: none; text-align: center; }
.codes code { display: block; padding: .5em; font-size: 1rem; letter-spacing: .04em; }

/* the boxes of a code are centred, with their label */
sav-otp::part(form-control) { justify-items: center; align-items: center; }
sav-otp::part(base) { justify-content: center; }
sav-otp::part(label) { justify-content: center; text-align: center; }
.qr + .key { justify-content: center; }

/* ---------- texts */
.doc { max-width: 44rem; margin: 0 auto; line-height: 1.7; }
.doc h2 { margin: 2rem 0 .5rem; }
.doc p + p { margin-top: .6rem; }
.doc h1 + p { margin-top: 1rem; }
.doc pre { margin: .6rem 0 1rem; padding: 1rem; overflow-x: auto; background: var(--sav-code-bg); border-left: 4px solid var(--sav-color-primary); }
.doc pre code { padding: 0; background: none; overflow-wrap: normal; }

/* ---------- docs */
.page > main.wide { max-width: 1180px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem); }
.docs { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); }
.docs .doc { max-width: 52rem; margin: 0; min-width: 0; }
.docs .doc > section { padding-top: 1.2rem; scroll-margin-top: 70px; }
.docs h3 { margin: 1.4rem 0 .4rem; }
.docs .lead { margin: .8rem 0 1.2rem; }
.docs ul, .docs ol { display: grid; gap: .45rem; padding-left: 1.25rem; }
.docs sav-code-block, .docs sav-alert, .docs .scroll, .docs sav-tabs { margin: .9rem 0 1.2rem; }
.toc { position: sticky; top: 90px; align-self: start; display: grid; gap: .1rem; font-size: .92rem; }
.toc b { padding: 0 .7rem .4rem; }
.toc a { padding: .38rem .7rem; color: var(--sav-color-text-muted); text-decoration: none; border-left: 3px solid var(--sav-color-border); }
.toc a:hover { color: var(--sav-color-text); }
.toc a[aria-current] { color: var(--sav-color-text); font-weight: var(--sav-font-weight-semibold); border-color: var(--sav-color-primary); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.docs table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.5; }
.docs :is(th, td) { padding: .55rem .8rem .55rem 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--sav-color-border); overflow-wrap: anywhere; }
.docs td:first-child { width: 34%; }
.docs th { font-size: .8rem; color: var(--sav-color-text-muted); }
.checks { list-style: none; padding: 0 !important; }
.checks li { position: relative; padding-left: 1.7rem; }
.checks li::before { content: ""; position: absolute; left: .1rem; top: .42em; width: .8rem; height: .8rem; background: var(--sav-color-primary); transform: rotate(10deg); }
.maker { display: grid; gap: 1.1rem; margin: 1.2rem 0 1.6rem; padding: 1.2rem; }
.maker-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.6rem, 1fr)); gap: .8rem; }
.maker-view { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.maker-view > div { display: grid; place-items: center; min-height: 110px; padding: 1rem; min-width: 0; }
.on-light { background: #fff; } .on-dark { background: #0f121b; }
.maker sav-code-block { margin: 0; }

/* ---------- phones */
.short, .switch { display: none; }
@media (max-width: 820px) {
  /* 16px: below it iOS zooms the page when a field is touched */
  :root { --sav-font-size-md: 1rem; --sav-font-size-sm: .875rem; }
  body { -webkit-tap-highlight-color: transparent; }
  .shell { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 1.2rem; padding-top: 1.3rem; padding-bottom: 2rem; }
  .shell > main { gap: 1.4rem; }
  /* the sections of the account: a bar at the bottom, under the thumb */
  .has-bar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .side { position: fixed; inset: auto 0 0 0; top: auto; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; padding: 0 max(.2rem, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(.2rem, env(safe-area-inset-left));
    background: color-mix(in oklab, var(--sav-color-surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--sav-color-border); }
  .side a { flex-direction: column; justify-content: center; gap: .22rem; min-height: 60px; padding: .4rem .1rem; font-size: .66rem; line-height: 1; text-align: center; }
  .side a sav-icon { font-size: 1.3rem; }
  .side a::before { inset: 5px 3px; }
  .side a:hover::before { background: none; }
  .side a:is([aria-current], [data-near])::before { background: var(--sav-color-primary); transform: rotate(-2deg); }
  .side a:is([aria-current], [data-near]) { color: var(--sav-color-on-primary); font-weight: var(--sav-font-weight-semibold); }
  .side hr, .side .only-wide { display: none; }
  .side .short { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side .long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--sav-color-border); background: var(--sav-color-surface); }
  .switch a { display: grid; place-items: center; min-height: 44px; padding: .3rem; color: var(--sav-color-text); text-align: center; text-decoration: none; }
  .switch a[aria-current] { background: var(--sav-color-primary); color: var(--sav-color-on-primary); font-weight: var(--sav-font-weight-semibold); }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .hero-art { order: -1; justify-items: start; }
  .hero-art img { width: 132px; }
  .hero-art::before, .hero-art::after { width: 92px; }
  .docs { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .toc { top: 64px; z-index: 10; display: flex; gap: 0; margin: 0 calc(-1 * clamp(1rem, 4vw, 2.5rem)); padding: 0 1rem; overflow-x: auto; scrollbar-width: none; background: var(--sav-color-bg); border-bottom: 1px solid var(--sav-color-border); }
  .toc b { display: none; }
  .toc a { flex: none; display: grid; align-items: center; min-height: 46px; border: 0; border-bottom: 3px solid transparent; }
  .docs .doc > section { scroll-margin-top: 120px; }
}
@media (max-width: 600px) {
  .hide-sm { display: none; }
  /* only the flag: the name stays for screen readers (aria-label) */
  .lang { width: 4.4rem; }
  .lang::part(trigger) { color: transparent; }
  .top { gap: .5rem; min-height: 58px; padding: .3rem max(.8rem, env(safe-area-inset-right)) .3rem max(.8rem, env(safe-area-inset-left)); }
  .top-actions { gap: .25rem; }
  .corner { top: .6rem; right: .7rem; }
  .auth { align-content: start; gap: 1rem; min-height: 0; padding: 4.2rem .9rem 1.6rem; }
  .auth-card { padding: 1.5rem 1.15rem; }
  .auth-card::before { --lean: -.9deg; }
  .layered::before { --lean: -.4deg; }
  .layered:nth-of-type(even)::before { --lean: .4deg; }
  .auth-foot a, .between > a, .links .link, .auth-card > .link, .foot a { display: inline-flex; align-items: center; min-height: 44px; }
  .auth-foot a { min-height: 0; padding: .6rem 0; }
  .panel { padding: 1.1rem 1rem; }
  .page-head sav-button { width: 100%; }
  .page-head sav-button::part(button), .page-head sav-button::part(base) { width: 100%; }
  /* main actions fill the row, one under the other, the main one first */
  .panel .actions:not(.start), .consent .actions, sav-dialog .actions:not(.start) { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.2rem, 1fr)); }
  .panel .actions .muted, .actions > sav-button:only-of-type { grid-column: 1 / -1; }
  .actions.start { display: grid; justify-content: stretch; }
  .actions sav-button { width: 100%; }
  .actions sav-button::part(button), .actions sav-button::part(base) { width: 100%; }
  /* rows: icon, text and state on the first line, the buttons under the text */
  .rows li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .55rem .8rem; }
  .rows li > sav-button, .rows .row-actions { grid-column: 2 / -1; justify-self: start; }
  .rows li > sav-badge + sav-badge { grid-column: 2; justify-self: start; }
  .rows .row-actions { flex-wrap: wrap; }
  .app-head { flex-wrap: nowrap; align-items: flex-start; }
  .app-head > sav-button { display: none; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
  .stat { padding: .75rem .8rem; }
  .stat b { font-size: 1.35rem; }
  /* six boxes always fit in one line */
  sav-otp { --gap: .3rem; }
  sav-otp::part(base) { flex-wrap: nowrap; }
  sav-otp::part(cell) { flex: 1 1 0; width: auto; min-width: 0; max-width: 3.1rem; }
  .qr { width: min(64vw, 200px); }
  /* the name goes above its value */
  .keys { grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .8rem; }
  .keys .key > span { grid-column: 1 / -1; }
  .keys .key + .key > span { margin-top: .6rem; }
  .toc { top: 58px; }
  .maker-view > div { padding: 1rem .4rem; }
  .key code { font-size: .8rem; }
  .codes { gap: .4rem; }
  .codes code { padding: .5em .1em; font-size: .9rem; }
  .foot { flex-direction: column; align-items: flex-start; gap: .2rem; padding-bottom: 1.4rem; }
  .foot nav { gap: 0 1.2rem; }
  .doc { line-height: 1.6; }
  .maker { padding: 1rem; }
  .maker-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs td:first-child { width: 42%; }
}
@media (max-width: 400px) { .top .brand { gap: .4rem; font-size: 1rem; } }
@media (max-width: 345px) { .top .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
