/* AbbyFlash Account: this site's own styles. They load after the base look, /assets/css/style.css (the same file as
   abbyflash-store's), whose classes are used as they are: the page shell (.wrap, .skip, .visually-hidden), the header
   and footer, buttons (.btn, .btn--grey/--red/--green/--orange/--small), windows (.window, .window__bar,
   .window__close, .window__body), tags (.chip, .badge), text links (.link-point), logo squares (.site-logo),
   dropdowns (.select) and the 404 page. The parts both sites have (panels, notices, fields, windows' contents) are the
   same rules as the store's public/assets/site.css, so the two look alike: a change to one of those belongs in both.
   No inline styles: the CSP is style-src 'self'. */

/* ------------------------------------------------------------------ tokens the base look doesn't have */
:root {
  /* brown: the admin page's Adjust wallet */
  --brown-bg: #92400e;
  --brown-hover: #78350f;
  --brown-ink: #ffffff;
  --panel: 720px; /* a page that is one column of panels */
}
[data-theme="dark"] {
  --brown-bg: #d6a26a;
  --brown-hover: #e3b989;
  --brown-ink: #1e140a;
}

/* ------------------------------------------------------------------ text */
body { overflow-wrap: break-word; }
h1 { margin: 0 0 14px; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 12px; }
h3 { font-size: 1.02rem; line-height: 1.35; margin: 18px 0 8px; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--font-mono); font-size: .87em; font-weight: 500; overflow-wrap: anywhere; }
strong { font-weight: 650; }
.muted { color: var(--muted); font-size: .94rem; }

/* ------------------------------------------------------------------ page widths */
main { padding-block: clamp(24px, 5vw, 48px) 48px; }
/* a page of one column (sign-in, Link, 404, errors); the pages with a lot on them take the whole width (.wrap--wide) */
.wrap--panel { --wrap: var(--panel); }

/* ------------------------------------------------------------------ panels: a page's boxes */
.panel {
  margin-bottom: 18px;
  padding: clamp(20px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel > :last-child { margin-bottom: 0; }
.panel h1 { font-size: clamp(1.5rem, 1.3rem + .9vw, 1.9rem); }
/* a panel's heading with a button at its right; the button goes under it when the line is too narrow */
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.panel__head > :is(h1, h2) { margin: 0; }
.panel__head:not(:last-child) { margin-bottom: 14px; }

.stack { margin-bottom: 18px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------------------------------------------ messages */
.note { padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--info) 25%, var(--line)); border-radius: var(--radius-sm); background: var(--info-bg); }
.note--error { border-color: color-mix(in srgb, var(--error) 35%, var(--line)); background: var(--error-bg); }
.note--ok { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); background: var(--ok-bg); }
#notice { margin-bottom: 18px; }
/* a page's notice can be closed (dom.js notify): a small, quiet × at its top right, the words flowing around it */
.note:has(> .note__close) { display: flow-root; }
.note__close {
  float: right;
  display: grid; place-items: center;
  width: 26px; height: 26px;
  margin: -2px -6px 0 10px;
  padding: 0; border: 0; border-radius: 7px;
  background: none; color: inherit; opacity: .65;
  cursor: pointer;
}
.note__close:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.note__close svg { width: 16px; height: 16px; }
/* in a notice too narrow for words beside it, the × gets its own line, still at the right */
.note:has(> .note__close) { container-type: inline-size; }
@container (max-width: 8rem) {
  .note__close { float: none; margin: -2px -6px 4px auto; }
}

/* ------------------------------------------------------------------ buttons: two layouts of ours
   .btn--block fills its column up to 320px (the widest any button is); a panel's own main button and a .btn--center
   one sit in the middle */
.btn--block { display: flex; width: 100%; height: auto; min-height: 46px; padding-block: 10px; line-height: 1.2; text-align: center; }
.panel > .btn--block, .btn--center { margin-inline: auto; }
.panel > .btn:not(:last-child) { margin-bottom: 16px; }
.btn--brown { --btn-bg: var(--brown-bg); --btn-ink: var(--brown-ink); --btn-hover: var(--brown-hover); }

