:root {
    color-scheme: light;
    --bg: #f5f7fa;
    --panel: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --line: #d8e0ea;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Tahoma, sans-serif;
    font-size: 15px;
}

button,
input {
    font: inherit;
}

button,
.toolbar a,
.link-box a {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    padding: 0 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

button:hover,
.toolbar a:hover {
    background: var(--brand-dark);
}

.link-box a:hover {
    background: var(--brand-dark);
}

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

.danger {
    background: #fff;
    color: var(--danger);
    border-color: #f0b8b3;
}

.danger:hover {
    background: #fff1f0;
}

.ghost {
    background: #fff;
    color: var(--text);
    border-color: var(--line);
}

.ghost:hover {
    background: #f8fafc;
}

.topbar {
    min-height: 72px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
}

.topbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stats div {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.stats strong {
    display: block;
    font-size: 28px;
}

.stats span {
    color: var(--muted);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.refresh-now {
    min-width: 130px;
}

.search {
    display: flex;
    flex: 1;
    gap: 8px;
}

input[type="search"],
input[type="password"] {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    background: #fff;
    color: var(--text);
}

code {
    font-size: 18px;
    font-weight: 700;
    color: #0f766e;
}

.mail-list {
    display: grid;
    gap: 12px;
}

.mail-item {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.mail-item.latest {
    border-color: #5bb5ad;
    box-shadow: inset 4px 0 0 #0f766e;
}

.mail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.recipient {
    font-size: 17px;
    font-weight: 700;
}

.meta {
    margin-top: 5px;
    color: var(--muted);
}

.mail-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mail-item h2 {
    margin: 14px 0 12px;
    font-size: 18px;
}

.link-box {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.link-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
}

.link-row span {
    color: #335075;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact {
    min-height: 36px;
    padding: 0 12px;
}

summary {
    cursor: pointer;
    color: var(--muted);
    font-weight: 700;
}

pre {
    width: 100%;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--muted);
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
}

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

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-box {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.login-box h1 {
    margin: 0 0 20px;
}

.login-box label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
}

.login-box button {
    width: 100%;
    margin-top: 14px;
}

.alert {
    background: #fff1f0;
    border: 1px solid #f0b8b3;
    color: var(--danger);
    border-radius: 6px;
    padding: 10px;
}

@media (max-width: 720px) {
    .topbar,
    .toolbar,
    .search,
    .mail-head,
    .mail-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .wrap {
        padding: 16px;
    }

    .link-row {
        grid-template-columns: 1fr 1fr;
    }

    .link-row span {
        grid-column: 1 / -1;
    }
}
