/* Membership controls for the case list and detail pages.
   Loaded only when membership is configured (see members_block() in generate.py). The page's own
   stylesheet in template.html carries the tokens and the header layout this file builds on.
   docs/specs/2026-11-14-cream-ui-design/membership.css is a copy of this file. */
:root {
  --white: #ffffff;
  --blue-strong: #025fac; --blue-border: #0268be;
  --backdrop: rgba(0, 0, 0, .45); --shadow: 0 4px 16px #1c1b181a;
}
:root[data-theme="dark"] {
  --white: #292622;
  --backdrop: rgba(0, 0, 0, .6); --shadow: 0 4px 16px #00000066;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: 9999px; background: transparent; color: var(--ink);
  font: inherit; font-size: .875rem; font-weight: 500; line-height: 1.3; cursor: pointer;
}
.btn svg { width: 16px; height: 16px; }
.btn:focus-visible, .avatar-btn:focus-visible, .menu-item:focus-visible, .linklike:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}
.btn.primary { background: var(--blue); border-color: var(--blue-border); color: #fff; }
.btn.primary:hover { border-color: var(--blue-strong); background: var(--blue-strong); }
.btn.secondary { background: var(--field); border-color: var(--line-warm); color: var(--body); }
.btn.secondary:hover { border-color: var(--line-hover); background: var(--field-hover); }
.btn.outline { border-color: var(--line); color: var(--body); }
.btn.outline:hover { background: var(--sunken); }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: .8125rem; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
dialog .icon-btn { margin: -4px -6px -4px 0; }
.field input { height: 40px; border: 1px solid var(--line); border-radius: 9999px; background-color: var(--field); color: var(--ink); font: inherit; font-size: 14px; }
.field input:hover { border-color: var(--line-hover); }
.field input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--glow); }

/* Account. The row has the height of the login button from the start, so nothing moves when it arrives. */
.head-tools { min-height: 40px; }
.account { display: flex; align-items: center; gap: 8px; flex: none; }
.menu-wrap { position: relative; }
.avatar-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 4px; border: 0;
  border-radius: 9999px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { background: var(--sunken); }
.avatar-btn svg { width: 16px; height: 16px; }
.avatar-btn .verified { display: inline-flex; margin-right: -2px; color: var(--blue); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--blue); color: #fff; font-size: 13px; font-weight: 600; }
.menu { position: absolute; z-index: 10; top: calc(100% + 8px); right: 0; width: max-content; min-width: 240px; max-width: calc(100vw - 40px);
  padding: 8px; border: 1px solid var(--line); border-radius: 24px; background: var(--white); box-shadow: var(--shadow); }
.menu-head { display: grid; gap: 6px; justify-items: start; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line-warm); }
.menu-head .email { color: var(--ink); font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.menu-head .hint { color: var(--muted); font-size: 12px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--body); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--sunken); color: var(--ink); }
.menu-item svg { width: 16px; height: 16px; }

/* Notice: the strip above the list. Blue says who can download and how many are left today;
   the warm one asks for something (verify the address, today's downloads are used). */
#notice { display: grid; gap: 8px; margin-top: 14px; }
.quota, .alert { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; border: 1px solid var(--blue-ring);
  border-radius: 14px; background: var(--blue-soft); color: var(--ink); font-size: .875rem; line-height: 1.6; }
.quota svg, .alert svg { width: 16px; height: 16px; color: var(--blue-text); }
.quota p, .alert p { flex: 1; min-width: 0; margin: 0; padding: 3px 0; }
/* The remaining allowance is the blue notice without an action button. */
.quota:not(.warn) > p:last-child { font-size: clamp(.6875rem, 1.4vw, .75rem); }
.quota .btn, .alert .btn { flex: none; max-width: 100%; }
.quota.warn, .alert { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.quota.warn svg, .alert svg { color: inherit; }
.alert strong { font-weight: 600; }

/* Dialogs: the shell of a card (16px corners), controls at the size of the page's own. */
dialog { width: min(384px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--white); color: var(--body); font-size: 13px; }
dialog::backdrop { background: var(--backdrop); }
dialog[open] { animation: rise .16s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
dialog h3 { margin: 0; color: var(--ink); font-size: 16px; line-height: 1.4; font-weight: 600; }
dialog p { margin: 0 0 12px; }
/* The small print under the price. */
.dialog-note { color: var(--muted); font-size: 12px; }
.dialog-reason { padding: 8px 12px; border: 1px solid var(--warn-line); border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12px; }

/* The login dialog. Everything on the centre axis: the mark, the title, what an account is for, the
   form, the other way in, and at the bottom the way to the other mode. The mark is an open lock to
   sign in and a pencil to register; its box is fixed, so the title does not move when the picture changes. */
.dialog-close { position: absolute; top: 20px; right: 20px; }
.login-head { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 8px; }
.dialog-mark { flex: none; width: 52px; height: 44px; object-fit: contain; }
.login-hint { margin: 0 6px 18px; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; text-wrap: balance; }
/* The link to reset the password follows its field in the page, so that Tab goes from the address to
   the password. It is drawn at the right end of the label's row. */
.field { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 6px 12px; margin-bottom: 12px; }
.field label { color: var(--ink); font-size: 12px; font-weight: 500; }
.field input { grid-column: 1 / -1; width: 100%; padding: 0 14px; font-weight: 400; }
.field .linklike { grid-area: 1 / 2; }
.field input[aria-invalid="true"] { border-color: var(--danger-ink); }
.field-error { margin: -6px 0 12px; color: var(--danger-ink); font-size: 12px; }
.form-error { margin: 10px 0 0; color: var(--danger-ink); font-size: 12px; text-align: center; }
#login-submit { margin-top: 4px; }
.linklike { padding: 0; border: 0; border-radius: 4px; background: none; color: var(--blue-text); font: inherit; font-size: 12px;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.divider { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--muted); font-size: 11px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-warm); }
.login-foot { margin: 14px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.price { display: flex; align-items: baseline; gap: 6px; margin: 0 0 12px; padding: 14px 16px; border: 1px solid var(--line-warm);
  border-radius: 12px; background: var(--card); color: var(--ink); font-weight: 500; }
.price b { font-size: 28px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 22px;
  background: var(--ink); color: var(--cream); font-size: 13px; text-align: center; opacity: 0; transform: translate(-50%, 6px);
  transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .quota, .alert { flex-wrap: wrap; padding: 8px 12px; font-size: .75rem; }
  .quota svg, .alert svg { align-self: flex-start; margin-top: 5px; }
  .quota p, .alert p { flex-basis: calc(100% - 26px); }
  .quota .btn, .alert .btn { max-width: calc(100% - 26px); margin-left: 26px; }
  /* Under 16px, iOS zooms the page when a field takes the focus. */
  .field input { height: 44px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  dialog[open] { animation: none; }
  .toast { transition: none; }
}