/* ------------------------------------------------------------------ sign-in choices: logo tiles
   One tile per provider: its logo (/assets/img/<name>-icon.svg) on its square (.site-logo). Buttons or links; the
   image's alt text names the action ("Continue with Google"), and the tile's title shows it on hover. */
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 12px 0 24px; padding: 0; list-style: none; }
.tiles.start { justify-content: flex-start; }
.tiles:empty { display: none; }
.tile {
  display: block;
  padding: 0; border: 0; border-radius: 16px;
  background: none;
  cursor: pointer;
  transition: transform .15s var(--ease);
}
.tile img {
  display: block; width: 56px; height: 56px; border-radius: 16px;
  box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgb(15 23 42 / .1);
  transition: box-shadow .2s var(--ease);
}
.tile:hover { transform: translateY(-2px); }
.tile:hover img { box-shadow: 0 0 0 1px var(--line-strong), 0 10px 20px -8px rgb(15 23 42 / .35); }
.tile:active { transform: translateY(0); }

/* ------------------------------------------------------------------ forms */
label { display: block; font-weight: 550; margin-bottom: 6px; }
input, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--solid-bg); color: var(--text);
  font: 400 1rem/1.4 var(--font-body);
  transition: border-color .15s, box-shadow .15s;
}
input:hover, textarea:hover { border-color: var(--faint); }
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.field + .field { margin-top: 14px; }
.field .muted { margin: 6px 0 0; }
.field + p { margin-top: 18px; }
.code-input { font: 600 1.4rem/1.3 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; text-align: center; }

/* the device code */
.code {
  padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: var(--sunken);
  font: 700 clamp(1.5rem, 1.2rem + 1.5vw, 1.9rem)/1.3 var(--font-mono); letter-spacing: .14em; text-align: center;
}

