:root {
    color-scheme: light;
    --bg:#f6f8fb;
    --surface:#fff;
    --soft:#eef0ff;
    --text:#0f172a;
    --muted:#475569;
    --line:#d9e1ec;
    --accent:#4f46e5;
    --on:#fff;
    --danger:#b91c1c;
    --nav:#111827;
    --navtext:#cbd5e1;
    font: 15px/1.55 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

html[data-theme=dark] {
    color-scheme: dark;
    --bg:#0b1220;
    --surface:#101827;
    --soft:#242b54;
    --text:#e5edf8;
    --muted:#a8b5ca;
    --line:#334155;
    --accent:#a5aaff;
    --on:#111827;
    --danger:#fca5a5;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

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

button {
    cursor: pointer;
}

button:disabled {
    opacity: .6;
    cursor: wait;
}

button,input,textarea,select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 13px;
    background: var(--surface);
}

button {
    transition: background .15s,transform .15s;
}

button:active {
    transform: scale(.98);
}

button.primary {
    background: var(--accent);
    color: var(--on);
    border-color: transparent;
    font-weight: 650;
}

button:hover:not(.primary) {
    background: var(--soft);
}

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

h1,h2,h3,p {
    margin: 0 0 12px;
}

h1 {
    font-size: 29px;
    letter-spacing: -.04em;
}

h2 {
    font-size: 21px;
}

small,.muted {
    color: var(--muted);
}

.skip {
    position: absolute;
    left: -10000px;
}

.skip:focus {
    left: 12px;
    top: 12px;
    z-index: 10;
    background: var(--surface);
    color: var(--text);
}

.loading {
    padding: 3rem;
}

.auth {
    max-width: 450px;
    margin: 8vh auto;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
}

.brand {
    font-weight: 750;
    font-size: 21px;
    letter-spacing: -.04em;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.brand img {
    width: 34px;
    height: 34px;
}

.auth form,.form {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 5px;
    font-weight: 550;
}

input,textarea {
    width: 100%;
    min-width: 0;
}

textarea {
    resize: vertical;
    min-height: 180px;
}

input[type=file] {
    padding: 8px;
}

input[readonly] {
    font-family: monospace;
}

.shell {
    display: grid;
    grid-template-columns: 232px minmax(0,1fr);
    min-height: 100dvh;
}

.sidebar {
    background: var(--nav);
    color: var(--navtext);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar .brand {
    color: white;
}

.sidebar button {
    background: transparent;
    border: 0;
    color: inherit;
    text-align: left;
    min-height: 44px;
}

.sidebar button.primary {
    background: #4f46e5;
    color: white;
    text-align: center;
    margin-bottom: 18px;
}

.sidebar button:hover,.sidebar button.active {
    background: #27345b;
    color: #fff;
}

.sidebar .account {
    margin-top: auto;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.workspace {
    min-width: 0;
    padding: 20px 28px;
}

.top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.top form {
    flex: 1;
    display: flex;
    gap: 8px;
    max-width: 680px;
}

.top form input {
    flex: 1;
}

.top .menu {
    display: none;
}

.titlebar,.actions,.row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.titlebar {
    justify-content: space-between;
    margin-bottom: 12px;
}

.titlebar h1 {
    margin: 0;
}

.panes {
    display: grid;
    grid-template-columns: minmax(230px,1fr) minmax(0,1.35fr);
    gap: 12px;
}

.panel {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    animation: enter .18s ease-out;
}

.mail-list {
    padding: 0;
    overflow: hidden;
}

.mailrow {
    display: grid;
    grid-template-columns: 36px minmax(0,1fr) auto;
    gap: 12px;
    align-items: start;
    text-align: left;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 15px;
    background: var(--surface);
}

.mailrow.selected {
    background: var(--soft);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
}

.mailrow .snippet,.mailrow .sender,.mailrow .subject {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
}

.mailrow.unread .subject {
    font-weight: 750;
}

.mailrow time {
    font-size: 11px;
    color: var(--muted);
}

.mailrow .snippet {
    font-size: 13px;
    color: var(--muted);
}

.body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    min-height: 150px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    margin-top: 20px;
}

.meta {
    overflow-wrap: anywhere;
}

.formpanel {
    max-width: 900px;
}

.empty {
    padding: 36px;
    text-align: center;
    color: var(--muted);
}

.danger {
    color: var(--danger);
}

.files {
    display: grid;
    gap: 6px;
}

.bottom {
    display: none;
}

#toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9;
    max-width: min(400px,90vw);
    background: var(--nav);
    color: white;
    border-radius: 12px;
    padding: 12px 18px;
    box-shadow: 0 10px 30px #0002;
}

#toast:empty {
    display: none;
}

.adminrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
}

