/*
 * Layout for the S.H.A.P. page: toolbar, tabs, chat, editors, dialogs, video, and QR.
 * Does not set the Material color roles. css/material-theme.css owns those.
 * index.html loads this after material-theme.css. The heading sits above the card.
 * Below 768px the tab bars hide and the menu button shows. Hang up stays hidden until a call.
 * Rules that used to sit in index.html stay at the end so they still win equal-specificity ties.
 */

body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 1.5rem 2.75rem 2.5rem 1rem;
    background: color-mix(in srgb, white 8%, var(--md-sys-color-surface-container-low));
}

/* Vue mounts here. contents keeps the toolbar and card as the body's flex children. */
#app {
    display: contents;
}

.page-corner {
    position: fixed;
    top: 0.7rem;
    right: 0.7rem;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.55rem;
}

.page-corner-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Top controls row above the title panel. It scrolls with the page. Shap Social stays hidden until login. */
.top-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    margin: 0 0 0.5rem;
}

html:not(.unlocked) #social-mode-toggle,
html:not(.unlocked) [data-social-toggle] {
    display: none !important;
}

[data-install][hidden] {
    display: none !important;
}

.top-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: auto;
    margin: 0;
    padding: 0.28rem 0.75rem;
    color: var(--md-sys-color-on-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    background: var(--md-sys-color-primary);
    border: 0;
    border-radius: 999px;
}

.top-control {
    gap: 0.3rem;
}

.top-control svg {
    flex: 0 0 auto;
    width: 1em;
    height: 1em;
}

a.top-control:hover,
a.top-control:focus {
    color: var(--md-sys-color-on-primary);
    text-decoration: none;
    box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--md-sys-color-on-primary) 8%, transparent);
}

#social-sign-video:not([hidden]) {
    display: block;
    max-width: 100%;
    max-height: 16rem;
    margin: 0.5rem 0;
}

.social-warning {
    color: var(--md-sys-color-error);
    font-weight: 700;
}

.social-post {
    margin: 0.75rem 0;
    padding: 0.85rem 1rem;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-outline));
    border-radius: 12px;
    background: color-mix(in srgb, var(--md-sys-color-primary) 10%, var(--md-sys-color-surface-container-low));
}

#social-feed {
    max-width: 100%;
    min-width: 0;
}

.social-post img,
.social-post video {
    display: block;
    max-width: 100%;
    height: auto;
}

#social-save-wallet.is-dirty {
    background: #e65100;
    color: #fff;
}

#social-save-wallet.is-saved {
    background: #2e7d32;
    color: #fff;
}

.social-locks {
    display: inline-flex;
    vertical-align: -0.2em;
    gap: 0.05rem;
}

.social-locks .cipher-lock.is-held {
    color: #2e7d32;
}

.social-locks .cipher-lock.is-open {
    color: #c62828;
}

.social-anchor {
    margin: 0.75rem 0 0;
    padding: 0.55rem 0.75rem;
    border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 35%, var(--md-sys-color-outline-variant));
    border-radius: 8px;
    background: color-mix(in srgb, var(--md-sys-color-primary) 18%, var(--md-sys-color-surface-container-high));
}

.social-anchor p {
    margin: 0;
}

.social-time-short,
.social-anchor-short {
    display: none;
}

.social-post header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.palette-dots {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 0.75rem 0 0;
    padding-bottom: 1.5rem;
}

/* Export to File opens from Settings, so it sits above it. */
#exportDialog {
    z-index: 41;
}

#settingsDialog {
    z-index: 40;
    align-items: safe center;
    overflow-y: auto;
}

#settingsDialog .lock-dialog-panel {
    position: relative;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#settingsDismiss {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 1.5rem;
    height: 1.5rem;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
}

#settingsDialog .lock-dialog-panel h2 {
    padding-right: 1.75rem;
}

#settings-button {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline);
}

#settings-button svg {
    width: 0.72rem;
    height: 0.72rem;
    display: block;
    margin: 0 auto;
}

.settings-switches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1.5rem;
}

.turn-row,
.diagnostics-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    margin-top: 0.25rem;
}

#diagnostics[hidden] {
    display: none;
}

.diagnostics-board {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.diagnostics-box {
    margin: 0;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 12px;
    background: var(--md-sys-color-surface-container);
}

.diagnostics-body {
    height: 10lh; /* ten text rows; older content scrolls inside this height */
    overflow-x: hidden;
    overflow-y: scroll;
    line-height: 1.4;
}

.diagnostics-box h3 {
    margin: 0 0 0.45rem;
    font-size: 0.95rem;
}

.diagnostics-box p,
.diagnostics-empty {
    margin: 0 0 0.25rem;
    overflow-wrap: anywhere;
}

.diagnostics-box table {
    width: 100%;
    margin: 0;
    font-size: 0.75rem;
    border-collapse: collapse;
}

.diagnostics-box th,
.diagnostics-box td {
    padding: 0.15rem 0.25rem 0.15rem 0;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

#own-coturn {
    margin-top: 0.75rem;
}

.own-coturn-note {
    margin: 0 0 0.5rem;
}

#own-coturn label {
    display: block;
    margin-top: 0.5rem;
}

#own-coturn input {
    box-sizing: border-box;
    width: 100%;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.settings-version {
    margin: 0 0 0.75rem;
}

#turn-server-note {
    margin-top: 1.5rem;
}

#turn-server-list {
    margin-top: 0.75rem;
}

.extended-turn-note {
    margin-top: 1rem;
}

.turn-server-row {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.5rem;
    margin: 0.35rem 0;
}

#siteResetDialog {
    z-index: 50;
}

.palette-dot {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-on-surface) 28%, transparent);
}

.palette-dot:hover,
.palette-dot:active {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-on-surface) 28%, transparent);
}

.palette-dot[aria-pressed="true"] {
    box-shadow:
        0 0 0 2px var(--md-sys-color-surface),
        0 0 0 4px var(--md-sys-color-on-surface);
}

#theme-toggle {
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline);
}

#theme-toggle:hover,
#theme-toggle:active {
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline);
}

#theme-toggle .theme-icon {
    width: 0.72rem;
    height: 0.72rem;
    display: block;
}

html.dark #theme-toggle .theme-icon-sun,
html:not(.dark) #theme-toggle .theme-icon-moon {
    display: none;
}

