[hidden] {
    display: none !important;
}

:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --bg-soft: #eef1f5;
    --surface: #ffffff;
    --ink: #1f2430;
    --muted: #6b7280;
    --faint: #9ca3af;
    --line: #e5e7eb;
    --line-strong: #d1d5db;
    --accent: #2563eb;
    --accent-ink: #ffffff;
    --accent-soft: #eff6ff;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --sidebar-width: 236px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
button { font: inherit; }

/* ===================== Shell layout ===================== */

.shell-admin, .shell-user {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 18px 12px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    z-index: 40;
}

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

.brand {
    color: var(--accent);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
}
.brand span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .08em; }

.sidebar-close { display: none; padding: 2px 8px; border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 0; }

.nav-group-label { margin: 14px 10px 6px; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.nav-group-label:first-child { margin-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 2px 0;
    border-radius: 8px;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 500;
}
.nav-item:hover { background: var(--bg-soft); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.sidebar-foot { padding: 12px 0 0; border-top: 1px solid var(--line); }
.nav-logout { display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer; font: inherit; }

.sidebar-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 30; }

.shell-body { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 60px;
    padding: 0 clamp(16px, 3vw, 32px);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-burger { display: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 16px; cursor: pointer; }

.topbar-title { color: var(--muted); font-size: 14px; font-weight: 500; }

.topbar-exit { color: var(--muted); font-size: 13px; background: none; border: 0; cursor: pointer; font: inherit; }
.topbar-exit:hover { color: var(--accent); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.shell-main {
    flex: 1;
    width: min(1200px, 100%);
    padding: clamp(20px, 4vw, 40px) clamp(16px, 3vw, 32px) 60px;
}

/* ===================== Public shell ===================== */

.shell-public .site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px clamp(20px, 5vw, 64px);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.shell-public .public-nav { display: flex; align-items: center; gap: 8px; }
.shell-public .public-nav a { padding: 8px 14px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.shell-public .public-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.shell-public .public-nav .nav-accent { border: 1px solid var(--line-strong); }

.public-main { margin: 0 auto; }

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 22px clamp(20px, 5vw, 64px);
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-size: 11px;
    letter-spacing: .1em;
}

/* ===================== Page primitives ===================== */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-head h1 { margin: 4px 0 8px; font-size: clamp(22px, 3vw, 30px); font-weight: 700; letter-spacing: -.02em; }
.page-head .lede { max-width: 640px; color: var(--muted); font-size: 14px; }

.eyebrow { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.step { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }

.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(240px, .5fr); gap: 40px; align-items: center; padding: clamp(24px, 5vw, 56px) 0; }
.hero h1 { margin: 8px 0 16px; font-size: clamp(30px, 5vw, 52px); font-weight: 800; line-height: 1.08; letter-spacing: -.03em; }
.hero .lede { color: var(--muted); font-size: 15px; }

.status-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.status-panel header { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; }
.status-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.status-row:last-child { border-bottom: 0; }
.status-row span { color: var(--muted); }
.status-row b { color: var(--ink); font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* ===================== Landing polish ===================== */

.hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(1200px 480px at 85% -10%, var(--accent-soft), transparent 60%),
        radial-gradient(900px 420px at -10% 110%, rgba(37, 99, 235, .06), transparent 55%),
        var(--surface);
    box-shadow: var(--shadow);
    padding: clamp(28px, 5vw, 60px);
}
.hero-copy { position: relative; z-index: 1; }
.hero h1 { margin: 10px 0 18px; font-size: clamp(32px, 5vw, 54px); font-weight: 800; line-height: 1.06; letter-spacing: -.03em; }
.hero .lede { max-width: 560px; color: var(--muted); font-size: 16px; }

.status-panel {
    position: relative;
    z-index: 1;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .86);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(6px);
    overflow: hidden;
}
.status-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
}
.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    font-size: 11px;
    font-weight: 600;
}
.status-dot::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, .16);
}
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.status-row:last-child { border-bottom: 0; }
.status-row span { color: var(--muted); font-weight: 500; }
.status-row b { font-weight: 600; }

.feature-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 24px;
}
.feature-strip article {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 16px;
}
.feature-strip h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.feature-strip p { color: var(--muted); font-size: 13px; }

/* ===================== DNS guide ===================== */

