/*
  Pocketwire dashboard and sign-in pages (server-rendered, see server/src/views.ts).
  Depends on tokens.css. No JavaScript runs on these pages, so the theme
  follows the system setting through the tokens; no colours are defined here.

  Component classes
    Layout     .app-shell .app-nav .app-logo .container .stack .row
    Surfaces   .card .card-header
    Actions    .btn .btn-primary .btn-ghost .btn-danger
    Forms      .field .input  (plus fieldset, legend and label.row choices)
    Data       .table .badge .badge-online .badge-offline .badge-pending
               .badge-sent .badge-failed .code-display
    Feedback   .alert .alert-error .alert-success
    Text       .muted
    Sign-in    .auth-page .auth-logo .consent-list
  A live specimen of every class: /assets/app-preview.html
*/

/* ------------------------------------------------------------------ */
/* Icons used by alerts, badges and the consent list (masks, so they   */
/* take the colour of the element that uses them)                      */
/* ------------------------------------------------------------------ */

:root {
  --app-w: 960px;
  --icon-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
  --icon-error: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.25M12 16.25h.01'/%3E%3C/svg%3E");
  --icon-success: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.25 2.5 2.5 4.75-5'/%3E%3C/svg%3E");
  --icon-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.25 5 8.75l4.5-5'/%3E%3C/svg%3E");
  --icon-cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m3.5 3.5 5 5m0-5-5 5'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------ */
/* 1. Base                                                             */
/* ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-app);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss03";
}

::selection {
  background: var(--selection);
}

[hidden] {
  display: none !important;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text-1);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  text-wrap: balance;
  overflow-wrap: break-word; /* app names and emails can be one long word */
}

h1 {
  font-size: 1.375rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.0625rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 0.9375rem;
  line-height: 1.35;
}

p,
ul,
ol,
dl,
dd,
blockquote,
pre,
figure,
form {
  margin: 0;
}

p {
  text-wrap: pretty;
}

hr {
  height: 1px;
  margin: 8px 0;
  border: 0;
  background: var(--line-1);
}

strong {
  color: var(--text-1);
  font-weight: var(--fw-semibold);
}

a {
  color: var(--text-1);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}

a:hover {
  text-decoration-color: var(--accent);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
}

:not(pre) > code {
  padding: 1px 6px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

pre {
  overflow-x: auto;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--code-bg);
  color: var(--text-1);
  font-size: 0.8125rem;
  line-height: 1.65;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------------ */
/* 2. Layout: shell, navigation, container, stack, row                 */
/* ------------------------------------------------------------------ */

.app-shell {
  background:
    radial-gradient(900px 300px at 50% -140px, var(--glow-spark), transparent 70%) no-repeat,
    var(--bg-app);
}

/* Logo, tabs and Sign out. Narrow screens: logo and Sign out on the
   first row, every tab visible below them (no hidden overflow). */
.app-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "logo out"
    "tabs tabs";
  align-items: center;
  gap: 10px 24px;
  padding: 12px max(var(--gutter), (100% - var(--app-w)) / 2) 10px;
  border-bottom: 1px solid var(--line-1);
  background: var(--overlay);
}

.app-logo {
  grid-area: logo;
  justify-self: start;
  display: inline-flex;
  margin: -4px;
  padding: 4px;
  border-radius: var(--r-sm);
}

.app-logo img {
  width: auto;
  height: 26px;
  max-width: none;
}

.app-nav nav {
  grid-area: tabs;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-inline: -12px;
}

.app-nav nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r-full);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}

.app-nav nav a:hover {
  color: var(--text-1);
  background: var(--btn-secondary-bg-hover);
}

.app-nav nav a[aria-current]:not([aria-current="false"]) {
  color: var(--text-1);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-1);
}

.app-nav nav a:focus-visible {
  outline-offset: 0;
}

.app-nav form {
  grid-area: out;
}

.app-nav .btn {
  --btn-h: 36px;
  padding-inline: 14px;
  font-size: 0.8125rem;
}