.palette-dot[data-palette="red"] { background: #f44336; }
.palette-dot[data-palette="deep-orange"] { background: #ff5722; }
.palette-dot[data-palette="orange"] { background: #ff9800; }
.palette-dot[data-palette="amber"] { background: #ffc107; }
.palette-dot[data-palette="indigo"] { background: #3f51b5; }
.palette-dot[data-palette="blue"] { background: #2196f3; }
.palette-dot[data-palette="green"] { background: #4caf50; }

.page-shell {
    width: min(1200px, 90%);
    max-width: 100%;
    min-width: 0;
    margin-top: 1.125rem;
}

.card {
    width: 100%;
    max-width: none;
}

.page-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    height: auto;
    margin: 0 0 0.75rem;
    padding: 1rem 0.75rem;
    background: color-mix(in srgb, black 8%, var(--md-sys-color-surface-container-low));
    border: 1px solid color-mix(in srgb, black 32%, var(--md-sys-color-surface-container-low));
    border-radius: 12px;
}

.page-toolbar-bar {
    display: contents;
}

.page-credit {
    order: 3;
    flex: 0 0 auto;
    margin: 0 0 0 auto;
    color: var(--md-sys-color-on-surface);
    font-size: 0.75rem;
    line-height: 1rem;
    white-space: nowrap;
}

.page-credit a {
    color: inherit;
}

.page-toolbar #logout-button {
    height: 1.75rem;
    margin: 0;
    padding: 0 0.85rem;
}

@font-face {
    font-family: "Bebas Neue";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/bebas-neue-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.page-toolbar h1 {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: "Bebas Neue", Impact, sans-serif;
    font-size: 1.85rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: uppercase;
}

.toolbar-actions {
    order: 4;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0;
    flex: 0 0 auto;
}

html:not(.unlocked) #logout-button {
    display: none;
}

#app-menu-logout:not([hidden]) {
    display: contents;
}

.toolbar-actions button,
.lock-actions button,
.contact-actions.contact-actions-row button,
.nav-toggle,
.app-menu button {
    margin: 0;
}

.login-intro,
.login-note {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: normal;
    line-height: 1.45;
    text-transform: none;
}

.login-more {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    vertical-align: baseline;
    -webkit-tap-highlight-color: transparent;
}

.login-more:hover,
.login-more:focus,
.login-more:focus-visible,
.login-more:active {
    outline: none;
    border: 0;
    background: none;
    box-shadow: none;
}

.login-chevron {
    width: 1rem;
    height: 1rem;
}

.login-more .login-chevron-up,
.login-more.is-open .login-chevron-down {
    display: none;
}

.login-more.is-open .login-chevron-up {
    display: inline;
}

.login-rule {
    margin: 0.35rem 0 0.9rem;
    border: 0;
    border-top: 1px solid var(--md-sys-color-outline-variant, rgba(0, 0, 0, 0.2));
}

/* Existing user: the password box with Login under it. New user: two buttons side by side. Both fill one column. */
#dataLock .login-section-title,
#dataLock .login-password-row,
#dataLock .lock-actions {
    max-width: 28rem;
}

.login-section-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: normal;
    text-transform: none;
}

.login-password-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.login-password-row input {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.login-password-row button {
    width: 100%;
    margin: 0;
}

.lock-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.lock-actions button {
    width: 100%;
    min-width: 0;
    white-space: normal;
}

.login-popup-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.login-popup-line label {
    margin: 0;
}

.login-popup-line input {
    flex: 1 1 8rem;
    min-width: 0;
    margin: 0;
}

.create-password-fields {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 0.75rem;
    row-gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.create-password-fields label,
.create-password-fields input {
    margin: 0;
    width: 100%;
}

.create-password-fields label {
    width: auto;
}

#rememberedTextEntry[hidden],
#personalShareResult[hidden],
#contactCodeRow[hidden],
#yourPersonalShare[hidden],
#rememberedTextOk[hidden] {
    display: none !important;
}

#rememberedTextButtons {
    margin-top: 1rem;
}

.lock-dialog input.field-invalid,
.lock-dialog input.field-invalid:focus {
    border-color: var(--md-sys-color-error);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-error);
}

.field-hint {
    margin: 0.35rem 0 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
}

.field-hint.is-ok {
    color: #2e7d32;
}

html.dark .field-hint.is-ok {
    color: #81c784;
}

.field-hint.is-error,
.social-sign-status.is-error,
#rememberedTextMessage.is-error {
    color: var(--md-sys-color-error);
    font-weight: 700;
}

.your-id-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.your-peer-label {
    margin: 0;
    min-height: 1.5rem;
}

.view-full-id {
    height: 1.75rem;
    margin: 0;
    padding: 0 0.75rem;
    font-size: 0.75rem;
}

.your-id-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.your-id-actions button {
    flex: 0 1 auto;
    height: auto;
    line-height: 1.35;
    padding: 0.7rem 1.15rem;
    margin: 0;
    white-space: normal;
}

.full-peer-id {
    margin-top: 0;
    overflow-wrap: anywhere;
}

.personal-share-warning {
    /* Fixed colours, not theme ones: the theme's error colour is hard to read on some palettes and backgrounds. */
    padding: 0.5rem 0.75rem;
    color: #8c1d18;
    font-weight: 700;
    background: #fff4e5;
    border: 1px solid #8c1d18;
    border-radius: 8px;
}

.nav-toggle {
    display: none;
    order: 1;
    width: 2rem;
    height: 2rem;
    padding: 0;
    flex: 0 0 auto;
    color: var(--md-sys-color-on-surface);
    background: transparent;
    box-shadow: none;
}

.app-menu {
    display: none;
}

.contact-actions.contact-actions-row {
    flex-wrap: wrap;
}

.contact-actions.contact-actions-row button {
    flex: 0 0 auto;
    padding: 0 0.85rem;
}

.card-body {
    padding: 0.5rem 1.4rem 1.6rem;
}

.control-group-wide {
    grid-column: 1 / -1;
}

.control-group {
    padding: 1rem 1.1rem 0.4rem;
    border-radius: 12px;
}

.cipher-mark {
    display: inline-flex;
    vertical-align: -0.2em;
    gap: 0.05rem;
}

.cipher-mark .cipher-lock {
    width: 0.95rem;
    height: 0.95rem;
}

.cipher-aes,
.cipher-pgp {
    color: #2e7d32;
}

.cipher-plain {
    color: #c62828;
}

#privateKey.is-secret {
    -webkit-text-security: disc;
}

.peer-presence[hidden] {
    display: none;
}

.peer-presence {
    display: inline-block;
    margin: 0.35rem 0 0;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.25rem;
}

.peer-presence.is-online {
    color: #052e16;
    background: #4caf50;
}

.peer-presence.is-offline {
    color: #fff;
    background: #c62828;
}

.peer-id-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.peer-id-actions button {
    height: auto;
    line-height: 1.35;
    padding: 0.7rem 1.15rem;
    margin: 0;
    white-space: normal;
}

#generate-random-peer-id-button[hidden] {
    display: none !important;
}

#advanced-peer-id-button {
    flex: 0 0 auto;
    margin-left: auto;
    color: #ffffff;
    background: var(--md-sys-color-error);
}