.dns-guide {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.dns-guide-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 18px clamp(16px, 3vw, 24px);
    border-bottom: 1px solid var(--line);
}
.dns-guide-head .eyebrow { flex-basis: 100%; }
.dns-guide-head .actions { margin-top: 0; margin-left: auto; }
.dns-guide .data-table-wrap { padding: 0 clamp(16px, 3vw, 24px) clamp(16px, 3vw, 24px); }

.flow { display: grid; grid-template-columns: minmax(220px, .45fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 72px); align-items: start; padding: clamp(24px, 5vw, 56px) 0; }
.flow-copy h1 { margin: 8px 0 14px; font-size: clamp(28px, 4vw, 42px); font-weight: 800; line-height: 1.12; letter-spacing: -.02em; }
.flow-copy .lede { color: var(--muted); font-size: 15px; }
.flow-copy a.text-link { display: inline-block; margin-top: 16px; }

/* ===================== Cards ===================== */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 24px; }
.data-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    min-height: 132px;
}
.data-card span { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.data-card strong { color: var(--ink); font-size: clamp(22px, 3vw, 30px); font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.data-card a { margin-top: auto; color: var(--accent); font-size: 13px; font-weight: 500; }
.card-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card-default { color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }

/* ===================== Panels / forms ===================== */

.form-panel {
    padding: clamp(18px, 3vw, 26px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.form-panel h2 { margin-bottom: 18px; font-size: 16px; font-weight: 700; }
.form-panel h3 { margin-bottom: 12px; font-size: 14px; font-weight: 600; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 28px; }
.compact-panel { margin-bottom: 20px; }
.form-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 600; }
.field input, .field select, .field textarea,
.toolbar input, .toolbar select, .toolbar textarea,
.inline-form input, .inline-form select, .inline-form textarea,
.filter-row input, .filter-row select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    outline: 0;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus,
.toolbar input:focus, .toolbar select:focus,
.inline-form input:focus, .inline-form select:focus,
.filter-row input:focus, .filter-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.field textarea, textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

.form-note { color: var(--muted); font-size: 13px; }
.form-status { min-height: 20px; margin: 10px 0; color: var(--muted); font-size: 13px; }
.form-status[data-state="error"] { color: var(--danger); }
.form-status[data-state="success"] { color: var(--success); }

.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: min(420px, calc(100vw - 32px));
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
    pointer-events: none;
}
.toast-container:popover-open { display: flex; }
.toast-container::backdrop { background: transparent; }
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-left: 4px solid var(--muted);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
    font-size: 14px;
    line-height: 1.5;
    pointer-events: auto;
    animation: toast-in .18s ease-out;
}
.toast[data-state="success"] { border-left-color: var(--success); }
.toast[data-state="error"] { border-left-color: var(--danger); }
.toast[data-state="error"] .toast-icon { color: var(--danger); }
.toast[data-state="success"] .toast-icon { color: var(--success); }
.toast-icon { flex: 0 0 auto; font-weight: 700; }
.toast-text { flex: 1 1 auto; word-break: break-word; }
.toast-close { flex: 0 0 auto; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .toast-container { top: 12px; max-width: none; width: calc(100vw - 24px); } }

/* ===================== Skeleton 加载占位 ===================== */
.skeleton-line {
    display: block;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bg-soft) 25%, var(--line) 37%, var(--bg-soft) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
}
.skeleton-line.short { width: 60%; margin-top: 6px; }
.skeleton-row td { padding-top: 14px; padding-bottom: 14px; }
.skeleton-block { padding: 12px 0; border-bottom: 1px solid var(--line); }
.skeleton-block:last-child { border-bottom: 0; }
@keyframes skeleton-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton-line { animation: none; } }