.readback {
    display: none;
}

.note {
    padding: 12px;
    background: var(--soft);
    border-radius: 10px;
}

.spacer {
    flex: 1;
}

@keyframes enter {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width:950px) {
    .panes {
        grid-template-columns: minmax(0,1fr);
    }

    .panes.reading .mail-list {
        display: none;
    }

    .panes:not(.reading) .reader {
        display: none;
    }

    .readback {
        display: inline-block;
    }
}

@media (max-width:720px) {
    .shell {
        display: block;
    }

    .sidebar {
        display: none;
        position: fixed;
        inset: 0 auto 0 0;
        width: 255px;
        z-index: 8;
        box-shadow: 0 0 0 100vmax #0006;
    }

    .sidebar.open {
        display: flex;
    }

    .workspace {
        padding: 14px 12px 92px;
    }

    .top {
        margin-bottom: 18px;
    }

    .top .menu {
        display: block;
    }

    .top form button {
        padding: 8px;
    }

    .top>button:not(.menu) {
        padding: 8px;
    }

    .bottom {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 8px 8px max(8px,env(safe-area-inset-bottom));
        gap: 5px;
        background: var(--surface);
        border-top: 1px solid var(--line);
        z-index: 7;
    }

    .bottom button {
        flex: 1;
        padding: 10px 3px;
        font-size: 13px;
        min-height: 44px;
    }

    .panel {
        padding: 15px;
    }

    .mail-list {
        padding: 0;
    }

    .auth {
        margin: 24px 12px;
        padding: 24px;
    }

    .titlebar h1 {
        font-size: 26px;
    }

    .adminrow {
        align-items: start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion:reduce) {
    *,*::before,*::after {
        animation: none!important;
        transition: none!important;
        scroll-behavior: auto!important;
    }
}

input[type=checkbox] {
    width: auto;
    min-width: 0;
    accent-color: var(--accent);
}

.sidebar .account small {
    color: #cbd5e1;
}

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

.panel h2:not(:first-child) {
    margin-top: 24px;
}
/* Cloud workspace: full-height list/detail, consistent controls and mobile layout. */

:root {
    --bg:#f4f6fa;
    --line:#dbe2ed;
    --shadow:0 10px 32px #18284a0a;
}

html[data-theme=dark] {
    --shadow:none;
}

body {
    min-height: 100dvh;
}

button {
    min-height: 40px;
}

button.primary:hover {
    filter: brightness(.96);
}

.brand {
    gap: 10px;
    white-space: nowrap;
    font-size: 20px;
    line-height: 1.15;
}

.brand span {
    min-width: 0;
}

.brand small {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .02em;
    margin-top: 5px;
}

.sidebar .brand small {
    color: #aebbd2;
}

.sidebar {
    padding: 24px 14px;
    gap: 4px;
    overflow-y: auto;
}

.sidebar .brand {
    padding: 0 8px;
}

.sidebar button:not(.primary) {
    padding: 10px 12px;
    font-weight: 500;
}

.sidebar .account {
    padding: 14px 10px 4px;
    border-top: 1px solid #334155;
}

.sidebar #unread {
    float: right;
    background: #475569;
    color: #fff;
    padding: 0 7px;
    border-radius: 9px;
    font-size: 12px;
}

.workspace {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding: 20px 28px 28px;
}

.top {
    margin-bottom: 22px;
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--bg);
    padding: 3px 0 9px;
}

.top form {
    max-width: 760px;
}

.connection {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.connection i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #16a34a;
}

.icon-button {
    min-width: 44px;
}

.eyebrow {
    font-size: 11px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: .11em;
    margin: 0 0 4px;
}

.titlebar {
    margin-bottom: 16px;
}

.panes {
    grid-template-columns: minmax(290px, .85fr) minmax(0,1.25fr);
    gap: 14px;
    min-height: calc(100dvh - 173px);
    align-items: stretch;
}

