/* ─────────────────────────────────────────────────────────────
   MailPool · 模仿 MailNest（迈巢）视觉风格
   shadcn/ui 风格主题：oklch 换算为 hex，Inter 字体，圆角 10px
   ───────────────────────────────────────────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --background: #ffffff;
    --foreground: #0f1115;
    --card: #ffffff;
    --card-foreground: #0f1115;
    --primary: #1a1c22;          /* 深蓝黑，仿 MailNest oklch(20.8% .042 265.755) */
    --primary-hover: #2a2d35;
    --primary-foreground: #fafafa;
    --secondary: #f4f4f5;
    --muted: #f4f4f5;
    --muted-foreground: #6e7178;
    --accent: #f4f4f5;
    --accent-foreground: #0f1115;
    --border: #e4e6e8;
    --input: #e4e6e8;
    --ring: #a8b0bd;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #d97706;
    --radius: 10px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 2px rgba(15, 17, 21, .04);
    --shadow-pop: 0 4px 16px rgba(15, 17, 21, .1);
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--background);
    color: var(--foreground);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── 顶部导航（仿迈巢：fixed 悬浮 + 胶囊链接）──── */
.topbar {
    position: fixed;
    top: 16px;
    left: 0;
    right: 0;
    z-index: 100;
}
.topbar-inner {
    padding: 0 32px;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.01em;
    color: var(--foreground);
    white-space: nowrap;
}
.brand-mark { width: 26px; height: 26px; border-radius: 7px; display: block; flex-shrink: 0; }
.brand-sub { font-size: 12px; font-weight: 500; color: var(--muted-foreground); }
.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 28px;
    font-weight: 700;
    font-size: 26px;
    letter-spacing: -.02em;
    color: var(--foreground);
}
.login-brand > div { display: flex; flex-direction: column; align-items: flex-start; }
.login-brand .brand-mark { width: 48px; height: 48px; border-radius: 13px; }
.login-brand .brand-sub { display: block; font-size: 13px; margin-top: 3px; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-item {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--card);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--foreground);
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}
@media (max-width: 1400px) {
    .brand-sub { display: none; }
    .topbar-inner { gap: 10px; padding: 0 16px; }
    .nav-item { padding: 0 9px; font-size: 12.5px; height: 34px; }
}
.nav-item:hover { background: var(--accent); color: var(--foreground); }
.nav-item.active { background: var(--foreground); color: var(--card); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ── 内容区 ─────────────────────────── */
.content {
    padding: 88px 32px 64px;
}
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.page-sub { color: var(--muted-foreground); margin-bottom: 24px; font-size: 14px; }

/* ── 卡片 ───────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 20px 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── 统计卡片 ───────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 18px 20px;
}
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat-label { color: var(--muted-foreground); font-size: 13px; margin-top: 2px; }
.stat-value.ok { color: var(--success); }
.stat-value.warn { color: var(--warning); }
.stat-value.dead { color: var(--danger); }

/* ── 表格（仿迈巢：无分隔线，th 与正文同色）── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: none; }
th {
    color: var(--foreground);
    font-weight: 500;
    font-size: 14px;
    text-transform: none;
    background: transparent;
    letter-spacing: 0;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* 表格外层圆角边框容器（仿迈巢 rounded-lg border） */
.mn-table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}
.mn-table-card .table-wrap { padding: 4px 0 8px; }
.mn-table-card th { padding: 14px 16px 8px; }
.mn-table-card td { padding: 8px 16px; }
.mn-table-card .mn-pager { padding: 0 16px 14px; margin-top: 0; }