/* ===================== 响应式表格：小屏幕隐藏低优先级列 ===================== */
/* 640px 以下：隐藏每张表中信息密度较低的辅助列（TTL/剩余天数/创建时间等），保留标识列和状态列 */
@media (max-width: 640px) {
    #tbl-mailboxes th:nth-child(4), #tbl-mailboxes td:nth-child(4) { display: none; }
    #tbl-user-certs th:nth-child(5), #tbl-user-certs td:nth-child(5) { display: none; }
    #tbl-admin-users th:nth-child(4), #tbl-admin-users td:nth-child(4) { display: none; }
    #tbl-admin-users th:nth-child(5), #tbl-admin-users td:nth-child(5) { display: none; }
    #tbl-admin-users th:nth-child(6), #tbl-admin-users td:nth-child(6) { display: none; }
    #tbl-admin-user-dns-providers th:nth-child(4), #tbl-admin-user-dns-providers td:nth-child(4) { display: none; }
    #tbl-admin-user-domain-guide th:nth-child(3), #tbl-admin-user-domain-guide td:nth-child(3) { display: none; }
    #tbl-admin-domain-guide th:nth-child(3), #tbl-admin-domain-guide td:nth-child(3) { display: none; }
    #tbl-admin-domain-detail-guide th:nth-child(3), #tbl-admin-domain-detail-guide td:nth-child(3) { display: none; }
    #tbl-user-domain-guide th:nth-child(3), #tbl-user-domain-guide td:nth-child(3) { display: none; }
    #tbl-admin-cert-domains th:nth-child(6), #tbl-admin-cert-domains td:nth-child(6) { display: none; }
    #tbl-admin-certs th:nth-child(6), #tbl-admin-certs td:nth-child(6) { display: none; }
    #tbl-admin-challenges th:nth-child(3), #tbl-admin-challenges td:nth-child(3) { display: none; }
    #tbl-admin-challenges th:nth-child(5), #tbl-admin-challenges td:nth-child(5) { display: none; }
    #tbl-admin-dns-providers-modal th:nth-child(4), #tbl-admin-dns-providers-modal td:nth-child(4) { display: none; }
    #tbl-admin-queue th:nth-child(4), #tbl-admin-queue td:nth-child(4) { display: none; }
    #tbl-admin-queue th:nth-child(5), #tbl-admin-queue td:nth-child(5) { display: none; }
    #tbl-admin-audit th:nth-child(1), #tbl-admin-audit td:nth-child(1) { display: none; }
    #tbl-admin-audit th:nth-child(5), #tbl-admin-audit td:nth-child(5) { display: none; }
    #tbl-admin-audit th:nth-child(6), #tbl-admin-audit td:nth-child(6) { display: none; }
    #tbl-admin-services th:nth-child(5), #tbl-admin-services td:nth-child(5) { display: none; }
    #tbl-admin-alerts th:nth-child(3), #tbl-admin-alerts td:nth-child(3) { display: none; }
    #tbl-admin-alerts th:nth-child(4), #tbl-admin-alerts td:nth-child(4) { display: none; }
}
/* 480px 以下：进一步隐藏"操作"列之外仍显冗余的次要状态列，保留最核心的标识+状态+操作 */
@media (max-width: 480px) {
    #tbl-admin-cert-domains th:nth-child(5), #tbl-admin-cert-domains td:nth-child(5) { display: none; }
    #tbl-admin-certs th:nth-child(2), #tbl-admin-certs td:nth-child(2) { display: none; }
    #tbl-admin-certs th:nth-child(3), #tbl-admin-certs td:nth-child(3) { display: none; }
    #tbl-user-certs th:nth-child(2), #tbl-user-certs td:nth-child(2) { display: none; }
}

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.check-field { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--ink); font-size: 13px; }
.check-field input { accent-color: var(--accent); }
.check-field-lg { font-size: 15px; font-weight: 600; }

.provider-create {
    padding: 14px 16px;
    margin: 4px 0 16px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: var(--surface-soft, var(--surface));
}
.inline-details {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}
.inline-details summary {
    cursor: pointer;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    user-select: none;
}
.inline-details[open] summary { border-bottom: 1px solid var(--line); }
.inline-details .field { margin-top: 14px; }

.toolbar, .inline-form, .filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar input, .filter-row input { width: auto; min-width: 200px; }
.toolbar select, .filter-row select { width: auto; min-width: 130px; }
.inline-form { margin-bottom: 20px; }
.inline-form input { width: auto; min-width: 220px; }

/* ===================== Buttons ===================== */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.button:hover { border-color: var(--accent); color: var(--accent); }
.button.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.button.primary:hover { background: #1d4ed8; color: var(--accent-ink); }
button.button:disabled { cursor: wait; opacity: .6; }

.text-button { padding: 0; border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 13px; }
.text-button:hover { text-decoration: underline; }
.text-button.copy-button { color: var(--accent); }
.text-link { color: var(--muted); font-size: 13px; }
.text-link:hover { color: var(--accent); }
.inline-select {
    padding: 4px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-size: 13px;
    cursor: pointer;
}
.inline-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inline-select:disabled { opacity: .6; cursor: progress; }
.tag-toggle { border: 0; cursor: pointer; font: inherit; font-weight: inherit; }
.tag-toggle:hover { filter: brightness(.95); }
.tag-toggle:disabled { opacity: .6; cursor: progress; }

/* ===================== Tables ===================== */

.data-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.data-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; background: var(--bg-soft); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--bg); }
.data-table strong { font-weight: 600; }
.data-table small { display: block; margin-top: 2px; color: var(--faint); font-size: 11px; }
.data-table select { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; }
.data-table input.table-input { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; }

