:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #121a2e;
  --surface-2: #1a2440;
  --surface-hover: #212d4d;
  --border: #2a3654;
  --border-strong: #6b7a9c;
  --text: #e6ebf5;
  --muted: #a7b1c6;
  --primary: #8fb0ff;
  --primary-bg: #2f5fe0;
  --primary-bg-hover: #3d6cf0;
  --on-primary: #ffffff;
  --primary-soft: #1c2a52;
  --danger: #ff9b9b;
  --danger-bg: #c23a3a;
  --danger-bg-hover: #a92f2f;
  --danger-soft: #3a1a22;
  --success: #6ee0ab;
  --success-soft: #11322a;
  --warning: #f7c873;
  --warning-soft: #3a2c12;
  --focus: #a9c1ff;
  --code-bg: #0a0f1d;
  --code-text: #dbe4f7;
  --overlay: rgb(3 6 15 / 72%);
  --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 12px 32px rgb(0 0 0 / 35%);
  --chart-input: #7fa6ff;
  --chart-output: #f0b35a;
  --qr-bg: #ffffff;
  --qr-ink: #111111;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-hover: #e8edf6;
  --border: #dde3ee;
  --border-strong: #6f7b92;
  --text: #0f172a;
  --muted: #475467;
  --primary: #1d4ed8;
  --primary-bg: #1d4ed8;
  --primary-bg-hover: #1e40af;
  --on-primary: #ffffff;
  --primary-soft: #e6edfe;
  --danger: #b42318;
  --danger-bg: #b42318;
  --danger-bg-hover: #912018;
  --danger-soft: #fef1f0;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #8a4b00;
  --warning-soft: #fff7e6;
  --focus: #1d4ed8;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --overlay: rgb(15 23 42 / 55%);
  --shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 10px 28px rgb(15 23 42 / 8%);
  --chart-input: #2855c9;
  --chart-output: #b35c00;
  --qr-bg: #ffffff;
  --qr-ink: #111111;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 1.55rem; line-height: 1.25; margin: .25rem 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
p { margin: .35rem 0; }
a { color: var(--primary); text-underline-offset: 2px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin: .3rem 0 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

button, .button {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 44px;
  padding: .55rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { background: var(--surface-hover); }
button.primary, .button.primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--on-primary); font-weight: 600; }
button.primary:hover, .button.primary:hover { background: var(--primary-bg-hover); }
button.danger { background: var(--danger-bg); border-color: var(--danger-bg); color: var(--on-primary); font-weight: 600; }
button.danger:hover { background: var(--danger-bg-hover); }
button.danger-outline { background: transparent; border-color: var(--danger); color: var(--danger); font-weight: 600; }
button.danger-outline:hover { background: var(--danger-soft); }
button.link { border: none; background: transparent; color: var(--primary); text-decoration: underline; padding: .55rem .25rem; }
button:disabled { opacity: .6; cursor: not-allowed; }
button svg { width: 18px; height: 18px; flex: none; }