html.dark:not([data-palette]) #advanced-peer-id-button {
    color: #601410;
}

#advanced-peer-id-button:hover,
#advanced-peer-id-button:active {
    box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.12);
}

.peer-select {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.peer-select .elevated-field,
.peer-select input,
.peer-select select,
.peer-select textarea,
.peer-select button,
.peer-select .custom-dropdown {
    margin-bottom: 0 !important;
}



.compose-row .btn-icon {
    display: none;
}

.compose-row .elevated-field {
    min-width: 0;
}

.file-picker {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.custom-dropdown {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
}

.custom-dropdown-content {
    display: none;
    position: absolute;
    top: 3rem;
    right: 0;
    min-width: 16rem;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 4px;
    z-index: 40;
}

.custom-dropdown-content button,
.custom-dropdown-content span {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 !important;
    padding: 0.65rem 0.8rem;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.4;
    text-align: left;
    text-transform: none;
    white-space: normal;
    word-break: break-all;
}

.custom-dropdown.show .custom-dropdown-content {
    display: block;
}

#hangup-button[hidden],
#start-call-button[hidden] {
    display: none !important;
}


/* Chat tab: a chat list on the left, the open conversation on the right. */
.comm {
    display: grid;
    grid-template-columns: minmax(15rem, 21rem) minmax(0, 1fr);
    gap: 1rem;
    min-height: 34rem;
}

.comm-sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
    padding: 0.75rem 0.75rem 4.75rem;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
}

.identity-card {
    padding: 0.4rem;
    border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 45%, var(--md-sys-color-outline-variant));
    border-radius: 16px;
    background: color-mix(in srgb, var(--md-sys-color-primary) 6%, var(--md-sys-color-surface-container-high));
}

/* The header is a separate panel that stays the same when the card opens or closes. */
.identity-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0.6rem 0.65rem;
    color: var(--md-sys-color-on-surface);
    font-weight: 400;
    line-height: 1.3;
    text-align: left;
    white-space: normal;
    background: color-mix(in srgb, var(--md-sys-color-primary) 12%, var(--md-sys-color-surface-container-high));
    border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-outline-variant));
    border-radius: 12px;
}

.identity-head:hover,
.identity-head:active {
    box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--md-sys-color-on-surface) 6%, transparent);
}

.identity-icon {
    display: grid;
    place-items: center;
    flex: 0 0 2.25rem;
    height: 2.25rem;
    color: var(--md-sys-color-on-primary);
    background: var(--md-sys-color-primary);
    border-radius: 10px;
}

.identity-text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.identity-title {
    font-weight: 700;
    overflow-wrap: normal;
    word-break: normal;
}

.identity-sub {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    margin-top: 0.15rem;
}

.identity-text .your-peer-label {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.identity-state {
    flex: 0 0 auto;
    padding: 0.15rem 0.5rem;
    color: var(--md-sys-color-on-error-container);
    font-size: 0.6875rem;
    font-weight: 700;
    background: var(--md-sys-color-error-container);
    border-radius: 999px;
}

.identity-card.is-configured .identity-state {
    color: #052e16;
    background: #4caf50;
}

.identity-chevron-button {
    display: grid;
    place-items: center;
    flex: 0 0 2rem;
    height: 2rem;
    color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface-container-high);
    border: 2px solid var(--md-sys-color-primary);
    border-radius: 50%;
}

/* Up while open, down while closed. */
.identity-chevron {
    transform: rotate(180deg);
    transition: transform 0.2s;
}

.identity-card.is-collapsed .identity-chevron {
    transform: none;
}

.identity-card.is-collapsed .identity-body {
    display: none;
}

.identity-body {
    padding: 0.65rem 0.35rem 0.35rem;
}

.identity-note {
    margin: 0 0 0.6rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    line-height: 1.45;
}

#yourPersonalShare p {
    margin: 0 0 0.25rem;
}

.identity-body .your-id-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

/* Generate and Show QR share the first row, Full ID and Advanced the second, so every edge lines up. */
.identity-body .your-id-actions button {
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.8rem;
    font-size: 0.8125rem;
}

.identity-body #advanced-peer-id-button {
    margin-left: 0;
}

.comm-list-head {
    padding: 0.25rem 0.25rem 0;
}

.comm-list-title {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

#panel #chat-search {
    margin: 0;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
}

.comm-list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 8rem;
    max-height: 30rem;
    overflow-y: auto;
}

.comm-list:empty::before,
#messages:empty::before {
    content: attr(data-empty);
    display: block;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
    text-align: center;
}

.comm-list:empty::before {
    padding: 1rem 0.5rem;
}

#messages:empty::before {
    max-width: 18rem;
    margin: 5rem auto;
}

.chat-sidebar-peer {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0.55rem 0.5rem;
    color: var(--md-sys-color-on-surface);
    font-weight: 400;
    line-height: 1.3;
    text-align: left;
    white-space: normal;
    background: transparent;
    border-radius: 12px;
}

.chat-sidebar-peer:hover,
.chat-sidebar-peer:active {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 6%, transparent);
    box-shadow: none;
}

.chat-sidebar-peer.is-selected {
    background: var(--md-sys-color-secondary-container);
    box-shadow: inset 3px 0 var(--md-sys-color-primary);
}

.chat-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 2.5rem;
    height: 2.5rem;
    color: var(--md-sys-color-on-primary-container);
    font-size: 0.875rem;
    font-weight: 700;
    background: var(--md-sys-color-primary-container);
    border-radius: 50%;
}

.chat-sidebar-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.chat-sidebar-name,
.chat-sidebar-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-sidebar-name {
    font-weight: 700;
}

.chat-sidebar-preview {
    min-height: 1em;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
}

.chat-sidebar-side {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

.chat-presence-dot {
    flex: 0 0 auto;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #c62828;
}

.chat-presence-dot.is-online {
    background: #2e7d32;
}

#remote-video.is-remote-control {
    cursor: crosshair;
    touch-action: none;
}

#remote-video.is-remote-control:focus {
    outline: 3px solid var(--md-sys-color-primary);
    outline-offset: -3px;
}

.chat-network {
    padding: 0 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.1rem;
    letter-spacing: 0.04em;
    border: 1px solid currentColor;
    border-radius: 0.3rem;
}

.chat-network.is-rtc {
    color: var(--md-sys-color-primary);
}