.break-cell { max-width: 340px; overflow-wrap: anywhere; }

/* ===================== Tags ===================== */

.tag {
    display: inline-block;
    padding: 3px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.tag-active, .tag-completed, .tag-ok, .tag-ready { border-color: #bbf7d0; background: #f0fdf4; color: var(--success); }
.tag-disabled, .tag-cancelled, .tag-failed, .tag-fail, .tag-critical { border-color: #fecaca; background: #fef2f2; color: var(--danger); }
.tag-pending, .tag-running, .tag-propagating, .tag-validating, .tag-warning { border-color: #fde68a; background: #fffbeb; color: var(--warning); }
.tag-installed { border-color: #bbf7d0; background: #f0fdf4; color: var(--success); }
.tag-record_created { border-color: #c7d2fe; background: #eef2ff; color: #4f46e5; }

/* ===================== Sections ===================== */

.admin-section { margin-top: 34px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-title h2 { font-size: 16px; font-weight: 700; }
.section-title span { color: var(--muted); font-size: 12px; }

.session-list { display: grid; gap: 0; }
.session-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.session-row:last-child { border-bottom: 0; }
.session-row small { display: block; margin-top: 4px; color: var(--muted); }
.session-row b { color: var(--success); font-size: 12px; }

.secret { overflow-wrap: anywhere; padding: 14px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--bg-soft); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; }

.log-view {
    margin: 0;
    padding: 14px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.check-list, .issue-list { display: grid; gap: 8px; margin: 16px 0; padding: 0; list-style: none; }
.check-list li, .issue-list li { display: flex; justify-content: space-between; gap: 16px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; }
.check-list b { color: var(--success); font-weight: 600; }
.issue-list { color: var(--danger); }

/* ===================== Webmail ===================== */

.webmail-layout {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 16px;
    align-items: start;
}
.webmail-folders {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.webmail-folder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
}
.webmail-folder:hover { background: var(--bg); }
.webmail-folder.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.folder-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}
.webmail-folder.active .folder-count { background: var(--accent); color: var(--accent-ink); }

.webmail-pane {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.webmail-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.webmail-toolbar .webmail-search { flex: 1 1 220px; min-width: 0; margin-bottom: 0; }
.webmail-toolbar .webmail-search input { min-width: 0; }
.webmail-toolbar .muted { margin-left: auto; font-size: 12px; }

.webmail-list { display: grid; }
.webmail-item {
    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(140px, 220px) 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    font-size: 13px;
}
.webmail-item:last-child { border-bottom: 0; }
.webmail-item:hover { background: var(--bg); }
.webmail-item.unread { background: var(--accent-soft); }
.webmail-item.unread:hover { background: #e0ecff; }
.webmail-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}
.webmail-item-from { overflow: hidden; color: var(--ink); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.webmail-item.unread .webmail-item-from { font-weight: 700; }
.webmail-item-subject { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.webmail-item.unread .webmail-item-subject { font-weight: 600; }
.webmail-item-date { color: var(--faint); font-size: 12px; white-space: nowrap; }

.webmail-reader { padding: 4px 2px; }
.webmail-reader-head h2 { font-size: 17px; font-weight: 700; line-height: 1.4; margin-bottom: 14px; overflow-wrap: anywhere; }
.webmail-reader-meta {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    font-size: 13px;
    margin-bottom: 12px;
}
.webmail-reader-plain { overflow-wrap: anywhere; }
.webmail-reader-plain strong {
    display: inline-block;
    width: 56px;
    color: var(--muted);
    font-weight: 600;
    margin-right: 8px;
}
.webmail-reader-actions { display: flex; gap: 10px; margin: 4px 0 16px; }
.webmail-reader-body {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    line-height: 1.7;
    overflow-wrap: break-word;
    min-height: 200px;
}
.webmail-reader-body pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 13px;
}
.webmail-reader-body img { max-width: 100%; height: auto; }
.webmail-reader-body blockquote { margin: 10px 0; padding-left: 12px; border-left: 3px solid var(--line-strong); color: var(--muted); }

.webmail-compose-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.webmail-compose-head h2 { font-size: 16px; font-weight: 700; }
.webmail-compose-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }

.button.button-primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.button.button-primary:hover { background: #1d4ed8; color: var(--accent-ink); }
.button-danger-ghost { border-color: #fecaca; background: #fef2f2; color: var(--danger); }
.button-danger-ghost:hover { border-color: var(--danger); background: var(--danger); color: #fff; }

@media (max-width: 860px) {
    .webmail-layout { grid-template-columns: 1fr; }
    .webmail-folders { grid-template-columns: repeat(3, 1fr); padding: 8px; }
    .webmail-item { grid-template-columns: 18px 1fr auto; }
    .webmail-item-subject { grid-column: 2 / -1; grid-row: 2; }
    .webmail-item-date { grid-column: 3; grid-row: 1; }
}

/* ===================== Modal / 用户详情弹窗 ===================== */

.modal {
    width: min(720px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal-form { padding: 20px 22px 22px; }
.modal-form h2 { margin-bottom: 14px; font-size: 16px; font-weight: 700; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-confirm { width: min(380px, calc(100vw - 32px)); }
.modal-confirm .modal-form { text-align: left; }
.modal-confirm .form-actions { justify-content: flex-end; margin-top: 20px; }
.user-detail-section { margin-top: 22px; }
.user-detail-section .section-title { margin-bottom: 10px; }
.user-detail-section .section-title h3 { font-size: 14px; font-weight: 700; }
.modal-form .data-table-wrap { margin-top: 10px; }
.modal-form label { display: grid; gap: 6px; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 600; }
.modal-form label input, .modal-form label select {
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    outline: 0;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
}
.modal-form label input:focus, .modal-form label select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-form .field-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.modal-form .field-row > label { flex: 1 1 160px; margin-bottom: 0; }
.modal-form .field-row > .check-field { flex: 0 0 auto; padding-bottom: 10px; }
.modal-form label input:disabled { background: var(--surface-2, #f3f4f6); color: var(--muted); cursor: not-allowed; }

/* ===================== Mobile responsive ===================== */

@media (max-width: 860px) {
    .shell-admin, .shell-user { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(var(--sidebar-width), 82vw);
        height: 100vh;
        transform: translateX(-105%);
        transition: transform .25s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .topbar-burger { display: inline-flex; }

    .hero, .flow { grid-template-columns: 1fr; gap: 24px; }
    .card-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .form-columns { grid-template-columns: 1fr; }
    .toolbar input, .filter-row input, .inline-form input { width: 100%; min-width: 0; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .inline-form { align-items: stretch; flex-direction: column; }
    .public-main { padding: 0 16px; }
    .site-footer { flex-direction: column; }
}

@media (max-width: 480px) {
    .shell-public .public-nav {
        display: none;
        position: absolute;
        top: 62px;
        left: 16px;
        right: 16px;
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--surface);
        box-shadow: var(--shadow-lg);
    }
    .shell-public .public-nav.open { display: flex; }
    .shell-public .site-header { position: relative; }
    .topbar-title { display: none; }
    .data-card { min-height: 110px; }
}

/* ===== 安装向导进度条 ===== */
.wizard {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0 0 8px;
    padding: 0;
    overflow-x: auto;
}
.wizard-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 8px;
    position: relative;
}
.wizard-step + .wizard-step::before {
    content: '';
    width: 16px;
    height: 1px;
    background: var(--line-strong);
    margin-right: 14px;
    flex: 0 0 auto;
}
.wizard-step:hover { color: var(--accent); background: var(--accent-soft); }
.wizard-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    flex: 0 0 auto;
}
.wizard-step.is-done .wizard-badge { background: var(--success); color: #fff; }
.wizard-step.is-current { color: var(--accent); font-weight: 700; }
.wizard-step.is-current .wizard-badge { background: var(--accent); color: #fff; }

/* ===== 控制面健康确认卡片 ===== */
.health-card .form-status { margin-bottom: 14px; }
.health-rows {
    display: grid;
    gap: 8px;
    margin: 0 0 4px;
}
.health-rows > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-size: 13px;
}
.health-rows span { color: var(--muted); text-transform: uppercase; font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.health-rows b { color: var(--success); font-weight: 600; }