/* ── 表单 ───────────────────────────── */
label { display: block; margin-bottom: 6px; color: var(--foreground); font-size: 13px; font-weight: 500; }
input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    background: var(--background);
    font-size: 14px;
    font-family: inherit;
    color: var(--foreground);
    margin-bottom: 14px;
    transition: border-color .15s, box-shadow .15s;
    box-shadow: 0 1px 2px rgba(15, 17, 21, .03);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(168, 176, 189, .25);
}
input::placeholder, textarea::placeholder { color: #a1a1aa; }
textarea { min-height: 90px; font-family: "Consolas", ui-monospace, monospace; font-size: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ── 按钮 ───────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: var(--primary-foreground);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-ghost {
    background: var(--background);
    color: var(--foreground);
    border-color: var(--border);
    box-shadow: 0 1px 2px rgba(15, 17, 21, .04);
}
.btn-ghost:hover { background: var(--accent); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── 徽章（浅色 pill，shadcn 风）────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
    border: 1px solid transparent;
}
.badge-available { background: #f0fdf4; color: #166534; border-color: #dcfce7; }
.badge-using { background: #fffbeb; color: #b45309; border-color: #fef3c7; }
.badge-dead { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-code {
    background: #f4f4f5;
    color: #0f1115;
    border-color: #e4e6e8;
    font-family: "Consolas", ui-monospace, monospace;
    font-weight: 600;
    font-size: 13px;
}
.badge-on { background: #f0fdf4; color: #166534; border-color: #dcfce7; }
.badge-off { background: #f4f4f5; color: #6e7178; border-color: #e4e6e8; }

/* ── Toggle 开关 ── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #d4d4d8; border-radius: 999px; transition: .3s;
}
.toggle-slider::before {
    content: ""; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle-row label { cursor: pointer; }
.badge-temp {
    background: #f0f9ff;
    color: #0369a1;
    border-color: #e0f2fe;
}

/* ── 商城页 tabs + 商品卡片（仿 MailNest /buy-email）────────── */
.mn-tabs {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--muted);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}
.mn-tab {
    border: none;
    background: transparent;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.mn-tab:hover { color: var(--foreground); }
.mn-tab.active { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-card); }

.mn-mall-note {
    font-size: 13px;
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 20px;
}
.mn-mall-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .mn-mall-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .mn-mall-list { grid-template-columns: 1fr; } }
.mn-mall-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: none;
}
.mn-mall-main { position: relative; }
.mn-mall-name { font-weight: 600; font-size: 15px; }
.mn-mall-code { margin-top: 4px; font-size: 13px; color: var(--muted-foreground); }
.mn-mall-row {
    display: flex;
    gap: 16px;
    margin-top: 4px;
    font-size: 13px;
    color: var(--muted-foreground);
}
.mn-mall-logo {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
}
.mn-mall-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: 16px;
}
.mn-mall-price-now { font-size: 18px; font-weight: 700; }
.mn-mall-price-origin {
    font-size: 12px;
    color: var(--muted-foreground);
    text-decoration: line-through;
}
.mn-mall-buy { min-width: 72px; }

/* ── 账户资料（仿 MailNest /account）────────────── */
.mn-price-free { color: var(--success); font-weight: 600; }

.mn-account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px 24px;
}
.mn-account-item { display: flex; gap: 8px; font-size: 14px; }
.mn-account-label { color: var(--muted-foreground); white-space: nowrap; }
.mn-api-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}
.mn-api-key {
    font-size: 13px;
    word-break: break-all;
    color: var(--foreground);
}

/* ── 邮件记录列表页（仿 MailNest /emails/temporary）────────── */
.mn-list-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}
.mn-filter-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    max-width: 420px;
}
.mn-filter-row div { flex: 1; }
.mn-filter-row select { margin-bottom: 0; }
.mn-email-link {
    color: var(--foreground);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-family: "Consolas", ui-monospace, monospace;
    font-size: 13px;
    word-break: break-all;
}
.mn-email-link:hover { color: var(--primary-hover); }
.mn-count {
    margin-left: 6px;
    color: var(--muted-foreground);
    font-size: 11px;
}
.mn-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    color: var(--muted-foreground);
    font-size: 13px;
    flex-wrap: wrap;
}
.mn-pager-info { white-space: nowrap; }

/* ── 邮件详情页（仿 MailNest /emails/<email>）────────────── */
.mn-detail-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.mn-detail-email {
    font-size: 16px;
    color: #5b6472;
    margin-top: 2px;
    word-break: break-all;
}
.mn-detail-hint {
    font-size: 13px;
    color: var(--muted-foreground);
    margin-bottom: 16px;
    line-height: 1.7;
}
.mn-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