/* ------------------------------------------------------------------ lists and key/value pairs */
ul.list { list-style: none; margin: 0; padding: 0; }
/* a row's text, then its button; the button goes under the text when they don't both fit (the text keeps 10rem) */
ul.list > li { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
ul.list > li > .grow { flex: 1 1 10rem; }
ul.list > li:first-child { border-top: 0; padding-top: 0; }
ul.list > li:last-child { padding-bottom: 0; }
ul.plain { margin: 0; padding-left: 1.2em; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* a value with a copy button after it (the username, the Account ID): the button goes under the value when the line is
   too narrow, and the label sits level with the middle of the row */
.kv dd.kv__copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.kv dd.kv__copy > .mono { min-width: 0; }
/* the username's "(You can change it again on …)", after its copy button, very small */
.kv dd.kv__copy > .kv__note { font-size: .75rem; }
.kv dd.kv__copy:has(> .kv__note) { margin-bottom: 6px; }
.kv dd.kv__copy:has(> .kv__note) > .copy { margin-right: 12px; }
/* a label beside a value whose first line is a 36px copy button and may wrap: level with that line */
@media (min-width: 360px) { .kv dt.kv__line { line-height: 36px; } }
.kv dt.kv__mid { align-self: center; }

/* the apps and purchases pages: one table, App, Item, Type, Status, Details, a row per thing the account has in an app
   (or has bought), the app named on each row. Lines between rows, none around the table: the panel is its box */
.account-table { width: 100%; margin-top: 20px; border-collapse: collapse; }
.account-table th, .account-table td { padding: 12px 16px 12px 0; text-align: left; vertical-align: baseline; border-top: 1px solid var(--line); }
.account-table :is(th, td):last-child { padding-right: 0; }
.account-table thead th { padding-top: 0; padding-bottom: 10px; border-top: 0; color: var(--faint); font: 600 .72rem/1.4 var(--font-body); letter-spacing: .06em; text-transform: uppercase; }
.account-table th[scope="row"] { font-weight: 550; }
.account-table__tag { width: 1%; white-space: nowrap; } /* Type and Status only as wide as their widest tag */
/* the row number (#): as wide as the biggest number, right-aligned so the digits line up, quieter than the rest */
.account-table__no, .account-table thead th:first-child { width: 1%; white-space: nowrap; text-align: right; }
.account-table__no { color: var(--faint); font-variant-numeric: tabular-nums; }
/* wide enough for columns: the app and item names stay on one line, each column only as wide as its widest entry with
   32px between columns, and the details take what's left */
@media (min-width: 720px) {
  .account-table__app, .account-table th[scope="row"] { width: 1%; white-space: nowrap; }
  .account-table th, .account-table td { padding-right: 32px; }
  .account-table :is(th, td):last-child { padding-right: 0; }
}

/* an account's status (admin), on a colour */
.badge.active, .badge.redeemed { background: var(--ok-bg); color: var(--ok); }
.badge.banned, .badge.deleted { background: var(--error-bg); color: var(--error); }

/* ------------------------------------------------------------------ confirmation windows (dom.js ask()): the message,
   any fields and one full-width button in the body */
.window { width: min(100% - 32px, 520px); }
.window--form { width: min(100% - 32px, 680px); }
.window__body > * + * { margin-top: 14px; }
.window__message { line-height: 1.55; color: var(--muted); }
.window__message > :last-child { margin-bottom: 0; }
.window__actions { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; margin-top: 20px; }
.window__actions > .btn { width: 100%; }

/* ------------------------------------------------------------------ record tables (admin)
   A line between rows, small capitals over the columns, the first column heading its row. When a table doesn't fit
   its panel (admin.js checks, at every width) or the screen is under 720px, it's .stacked: each row shows as labelled
   lines (each cell's data-label), the first cell as the row's title. Nothing scrolls sideways */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; margin-top: 6px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 11px 16px 11px 0; text-align: left; vertical-align: baseline; border-top: 1px solid var(--line); overflow-wrap: break-word; }
.data-table :is(.badge, .chip, .btn) { white-space: nowrap; }
.data-table :is(th, td):last-child { padding-right: 0; }
.data-table thead th { padding-top: 0; padding-bottom: 10px; border-top: 0; color: var(--faint); font: 600 .72rem/1.4 var(--font-body); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow-wrap: normal; }
.data-table tbody tr:hover > * { background: color-mix(in srgb, var(--sunken) 60%, transparent); }
.data-table th[scope="row"] { font-weight: 550; }
.data-table code { overflow-wrap: anywhere; }
/* in columns, ids and times stay whole (a table that gets too wide for them stacks instead); stacked, ids may break */
.data-table:not(.stacked) .mono { overflow-wrap: normal; }
.when { white-space: nowrap; }
.sub-id { display: block; font-size: .8rem; } /* an item's id under its name */
.cell-link { color: var(--link); font-weight: 550; text-decoration: none; }
.cell-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.data-table.stacked, .data-table.stacked tbody, .data-table.stacked tr { display: block; }
.data-table.stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.data-table.stacked tr { padding: 12px 0; border-top: 1px solid var(--line); }
.data-table.stacked tbody tr:hover > * { background: none; }
.data-table.stacked tr > * { display: block; padding: 2px 0; border-top: 0 !important; overflow-wrap: anywhere; }
.data-table.stacked th[scope="row"] { padding-bottom: 6px; font-weight: 650; }
/* label | value: the label column is as wide as "LAST ACTIVE"; a tag or button keeps its own width */
.data-table.stacked td { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 2px 12px; align-items: baseline; justify-items: start; }
.data-table.stacked td::before { content: attr(data-label); color: var(--faint); font: 600 .68rem/1.4 var(--font-body); letter-spacing: .06em; text-transform: uppercase; overflow-wrap: anywhere; }
.data-table.stacked td[data-label=""] { display: block; }
.data-table.stacked td[data-label=""]::before { content: none; }
/* under 360px the label goes above its value, in tables and in key/value lists */
@media (max-width: 359px) {
  .data-table.stacked td { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dd + dt { margin-top: 8px; }
}

/* admin: a row of filters or a search form, wrapping to as many lines as it needs */
.lookup { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); gap: 14px; align-items: end; margin-bottom: 18px; }
.lookup .field + .field { margin-top: 0; }
.lookup .select { display: flex; }
.results:not(:empty) { margin-bottom: 4px; }
.inline-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; }
.inline-field label { margin: 0; }
.inline-field .select { max-width: 100%; }
/* the apps and purchases pages' app filter, at the right of the page's title (under it when narrow): the label, the
   dropdown beside it up to 320px, and under it once it would be narrower than 12rem */