.chat-network.is-dht {
    color: var(--md-sys-color-on-primary);
    background: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

.chat-network.is-past {
    opacity: 0.5;
}

.chat-unread {
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.4rem;
    color: var(--md-sys-color-on-primary);
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.5rem;
    text-align: center;
    background: var(--md-sys-color-primary);
    border-radius: 999px;
    box-shadow: 0 0 0 2px var(--md-sys-color-surface-container);
}

.chat-sidebar-peer.has-unread .chat-sidebar-name,
.chat-sidebar-peer.has-unread .chat-sidebar-preview {
    color: var(--md-sys-color-on-surface);
    font-weight: 700;
}

.comm-add {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    width: 3.25rem;
    height: 3.25rem;
    margin: 0;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.comm-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
}

.comm-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.comm-back {
    display: none !important;
}

.comm-peer {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
    min-width: 0;
}

.comm-peer .peer-id-combo {
    flex: 1 1 14rem;
    min-width: 0;
    margin: 0;
}

.comm-peer .peer-presence {
    display: inline-flex;
    align-items: center;
    height: calc(2.25rem + 2px);
    margin: 0;
    padding: 0 0.75rem;
}

.comm-peer .peer-presence[hidden] {
    display: none;
}

/* How messages to this peer are locked: lock icons and No key, Single key, or Double key. */
.peer-cipher {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.4rem;
    height: calc(2.25rem + 2px);
    margin: 0;
    padding: 0 0.75rem;
    color: var(--md-sys-color-on-surface);
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 6px;
}

.peer-cipher[hidden] {
    display: none;
}

.peer-cipher .cipher-mark {
    display: inline-flex;
    gap: 0.1rem;
}

/* #panel input sets a bottom margin on every field; the To box sits on the header's centre line instead. */
#panel #other-peer-id {
    margin: 0;
}

.comm-call {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-self: flex-start; /* Stays on the top row with presence when the lock status wraps under it. */
    align-items: center;
    gap: 0.4rem;
}

.comm-icon {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    color: var(--md-sys-color-on-surface-variant);
    background: transparent;
    border-radius: 50%;
}

/* The call button carries a border so it reads as a button, the same as the phone back button. */
.comm-head .comm-icon {
    height: calc(2.25rem + 2px);
    width: calc(2.25rem + 2px);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 10px;
}

.comm-icon:hover,
.comm-icon:active,
.comm-icon[aria-expanded="true"] {
    color: var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
    box-shadow: none;
}

#hangup-button[hidden],
#start-call-button[hidden] {
    display: none !important;
}

#hangup-button {
    height: calc(2.25rem + 2px);
    margin: 0;
    padding: 0 1rem;
    color: var(--md-sys-color-on-error);
    background: var(--md-sys-color-error);
}

.call-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 20;
    min-width: 15rem;
    padding: 0.85rem;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
}

.call-menu[hidden] {
    display: none;
}

.call-menu-title {
    margin: 0 0 0.6rem;
    font-weight: 700;
}

.call-menu #start-call-button {
    width: 100%;
    margin: 0.25rem 0 0;
}

#video-container {
    display: none;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

#messages {
    flex: 1 1 auto;
    min-height: 18rem;
    max-height: 60vh;
    margin: 0;
    padding: 1rem;
    overflow-y: auto;
    background: color-mix(in srgb, var(--md-sys-color-primary) 4%, var(--md-sys-color-surface-container-low));
    border: 0;
    border-radius: 0;
}

#messages > * {
    margin: 0.2rem 0;
}

#messages .chat-line.is-received,
#messages .chat-line.is-sent {
    width: fit-content;
    max-width: 78%;
    margin: 0.35rem 0;
    padding: 0.45rem 0.7rem;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

#messages .chat-line.is-received {
    margin-right: auto;
    text-align: left;
    background: var(--md-sys-color-surface-container-high);
    border-radius: 14px 14px 14px 4px;
}

#messages .chat-line.is-sent {
    margin-left: auto;
    text-align: left;
    background: color-mix(in srgb, var(--md-sys-color-primary) 22%, var(--md-sys-color-surface-container-high));
    border-radius: 14px 14px 4px 14px;
}

.chat-status {
    margin-left: 0.45rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.6875rem;
}

.chat-line.is-delivered .chat-status {
    color: var(--md-sys-color-primary);
    font-weight: 700;
}

.comm-compose {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

#panel #message {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0.55rem 1rem;
    border-radius: 999px;
}

#panel #selected-file-name {
    flex: 0 1 10rem;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    border-radius: 999px;
}

#panel #selected-file-name:placeholder-shown {
    display: none;
}

.comm-send {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    padding: 0;
    border-radius: 50%;
}

.video-tile[hidden] {
    display: none !important;
}

.video-tile {
    flex: 1 1 320px;
    padding: 0.85rem;
    border-radius: 12px;
}

.video-tile.is-large {
    flex-basis: 100%;
}

.video-tile-label {
    margin: 0 0 0.6rem;
}

.video-tile video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 240px;
    margin: 0 0 0.75rem;
    border: 0;
    border-radius: 8px;
    background: #111;
    object-fit: contain;
}

.video-tile.is-large video {
    max-height: 70vh;
}

.video-tile video:fullscreen {
    max-height: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.call-options,
.call-actions,
.answer-choices,
.crypto-choices,
.contact-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin: 0 0 0.9rem;
}

.call-options label,
.answer-choices label,
.crypto-choices label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 !important;
}

.call-options label[hidden] {
    display: none;
}

.call-options input,
.answer-choices input,
.crypto-choices input {
    margin: 0 !important;
}

.call-options,
.answer-choices {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
}

.notify-choice {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.8rem 0 0.2rem !important;
}

.notify-choice input {
    margin: 0 !important;
}

.answer-choice-label,
.contacts-hint {
    margin: 0.15rem 0 0.55rem;
}

.contacts-page .dt-length,
.passwords-page .dt-length {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#contactsList[hidden] {
    display: none;
}

#contactsTable tbody tr,
#passwordAccountsTable tbody tr {
    cursor: pointer;
}

#passwordAccountsTable thead th {
    white-space: nowrap;
}

/* No saved rows: hide the heading row. The empty-table message stays in the body. */
#contactsTable.is-empty > thead,
#passwordAccountsTable.is-empty > thead {
    display: none;
}

/* From the phone breakpoint up to 1600px, long cells end in an ellipsis inside the panel.
   DataTables cannot drop columns there when the table was drawn on a hidden tab, so the
   fixed layout keeps every row inside the card. Below 769px the expander drops columns.
   At 1600px and wider the full text fits. */
@media (min-width: 769px) and (max-width: 1599px) {
    .contacts-page .dt-container,
    .passwords-page .dt-container {
        max-width: 100%;
    }

    #contactsTable.dataTable,
    #passwordAccountsTable.dataTable {
        width: 100% !important;
        max-width: 100%;
        min-width: 0 !important;
        table-layout: fixed;
    }

    #contactsTable.dataTable col,
    #passwordAccountsTable.dataTable col {
        width: auto !important;
        min-width: 0 !important;
    }

    #contactsTable.dataTable > thead > tr > th,
    #passwordAccountsTable.dataTable > thead > tr > th,
    #contactsTable.dataTable > tbody > tr:not(.child) > td,
    #passwordAccountsTable.dataTable > tbody > tr:not(.child) > td {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

#contactsTable td.keys-short {
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
}

#output,
#passwordOutput {
    margin-top: 0.25rem;
}

#output:empty,
#passwordOutput:empty {
    display: none;
}

#qrApp select {
    display: block;
    width: 100%;
    margin: 0 0 0.9rem;
}

#qrApp button.is-active {
    color: var(--md-sys-color-on-secondary-container);
    background: var(--md-sys-color-secondary-container);
}

#qrScanDialog {
    z-index: 45;
    align-items: safe center;
    overflow-y: auto;
}

#qr-scan-text {
    max-height: 50vh;
    margin: 0 0 1rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

#qrApp .qr-debug {
    display: none;
}

#qrApp.is-debug .qr-debug {
    display: block;
}

.qr-modes,
.qr-styles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0 0 1rem;
}

.qr-modes button,
.qr-styles button {
    margin: 0 !important;
}

/* Equal columns on a phone, so the mode and style buttons line up in rows instead of wrapping ragged. */
@media (max-width: 768px) {
    .qr-modes,
    .qr-styles {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .qr-modes button,
    .qr-styles button {
        width: 100%;
        min-width: 0;
        height: auto;
        min-height: 2.5rem;
        padding: 0.3rem 0.4rem;
        line-height: 1.2;
        white-space: normal;
    }
}

#qr-preview,
#qr-result {
    display: block;
    width: min(100%, 320px);
    height: auto;
    margin: 0.4rem 0 0.8rem;
}

.qr-viewfinder {
    position: relative;
    margin-bottom: 0.8rem;
    background: #111;
    min-height: 12rem;
}

.qr-viewfinder video,
.qr-viewfinder canvas {
    display: block;
    width: 100%;
    max-height: 22rem;
}

#qr-bitmap,
#qr-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#qr-bitmap {
    display: none;
}

#qr-camera-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.8rem;
    margin: 0;
    text-align: center;
}

.qr-scan-progress {
    margin: -0.4rem 0 0.8rem;
    font-weight: 600;
    text-align: center;
}

.qr-handoff {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    color: var(--md-sys-color-on-secondary-container);
    background: var(--md-sys-color-secondary-container);
}

.qr-handoff[hidden] {
    display: none;
}

#qrApp pre,
#qr-stats {
    width: 100%;
    margin: 0 0 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
}

#qrApp pre {
    min-height: 2.5rem;
    padding: 0.6rem 0.75rem;
}

#qr-stats th,
#qr-stats td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    text-align: left;
}

#qr-self-test {
    width: min(100%, 36rem);
    border-radius: 28px;
}

#qr-self-test::backdrop {
    background: var(--md-sys-color-scrim);
}

.peer-select select {
    flex: 1 1 auto;
    width: auto;
    margin-bottom: 0;
}

.peer-id-combo {
    flex-wrap: nowrap;
    margin-bottom: 0.9rem;
}

.peer-id-combo > .form-control {
    min-width: 0;
    height: calc(1.5rem + 0.75rem + 2px);
    color: var(--md-sys-color-on-surface);
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-right: 0;
    border-radius: 4px 0 0 4px;
    box-shadow: none;
}

.peer-id-combo > .form-control:focus {
    color: var(--md-sys-color-on-surface);
    background: transparent;
    border-color: var(--md-sys-color-primary);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}

#peerSelectBtn {
    height: calc(1.5rem + 0.75rem + 2px);
    margin: 0;
    padding: 0 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 0 4px 4px 0;
    box-shadow: none;
}

#peerSelectBtn:hover,
#peerSelectBtn:focus {
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: none;
}

.peer-id-combo .dropdown-menu {
    min-width: 16rem;
    max-width: min(28rem, calc(100vw - 2rem));
    max-height: 12.5rem;
    overflow-y: auto;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.peer-id-combo .dropdown-item,
.peer-id-combo .dropdown-item-text {
    height: auto;
    margin: 0;
    padding: 0.55rem 0.9rem;
    color: var(--md-sys-color-on-surface);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.4;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.peer-id-combo .dropdown-item:hover,
.peer-id-combo .dropdown-item:focus {
    color: var(--md-sys-color-on-surface);
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
    box-shadow: none;
}

@media (max-width: 768px) {
    body {
        display: block;
    }

    .page-shell {
        width: 100%;
        margin-top: 0;
    }

    .page-corner {
        position: fixed;
        top: 0.7rem;
        right: 0.7rem;
        z-index: 40;
    }

    .social-post {
        overflow: hidden;
    }

    .social-post header,
    .social-post time {
        min-width: 0;
        max-width: 100%;
    }

    .social-time-full,
    .social-anchor-full {
        display: none;
    }

    .social-time-short {
        display: inline;
    }

    .social-anchor-short {
        display: block;
    }

    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        padding: 0;
        background: transparent;
        border: 0;
    }

    .page-credit {
        order: -1;
        margin: 0 0 0 auto;
    }

    .page-toolbar-bar {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        order: 1;
        padding: 1rem 0.75rem;
        background: color-mix(in srgb, black 8%, var(--md-sys-color-surface-container-low));
        border: 1px solid color-mix(in srgb, black 32%, var(--md-sys-color-surface-container-low));
        border-radius: 12px;
    }

    #logout-button {
        display: none;
    }

    .title-full {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .top-controls {
        display: none;
    }

    .app-menu .app-menu-top {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.25rem 0.35rem;
    }

    .app-menu .app-menu-top .top-control {
        display: inline-flex;
        justify-content: center;
        width: auto;
        min-height: 0;
        padding: 0.28rem 0.75rem;
        color: var(--md-sys-color-on-primary);
        background: var(--md-sys-color-primary);
        border-radius: 999px;
    }

    #myTab,
    #socialTab {
        display: none !important;
    }

    #app-menu [data-tab="assist"] {
        display: none;
    }

    .contact-actions.contact-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .contact-actions.contact-actions-row button {
        width: 100%;
    }

    .app-menu:not([hidden]) {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        margin: 0 0 0.75rem;
        padding: 0.35rem;
        background: var(--md-sys-color-surface-container);
        border-radius: 12px;
    }

    .app-menu button {
        display: flex;
        justify-content: flex-start;
        width: 100%;
        height: auto;
        min-height: 2.5rem;
        padding: 0.4rem 0.85rem;
        color: var(--md-sys-color-on-surface);
        background: transparent;
        box-shadow: none;
        border-radius: 8px;
    }

    .app-menu button:hover,
    .app-menu button:focus {
        color: var(--md-sys-color-on-surface);
        background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
        box-shadow: none;
    }

    .app-menu button.is-current {
        font-weight: 700;
    }

    .app-menu-split {
        width: 100%;
        margin: 0.35rem 0;
        border: 0;
        border-top: 1px solid var(--md-sys-color-outline-variant);
    }

    .app-menu-split[hidden] {
        display: none !important;
    }

    .comm {
        display: block;
        min-height: 0;
    }

    .comm-main {
        display: none;
        min-height: calc(100dvh - 9rem);
    }

    .comm.show-conversation .comm-sidebar {
        display: none;
    }

    .comm.show-conversation .comm-main {
        display: flex;
    }

    .comm-back {
        display: inline-flex !important;
    }

    /* Back, the To box, and Call share one row; the presence badge fills the row under them. */
    .comm-head {
        flex-wrap: wrap;
        padding: 0.6rem;
    }

    .comm-peer {
        display: contents;
    }

    /* The To box takes most of the first row, so presence and the lock status wrap together onto the second. */
    .comm-peer .peer-id-combo {
        flex: 1 1 60%;
    }

    .comm-peer .peer-presence {
        order: 10;
        flex: 1 1 auto;
        justify-content: center;
    }

    .comm-peer .peer-cipher {
        order: 11;
        flex: 1 1 auto;
        justify-content: center;
    }

    .comm-list {
        max-height: none;
    }

    #messages {
        max-height: none;
    }

    #messages .chat-line.is-received,
    #messages .chat-line.is-sent {
        max-width: 88%;
    }

    .peer-select {
        align-items: stretch;
        flex-direction: column;
    }

    .peer-select button {
        width: 100%;
    }

    .peer-select.compose-row {
        flex-direction: row;
        align-items: center;
    }

    .peer-select.compose-row button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.75rem;
        flex: 0 0 2.75rem;
        margin-right: 0 !important;
        padding: 0;
        line-height: 0;
    }

    .peer-select.compose-row .btn-label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    .peer-select.compose-row .btn-icon {
        display: block;
    }
}

.flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin: 0.5rem 0 1.25rem;
}

.flex-child,
.crypto-box,
.contact-editor,
.password-editor,
.elevated-field {
    box-sizing: border-box;
    border-radius: 12px;
    box-shadow: none;
}

.flex-child {
    flex: 1 1 300px;
    padding: 1rem 1.15rem 0.4rem;
}

.crypto-box,
.contact-editor,
.password-editor {
    margin: 1rem 0;
    padding: 1rem 1.15rem 0.5rem;
}

.elevated-field {
    display: block;
    width: 100%;
    min-height: 2.6rem;
    margin: 0 0 1rem;
    padding: 0.55rem 0.75rem;
    word-break: break-all;
}

.flex-child textarea,
.crypto-box textarea,
.contact-editor textarea,
.contact-editor input,
.password-editor textarea,
.password-editor input,
.crypto-box input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 0.85rem;
}

.flex-child button,
.crypto-box button,
.contact-editor button,
.password-editor button,
.contact-actions button {
    margin: 0 0.6rem 0.85rem 0;
}

/* The row gap spaces a button beside a field, so a stacked one lines up with the field above it. */
.peer-select button,
.password-editor .peer-select button {
    margin: 0;
}

.crypto-choices {
    gap: 1.5rem;
    margin: 0.25rem 0 0.5rem;
}

.assist-role {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 1.75rem;
    row-gap: 0.5rem;
    border: 0;
    margin: 0 0 0.75rem;
    padding: 0;
}

.assist-role legend {
    flex-basis: 100%;
    margin: 0 0 0.35rem;
    padding: 0;
}

.assist-role label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 !important;
    color: var(--md-sys-color-on-surface);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.4;
}

.assist-os {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.assist-os button.is-active {
    outline: 2px solid var(--md-sys-color-primary);
}

.assist-direct-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
}

.assist-direct-actions label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 !important;
}

.assist-terminal {
    height: 26rem;
    max-height: 70vh;
    margin: 0.5rem 0 1.25rem;
    padding: 0.4rem;
    overflow: hidden;
    background: #111;
    border-radius: 8px;
}

.assist-command {
    min-height: 2.6rem;
    margin: 0.75rem 0;
    padding: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--md-sys-color-on-surface);
    font-family: ui-monospace, "Share Tech Mono", monospace;
    background: color-mix(in srgb, black 8%, var(--md-sys-color-surface-container-low));
    border-radius: 8px;
}

.peer-select .elevated-field,
#message.elevated-field {
    flex: 1 1 auto;
    width: auto;
}

#myTabContent {
    padding-top: 1.25rem;
}

.contacts-page .dt-container,
.passwords-page .dt-container {
    margin: 0.25rem 0 1.25rem;
}

.contacts-page .dt-length select,
.contacts-page .dt-length label,
.passwords-page .dt-length select,
.passwords-page .dt-length label {
    margin: 0 !important;
}

.contacts-hint {
    margin: 0 0 0.75rem;
}

.totp-card {
    margin: 0.75rem 0;
    padding: 0.85rem 1rem;
    border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-outline));
    border-radius: 12px;
    background: color-mix(in srgb, var(--md-sys-color-primary) 8%, var(--md-sys-color-surface-container-low));
    cursor: pointer;
}

.totp-card.is-selected {
    box-shadow: inset 0 0 0 2px var(--md-sys-color-primary);
}

.totp-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.totp-code {
    margin: 0.35rem 0 0.15rem;
    font-size: 1.75rem;
    letter-spacing: 0.14em;
    font-variant-numeric: tabular-nums;
}

.totp-remaining {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
}

.password-note {
    margin: 0 0 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
    line-height: 1.35;
}

.password-special-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 0.85rem;
    text-transform: none;
    letter-spacing: 0;
}

.password-editor .password-special-label input {
    width: auto;
    margin: 0;
}

textarea {
    width: 100%;
}

#panel input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#panel select,
#panel textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.85rem;
}

#panel .dt-container input,
#panel .dt-container select {
    display: inline-block;
    width: auto;
    margin-bottom: 0;
}

#app-menu-tools,
#app-menu-social {
    display: contents;
}

#app-menu-tools[hidden],
#app-menu-social[hidden] {
    display: none !important;
}

.hidden {
    display: none;
}

.lock-dialog[hidden] {
    display: none;
}

.lock-dialog {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2.75rem 2.5rem 1rem;
}

.lock-dialog-panel {
    box-sizing: border-box;
    /* At most 28rem, and at most 90% of the area inside the body padding, so a popup is not wider than the panel. */
    width: min(28rem, 1200px, calc(0.9 * (100vw - 3.75rem)));
    max-width: 100%;
    padding: 1.5rem;
    overflow-wrap: anywhere;
}