.panel {
    box-shadow: var(--shadow);
    animation: enter .16s ease-out;
}

.list-head {
    padding: 15px 17px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.list-head small {
    font-size: 12px;
}

.mail-list {
    display: flex;
    flex-direction: column;
}

.mailrow {
    grid-template-columns: 36px minmax(0,1fr) auto;
    padding: 16px 15px;
    min-height: 87px;
}

.mailrow.unread {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
}

.mailrow .subject {
    font-weight: 600;
}

.mailrow .sender {
    font-size: 13px;
}

.mailrow.selected {
    box-shadow: inset 3px 0 var(--accent);
}

.pagination {
    margin-top: auto;
    padding: 12px;
    justify-content: center;
}

.reader {
    padding: 26px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.reader-empty {
    display: grid;
    justify-items: center;
    align-content: center;
    flex: 1;
    min-height: 260px;
    text-align: center;
    color: var(--muted);
    padding: 24px;
}

.reader-empty img {
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    opacity: .85;
}

.reader-empty h2 {
    color: var(--text);
    font-size: 20px;
}

.reader .actions {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 23px;
}

.reader .actions button {
    font-size: 13px;
    padding: 8px 11px;
}

.message-title {
    font-size: 25px;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.reader .meta {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bg);
}

.body {
    font-size: 16px;
    line-height: 1.7;
    min-height: 170px;
}

.reader #reply {
    align-self: flex-start;
    margin-top: 24px;
}

.files button {
    text-align: left;
}

.formpanel {
    max-width: 850px;
    padding: 26px;
}

.formpanel form {
    gap: 16px;
}

.formpanel textarea {
    min-height: 260px;
}

.formpanel label {
    font-size: 13px;
}

.formpanel input,.formpanel textarea {
    font-size: 15px;
}

.formpanel h2 {
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.auth {
    margin: 9vh auto;
    box-shadow: var(--shadow);
    border-radius: 22px;
}

.auth form {
    gap: 16px;
}

.auth label {
    font-size: 14px;
}

.auth input {
    font-size: 16px;
}

.auth label span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.auth button {
    min-height: 46px;
}

.adminrow small {
    font-size: 13px;
}

.sidebar .account strong {
    color: #fff;
}

.note {
    font-size: 13px;
}

@media (min-width:951px) {
    .mail-list,.reader {
        max-height: calc(100dvh - 173px);
        overflow-y: auto;
    }

    .mail-list {
        overflow-x: hidden;
    }

    .mailrow {
        flex-shrink: 0;
    }
}

@media (max-width:1100px) {
    .workspace {
        padding: 18px;
    }

    .mailrow {
        grid-template-columns: 32px minmax(0,1fr);
    }

    .mailrow time {
        grid-column: 2;
        font-size: 11px;
    }

    .mailrow .avatar {
        width: 32px;
        height: 32px;
    }
}

@media (max-width:950px) {
    .panes {
        grid-template-columns: minmax(0,1fr);
        min-height: 0;
    }

    .reader {
        min-height: 65vh;
    }

    .mailrow {
        grid-template-columns: 36px minmax(0,1fr) auto;
    }

    .mailrow time {
        grid-column: auto;
    }

    .mail-list {
        min-height: 55vh;
    }
}

@media (max-width:720px) {
    .workspace {
        padding: 12px 12px 100px;
    }

    .top {
        gap: 6px;
    }

    .top form {
        min-width: 0;
    }

    .top form button {
        padding: 8px;
        font-size: 12px;
    }

    .connection {
        display: none;
    }

    .titlebar {
        margin-bottom: 12px;
    }

    .mailrow {
        grid-template-columns: 32px minmax(0,1fr) auto;
        gap: 8px;
        padding: 13px 10px;
        min-height: 78px;
    }

    .mailrow.unread {
        padding-left: 7px;
    }

    .mailrow time {
        font-size: 10px;
        max-width: 80px;
        text-align: right;
    }

    .reader,.formpanel {
        padding: 17px;
    }

    .reader .actions {
        gap: 5px;
    }

    .reader .actions button {
        padding: 7px 9px;
    }

    .auth {
        margin: 24px 12px;
    }

    .bottom button {
        min-height: 48px;
    }

    #toast {
        bottom: 80px;
        right: 12px;
    }

    .sidebar {
        max-width: 85vw;
    }

    .formpanel textarea {
        min-height: 190px;
    }
}

@media (max-width:360px) {
    .mailrow {
        grid-template-columns: 28px minmax(0,1fr);
    }

    .mailrow time {
        grid-column: 2;
        text-align: left;
        max-width: none;
    }

    .top form button {
        font-size: 11px;
    }

    .top .icon-button {
        min-width: 34px;
    }
}

.drawer-close {
    display: none;
}

@media (max-width:720px) {
    .sidebar.open {
        box-shadow: none;
    }

    .sidebar.open+.drawer-close {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 7;
        background: #0008;
        border: 0;
        border-radius: 0;
        width: 100%;
        height: 100%;
        padding: 0;
    }

    .sidebar.open+.drawer-close:hover {
        background: #0008;
    }
}
/* 0.4.4: compact responsive workspace, no remote fonts or icon dependencies. */

:root {
    --bg:#f3f5f9;
    --line:#dce2ec;
    --soft:#edf0ff;
    --accent:#4338ca;
    --nav:#111827;
    --shadow:0 8px 24px #17213a08;
}

html[data-theme=dark] {
    --bg:#0c1220;
    --surface:#151e2e;
    --line:#2c374c;
    --soft:#252e54;
    --accent:#a5b4fc;
    --text:#eaf0fb;
    --muted:#a6b4ca;
}

.glyph {
    width: 19px;
    height: 19px;
    flex: none;
    vertical-align: middle;
    display: inline-block;
}

.subject .glyph {
    width: 14px;
    height: 14px;
    margin-right: 5px;
}

button .glyph {
    margin-right: 4px;
}

.sidebar button {
    display: flex;
    align-items: center;
    gap: 11px;
}

.sidebar button.primary {
    justify-content: center;
}

.sidebar button .glyph {
    margin: 0;
}

.sidebar button #unread {
    margin-left: auto;
    float: none;
}