label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .35rem; }
input {
  font: inherit;
  font-size: 16px;
  width: 100%;
  min-height: 44px;
  padding: .55rem .75rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
input[readonly] { background: var(--surface-2); color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.field { margin: .9rem 0; }
.field-error { color: var(--danger); font-size: .88rem; margin: .3rem 0 0; display: flex; gap: .35rem; align-items: flex-start; }
.field-error::before { content: "⚠"; }
.name-fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: .8rem; row-gap: .9rem; margin: .9rem 0; }
.name-fields > .field { margin: 0; }

.brand { font-weight: 800; font-size: 1.05rem; letter-spacing: .01em; color: var(--text); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; gap: .3em; }
.brand span { color: var(--primary); }

.site-header { display: flex; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; padding: .5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header nav { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1 1 auto; min-width: 0; }
.header-end { display: flex; align-items: center; gap: .5rem; margin-left: auto; min-width: 0; }
.header-end button { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.theme-toggle { width: 44px; padding: 0; border-radius: 999px; flex: none; }
.theme-toggle .icon-to-dark, :root[data-theme="light"] .theme-toggle .icon-to-light { display: none; }
:root[data-theme="light"] .theme-toggle .icon-to-dark { display: inline; }
.auth-card .name-fields { grid-template-columns: 1fr; gap: 0; }
.auth-shell { min-height: calc(100vh - 61px); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 2rem 1.75rem; }
.auth-subtitle { color: var(--muted); margin: 0 0 1rem; }
.auth-footer { margin-top: 1.2rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.form-actions .primary { flex: 1 1 auto; }

.alert { display: flex; gap: .7rem; align-items: flex-start; border-radius: 12px; padding: .85rem 1rem; margin: .8rem 0; border: 1px solid transparent; }
.alert strong { display: block; }
.alert .alert-icon { font-weight: 800; flex: none; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert.success { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.alert.warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.alert.info { background: var(--primary-soft); color: var(--text); border-color: var(--border-strong); }
.alert p { color: inherit; }

.app-shell { max-width: 1120px; margin: 0 auto; padding: 1.1rem 1rem 3rem; }
.tab { border: 1px solid transparent; background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tab:hover { background: var(--surface-hover); color: var(--text); }
.tab[aria-selected="true"], .tab[aria-current="page"] { background: var(--primary-soft); color: var(--text); border-color: var(--border-strong); }
.user-id { min-width: 0; text-align: right; }
.user-id strong, .user-id span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.user-id span { color: var(--muted); font-size: .82rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 1.2rem 1.3rem; margin-bottom: 1rem; min-width: 0; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-header > div { min-width: 0; }

.key-panel { display: grid; gap: .6rem; }
.key-row { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: baseline; }
.key-prefix, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--surface-2); border: 1px solid var(--border); padding: .1rem .4rem; border-radius: 6px; overflow-wrap: anywhere; }
.key-value { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; background: var(--code-bg); color: var(--code-text); padding: .85rem; border-radius: 10px; overflow-wrap: anywhere; margin: 0; }
.reveal-box { display: grid; gap: .6rem; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: .4rem 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid currentColor; white-space: nowrap; }
.badge::before { content: ""; width: .5rem; height: .5rem; border-radius: 999px; background: currentColor; }
.badge.registered { color: var(--success); }
.badge.invited { color: var(--primary); }
.badge.pending, .badge.expired, .badge.modified { color: var(--warning); }
.badge.cancelled, .badge.replaced { color: var(--muted); border-style: dashed; }
.badge.cancelled::before, .badge.replaced::before { background: transparent; border: 1.5px solid currentColor; }
.badge.disabled, .badge.failed { color: var(--danger); }
.badge.admin { color: var(--text); }

.empty { border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 2rem 1rem; text-align: center; color: var(--muted); }
.empty strong { color: var(--text); display: block; font-size: 1.02rem; margin-bottom: .3rem; }

.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-clip { display: block; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
td .button, td button { white-space: nowrap; }
td .row-actions { flex-wrap: nowrap; }
.cell-clip + .cell-clip, .cell-clip + .badge { margin-top: .15rem; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; min-width: 0; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.quota-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin: .6rem 0; }
.quota { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; min-width: 0; }
.quota.reached { border-color: var(--warning); }
.quota-value { display: block; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.quota-cap { color: var(--muted); font-size: .95rem; font-weight: 400; white-space: nowrap; }
.quota-override { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1.2rem; }
.quota-note { color: var(--warning); font-size: .9rem; font-weight: 600; margin: .3rem 0 0; }
.meter { height: .6rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); overflow: hidden; margin: .5rem 0 .2rem; }
.meter > span { display: block; height: 100%; background: var(--primary-bg); }
.quota.reached .meter > span { background: var(--warning); }

.check-field { display: flex; align-items: center; gap: .3rem; margin: .9rem 0 0; }
.check-field label { margin: 0; font-size: 1rem; cursor: pointer; }
.check-field input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0 0 0 -10px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.check-field input[type="checkbox"]::before {
  content: "";
  grid-area: 1 / 1;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
}
.check-field input[type="checkbox"]::after {
  content: "";
  grid-area: 1 / 1;
  width: 7px;
  height: 13px;
  border: solid var(--on-primary);
  border-width: 0 3px 3px 0;
  transform: translateY(-2px) rotate(45deg);
  opacity: 0;
}
.check-field input[type="checkbox"]:checked::before { background: var(--primary-bg); border-color: var(--primary-bg); }
.check-field input[type="checkbox"]:checked::after { opacity: 1; }
.check-hint { margin: 0 0 .4rem; }

.list-cards { display: none; }
.list-card { border: 1px solid var(--border); border-radius: 12px; padding: .8rem .9rem; margin-bottom: .6rem; background: var(--surface); min-width: 0; }
.list-card-head { display: flex; justify-content: space-between; gap: .6rem; align-items: flex-start; flex-wrap: wrap; }
.list-card-head strong { overflow-wrap: anywhere; min-width: 0; }
.list-card .dl { font-size: .9rem; }

.subnav { display: flex; flex-wrap: wrap; gap: .25rem; margin: .4rem 0 1rem; }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.chart-figure { margin: 0; min-width: 0; }
.chart-figure figcaption { font-weight: 600; margin-bottom: .2rem; }
.chart-scale { color: var(--muted); font-size: .82rem; margin: 0 0 .4rem; }
.chart { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .25rem; height: 150px; border-bottom: 1px solid var(--border-strong); }
.chart-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; min-width: 0; }
.chart-value { font-size: .7rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.4; }
.chart-bar { border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-bar.in { background: var(--chart-input); }
.chart-bar.out { background: repeating-linear-gradient(45deg, var(--chart-output) 0 4px, transparent 4px 7px); border: 1.5px solid var(--chart-output); }
.chart-labels { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .25rem; font-size: .7rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.legend-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: .35rem; }
.legend-swatch.in { background: var(--chart-input); }
.legend-swatch.out { background: repeating-linear-gradient(45deg, var(--chart-output) 0 4px, transparent 4px 7px); border: 1.5px solid var(--chart-output); }

.dialog { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.dialog[hidden] { display: none; }
.dialog-card { width: 100%; max-width: 480px; max-height: calc(100vh - 2rem); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 1.4rem 1.4rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .55rem; margin-top: 1.1rem; flex-wrap: wrap; }

.dialog-card.wide { max-width: 900px; }
.thread-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: .6rem 1rem; flex-wrap: wrap; margin-bottom: .7rem; }
.thread-toolbar > div:first-child { flex: 1 1 22rem; min-width: 0; }
.thread-toolbar h2 { margin: 0; }
.thread-scroll { display: grid; gap: .8rem; align-content: start; max-height: min(70vh, 56rem); overflow-y: auto; overflow-x: hidden; padding: .6rem .5rem .6rem .4rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.thread-start { margin: 0; padding: .3rem 0 .6rem; text-align: center; color: var(--muted); font-size: .85rem; border-bottom: 1px dashed var(--border-strong); }
.thread-older { display: grid; justify-items: center; gap: .2rem; text-align: center; padding: .3rem 0 .5rem; border-bottom: 1px dashed var(--border-strong); }
.thread-older .hint { margin: 0; }
.msg { border: 1px solid var(--border); border-radius: 12px; padding: .75rem .9rem; background: var(--surface); min-width: 0; scroll-margin-top: 1rem; }
.msg.user { background: var(--primary-soft); border-color: var(--border-strong); }
.msg.old { border-style: dashed; }
.msg-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.msg-head strong { color: var(--text); }
.msg-head time { margin-left: auto; }
.msg-body { overflow-wrap: anywhere; }
.msg-body ul, .msg-body ol { padding-left: 1.3rem; margin: .4rem 0; }
.msg-body pre { background: var(--code-bg); color: var(--code-text); padding: .75rem; border-radius: 8px; overflow-x: auto; font-size: .85rem; overflow-wrap: normal; }
.msg-body pre code { background: transparent; border: none; padding: 0; color: inherit; overflow-wrap: normal; }
.code-lang { display: block; font-size: .75rem; color: var(--muted); margin: .6rem 0 -.3rem; }
details.tool { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 0 .7rem; margin: .4rem 0; }
details.tool summary { cursor: pointer; font-weight: 600; min-height: 44px; padding: .6rem 0; line-height: 1.5; }
details.tool summary code { overflow-wrap: normal; white-space: nowrap; }
details.tool summary code.cmd-line { white-space: normal; overflow-wrap: anywhere; }
.cmd-token { white-space: nowrap; }
.tool-output { max-height: 24rem; overflow: auto; }
.tool-kind { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: .3rem; }
.tool-arg { font-weight: 400; overflow-wrap: anywhere; }
.tool-meta { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.tool-meta.failed { color: var(--danger); font-weight: 600; }
.file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(18rem, 100%), 1fr)); gap: .6rem; margin: .6rem 0; }
.file-card { display: grid; gap: .5rem; border: 1px solid var(--border-strong); border-radius: 10px; padding: .6rem .7rem; background: var(--surface); color: var(--text); min-width: 0; }
.file-main { display: flex; gap: .6rem; align-items: center; min-width: 0; }
.file-kind { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 3.2rem; height: 2.2rem; padding: 0 .3rem; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: .72rem; font-weight: 800; }
.file-meta { display: grid; min-width: 0; }
.file-name { overflow-wrap: anywhere; }
.file-meta .muted { font-size: .85rem; }
.file-note { margin: 0; }
.file-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.file-status { margin: 0; }
.file-thumb { display: block; width: 100%; max-width: 320px; height: auto; border-radius: 8px; border: 1px solid var(--border); }
.preview-image { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }
.preview-text { background: var(--code-bg); color: var(--code-text); padding: .75rem; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; max-height: 55vh; overflow-y: auto; margin: .4rem 0; }
.preview-text code { background: transparent; border: none; padding: 0; color: inherit; }
.slides { padding-left: 1.4rem; display: grid; gap: .6rem; margin: .4rem 0; }
.slides p { margin: .15rem 0 0; color: var(--muted); }
.dialog-file { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.mock-note { border: 1px dashed var(--border-strong); border-radius: 8px; padding: .45rem .7rem; color: var(--muted); font-size: .9rem; }
.scroll-hint { display: none; }
.sheet tbody th { text-transform: none; letter-spacing: normal; font-size: .92rem; color: var(--text); font-weight: 600; }
.sheet th:first-child { position: sticky; left: 0; z-index: 1; }
.divergence { border-left: 4px solid var(--warning); background: var(--warning-soft); color: var(--warning); border-radius: 8px; padding: .6rem .8rem; font-size: .9rem; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-hover), var(--surface-2)); border-radius: 8px; height: 1rem; margin: .5rem 0; }
.section-title { margin-top: 1.4rem; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }

@media (max-width: 900px) {
  .table-wrap.responsive { display: none; }
  .list-cards { display: block; }
}

@media (max-width: 760px) {
  .name-fields, .charts, .quota-grid { grid-template-columns: 1fr; }
  .stat-grid { gap: .5rem; }
  .stat { padding: .6rem .7rem; }
  .stat-label { font-size: .8rem; }
  .stat-value { font-size: 1.35rem; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .dl dt { font-size: .85rem; margin-top: .45rem; }
  .dl dt:first-child { margin-top: 0; }
  .thread-scroll { padding: .35rem .25rem; }
  .msg { padding: .6rem .65rem; }
  .site-header nav { order: 3; width: 100%; }
  .app-header .header-end { display: contents; }
  .app-header .header-end > button:first-of-type { margin-left: auto; }
  .app-header .user-id { order: 2; flex: 1 1 100%; display: flex; gap: .5rem; align-items: baseline; text-align: left; font-size: .9rem; }
  .app-header .user-id strong { flex: 0 1 auto; min-width: 0; max-width: none; }
  .app-header .user-id span { flex: 1 1 0; min-width: 0; max-width: none; }
  .tab { padding: .55rem .6rem; }
  .auth-card { padding: 1.5rem 1.1rem; }
  .card { padding: 1rem; }
  .dialog-actions button { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  .scroll-hint { display: block; }
  .sheet th, .sheet td { padding: .45rem .5rem; }
}

.qr-box {
  display: grid;
  width: min(220px, 100%);
  aspect-ratio: 1;
  place-items: center;
  margin-block: 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--qr-bg);
}

.qr-box img {
  display: block;
  width: 100%;
  height: 100%;
}

.skeleton-block {
  width: 82%;
  height: 82%;
  background: repeating-linear-gradient(45deg, var(--qr-ink) 0 8px, var(--qr-bg) 8px 16px);
}

.reveal-box,
.card form,
.form-actions,
.form-actions > *,
.dialog-card,
.auth-card pre {
  min-width: 0;
  max-width: 100%;
}

.key-value {
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-all;
}

.form-actions > button,
.form-actions > .button,
.dialog-actions > button {
  white-space: normal;
  overflow-wrap: anywhere;
}

.auth-card pre {
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .subnav .button {
    flex: 1 1 calc(50% - .25rem);
    white-space: normal;
  }
}