.container {
  width: 100%;
  max-width: calc(var(--app-w) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.app-shell main {
  padding-block: 28px 72px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-shell main.stack {
  gap: 24px;
}

fieldset.stack {
  gap: 8px;
}

/* In the dashboard a button sits at its own width; in sign-in cards it fills the row. */
.app-shell .stack > .btn {
  align-self: flex-start;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.row > .input {
  flex: 1 1 12rem;
  width: auto;
  min-width: 0;
}

.row > .field {
  flex: 1 1 14rem;
  min-width: 0;
}

/* ------------------------------------------------------------------ */
/* 3. Cards                                                            */
/* ------------------------------------------------------------------ */

.card {
  position: relative;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: var(--highlight), var(--shadow-1);
}

/* A table may be wider than a phone: the card scrolls sideways, the page never does. */
.card:has(> .table) {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

/* The fresh pairing code is the one thing to look at on its page. */
.card:has(> .code-display) {
  border-color: var(--accent-line);
  box-shadow: var(--highlight), 0 0 0 4px var(--accent-soft), var(--shadow-2);
}

.card p {
  max-width: 72ch;
  overflow-wrap: break-word;
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.card-header .muted {
  font-size: var(--fs-sm);
}

/* A card inside a card: one waiting approval */
.card .card {
  padding: 16px;
  border-color: var(--line-1);
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: none;
}

.card .card > .row:first-child {
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
}

.card .card > .row:first-child .muted {
  font-size: 0.8125rem;
}

.card .card > .row:last-child {
  justify-content: flex-end;
  gap: 8px;
}

/* ------------------------------------------------------------------ */
/* 4. Buttons                                                          */
/* ------------------------------------------------------------------ */

.btn {
  --btn-h: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  background: var(--btn-secondary-bg);
  color: var(--text-1);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}

.btn:hover:not(:disabled) {
  border-color: var(--line-3);
  background: var(--btn-secondary-bg-hover);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline-offset: 3px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  border-color: transparent;
  background-color: var(--btn-primary-bg);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 55%);
  color: var(--btn-primary-fg);
  box-shadow: var(--btn-primary-shadow);
}

.btn-primary:hover:not(:disabled) {
  border-color: transparent;
  background-color: var(--btn-primary-bg-hover);
}

/* Secondary action: outlined, no fill */
.btn-ghost {
  background: transparent;
}

/* Remove, Disconnect: calm until hovered, never the loudest thing in a row */
.btn-danger {
  border-color: var(--danger-line);
  background: transparent;
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.btn-danger:focus-visible {
  outline-color: var(--danger);
}

/* ------------------------------------------------------------------ */
/* 5. Forms                                                            */
/* ------------------------------------------------------------------ */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  color: var(--text-1);
  font-size: 0.8125rem;
  font-weight: var(--fw-medium);
}

.input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--input-line);
  border-radius: var(--r-sm);
  background: var(--input-bg);
  color: var(--text-1);
  font-size: 1rem; /* 16px keeps phones from zooming in on focus */
  line-height: 1.4;
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}

.input::placeholder {
  color: var(--text-3);
  opacity: 1;
}

.input:hover {
  border-color: var(--input-line-hover);
}

.input:focus,
.input:focus-visible {
  border-color: var(--focus);
  outline: 2px solid transparent; /* shows as a real outline in forced-colour modes */
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.input:user-invalid {
  border-color: var(--danger);
}

.input:user-invalid:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

/* Browser autofill: keep it on-theme but still visibly filled */
.input:-webkit-autofill {
  -webkit-text-fill-color: var(--text-1);
  caret-color: var(--text-1);
  box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--accent) 8%, var(--input-bg));
}

.input:-webkit-autofill:focus {
  box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--accent) 8%, var(--input-bg)), 0 0 0 3px var(--accent-soft);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Floated, the legend lays out like any other item, so the stack gap applies. */
legend {
  float: left;
  width: 100%;
  margin: 0 0 4px;
  padding: 0;
  color: var(--text-1);
  font-weight: var(--fw-semibold);
}

input[type="radio"],
input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* A choice: radio or checkbox with its text, drawn as a selectable tile */
label.row {
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--text-1);
  line-height: 1.45;
  cursor: pointer;
  transition: border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out);
}

label.row:hover {
  border-color: var(--line-3);
}

label.row:has(> input:checked) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

label.row:has(> input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

label.row:has(> input:focus-visible) > input {
  outline: none;
}

label.row:has(> input:disabled) {
  border-style: dashed;
  background: transparent;
  color: var(--text-3);
  cursor: not-allowed;
}

label.row:has(> input:disabled) > input {
  cursor: not-allowed;
}

/* The kill switch reads as engaged, not as just another preference */
label.row:has(> input[name="paused"]:checked) {
  border-color: var(--danger-line);
  background: var(--danger-soft);
}

label.row > input[name="paused"] {
  accent-color: var(--danger);
}

/* ------------------------------------------------------------------ */
/* 6. Tables                                                           */
/* ------------------------------------------------------------------ */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line-1);
  text-align: left;
  vertical-align: middle;
}