.inline-field--head { flex: 1 1 auto; justify-content: flex-end; gap: 6px 12px; }
.inline-field--head label { font-weight: 600; color: var(--muted); }
.inline-field--head .select { flex: 1 1 12rem; max-width: 20rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
/* buttons with a note at the right, as .panel__head; the note goes under them when the line is too narrow */
.actions--spread { align-items: center; justify-content: space-between; }
.actions > p { margin: 0; }
.more { margin: 16px 0 0; }
/* a page's line above its table */
.intro { margin-bottom: 18px; }

/* ------------------------------------------------------------------ narrow screens. Nothing shrinks */
/* four tiles still fit one row on a 320px phone */
@media (max-width: 359px) {
  .tiles { gap: 10px; }
  .tile img { width: 48px; height: 48px; border-radius: 14px; }
}
/* narrow screens: the columns don't fit (they need about 700px). Each row shows on lines, numbered like a list: the
   number at the left, then the app as a small label, the item and its two tags (type, status) at the right, and the
   details. The column headings are for screen readers only */
@media (max-width: 719px) {
  .account-table, .account-table tbody { display: block; }
  .account-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .account-table tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px;
    padding: 12px 0; border-top: 1px solid var(--line);
  }
  /* a row with no status (a balance): its type takes the status's place too, so it ends at the right like the others */
  .account-table__tag:empty { display: none; }
  .account-table__tag:has(+ .account-table__tag:empty) { grid-column: 3 / -1; justify-self: end; }
  .account-table tr > * { padding: 0; border-top: 0 !important; }
  .account-table tr > td:last-child { grid-column: 2 / -1; color: var(--muted); }
  .account-table__no, .account-table__app { color: var(--faint); font: 600 .72rem/1.4 var(--font-body); letter-spacing: .06em; text-transform: uppercase; }
  .account-table__no { grid-column: 1; grid-row: 1 / span 3; align-self: start; width: auto; }
  .account-table__app { grid-column: 2 / -1; }
  .account-table__tag { width: auto; }
}
/* under 360px the item's name and both tags don't fit one line: the tags go on a line of their own under the name */
@media (max-width: 359px) {
  .account-table tr { grid-template-columns: auto auto minmax(0, 1fr); }
  .account-table__no { grid-row: 1 / span 4; }
  .account-table th[scope="row"] { grid-column: 2 / -1; }
  .account-table__tag,
  .account-table__tag:has(+ .account-table__tag:empty) { grid-column: auto; justify-self: start; }
}
@media (max-width: 299px) {
  .account-table tr { grid-template-columns: auto minmax(0, 1fr); }
  .account-table__no { grid-row: 1 / span 5; }
  .account-table__tag,
  .account-table__tag:has(+ .account-table__tag:empty) { grid-column: 2; justify-self: start; }
}
/* under 260px a long button label or tag goes onto more lines instead of out of its box */
@media (max-width: 259px) {
  .panel .btn, .window__body .btn { flex-wrap: wrap; height: auto; min-height: 46px; padding: 8px 12px; line-height: 1.2; text-align: center; white-space: normal; overflow-wrap: anywhere; }
  .panel .btn--small, .window__body .btn--small { min-height: 40px; }
  .chip, .account-table .badge { white-space: normal; overflow-wrap: anywhere; }
}
