:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #8b95a7;
    --line: #dfe3ea;
    --accent: #6366d9;
    --accent-dark: #4f52c8;
    --green: #05b88f;
    --purple: #8b5cf6;
    --blue: #5a67d8;
    --warning-bg: #eaf2ff;
    --warning-line: #b8d2ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 14px;
}

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

.topbar {
    height: 58px;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 32px;
    background: var(--panel);
    border-top: 4px solid #2f4858;
    border-bottom: 1px solid #e7eaf0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.brand-icon {
    width: 22px;
    height: 18px;
    border: 2px solid var(--blue);
    border-radius: 3px;
    position: relative;
}

.brand-icon::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 4px;
    width: 10px;
    height: 2px;
    background: var(--blue);
}

.tabs {
    display: flex;
    gap: 6px;
}

.tab {
    border: 1px solid transparent;
    background: transparent;
    color: #667085;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
}

.tab.is-active {
    color: #111827;
    background: #ffffff;
    border-color: #e7eaf0;
}

.shell {
    width: min(1152px, calc(100% - 40px));
    margin: 28px auto;
}

.view {
    display: none;
}

.view.is-active {
    display: block;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

h1 {
    font-size: 28px;
    line-height: 1.2;
    margin: 0 0 4px;
}

h2 {
    font-size: 18px;
    margin: 0 0 22px;
}

p {
    margin: 0;
}

.muted,
.hint,
#dashboard-subtitle {
    color: var(--muted);
}

.notice {
    border: 1px solid var(--warning-line);
    background: var(--warning-bg);
    color: #2563eb;
    border-radius: 6px;
    padding: 13px 16px;
    margin-bottom: 16px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 108px);
    gap: 12px;
    margin-bottom: 32px;
}

.metric {
    min-height: 72px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 16px 16px 12px;
    position: relative;
}

.metric::before {
    content: "";
    position: absolute;
    left: 20px;
    top: 18px;
    width: 4px;
    height: 32px;
    border-radius: 3px;
    background: var(--green);
}

.metric b {
    display: block;
    padding-left: 18px;
    font-size: 24px;
    line-height: 24px;
}