.table th {
  padding-block: 0 10px;
  border-bottom-color: var(--line-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table th:first-child,
.table td:first-child {
  padding-left: 0;
}

.table th:last-child,
.table td:last-child {
  padding-right: 0;
}

.table tbody tr:last-child td {
  border-bottom: 0;
  padding-bottom: 4px;
}

/* A table with no header row (trusted contacts) starts with a rule */
.table:not(:has(thead)) {
  border-top: 1px solid var(--line-1);
}

/* Row actions: shrink to fit, aligned to the right edge */
.table td:last-child:has(> form) {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.table .btn {
  --btn-h: 32px;
  padding-inline: 12px;
  font-size: 0.8125rem;
}

.table td > .muted {
  max-width: 48ch;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* 7. Badges                                                           */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px 0 8px;
  border: 1px solid var(--neutral-line);
  border-radius: var(--r-full);
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  vertical-align: middle;
}

.badge::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Online: the live spark */
.badge-online {
  border-color: var(--ok-line);
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-online::before {
  box-shadow: 0 0 0 3px var(--ok-soft), 0 0 8px var(--accent-glow);
}

/* Offline: hollow ring, so the two device states differ in shape too */
.badge-offline::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px currentColor;
}

/* queued, awaiting approval, sending */
.badge-pending {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
}

/* sent, delivered */
.badge-sent {
  border-color: var(--ok-line);
  background: var(--ok-soft);
  color: var(--ok);
}

/* failed, rejected, expired */
.badge-failed {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-sent::before,
.badge-failed::before {
  width: 10px;
  height: 10px;
  border-radius: 0;
  -webkit-mask: var(--icon-tick) center / contain no-repeat;
  mask: var(--icon-tick) center / contain no-repeat;
}

.badge-failed::before {
  -webkit-mask-image: var(--icon-cross);
  mask-image: var(--icon-cross);
}

/* ------------------------------------------------------------------ */
/* 8. Pairing code, message bubble                                     */
/* ------------------------------------------------------------------ */

.code-display {
  padding: 22px 16px;
  border: 1px dashed var(--accent-line);
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 160% at 50% 0%, var(--accent-soft), transparent 65%),
    var(--code-bg);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: clamp(1.875rem, 1.1rem + 3.6vw, 2.75rem);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums slashed-zero;
  line-height: 1.1;
  letter-spacing: 0.16em;
  text-indent: 0.16em; /* balances the tracking after the last character */
  text-align: center;
  white-space: nowrap;
  user-select: all;
}

/* The text an AI app wants to send, drawn as an outgoing message */
blockquote {
  align-self: flex-end;
  max-width: min(34rem, 88%);
  padding: 10px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 18px 18px 6px 18px;
  background: var(--accent-soft);
  color: var(--text-1);
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* 9. Alerts and muted text                                            */
/* ------------------------------------------------------------------ */

.alert {
  position: relative;
  padding: 11px 16px 11px 44px;
  border: 1px solid var(--info-line);
  border-radius: var(--r-md);
  background: var(--info-soft);
  color: var(--text-1);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.alert::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 15px;
  width: 19px;
  height: 19px;
  background: var(--info);
  -webkit-mask: var(--icon-info) center / contain no-repeat;
  mask: var(--icon-info) center / contain no-repeat;
}

.alert a {
  color: inherit;
  font-weight: var(--fw-semibold);
  text-decoration-color: currentColor;
}

.alert-error {
  border-color: var(--danger-line);
  background: var(--danger-soft);
}

.alert-error::before {
  background: var(--danger);
  -webkit-mask-image: var(--icon-error);
  mask-image: var(--icon-error);
}

.alert-success {
  border-color: var(--ok-line);
  background: var(--ok-soft);
}

.alert-success::before {
  background: var(--ok);
  -webkit-mask-image: var(--icon-success);
  mask-image: var(--icon-success);
}

.muted {
  color: var(--text-2);
}

p.muted {
  font-size: var(--fs-sm);
}

.muted strong {
  color: var(--text-1);
}

/* ------------------------------------------------------------------ */
/* 10. Sign-in, sign-up, consent and message pages                     */
/* ------------------------------------------------------------------ */

.auth-page {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  padding: 32px var(--gutter);
  background:
    radial-gradient(520px 320px at 50% 0%, var(--glow-spark), transparent 72%) no-repeat,
    var(--bg-app);
}

body.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Faint grid behind the card, fading out from the centre */
.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 35%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 60% 55% at 50% 35%, #000 10%, transparent 75%);
  pointer-events: none;
}

body.auth-page::before {
  position: fixed;
}

.auth-page > .card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  border-radius: var(--r-xl);
  box-shadow: var(--highlight), var(--shadow-2);
}

/* A spark of light along the top edge */
.auth-page > .card::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
  pointer-events: none;
}

/* The logo is the card's first child; it is drawn centred above the card. */
.auth-page > .card:has(> .auth-logo) {
  margin-top: 64px;
}

.auth-logo {
  position: absolute;
  bottom: 100%;
  left: 50%;
  display: inline-flex;
  margin-bottom: 22px;
  padding: 4px;
  border-radius: var(--r-sm);
  transform: translateX(-50%);
}

.auth-logo img {
  width: auto;
  height: 32px;
  max-width: none;
}

.auth-page h1 {
  font-size: var(--fs-xl);
  letter-spacing: -0.025em;
  text-align: center;
}

.auth-page h1 + p {
  margin-top: -6px;
  text-align: center;
}

.auth-page h1 + p.muted {
  font-size: 0.9375rem;
}

.auth-page .card > p:last-child {
  text-align: center;
}

.auth-page .input {
  min-height: 44px;
  padding-inline: 14px;
}

.auth-page .btn {
  --btn-h: 44px;
}

.auth-page .stack > .btn {
  align-self: stretch;
}

.auth-page form.row > .btn {
  flex: 1 1 0;
}

.auth-page .alert {
  text-align: left;
}

/* What the app will be allowed to do */
.consent-list {
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--bg-2);
  list-style: none;
}

