/* SaaS 运营后台 · 独立样式（v53） */
*, *::before, *::after { box-sizing: border-box; }
:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --line: #e5e7eb;
    --text: #1f2329;
    --text-2: #6b7280;
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --ok: #16a34a;
    --warn: #d97706;
    --err: #dc2626;
    --radius: 10px;
}
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }

/* ---------- 登录 ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #eef2ff 0%, #f5f6f8 55%, #f7f7f9 100%);
    padding: 24px;
}
.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 32px 28px 24px;
    box-shadow: 0 12px 32px rgba(17, 24, 39, .08);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo {
    width: 46px; height: 46px; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand); color: #fff;
    border-radius: 12px; font-size: 22px; font-weight: 700;
}
.login-brand h1 { font-size: 18px; margin: 0 0 4px; }
.login-brand p { margin: 0; font-size: 12px; }
.login-foot { margin: 18px 0 0; text-align: center; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 14px; outline: none; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 208px; flex: 0 0 208px;
    background: #111827; color: #e5e7eb;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
    width: 32px; height: 32px; flex: 0 0 32px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand); color: #fff; border-radius: 8px; font-weight: 700;
}
.brand-text strong { display: block; font-size: 13px; color: #fff; }
.brand-text small { display: block; font-size: 11px; color: #9ca3af; }
.nav { padding: 10px 8px; flex: 1; }
.nav-item {
    display: block; padding: 9px 12px; margin-bottom: 2px;
    color: #d1d5db; border-radius: 8px; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--brand); color: #fff; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .muted { color: #6b7280; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 56px; flex: 0 0 56px;
    background: var(--panel); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-name { color: var(--text-2); }
.content { padding: 20px 24px 40px; }

/* ---------- 通用块 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 18px; margin: 0; font-weight: 600; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.card-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; background: #fafbfc; }
.card-body { padding: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 600; }
.stat-value.small { font-size: 15px; }
.stat-sub { font-size: 12px; color: var(--text-2); margin-top: 4px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: #fafbfc; font-weight: 600; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: none; }
.col-actions { white-space: nowrap; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 18px; }
.badge-success { background: #ecfdf5; color: var(--ok); }
.badge-gray { background: #f3f4f6; color: var(--text-2); }
.badge-warn { background: #fffbeb; color: var(--warn); }
.badge-danger { background: #fef2f2; color: #b91c1c; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 6px 14px; border-radius: 8px;
    border: 1px solid var(--line); background: #fff; color: var(--text);
    font-size: 13px; cursor: pointer; line-height: 20px;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-block { width: 100%; padding: 10px; font-size: 14px; }
.btn-link { border-color: transparent; background: transparent; color: var(--brand); padding: 3px 6px; }
.btn-link:hover { background: rgba(37,99,235,.06); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.alert-info { background: #eff6ff; border-color: #dbeafe; color: #1e40af; }
.alert-success { background: #ecfdf5; border-color: #d1fae5; color: #065f46; }
.alert-warn { background: #fffbeb; border-color: #fef3c7; color: #92400e; }
.alert-error { background: #fef2f2; border-color: #fee2e2; color: #991b1b; }

.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; flex-wrap: wrap; }
.filter-bar input[type="text"] { flex: 0 0 260px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none; }
.filter-bar input[type="text"]:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.inline-form { display: inline; margin: 0; }

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

@media (max-width: 860px) {
    .sidebar { display: none; }
    .content { padding: 16px; }
}

/* ---------- 商家主体表单（v54） ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .field-full { grid-column: 1 / -1; }
.form-grid .field select,
.form-grid .field textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 14px; outline: none; background: #fff; font-family: inherit;
}
.form-grid .field textarea { min-height: 62px; resize: vertical; }
.form-grid .field input:focus, .form-grid .field select:focus, .form-grid .field textarea:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-grid .field-hint { display: block; margin-top: 4px; font-size: 12px; color: #6b7280; }

/* 载体多选：横向排布，不拉长表单 */
.check-group { display: flex; flex-wrap: wrap; gap: 10px; }
.form-grid .field .check-group { padding-top: 2px; }
.check-item {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 6px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; font-size: 13px; color: #111827;
}
.check-item input[type=checkbox] { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: #2563eb; }
.check-item:has(input:checked) { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
.form-grid .field .check-group + .field-hint { margin-top: 8px; }
/* 服务周期：开始 / 时长 / 到期 横向一行 */
.period-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.period-item { display: flex; flex-direction: column; gap: 4px; }
.period-label { font-size: 12px; color: #6b7280; }
.period-item input, .period-item select { width: 168px; }
.period-item input[readonly] { background: #f9fafb; color: #374151; }
.form-actions { grid-column: 1 / -1; margin: 4px 0 2px; }
.profile-view { width: 100%; border-collapse: collapse; }
.profile-view th, .profile-view td { padding: 8px 10px; border-bottom: 1px solid #eef0f3; font-size: 13px; text-align: left; }
.profile-view th { width: 120px; color: #6b7280; font-weight: 500; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* 服务周期快捷筛选 */
.period-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.period-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line);
    border-radius: 999px; background: #fff; color: var(--text); font-size: 13px; text-decoration: none; }
.period-chip:hover { border-color: #c7cdd6; }
.period-chip b { font-weight: 600; }
.period-chip.is-active { border-color: #2563eb; color: #1d4ed8; background: #eff6ff; }
.period-chip.is-warn b { color: var(--warn); }
.period-chip.is-danger b { color: #b91c1c; }
.table th a { color: inherit; text-decoration: none; border-bottom: 1px dashed currentColor; }
.table th a:hover { color: #1d4ed8; }

/* 功能定价表（收费页 v55） */
.table .cell-input {
    width: 96px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
    font-size: 13px; outline: none; background: #fff; color: var(--text);
}
.table .cell-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.table .cell-input-sm { width: 72px; }
.table .cell-input-wide { width: 180px; }
.table select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; color: var(--text); outline: none; }
.table select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* 功能开通：横向多选 v55 */
.feature-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.feature-item { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fff; cursor: pointer; }
.feature-item.on { border-color: #93c5fd; background: #f0f7ff; }
.feature-item input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.feature-text { display: flex; flex-direction: column; line-height: 1.3; }
.feature-name { font-size: 13px; color: var(--text); }
.feature-meta { font-size: 11px; color: var(--text-2); }
.feature-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.feature-group-title{margin:14px 0 8px;font-size:13px;font-weight:600;color:#374151;display:flex;align-items:center;gap:6px}
.feature-group-title:first-child{margin-top:0}

/* 一次性配置折叠区（SaaS，与商家后台 .cfg-fold 统一 · v62） */
.cfg-fold { padding: 0 !important; }
.cfg-fold > .cfg-sum { cursor: pointer; list-style: none; display: flex; justify-content: space-between;
    align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; }
.cfg-fold > .cfg-sum::-webkit-details-marker { display: none; }
.cfg-fold > .cfg-sum:hover .cfg-tip { color: #2563eb; }
.cfg-title { font-size: 15px; font-weight: 700; color: #1f2937; }
.cfg-tip { font-size: 12px; color: #94a3b8; }
.cfg-fold[open] > .cfg-sum { border-bottom: 1px solid #eef2f9; }
.cfg-fold > .cfg-body { padding: 14px 18px 18px; }
.cfg-fold.is-sub { border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: 10px; }
.cfg-fold.is-sub > .cfg-sum { padding: 12px 14px; }
.cfg-fold.is-sub > .cfg-body { padding: 12px 14px 14px; }