.sidebar button.active {
    box-shadow: inset 3px 0 #a5b4fc;
}

.sidebar .brand {
    margin-bottom: 24px;
}

.sidebar {
    width: 100%;
    border-right: 1px solid #273247;
}

.shell {
    grid-template-columns: 222px minmax(0,1fr);
}

.workspace {
    padding: 16px 24px;
    gap: 0;
}

.top {
    padding: 7px 0 10px;
    gap: 10px;
}

.top form {
    position: relative;
    max-width: 760px;
    min-width: 0;
    align-items: center;
}

.top form>.glyph {
    position: absolute;
    left: 13px;
    color: var(--muted);
    pointer-events: none;
}

.top form input {
    padding-left: 41px;
    min-height: 44px;
}

.top button {
    min-height: 44px;
}

.top .icon-button .glyph,.menu .glyph {
    margin: 0;
}

.titlebar {
    margin-bottom: 14px;
}

.titlebar h1 {
    font-size: 28px;
}

.reader {
    padding: 23px clamp(18px,2vw,32px);
}

.reader .actions {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface);
    padding-top: 4px;
}

.reader .body {
    margin-top: 14px;
    min-height: 120px;
    padding: 20px 0;
    line-height: 1.65;
}

.message-title {
    margin-bottom: 14px;
    font-weight: 700;
}

.reader .meta {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.mailrow {
    min-height: 84px;
}

.mailrow .subject {
    font-size: 14px;
}

.mailrow .snippet {
    margin-top: 4px;
}

.avatar {
    background: #e4e7ff;
    color: #3730a3;
    border-radius: 50%;
}

.mailrow.unread .subject {
    font-weight: 750;
}

.reader .security-label {
    margin-bottom: 12px;
}

.security-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

.security-label.secure {
    color: #166534;
}

html[data-theme=dark] .security-label.secure {
    color: #86efac;
}

.security-label .glyph {
    width: 16px;
    height: 16px;
}

.encryption-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    background: var(--soft);
    border-radius: 12px;
}

.encryption-toggle span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.encryption-toggle input {
    width: 22px;
    height: 22px;
    flex: none;
}

.key-panel {
    display: grid;
    gap: 12px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.key-panel textarea {
    min-height: 100px;
    font-family: monospace;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.key-panel input {
    font-size: 12px;
}

.key-panel button {
    justify-self: start;
}

.auth {
    max-width: 460px;
    margin: clamp(20px,7vh,70px) auto;
    padding: clamp(22px,4vw,38px);
    border-radius: 24px;
}

.auth-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    color: var(--muted);
    margin-bottom: 16px;
}

.auth h1 {
    font-size: 30px;
    margin-bottom: 8px;
}

.auth .brand {
    margin-bottom: 25px;
}

.auth label {
    font-weight: 600;
}

.auth input {
    min-height: 46px;
}

.auth input[type=checkbox] {
    min-height: 0;
}

.auth .address-field {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
}

.auth .address-field input {
    border: 0;
    border-radius: 0;
    flex: 1;
    width: 0;
    min-width: 70px;
    background: transparent;
}

.auth .address-field:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.auth .address-field input:focus-visible {
    outline: none;
}

.auth .domain-suffix {
    padding: 0 11px;
    color: var(--muted);
    font-weight: 550;
    font-size: 13px;
    white-space: nowrap;
    flex: none;
    border-left: 1px solid var(--line);
    align-self: stretch;
    display: flex;
    align-items: center;
    background: var(--bg);
}

.auth #address-hint {
    font-weight: 400;
    font-size: 12px;
    line-height: 1.4;
}

.auth button {
    border-radius: 12px;
}

.formpanel {
    max-width: 760px;
}

.formpanel input:not([type=checkbox]),.formpanel textarea {
    min-height: 44px;
}

.formpanel input[type=file] {
    max-width: 100%;
}

.formpanel textarea {
    min-height: 220px;
}

button:disabled {
    opacity: .52;
    cursor: not-allowed;
}

.reader button:not(:disabled),.sidebar button:not(:disabled),.bottom button:not(:disabled) {
    transition: background-color .15s ease,box-shadow .15s ease,transform .15s ease;
}

.reader button:active,.sidebar button:active,.bottom button:active {
    transform: scale(.98);
}

@media (max-width:1100px) {
    .shell {
        grid-template-columns: 200px minmax(0,1fr);
    }

    .workspace {
        padding: 14px 17px;
    }

    .panes {
        grid-template-columns: minmax(235px,.85fr) minmax(0,1.15fr);
    }
}

@media (max-width:950px) {
    .panes {
        grid-template-columns: minmax(0,1fr);
    }

    .reader .actions {
        position: static;
    }

    .reader {
        min-height: 60vh;
    }
}

@media (max-width:720px) {
    .shell {
        display: block;
    }

    .sidebar {
        width: 270px;
        max-width: 85vw;
        padding-top: max(20px,env(safe-area-inset-top));
        padding-bottom: max(16px,env(safe-area-inset-bottom));
    }

    .workspace {
        padding: 8px 12px calc(85px + env(safe-area-inset-bottom));
    }

    .top {
        gap: 7px;
        top: 0;
    }

    .top form {
        gap: 5px;
    }

    .top form input {
        padding-left: 35px;
        font-size: 16px;
    }

    .top form>.glyph {
        left: 10px;
        width: 17px;
    }

    .top form button {
        min-width: 48px;
    }

    .top .menu,.top .icon-button {
        min-width: 44px;
        padding: 7px;
    }

    .bottom {
        gap: 4px;
        padding: 6px 8px max(7px,env(safe-area-inset-bottom));
    }

    .bottom button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        border-color: transparent;
        min-height: 53px;
        font-size: 11px;
    }

    .bottom button .glyph {
        margin: 0;
        width: 20px;
        height: 20px;
    }

    .bottom button:not(.primary) {
        background: transparent;
    }

    .bottom button.primary {
        border-radius: 14px;
    }

    .mailrow {
        grid-template-columns: 34px minmax(0,1fr) auto;
        min-height: 78px;
    }

    .mailrow time {
        max-width: 82px;
        white-space: normal;
    }

    .mailrow .sender {
        font-size: 13px;
    }

    .reader .actions button {
        min-height: 42px;
    }

    .reader .body {
        font-size: 15px;
    }

    .auth {
        margin: 20px auto;
        max-width: calc(100% - 24px);
        padding: 23px;
    }

    .auth .domain-suffix {
        font-size: 12px;
        padding: 0 9px;
    }

    .formpanel {
        padding: 17px;
    }

    .formpanel input,.formpanel textarea {
        font-size: 16px;
    }

    .formpanel .actions button {
        min-height: 44px;
    }

    .titlebar h1 {
        font-size: 25px;
    }

    .encryption-toggle {
        padding: 12px;
    }

    .sidebar.open {
        animation: drawerIn .18s ease-out;
    }

    .sidebar.open+.drawer-close {
        animation: fadeIn .15s ease-out;
    }
}

