/* wiPAYE download page (job A103). Aluwi brand: wine bar, Source Sans 3, the wi + star marks. Light only. */
:root {
  --wine: #702228; --wine-light: #922D38; --wine-deep: #5A161D; --ink: #140705;
  --page: #FBF7F7; --card: #FFFFFF; --line: #EADCDD; --muted: #6B5557; --tint: #F4ECEC;
  --gold: #B8862B; --ok: #1F7A4D; --ok-bg: #E6F3EC; --alert: #B3261E; --alert-bg: #FDECEA;
  --font: "Source Sans 3", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 8px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--page); color: var(--ink); font: 16px/1.5 var(--font); }
[hidden] { display: none !important; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 880px; margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.break { overflow-wrap: anywhere; }

.star { display: inline-block; flex: 0 0 auto; width: 14px; height: 14px; background: currentColor; -webkit-mask: url(star.png) center/contain no-repeat; mask: url(star.png) center/contain no-repeat; }
.star.big { width: 36px; height: 36px; color: var(--gold); margin-bottom: 8px; }
.wi { display: inline-block; width: 1.2em; height: .88em; background: currentColor; -webkit-mask: url(wi.png) center/contain no-repeat; mask: url(wi.png) center/contain no-repeat; }

/* Top bar */
.bar { background: var(--wine); color: #fff; }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: baseline; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.375rem; letter-spacing: .02em; min-height: 44px; padding-top: 10px; }
.brand-sub { font-weight: 400; font-size: 1rem; letter-spacing: 0; margin-left: 12px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.35); opacity: .92; }
.account { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 4px 12px 4px 4px; border: 1px solid rgba(255,255,255,.35); border-radius: 22px; background: transparent; color: #fff; font: inherit; font-size: .9375rem; cursor: pointer; max-width: 50vw; }
.account:hover { background: rgba(255,255,255,.1); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.18); flex: 0 0 auto; -webkit-mask: none; position: relative; }
.avatar::after { content: ""; position: absolute; inset: 9px; background: #fff; -webkit-mask: url(star.png) center/contain no-repeat; mask: url(star.png) center/contain no-repeat; }
.account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .account-email { display: none; } .account { padding: 4px; } .brand-sub { display: none; } }

main { flex: 1; padding-block: 32px 56px; }
h1:focus { outline: none; }
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 8px; font-weight: 700; text-wrap: balance; }
h2 { font-size: 1.25rem; margin: 0; font-weight: 600; }
h3 { font-size: 1.0625rem; margin: 0 0 8px; font-weight: 600; }
.lede { margin: 0 0 20px; color: var(--muted); font-size: 1.0625rem; }
.fine { font-size: .875rem; color: var(--muted); margin: 16px 0 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; box-shadow: 0 1px 2px rgba(20,7,5,.04); }
.narrow { max-width: 460px; margin-inline: auto; }
.center { text-align: center; padding-top: 48px; }
@media (max-width: 480px) { .card { padding: 20px; } h1 { font-size: 1.625rem; } main { padding-top: 20px; } }

/* Forms and buttons */
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=email] { width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; font-size: 1.0625rem; color: var(--ink); background: #fff; border: 1px solid #CBB8BA; border-radius: var(--r); }
input[type=email]:focus { outline: 2px solid var(--wine); outline-offset: 1px; border-color: var(--wine); }
.field-error { color: var(--alert); font-size: .9375rem; margin: 6px 0 0; }
form .btn { margin-top: 16px; }
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 10px 20px; border-radius: var(--r); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer; color: var(--wine); background: #fff; border-color: var(--line); }
.btn:focus-visible, .icon-btn:focus-visible, .account:focus-visible, .linkish:focus-visible, .brand:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: var(--wine); color: #fff; border-color: var(--wine); }
.btn.primary:hover { background: var(--wine-deep); }
.btn.ghost:hover, .btn.secondary:hover { background: var(--tint); }
.btn.block { width: 100%; }
.btn[disabled] { cursor: progress; }
.btn .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255,255,255,.18); transition: width .2s linear; pointer-events: none; }
.btn.secondary .fill { background: var(--tint); }
.btn > span { position: relative; }

/* Company section */
.company + .company { margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--line); }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.eyebrow .star { color: var(--gold); }
.latest { margin-top: 20px; }
.version-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 20px; }
.version-row h2 { font-size: 1.5rem; }
.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 13px; font-size: .8125rem; font-weight: 600; background: var(--ok-bg); color: var(--ok); }
.date { color: var(--muted); font-size: .9375rem; }
.installers { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.dl { flex-direction: column; align-items: flex-start; text-align: left; padding: 14px 20px; min-height: 64px; gap: 2px; }
.dl .t { font-size: 1.0625rem; }
.dl .s { font-weight: 400; font-size: .875rem; opacity: .85; overflow-wrap: anywhere; }
.extras { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 12px; }
.keep { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0 0; padding: 12px 14px; border-radius: var(--r); background: var(--tint); font-size: .9375rem; }
.keep .star { color: var(--wine); margin-top: 4px; }
.notes { margin-top: 28px; }
.notes ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notes li { display: flex; gap: 10px; align-items: flex-start; }
.notes li .star { color: var(--wine); margin-top: 5px; width: 12px; height: 12px; }
.links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.linkish { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--wine); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish:hover { color: var(--wine-deep); }
.status { margin: 12px 0 0; font-size: .9375rem; color: var(--muted); }
.status:empty { display: none; }
.status.err { color: var(--alert); }

/* Overlays (all screen sizes; on phones they rise from the bottom) */
dialog.sheet { width: min(560px, calc(100vw - 32px)); max-height: min(85vh, 720px); padding: 20px 24px 24px; border: 0; border-radius: 12px; background: #fff; color: var(--ink); box-shadow: 0 24px 64px rgba(20,7,5,.28); overflow: auto; }
dialog.sheet::backdrop { background: rgba(20,7,5,.45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.icon-btn { width: 44px; height: 44px; margin-right: -10px; border: 0; border-radius: 50%; background: none; font-size: 1.125rem; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--tint); color: var(--ink); }
@media (max-width: 560px) {
  dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)); }
}
.hash { margin: 16px 0 0; }
.hash h3 { margin: 0 0 6px; overflow-wrap: anywhere; }
.code { display: block; font: .875rem/1.5 var(--mono); padding: 10px 12px; background: var(--tint); border-radius: 6px; overflow-wrap: anywhere; user-select: all; }
.hash .btn { margin-top: 8px; min-height: 44px; padding: 6px 14px; }
.how { margin-top: 20px; font-size: .9375rem; }
.how p { margin: 0 0 8px; }
.how .code { display: inline; padding: 2px 6px; }
.older { padding: 16px 0; border-top: 1px solid var(--line); }
.older:first-child { border-top: 0; }
.older .extras { margin-top: 8px; }
.older .btn { min-height: 44px; padding: 8px 14px; font-size: .9375rem; }

.foot { padding-block: 20px calc(20px + env(safe-area-inset-bottom, 0px)); font-size: .875rem; color: var(--muted); border-top: 1px solid var(--line); background: #fff; }
.foot .wrap { display: flex; gap: 8px; align-items: flex-start; }
.foot .star { color: var(--wine); margin-top: 4px; }
#confirm-new { margin-top: 12px; }
