:root {
    --brand: #ff6a00;
    --brand-dark: #e05e00;
    --dark: #1b2430;
    --dark-2: #232f3e;
    --body-bg: #f4f6f9;
    --text: #33404f;
    --muted: #7a8699;
    --border: #e3e8ef;
    --success: #1f9d55;
    --danger: #e0245e;
    --info: #0091ff;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* ===== 顶栏 ===== */
.topbar {
    background: linear-gradient(135deg, #16202c 0%, #1e2c3d 100%);
    color: #fff;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
}
.topbar .logo .logo-icon {
    width: 32px; height: 32px;
    background: var(--brand);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px; color: #fff;
}
.topbar .logo small { font-weight: 400; color: #9fb0c3; font-size: 12px; }
.topbar .right { display: flex; align-items: center; gap: 8px; }

/* ===== 页头横幅 ===== */
.page-hero {
    background: linear-gradient(135deg, #1b2430 0%, #28384b 100%);
    color: #fff;
    padding: 34px 20px 30px;
    text-align: center;
}
.page-hero h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; }
.page-hero p { margin: 0; color: #aebccd; font-size: 14px; }

/* ===== 导航 ===== */
.navbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 56px;
    z-index: 99;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.navbar .nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    overflow-x: auto;
    padding: 0 16px;
}
.navbar a {
    display: block;
    padding: 13px 16px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.navbar a:hover { color: var(--brand); }
.navbar a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ===== 布局 ===== */
.wrapper { max-width: 1280px; margin: 20px auto; padding: 0 16px; }
.row { display: flex; gap: 20px; flex-wrap: wrap; }
.col-main { flex: 1 1 0; min-width: 0; }
.col-side { width: 260px; flex-shrink: 0; }

/* ===== 卡片 ===== */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 18px;
    overflow: hidden;
}
.card-header {
    padding: 12px 18px;
    background: #fafbfd;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

/* 工具入口卡片 */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.tool-card {
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    text-decoration: none;
    color: var(--text);
    transition: all .18s ease;
}
.tool-card:hover {
    border-color: var(--brand);
    box-shadow: 0 6px 18px rgba(255,106,0,.12);
    transform: translateY(-2px);
    color: var(--text);
}
.tool-card .t-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; color: #fff;
    margin-bottom: 12px;
}
.tool-card h4 { margin: 0 0 6px; font-size: 16px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 13px; }

/* 左侧子导航 */
.side-nav { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.side-nav .sn-title { padding: 12px 16px; font-weight: 700; background: #fafbfd; border-bottom: 1px solid var(--border); }
.side-nav a {
    display: block; padding: 11px 16px; color: var(--text);
    text-decoration: none; border-bottom: 1px solid #f0f2f5; font-size: 13.5px;
}
.side-nav a:last-child { border-bottom: none; }
.side-nav a:hover { background: #fff7f0; color: var(--brand); }
.side-nav a.active { background: #fff1e5; color: var(--brand); font-weight: 600; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; }
.form-group .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255,106,0,.12); }
textarea.form-control { resize: vertical; }
select.form-control { padding: 8px 8px; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1 1 180px; }
.form-row .form-group.wide { flex: 2 1 300px; }

/* ===== CloudFlare 工具页公共表单 ===== */
.form-line { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.form-line > .fl-label { width: 96px; flex-shrink: 0; padding-top: 8px; font-size: 13.5px; color: #33404f; font-weight: 600; }
.form-line > .fl-body { flex: 1; min-width: 0; }
.form-line textarea, .form-line input, .form-line select { width: 100%; box-sizing: border-box; }
.form-line input, .form-line select { max-width: 460px; }
.form-line .hint { font-size: 11.5px; color: #9aa5b1; margin-top: 5px; line-height: 1.7; }
.acc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.acc-actions a, .acc-actions button { padding: 4px 12px; font-size: 12px; border-radius: 7px; cursor: pointer; text-decoration: none; }
.btn-mgr { background: #fff; border: 1px solid #cbd5e1; color: #334155; }
.btn-read { background: #fff; border: 1px solid #ffd9b3; color: #ff6a00; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s ease;
    text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-outline { background: #fff; color: var(--text); border-color: #cfd8e3; }
.btn-outline:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 11px 26px; font-size: 15px; }
.btn-block { width: 100%; }

/* 复选框开关 */
.checkbox-line { display: flex; align-items: center; gap: 8px; }
.checkbox-line input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }

/* ===== 模态框 ===== */
.modal-mask {
    display: none;
    position: fixed; inset: 0;
    background: rgba(20,28,40,.55);
    z-index: 200;
    align-items: center; justify-content: center;
    padding: 24px;
}
.modal-mask.show { display: flex; }
.modal-mask.show .modal { margin: auto; }
.modal {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    margin: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-size: 15px;
}
.modal-header .close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ===== 域名列表 ===== */
.domain-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.domain-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
}
.domain-item:hover { background: #fff7f0; }
.domain-item:last-child { border-bottom: none; }
.domain-item .d-name { flex: 1; font-weight: 500; }
.domain-item .d-status { font-size: 12px; color: var(--muted); }
.domain-item .d-status.active { color: var(--success); }
.domain-item .d-status.pending { color: var(--brand); }

/* ===== 任务进度 ===== */
.progress {
    height: 8px; background: #e8edf3; border-radius: 4px; overflow: hidden; margin: 10px 0;
}
.progress .bar {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--brand), #ff9a3d);
    border-radius: 4px;
    transition: width .2s ease;
}
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0 0; }
.stat-item { font-size: 13px; color: var(--muted); }
.stat-item b { font-size: 15px; color: var(--text); }
.stat-item.ok b { color: var(--success); }
.stat-item.err b { color: var(--danger); }

/* ===== 结果表格 ===== */
.table-wrap { overflow-x: auto; }
table.result-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.result-table th, table.result-table td {
    padding: 9px 12px; text-align: left;
    border-bottom: 1px solid #eef1f5;
    vertical-align: top;
}
table.result-table th { background: #fafbfd; font-weight: 600; color: var(--muted); white-space: nowrap; }
table.result-table tr:last-child td { border-bottom: none; }
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.badge.ok { background: #e6f7ee; color: var(--success); }
.badge.err { background: #fde8ef; color: var(--danger); }
.badge.run { background: #e8f1ff; color: var(--info); }
.badge.wait { background: #f0f2f5; color: var(--muted); }

/* 空状态 */
.empty {
    text-align: center; padding: 40px 20px; color: var(--muted);
}

/* ===== 提示 ===== */
.alert {
    padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
    font-size: 13.5px; border: 1px solid transparent;
}
.alert-info { background: #e8f3ff; border-color: #cfe4ff; color: #1a5fb4; }
.alert-warn { background: #fff6e8; border-color: #ffe0b3; color: #9a6200; }
.alert-err { background: #fde8ef; border-color: #fbc4d6; color: #b0133f; }

.toast-wrap {
    position: fixed; top: 70px; right: 20px; z-index: 300;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: #fff; border-radius: 8px; padding: 11px 16px;
    box-shadow: 0 6px 24px rgba(0,0,0,.16);
    font-size: 13.5px; border-left: 4px solid var(--info);
    min-width: 240px; max-width: 360px;
    animation: slideIn .25s ease;
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--brand); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== 页脚 ===== */
.footer {
    margin-top: 40px;
    background: #16202c; color: #8fa0b4;
    padding: 30px 20px;
    text-align: center;
    font-size: 13px;
}
.footer a { color: #b9c6d6; text-decoration: none; }

/* token 面板 */
.token-panel { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.token-panel .form-control { flex: 1 1 320px; }
.token-status { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.token-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }
.token-status.ok { color: var(--success); }
.token-status.ok::before { background: #16a34a; }
.token-status.err { color: var(--danger); }
.token-status.err::before { background: #ef4444; }

/* Cloudflare 操作账户卡片 (90th 式: 状态在标题右侧, 下拉+按钮一行) */
.cf-acc-card .cf-acc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cf-acc-card .cf-acc-title { font-weight: 700; color: #1e293b; display: inline-flex; align-items: center; gap: 6px; }
.cf-acc-card .acct-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cf-acc-card .acct-row select {
    flex: 1; min-width: 220px; max-width: 400px;
    padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 9px;
    font-size: 13.5px; outline: none; background: #fff; cursor: pointer;
}
.cf-acc-card .acct-row select:focus { border-color: #ff9a3d; box-shadow: 0 0 0 3px rgba(255, 154, 61, .15); }
.cf-acc-card .acct-row .btn { display: inline-flex; align-items: center; gap: 5px; }
.cf-acc-card .acc-hint { font-size: 12px; color: #94a3b8; margin-top: 10px; }
.cf-acc-card .token-status a { color: #2563eb; }

/* 响应式 */
@media (max-width: 900px) {
    .col-side { width: 100%; }
    .side-nav { display: flex; flex-wrap: wrap; }
    .side-nav .sn-title { width: 100%; }
    .side-nav a { border-bottom: none; }
}

/* ===== 域名管理 左右布局 (聚合DNS 侧边栏, 90th 风格) ===== */
.dm-layout { display: flex; gap: 22px; align-items: flex-start; }
.dm-side { width: 208px; flex-shrink: 0; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px 10px 18px; box-shadow: 0 2px 10px rgba(20,30,45,.04); }
.dm-side-back { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #64748b; text-decoration: none; padding: 4px 8px 10px; border-bottom: 1px dashed #eef2f7; margin-bottom: 12px; }
.dm-side-back:hover { color: var(--brand); }
.dm-arr { font-weight: 700; }
.dm-side-title { font-size: 14px; font-weight: 800; color: #1e293b; padding: 2px 8px 10px; }
.dm-side-nav { display: flex; flex-direction: column; gap: 2px; }
.dm-side-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 9px; font-size: 13px; color: #475569; text-decoration: none; font-weight: 600; transition: all .15s ease; }
.dm-side-item .dm-side-ic { display: inline-flex; width: 22px; height: 22px; border-radius: 7px; background: #f1f5f9; color: #64748b; align-items: center; justify-content: center; flex-shrink: 0; }
.dm-side-item:hover { background: #f8fafc; color: var(--brand); }
.dm-side-item:hover .dm-side-ic { background: #fff1e5; color: var(--brand); }
.dm-side-item.on { background: linear-gradient(135deg, #fff1e5, #ffe8d1); color: #d95f00; }
.dm-side-item.on .dm-side-ic { background: linear-gradient(135deg, #ff6a00, #ff9a3d); color: #fff; }
.dm-main { flex: 1; min-width: 0; }
@media (max-width: 860px) {
    .dm-layout { flex-direction: column; }
    .dm-side { width: 100%; }
    .dm-side-nav { flex-direction: row; flex-wrap: wrap; }
    .dm-side-title { width: 100%; }
}

/* ===== 侧边折叠菜单 (SSL证书 分类展开) ===== */
.side-group { position: relative; }
.side-group .side-toggle {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; padding: 11px 16px; color: var(--text);
    text-decoration: none; border-bottom: 1px solid #f0f2f5; font-size: 13.5px;
    background: #fff; user-select: none;
}
.side-group .side-toggle:hover { background: #fff7f0; color: var(--brand); }
.side-group .side-toggle .side-arrow { font-size: 11px; color: #94a3b8; transition: transform .2s ease; }
.side-group .side-toggle.open { background: #fff7f0; color: var(--brand); font-weight: 600; }
.side-group .side-toggle.open .side-arrow { transform: rotate(180deg); color: var(--brand); }
.side-sub { display: none; background: #f8fafc; }
.side-sub.show { display: block; }
.side-sub a {
    display: block; padding: 9px 16px 9px 32px !important;
    color: #64748b; text-decoration: none; font-size: 12.8px;
    border-bottom: 1px solid #eef2f7; position: relative;
}
.side-sub a::before { content: ""; position: absolute; left: 18px; top: 0; bottom: 0; width: 2px; background: #e2e8f0; }
.side-sub a:last-child { border-bottom: none; }
.side-sub a:hover { background: #fff; color: var(--brand); }
.side-sub a.active { background: #fff1e5; color: #d95f00; font-weight: 600; }
.side-sub a.active::before { background: var(--brand); }