/* ── Toast（仿 Sonner）────────────────── */
.toast {
    position: fixed;
    top: 72px;
    right: 20px;
    background: var(--card);
    color: var(--foreground);
    border: 1px solid var(--border);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    opacity: 0;
    transform: translateY(-8px);
    transition: all .25s;
    z-index: 999;
    max-width: 380px;
    font-size: 13px;
    box-shadow: var(--shadow-pop);
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: #bbf7d0; color: #166534; }
.toast.error { border-color: #fecaca; color: #b91c1c; }

/* ── 登录页（仿迈巢登录页：白底居中）───────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
}
.login-card {
    width: 360px;
    padding: 8px 0;
}
.login-card h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.login-card p { color: var(--muted-foreground); margin-bottom: 24px; font-size: 14px; }
.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.6;
}
.login-card .btn { width: 100%; height: 38px; margin-top: 4px; }

/* ── 邮件记录 ───────────────────────── */
.mail-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.mail-item:last-child { border-bottom: none; }
.mail-subject { font-weight: 600; }
.mail-meta { color: var(--muted-foreground); font-size: 12px; margin-top: 2px; }
.mail-body {
    margin-top: 6px;
    color: #3f3f46;
    font-size: 13px;
    max-height: 60px;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-all;
}
.mail-body.expanded { max-height: none; }

.empty {
    color: var(--muted-foreground);
    text-align: center;
    padding: 40px 0;
    font-size: 13px;
}

/* ── 项目卡片（迈巢式网格）────────────────────── */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}
.project-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
    background: var(--card);
}
.project-card:hover {
    border-color: #c8cbd1;
    box-shadow: 0 6px 24px rgba(15, 17, 21, .06);
}
.project-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.project-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--muted);
    padding: 9px;
    flex-shrink: 0;
    object-fit: contain;
}
.project-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--foreground);
    padding: 0;
}
.project-card-name { flex: 1; min-width: 0; }
.project-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-code { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--muted-foreground);
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