.metric span {
    display: block;
    padding-left: 18px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.metric-purple::before {
    background: var(--purple);
}

.metric-gray::before {
    background: #9aa3af;
}

.metric-blue::before {
    background: var(--blue);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.filter-icon {
    width: 16px;
    height: 16px;
    border-left: 2px solid #111827;
    border-right: 2px solid #111827;
    transform: skew(-18deg);
}

select,
input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: #111827;
    padding: 11px 12px;
    outline: none;
}

select {
    width: 200px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgb(99 102 217 / 0.12);
}

.code-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.code-card {
    min-height: 210px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 20px;
}

.card-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.recipient {
    font-weight: 700;
}

.badge {
    height: 24px;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    white-space: nowrap;
    color: #00a77e;
    background: #dcfbef;
}

.subline {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.subject {
    margin-top: 18px;
    color: #344054;
}

.mail-meta {
    margin-top: 12px;
    color: #667085;
    font-size: 13px;
}

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

.code-value {
    display: inline-flex;
    align-items: center;
    min-height: 50px;
    padding: 0 18px;
    border: 1px solid #e3e5f2;
    border-radius: 5px;
    background: #f0f1fb;
    color: var(--accent);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 1px;
}

.divider {
    border-top: 1px solid #edf0f4;
    margin: 12px 0;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.primary-button,
.secondary-button,
.text-button {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 16px;
    cursor: pointer;
    background: #fff;
}

.primary-button {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.primary-button:hover {
    background: var(--accent-dark);
}

.secondary-button:hover,
.text-button:hover {
    background: #f8fafc;
}

.text-button {
    padding: 6px 12px;
}

.empty-state {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 32px;
    color: var(--muted);
    background: #fff;
    text-align: center;
}

.narrow-page {
    width: min(1126px, 100%);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    margin-top: 26px;
}

.panel-copy {
    margin-bottom: 16px;
}

.account-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.compact-form {
    margin-bottom: 16px;
}

.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid #edf0f4;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fbfcfe;
}

.fixed-config {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.fixed-config div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid #edf0f4;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fbfcfe;
}

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

.fixed-config strong {
    font-weight: 700;
    word-break: break-all;
}

.account-row strong {
    display: block;
}

.auth-box {
    margin-top: 16px;
    border: 1px solid #b8d2ff;
    background: #eaf2ff;
    border-radius: 8px;
    padding: 16px;
}

.auth-code {
    display: inline-flex;
    margin: 12px 0;
    padding: 10px 16px;
    border: 1px solid #d7ddf5;
    border-radius: 6px;
    background: #ffffff;
    color: var(--accent);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.auth-code.mini {
    min-height: auto;
    margin: 0;
    font-size: 18px;
}

.tutorial {
    margin-top: 18px;
    border-top: 1px solid #edf0f4;
    padding-top: 16px;
}

.tutorial summary {
    cursor: pointer;
    font-weight: 700;
}

.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.tutorial-step {
    border: 1px solid #e5e7ef;
    border-radius: 8px;
    background: #ffffff;
    padding: 14px;
}

.tutorial-step h3 {
    margin: 12px 0 8px;
    font-size: 15px;
}

.tutorial-step p {
    color: #475467;
    font-size: 13px;
    line-height: 1.7;
}

.tutorial-visual {
    min-height: 124px;
    border: 1px solid #e8ecf4;
    border-radius: 8px;
    background: #f8fafc;
    padding: 12px;
}

.fake-browser,
.fake-form,
.fake-permissions,
.fake-client,
.fake-device,
.fake-worker {
    height: 100%;
    min-height: 98px;
    border: 1px solid #dfe5ef;
    border-radius: 7px;
    background: #ffffff;
    padding: 10px;
}

.fake-browser > span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #cbd5e1;
    margin-right: 4px;
}

.fake-title {
    margin-top: 10px;
    font-weight: 700;
}

.fake-menu,
.fake-button,
.fake-input,
.fake-radio,
.fake-permissions b,
.fake-permissions span,
.fake-client code,
.fake-link,
.fake-worker span {
    display: block;
    border-radius: 5px;
    background: #eef2ff;
    color: #4f52c8;
}

.fake-menu {
    margin-top: 10px;
    padding: 7px;
}

.fake-button {
    width: 118px;
    margin-top: 8px;
    padding: 7px;
    text-align: center;
    background: var(--accent);
    color: #ffffff;
}

.fake-input {
    height: 28px;
    margin-bottom: 12px;
    background: #f1f5f9;
}

.fake-input.wide {
    width: 100%;
}

.fake-radio {
    height: 14px;
    margin-top: 9px;
    background: #e2e8f0;
}

.fake-radio.active {
    background: #c7d2fe;
}

.fake-permissions div,
.fake-client span {
    font-weight: 700;
    margin-bottom: 10px;
}

.fake-permissions span,
.fake-permissions b {
    width: fit-content;
    padding: 5px 8px;
    margin-top: 6px;
}

.fake-client code {
    display: inline-block;
    padding: 10px;
    color: #111827;
    background: #f1f5f9;
}

.fake-device,
.fake-worker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.fake-link,
.fake-worker span {
    padding: 7px 9px;
}

.fake-worker div {
    font-weight: 700;
}

.tutorial-note {
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
}

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

label {
    display: block;
    margin-bottom: 16px;
    color: #344054;
}

label input,
label textarea {
    margin-top: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 12px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.checkbox-line input {
    width: auto;
}

.mailbox-card {
    border: 1px solid #edf0f4;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 16px;
    background: #fbfcfe;
}

.mailbox-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 18px;
}

.flow-list {
    margin: 0;
    padding-left: 20px;
    line-height: 2;
}

code {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 5px;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    max-width: 360px;
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    background: #111827;
    box-shadow: 0 14px 36px rgb(15 23 42 / 0.18);
}

@media (max-width: 900px) {
    .topbar {
        height: auto;
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 18px;
    }

    .shell {
        width: min(100% - 24px, 1152px);
        margin: 20px auto;
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .metric-grid,
    .code-grid {
        grid-template-columns: 1fr;
    }

    .metric-grid {
        gap: 10px;
    }

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

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