.lock-dialog-panel h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

#lockDialogButtons,
#rememberedTextButtons,
#incomingCallButtons,
#newMessageButtons,
#createAccountButtons,
#loadFileButtons,
#randomPeerButtons,
#turnChoiceButtons,
#siteResetButtons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#fullPeerIdButtons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#lockDialogButtons button,
#rememberedTextButtons button,
#incomingCallButtons button,
#newMessageButtons button,
#createAccountButtons button,
#loadFileButtons button,
#randomPeerButtons button,
#turnChoiceButtons button,
#siteResetButtons button,
#fullPeerIdButtons button {
    margin-right: 0.5rem;
}

#incomingCallDialog,
#newMessageDialog {
    z-index: 30;
}

#rememberedTextInput,
#randomPeerId {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 1rem;
}

/* Update notice: a small card in the corner. It never blocks the page. */
.update-notice {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 25;
    width: min(22rem, calc(100vw - 2rem));
    padding: 0.9rem 1rem;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 55%, var(--md-sys-color-outline-variant));
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
}

.update-notice[hidden] {
    display: none;
}

.update-notice-title {
    margin: 0 0 0.3rem;
    font-weight: 700;
}

.update-notice-text {
    margin: 0 0 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.update-notice-actions {
    display: flex;
    gap: 0.5rem;
}

.update-notice-actions button {
    height: 2.25rem;
    margin: 0;
    padding: 0 1rem;
}

#updateLater {
    color: var(--md-sys-color-primary);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline);
}

.update-check-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.update-check-row button {
    height: 2rem;
    margin: 0;
    padding: 0 0.9rem;
    font-size: 0.8125rem;
}

/* Contact by name / Contact by ID tabs at the top of the contact dialog. */
.dialog-tabs {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    margin: 0 0 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.dialog-tabs[hidden] {
    display: none;
}

.dialog-tabs button {
    height: auto;
    margin: 0;
    padding: 0.55rem 0.5rem;
    color: var(--md-sys-color-on-surface-variant);
    white-space: normal;
    background: transparent;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
}

.dialog-tabs button[aria-selected="true"] {
    color: var(--md-sys-color-primary);
    font-weight: 700;
    border-bottom-color: var(--md-sys-color-primary);
}

#contactIdEntry[hidden] {
    display: none;
}

#contactIdInput,
#contactIdName {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.field-hint.is-warning {
    color: var(--md-sys-color-error);
}

/* Equal specificity with the narrow-screen .peer-select rule above. The row stays centered. */
.peer-select {
    align-items: center;
}

#contactQrEntry[hidden] {
    display: none;
}

.contact-qr-view video {
    display: block;
    width: 100%;
    max-height: 16rem;
    margin: 0 0 0.75rem;
    object-fit: cover;
    background: #000;
    border-radius: 12px;
}

.contact-qr-view video[hidden] {
    display: none;
}

.contact-qr-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.5rem;
}

.contact-qr-actions button {
    width: 100%;
    margin: 0;
}

/* The QR stays black on white in both themes so any camera reads it. */
.identity-qr-image {
    display: block;
    width: min(100%, 16rem);
    margin: 0 auto 0.75rem;
    padding: 0.5rem;
    background: #fff;
    border-radius: 8px;
    image-rendering: pixelated;
}

.identity-qr-image[hidden] {
    display: none;
}

.identity-qr-text {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-avatar.is-genesis svg {
    display: block;
}

.peer-select:has(textarea) {
    align-items: flex-start;
}

.qr-result-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.qr-result-head p {
    margin: 0;
}

/* Export saves the encrypted account, so it only shows once someone is logged in. */
html:not(.unlocked) #exportToFileBtn,
#exportStatus:empty {
    display: none;
}

.contact-sync {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.contact-sync[hidden] {
    display: none;
}

.sync-code {
    margin: 0.5rem 0 1rem;
    color: var(--md-sys-color-primary);
    font-family: 'Share Tech Mono', monospace;
    font-size: 2.25rem;
    letter-spacing: 0.15em;
    text-align: center;
}

.install-choices {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 1rem;
}

.install-choices button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0.85rem 1rem;
    text-align: left;
    white-space: normal;
    border-radius: 12px;
}

.install-choices button span {
    font-size: 0.8125rem;
    font-weight: 400;
    text-transform: none;
}

/* Group chats (js/chat/groups.1.0.0.1.js): New group beside the list title, the group row, and its dialogs. */
.comm-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.comm-list-head .comm-list-action {
    height: auto;
    margin: 0;
    padding: 0.2rem 0.7rem;
    font-size: 0.75rem;
}

.chat-avatar.is-group svg {
    display: block;
}

.chat-group-count {
    min-width: 1.5rem;
    padding: 0 0.35rem;
    color: var(--md-sys-color-primary);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    border: 1px solid currentColor;
    border-radius: 0.3rem;
}

.chat-group-count.is-past {
    opacity: 0.5;
}

.group-info[hidden] {
    display: none;
}

.group-info {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0.35rem 0 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}

.group-info button {
    height: auto;
    margin: 0;
    padding: 0.2rem 0.7rem;
    font-size: 0.8125rem;
}

.chat-sender {
    margin-right: 0.25rem;
    color: var(--md-sys-color-primary);
    font-weight: 700;
}

#messages .group-note {
    margin: 0.5rem auto;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
    text-align: center;
}

.group-dialog-label {
    margin: 0.75rem 0 0.35rem;
    font-weight: 700;
}

.group-picks {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 14rem;
    overflow-y: auto;
}

.group-picks:empty::before {
    content: attr(data-empty);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.875rem;
}

.group-pick {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-weight: 400;
}

.group-members {
    margin: 0;
    padding: 0;
    list-style: none;
}

.group-members li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.group-member-name {
    flex: 1 1 auto;
    min-width: 0;
}

.group-members li button,
.group-dialog-row button {
    height: auto;
    margin: 0;
    padding: 0.3rem 0.8rem;
}

.group-dialog-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.group-dialog-row[hidden] {
    display: none;
}

#panel .group-dialog-row input,
.group-dialog-row select {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.group-dialog-message {
    min-height: 1.25rem;
    margin: 0.75rem 0;
    font-size: 0.875rem;
}

.group-dialog-message.is-error {
    color: var(--md-sys-color-error);
    font-weight: 700;
}

.group-dialog-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* File transfer (js/chat/file-transfer.1.0.0.1.js): the file line with progress and its buttons. */
#messages .chat-line.file-line {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: min(18rem, 78%);
}

.file-line .cipher-mark {
    align-self: flex-start;
}

.file-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
}

.file-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.file-size,
.file-state {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
}