@media (max-width:360px) {
    .top form button {
        font-size: 11px;
        padding: 5px;
    }

    .top .menu,.top .icon-button {
        min-width: 40px;
    }

    .auth .domain-suffix {
        font-size: 11px;
        padding: 0 6px;
    }

    .mailrow {
        grid-template-columns: 30px minmax(0,1fr);
    }

    .mailrow time {
        grid-column: 2;
        text-align: left;
        max-width: none;
    }
}

@keyframes drawerIn {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion:reduce) {
    *,*::before,*::after {
        animation: none!important;
        transition: none!important;
        scroll-behavior: auto!important;
    }
}

.settings-grid {
    display: grid;
    gap: 14px;
    max-width: 930px;
}

.settings-grid .formpanel {
    max-width: none;
}

.settings-grid h2 {
    font-size: 18px;
}

.settings-grid h2 small {
    font-size: 11px;
    font-weight: 500;
    margin-left: 7px;
}

.settings-grid .panel {
    padding: 22px;
}

.key-panel #lookup-result {
    display: grid;
    gap: 8px;
}

.key-panel #lookup-result:empty {
    display: none;
}

.key-panel textarea {
    min-height: 96px!important;
}

.key-panel .form {
    margin-top: 6px;
}

@media (max-width:720px) {
    .settings-grid .panel {
        padding: 16px;
    }

    .settings-grid {
        gap: 10px;
    }
}

.security-dialog {
    width: min(440px,calc(100% - 32px));
    border: 1px solid var(--line,#aaa);
    border-radius: 16px;
    padding: 24px;
    max-height: 85vh;
    overflow: auto;
    color: var(--text);
    background: var(--surface);
}

.security-dialog::backdrop {
    background: #0008;
}

.security-dialog form {
    margin: 0;
}

.smtp-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: inherit;
}

/* 0.7.1: theme-safe dialogs, signup and recovery onboarding. */
.security-dialog {
    width: min(520px, calc(100% - 24px));
    max-height: min(88dvh, 760px);
    padding: clamp(18px, 4vw, 30px);
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 24px 80px #0006;
    margin: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.security-dialog h2 {
    color: var(--text);
    font-size: 22px;
    line-height: 1.25;
    border: 0;
    padding: 0;
    margin-bottom: 10px;
}
.security-dialog p {
    color: var(--muted);
}
.security-dialog label {
    color: var(--text);
}
.security-dialog .recovery-code {
    min-height: 88px;
    height: auto;
    resize: none;
    font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow-wrap: anywhere;
    word-break: break-all;
    background: var(--bg);
    color: var(--text);
}
.security-dialog .recovery-confirm {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 16px;
}
.security-dialog .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}
.security-dialog .actions button {
    flex: 1 1 125px;
}
.security-dialog .dialog-status,
.auth-status {
    color: var(--muted);
    min-height: 1.5em;
    font-size: 13px;
    overflow-wrap: anywhere;
}
.auth-status:empty,
.dialog-status:empty {
    display: none;
}
.auth {
    width: min(460px, calc(100% - 24px));
}
.auth details {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.auth details summary {
    cursor: pointer;
    color: var(--muted);
}
.auth details[open] summary {
    margin-bottom: 10px;
}
#verification {
    max-width: 100%;
    overflow-x: auto;
}
input:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
    caret-color: var(--text);
}
@media (max-width: 720px) {
    .auth {
        margin: 16px auto;
        padding: 20px;
    }
    .auth input,
    .security-dialog input {
        font-size: 16px;
    }
    .security-dialog {
        max-height: 88dvh;
    }
}

.passkey-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}
.passkey-row small {
    display: block;
    color: var(--muted);
}
#passkey-signin {
    min-height: 46px;
    font-weight: 650;
    background: var(--soft);
    color: var(--text);
    border: 1px solid var(--line);
}
html[data-theme=dark] dialog.security-dialog {
    color-scheme: dark;
    color: var(--text);
    background-color: var(--surface);
}
html[data-theme=light] dialog.security-dialog {
    color-scheme: light;
    color: var(--text);
    background-color: var(--surface);
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