.consent-list li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 2px 12px;
  padding: 12px 14px;
}

.consent-list li + li {
  border-top: 1px solid var(--line-1);
}

.consent-list li::before {
  content: "";
  grid-row: 1 / span 2;
  width: 20px;
  height: 20px;
  background: var(--accent-text);
  -webkit-mask: var(--icon-success) center / contain no-repeat;
  mask: var(--icon-success) center / contain no-repeat;
}

.consent-list strong {
  grid-column: 2;
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: var(--fw-medium);
  line-height: 20px;
  overflow-wrap: anywhere;
}

.consent-list .muted {
  grid-column: 2;
  color: var(--text-1);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

/* An auth page shown inside another page, as in the component preview */
.auth-page:not(body) {
  overflow: hidden;
  min-height: 0;
  padding-block: 40px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-xl);
}

.row > .auth-page {
  flex: 1 1 22rem;
  align-self: stretch;
  min-width: 0;
}

/* ------------------------------------------------------------------ */
/* 11. Wider screens                                                   */
/* ------------------------------------------------------------------ */

@media (min-width: 840px) {
  html {
    scroll-padding-top: 84px;
  }

  .app-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "logo tabs out";
    min-height: 60px;
    padding-block: 0;
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
  }

  .app-nav nav {
    flex-wrap: nowrap;
    margin-inline: 0;
  }

  .app-shell main {
    padding-block: 36px 96px;
  }
}

@media (max-width: 560px) {
  .card {
    padding: 18px;
  }

  .card .card {
    padding: 14px;
  }

  .auth-page > .card {
    padding: 24px 20px;
  }

  .table th,
  .table td {
    padding-inline: 8px;
  }

  h1 {
    font-size: 1.25rem;
  }

  .auth-page h1 {
    font-size: 1.375rem;
  }

  blockquote {
    max-width: 94%;
  }
}

/* ------------------------------------------------------------------ */
/* 12. Preferences: motion, forced colours, print                      */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .btn:active:not(:disabled) {
    transform: none;
  }
}

@media (forced-colors: active) {
  .badge::before,
  .alert::before,
  .consent-list li::before {
    forced-color-adjust: none;
    background: CanvasText;
  }

  .badge-online::before {
    box-shadow: none;
  }

  .badge-offline::before {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px CanvasText;
  }

  .app-nav nav a[aria-current]:not([aria-current="false"]) {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }

  label.row:has(> input:checked) {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }

  .auth-page > .card::after {
    display: none;
  }
}

@media print {
  .app-nav,
  .btn,
  form.row {
    display: none !important;
  }

  body,
  .app-shell,
  .auth-page {
    background: #fff;
    color: #000;
  }

  .card {
    border-color: #bbb;
    box-shadow: none;
    break-inside: avoid;
  }
}