.file-progress {
    width: 100%;
    height: 0.5rem;
    accent-color: var(--md-sys-color-primary);
}

.file-progress[hidden] {
    display: none;
}

.file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.file-actions:empty {
    display: none;
}

.file-actions button,
.file-actions .file-save {
    height: auto;
    margin: 0;
    padding: 0.25rem 0.8rem;
    font-size: 0.8125rem;
}

#messages .file-actions .file-save {
    color: var(--md-sys-color-on-primary);
    font-weight: 700;
    text-decoration: none;
    background: var(--md-sys-color-primary);
    border-radius: 999px;
}

.comm-main.is-dropping {
    outline: 3px dashed var(--md-sys-color-primary);
    outline-offset: -6px;
}

/* Ports in Remote assistance (js/assist/assist-native.1.0.0.1.js): Share a port, and the shared or open ports. */
.assist-ports h4 {
    margin: 1.25rem 0 0.5rem;
    font-size: 1rem;
}

.assist-port-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.75rem;
}

.assist-port-form[hidden] {
    display: none;
}

.assist-port-form label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin: 0;
    font-size: 0.8125rem;
}

#panel .assist-port-form input,
.assist-port-form select {
    margin: 0;
}

#panel .assist-port-form #assist-port-number {
    width: 7rem;
}

.assist-port-form label.assist-port-lan {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.25rem;
}

.assist-port-form button,
.assist-port-list button,
#assist-port-refresh {
    height: auto;
    margin: 0;
    padding: 0.35rem 0.9rem;
}

.assist-port-list {
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
}

.assist-port-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.assist-port-name {
    font-weight: 700;
}

.assist-port-detail {
    flex: 1 1 12rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
}

/* Files over animated QR (js/qr-tab/qr-file.1.0.0.1.js): File, Seal to contact, Speed, Part size, and the result. */
.qr-file-row,
.qr-anim-controls,
.qr-file-key {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin: 0.5rem 0;
}

.qr-file-row[hidden],
.qr-anim-controls[hidden],
.qr-file-key[hidden] {
    display: none;
}

.qr-file-row label,
.qr-anim-controls label,
.qr-file-key label {
    margin: 0;
}

.qr-anim-controls label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

#panel .qr-file-row select,
#panel .qr-anim-controls select,
#panel .qr-file-key select,
.qr-file-row select,
.qr-anim-controls select,
.qr-file-key select {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    margin: 0;
}

.qr-file-row button,
.qr-file-key button {
    margin: 0;
}

#qr-file-info.is-warning {
    color: var(--md-sys-color-error);
    font-weight: 700;
}

#qr-file-hash {
    overflow-wrap: anywhere;
}

/* Safety numbers (js/chat/safety.1.0.0.1.js): the lock status opens Verify; a changed key is marked. */
#peer-cipher {
    cursor: pointer;
}

#peer-cipher:hover,
#peer-cipher:focus-visible {
    border-color: var(--md-sys-color-primary);
}

#peer-cipher[data-safety="changed"] {
    color: var(--md-sys-color-on-error);
    background: var(--md-sys-color-error);
    border-color: var(--md-sys-color-error);
}

.verify-number {
    margin: 0.75rem 0;
    font-family: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    word-spacing: 0.4em;
    line-height: 1.7;
}

.verify-qr {
    display: block;
    width: min(14rem, 100%);
    margin: 0 auto 0.5rem;
    image-rendering: pixelated;
}

.verify-qr[hidden],
.verify-video[hidden],
#verifyActions[hidden],
#verifyHint[hidden] {
    display: none;
}

.verify-video {
    display: block;
    width: 100%;
    max-height: 16rem;
    border-radius: 8px;
    background: #000;
}

#verifyState.is-error,
#messages .safety-note {
    color: var(--md-sys-color-error);
    font-weight: 700;
}

.verify-close {
    margin-top: 0.75rem;
}

/* The one status line under the messages (displayStatus in js/chat/chat.1.0.0.1.js). */
.chat-status {
    flex: 0 0 auto;
    margin: 0;
    padding: 0.35rem 1rem;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
    background: var(--md-sys-color-surface-container, var(--md-sys-color-surface));
    border-top: 1px solid var(--md-sys-color-outline-variant, rgba(127, 127, 127, 0.35));
}

.chat-status[hidden] {
    display: none;
}

/* Sub tabs in Remote assistance (js/assist/assist.1.0.0.1.js). */
.assist-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.assist-subtabs[hidden] {
    display: none;
}

.assist-subtabs button.is-active {
    outline: 2px solid var(--md-sys-color-primary);
}

/* Larger and Full screen for a QR code (js/qr-tab/qr-zoom.1.0.0.1.js). !important as #qr-preview sets its own width. */
.qr-zoom-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.qr-zoom:has(> img:not([src])) > .qr-zoom-actions,
.qr-zoom:has(> img[hidden]) > .qr-zoom-actions,
.qr-zoom-close {
    display: none;
}

.qr-zoom.is-larger > img {
    width: min(100%, 90vh) !important;
    max-width: none;
    margin-inline: auto;
    image-rendering: pixelated;
}

.qr-zoom.is-full {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.qr-zoom.is-full > img {
    box-sizing: border-box;
    width: min(100vw, 100vh, 100dvh) !important;
    height: min(100vw, 100vh, 100dvh) !important;
    max-width: none;
    margin: 0;
    padding: 3vmin;
    object-fit: contain;
    background: #fff;
    border-radius: 0;
    image-rendering: pixelated;
}

.qr-zoom.is-full > .qr-zoom-actions {
    display: none;
}

.qr-zoom.is-full > .qr-zoom-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: block;
    color: #111;
    background: #eee;
    border: 1px solid #111;
}

/* Buttons that delete something: outlined in the error colour so they don't look like Save. Same look as the planner's Delete. */
button.shap-danger {
    color: var(--md-sys-color-error);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--md-sys-color-error);
}

button.shap-danger:hover,
button.shap-danger:focus-visible {
    box-shadow: inset 0 0 0 1px var(--md-sys-color-error), inset 0 0 0 100px color-mix(in srgb, var(--md-sys-color-error) 10%, transparent);
}

/* QR tab: the style and speed settings sit under the code (js/qr-tab/qr-pane.1.0.0.1.js). */
#qrApp .qr-settings-head {
    margin: 1.25rem 0 0.6rem;
    padding-top: 1rem;
    font-size: 1rem;
    font-weight: 500;
    border-top: 1px solid var(--md-sys-color-outline-variant, var(--md-sys-color-outline));
}

/* Larger and Full screen sit centred under the generated code, which is at most 320px wide, not under the whole panel. */
#qr-generate .qr-zoom:not(.is-larger):not(.is-full) > .qr-zoom-actions {
    width: min(100%, 320px);
}