/* ── 首页项目区（仿迈巢购买页卡片）────────────── */
.mp-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.mp-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
}
.mp-tab:hover { color: var(--foreground); }
.mp-tab.active { color: var(--foreground); border-bottom-color: var(--foreground); }
.mp-card { display: flex; flex-direction: column; gap: 12px; }
.mp-card-head { display: flex; align-items: center; gap: 12px; }
.mp-card-name { flex: 1; min-width: 0; }
.mp-card-body {
    display: flex;
    flex-direction: column;
    gap: 7px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.mp-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12.5px;
    color: var(--muted-foreground);
}
.mp-row b { color: var(--foreground); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.mp-card-foot .btn { flex-shrink: 0; }

/* ── 项目图标选择器 ───────────────────────── */
.logo-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.logo-option {
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--card);
    transition: border-color .12s, box-shadow .12s;
    user-select: none;
    overflow: hidden;
}
.logo-option img { width: 24px; height: 24px; object-fit: contain; }
.logo-option:hover { border-color: #b7bac0; }
.logo-option.active {
    border-color: var(--foreground);
    box-shadow: 0 0 0 2.5px var(--card), 0 0 0 4px var(--foreground);
}
.logo-option .lf { font-weight: 700; font-size: 14px; color: var(--muted-foreground); }
.logo-option.logo-custom span { font-size: 20px; color: var(--muted-foreground); line-height: 1; }
.mono { font-family: "Consolas", ui-monospace, monospace; font-size: 13px; }
.danger-zone { border-color: #fecaca; }

/* ── 弹层（正则测试）────────────────────── */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 21, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
}
.modal {
    width: 560px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(15, 17, 21, .25);
    padding: 24px;
}

code { font-family: "Consolas", ui-monospace, monospace; background: var(--muted); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

/* ── 开发文档站（仿迈巢 docs）────────────── */
.docs-layout {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    display: flex;
    gap: 48px;
    align-items: flex-start;
}
.docs-sidebar {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 88px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.docs-group {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted-foreground);
    margin: 16px 0 6px;
    letter-spacing: .04em;
}
.docs-group:first-child { margin-top: 0; }
.docs-link {
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.docs-link:hover { background: var(--accent); color: var(--foreground); }
.docs-link.active { background: var(--accent); color: var(--foreground); font-weight: 500; }
.docs-content { flex: 1; min-width: 0; max-width: 780px; }
.docs-content .page-title { margin-bottom: 8px; }
.doc-section { margin-top: 28px; }
.doc-section h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.doc-section h3 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; }
.doc-section p { color: #3f3f46; margin: 8px 0; font-size: 14px; line-height: 1.7; }
.doc-section p a { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }
.doc-ol { margin: 8px 0 8px 20px; color: #3f3f46; line-height: 1.8; }
.doc-table { width: 100%; border-collapse: collapse; margin: 12px 0 8px; }
.doc-table th {
    background: #fafafa;
    color: var(--muted-foreground);
    font-weight: 500;
    font-size: 12px;
    text-align: left;
    padding: 9px 12px;
    border: 1px solid var(--border);
}
.doc-table td {
    padding: 9px 12px;
    border: 1px solid var(--border);
    font-size: 13px;
    vertical-align: top;
}
.doc-table tr:hover td { background: #fafafa; }
.doc-method-line { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; }
.doc-path-inline {
    font-family: "JetBrains Mono", Consolas, ui-monospace, monospace;
    font-size: 13.5px;
    background: transparent;
    padding: 0;
}
.doc-method {
    display: inline-block;
    font-family: "JetBrains Mono", Consolas, ui-monospace, monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 5px;
    letter-spacing: .04em;
    margin-right: 6px;
    vertical-align: middle;
}
.doc-method-get { background: #f0fdf4; color: #166534; border: 1px solid #dcfce7; }
.doc-method-post { background: #eff6ff; color: #1d4ed8; border: 1px solid #dbeafe; }
.doc-code {
    background: #0f1115;
    color: #e4e6e8;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 12px 0 16px;
    overflow-x: auto;
    font-family: "JetBrains Mono", Consolas, ui-monospace, monospace;
    font-size: 12.5px;
    line-height: 1.7;
    white-space: pre;
}
.doc-code .doc-method { margin-right: 4px; }
.doc-code .doc-path { color: #93c5fd; }


/* ── 响应式补丁（2026-11-15）─────────────────────────
   修复：375px 下 .content 左右 32px 内边距 + .btn-row 不换行导致
   accounts 页横向溢出 82px；768px 下 pool/projects 表格未包 .table-wrap
   直接撑破视口（最高 568px）。 */
@media (max-width: 900px) {
    .content { padding: 72px 16px 48px; }
    .topbar-inner { padding: 0 12px; gap: 8px; }
    .brand-sub { display: none; }
    .stat-card { min-width: 0; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}
@media (max-width: 640px) {
    .content { padding: 64px 12px 40px; }
    .page-title { font-size: 20px; }
    .btn-row { flex-wrap: wrap; }
    .btn-row > .btn { flex: 1 1 auto; min-width: 0; }
    .form-row { flex-direction: column; align-items: stretch; }
    .topbar-inner { height: 52px; }
    .nav { gap: 2px; }
    .nav-item { padding: 0 8px; font-size: 12px; }
    th, td { padding: 8px; }
}

/* 窄屏兜底：卡片 padding 24px 会把内部 table 挤出视口 6~36px */
@media (max-width: 640px) {
    .card { padding: 14px; }
    .card.table-wrap { padding: 14px 8px; }
    .content { padding-left: 10px; padding-right: 10px; }
    .content > * { min-width: 0; }
    table { min-width: 0; }
    .btn-sm { padding: 4px 8px; font-size: 12px; }
}


/* ── 客户视图与管理视图的视觉区分 ──────────────────────
   管理员：默认顶栏；客户：品牌副标变绿色徽章 + 高亮项绿色。
   两套菜单在 base.html 按 admin_ok / user_logged_in 渲染。 */
body.customer-view .brand-sub {
    color: #16a34a;
    background: rgba(22, 163, 74, .12);
    padding: 2px 9px;
    border-radius: 999px;
    font-weight: 600;
}
body.customer-view .nav-item.active {
    background: rgba(22, 163, 74, .12);
    color: #15803d;
}

/* ── 设置页 Tab 导航 ─────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    margin-bottom: 20px;
}
.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted, #64748b);
    cursor: pointer;
    transition: color .15s, border-color .15s;
    margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text, #111827); }
.tab-btn.tab-active {
    color: var(--primary, #2563eb);
    border-bottom-color: var(--primary, #2563eb);
}
.tab-panel { animation: fadeIn .15s ease-in; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }