/* 知客猫 GEO 工作台 · 骨架样式（配色与官网 style.css 统一：红 #e53e3e / 深蓝黑 #1a1a2e / 浅灰蓝渐变） */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #f5f7fa; color: #1a1a2e;
}

/* ---------- 登录 ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16162b 55%, #101020 100%);
}
.login-card {
    width: 360px; background: #fff; border-radius: 16px; padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.logo { color: #e53e3e; font-weight: 800; font-size: 20px; }
.logo sup { font-size: 10px; }
.logo-sep { width: 1px; height: 18px; background: #ddd; }
.logo-sub { font-size: 14px; color: #555; font-weight: 600; }
.login-card input {
    width: 100%; padding: 12px 14px; margin-bottom: 14px;
    border: 1px solid #dcdfe6; border-radius: 8px; font-size: 14px;
}
.login-card input:focus { outline: none; border-color: #e53e3e; box-shadow: 0 0 0 3px rgba(229,62,62,.12); }
.login-err { color: #c63333; font-size: 13px; margin-bottom: 12px; }
.login-btn {
    width: 100%; padding: 12px; border: none; border-radius: 8px; cursor: pointer;
    background: #e53e3e;
    color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 4px;
    transition: background .15s;
}
.login-btn:hover { background: #c63333; }

/* ---------- 骨架 ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- 侧边栏（官网导航同款深蓝黑） ---------- */
.sidebar {
    width: 240px; flex-shrink: 0; display: flex; flex-direction: column;
    background: linear-gradient(180deg, #1a1a2e, #16162b 60%, #14142a);
    color: rgba(255,255,255,.75);
}
.side-menu { flex: 1; padding: 6px 12px; overflow-y: auto; }
.menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; margin: 3px 0; border-radius: 10px;
    color: rgba(255,255,255,.75); font-size: 14px; cursor: pointer; text-decoration: none;
    transition: background .15s, color .15s;
}
.menu-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.menu-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.menu-item.active {
    background: #e53e3e;
    color: #fff; font-weight: 600;
    box-shadow: 0 4px 14px rgba(229,62,62,.35);
}
.caret { margin-left: auto; font-size: 12px; opacity: .7; }
.menu-sub { margin-left: 24px; }
.menu-item.sub { font-size: 13px; padding: 9px 14px; }
.side-user {
    display: flex; align-items: center; gap: 10px;
    margin: 14px 12px 6px; padding: 10px 12px; border-radius: 10px;
    background: rgba(255,255,255,.06);
}
.avatar {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    background: #e53e3e;
    color: #fff; font-size: 13px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.side-user-name { font-size: 13px; color: #fff; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
    border: none; background: none; color: rgba(255,255,255,.55); cursor: pointer;
    display: flex; align-items: center; padding: 4px;
}
.logout-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.logout-btn:hover { color: #e53e3e; }
.collapse-btn {
    border: none; background: none; color: rgba(255,255,255,.55); cursor: pointer;
    display: flex; align-items: center; padding: 4px; transition: transform .2s;
}
.collapse-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.collapse-btn:hover { color: #fff; }

/* ---------- 主区（官网 CTA 区同款浅灰蓝渐变） ---------- */
.main {
    flex: 1; padding: 26px 30px; overflow-x: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 50%, #f0f4ff 100%);
}
.page-title { font-size: 22px; font-weight: 800; margin-bottom: 22px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
    background: rgba(255,255,255,.85); border: 1px solid #e8e8ef;
    border-radius: 12px; padding: 18px 16px; text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.stat-label { font-size: 13px; color: #8a8f9c; margin-bottom: 8px; }
.stat-num { font-size: 26px; font-weight: 800; }

.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
.panel {
    background: rgba(255,255,255,.85); border: 1px solid #e8e8ef;
    border-radius: 12px; padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.panel-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.empty { color: #b5b9c4; font-size: 14px; text-align: center; padding: 48px 0; }
.empty-check { color: #4caf50; font-size: 26px; margin-bottom: 10px; }

.placeholder-panel { text-align: center; padding: 70px 0; }
.placeholder-icon { font-size: 40px; margin-bottom: 14px; }
.placeholder-text { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.placeholder-sub { color: #8a8f9c; font-size: 13px; }

/* ---------- 账号设置 ---------- */
.account-panel { max-width: 480px; }
.account-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 13px 2px; border-bottom: 1px solid #eef0f5; font-size: 14px;
}
.account-row span { color: #8a8f9c; }
.account-logout {
    margin-top: 20px; padding: 11px 26px; border: none; border-radius: 8px;
    background: #e53e3e; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
}
.account-logout:hover { background: #c63333; }

/* ---------- 底部项目管理/切换 ---------- */
.side-projects {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    margin: 6px 12px 12px; padding: 10px 12px; border-radius: 10px;
    background: rgba(255,255,255,.06);
}
.proj-manage { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; flex-shrink: 0; }
.proj-manage svg { width: 16px; height: 16px; fill: none; stroke: #e53e3e; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.proj-manage:hover { color: #fff; }
.proj-switch {
    display: flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer;
    color: #fff; background: rgba(229,62,62,.16); border: 1px solid rgba(229,62,62,.45);
    padding: 4px 8px; border-radius: 8px; min-width: 0;
}
.proj-switch .txt { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-switch .caret { font-size: 10px; }
.proj-switch:hover { background: rgba(229,62,62,.3); }
.proj-menu {
    position: absolute; left: 0; right: 0; bottom: calc(100% + 6px);
    background: #23233a; border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
    padding: 6px; max-height: 260px; overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 20;
}
.proj-menu-item {
    padding: 9px 10px; border-radius: 7px; font-size: 13px; cursor: pointer;
    color: rgba(255,255,255,.85);
}
.proj-menu-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.proj-menu-item.on { color: #fff; background: rgba(229,62,62,.28); }
.proj-menu-item.on::after { content: ' ✓'; color: #e53e3e; }

/* ---------- 项目管理视图 ---------- */
.proj-form { display: flex; gap: 10px; flex-wrap: wrap; }
.proj-form input { padding: 10px 12px; border: 1px solid #dcdfe6; border-radius: 8px; font-size: 14px; flex: 1; min-width: 140px; }
.proj-form input:focus { outline: none; border-color: #e53e3e; box-shadow: 0 0 0 3px rgba(229,62,62,.12); }
.btn-red { padding: 10px 22px; border: none; border-radius: 8px; background: #e53e3e; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-red:hover { background: #c63333; }
.project-list { display: flex; flex-direction: column; }
.project-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 2px; border-bottom: 1px solid #eef0f5; font-size: 14px;
}
.project-row .p-name { font-weight: 600; }
.tag-on { font-size: 11px; color: #e53e3e; background: rgba(229,62,62,.1); padding: 2px 8px; border-radius: 999px; }
.project-row .p-meta { color: #8a8f9c; font-size: 12px; flex: 1; }
.project-row .p-ops { display: flex; gap: 6px; flex-shrink: 0; }
.p-btn { padding: 5px 10px; font-size: 12px; border: 1px solid #dcdfe6; background: #fff; border-radius: 6px; cursor: pointer; color: #555; }
.p-btn:hover { border-color: #e53e3e; color: #e53e3e; }
.p-btn.danger:hover { border-color: #c63333; color: #c63333; }
.p-ops a.p-btn { text-decoration: none; line-height: 1.6; display: inline-block; }

/* ---------- 新建项目：右上角悬浮按钮 + 弹框 + 服务期 ---------- */
.fab-new {
    position: fixed; top: 22px; right: 30px; z-index: 900;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px; border: none; border-radius: 999px;
    background: #e53e3e; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
    box-shadow: 0 10px 26px rgba(229,62,62,.3);
    transition: background .18s ease, transform .18s ease;
}
.fab-new:hover { background: #c63333; transform: translateY(-1px); }
.fab-new svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.proj-modal { width: 520px; }
.proj-modal .fld { display: block; margin-bottom: 14px; }
.proj-modal .fld > span { display: block; font-size: 12.5px; color: #6b7180; margin-bottom: 6px; }
.proj-modal .fld > span i { color: #e53e3e; font-style: normal; }
.proj-modal .fld input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #dcdfe6; border-radius: 8px; font-size: 14px; }
.proj-modal .fld input:focus { outline: none; border-color: #e53e3e; box-shadow: 0 0 0 3px rgba(229,62,62,.12); }
.proj-modal .fld-row { display: flex; gap: 12px; }
.proj-modal .fld-row .fld { flex: 1; }
.term-quick { display: flex; gap: 8px; flex-wrap: wrap; }
.term-quick button { padding: 7px 14px; border: 1px solid #dcdfe6; border-radius: 999px; background: #fff; font-size: 13px; color: #555; cursor: pointer; }
.term-quick button:hover { border-color: #e53e3e; color: #e53e3e; }
.term-quick button.on { background: rgba(229,62,62,.1); border-color: #e53e3e; color: #e53e3e; font-weight: 700; }
.term-hint { font-size: 12px; color: #8a8f9c; min-height: 18px; margin-top: 10px; }
/* 编辑/续期服务期弹框 */
.tf-head { display: flex; flex-direction: column; gap: 3px; margin: -4px 0 14px; }
.tf-name { font-size: 15px; font-weight: 700; color: #1a1a2e; }
.tf-meta { font-size: 12.5px; color: #8a8f9c; }
.term-quick button.ghost { color: #e53e3e; border-style: dashed; }
.term-quick button.ghost:hover { background: rgba(229,62,62,.08); }
/* 服务期徽标：已到期/最后1天红、3天紫、7天蓝、15天黄、30天绿 */
.p-term { font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; white-space: nowrap; font-weight: 400; }
.p-term.t0, .p-term.t1 { color: #e53e3e; background: rgba(229,62,62,.12); }
.p-term.t2 { color: #722ed1; background: rgba(114,46,209,.12); }
.p-term.t3 { color: #2b6cb0; background: rgba(43,108,176,.12); }
.p-term.t4 { color: #b7791f; background: rgba(214,158,2,.16); }
.p-term.t5 { color: #2f855a; background: rgba(47,133,90,.12); }
.p-term.t6 { color: #8a8f9c; background: #eef0f5; }

/* ---------- 项目到期提醒（右下角一个弹框：一列到期项目，越临近越靠上，每行按档位着色） ---------- */
.expiry-bubble {
    position: fixed; right: 26px; bottom: 26px; z-index: 1100; width: 336px;
    max-height: calc(100vh - 60px); display: flex; flex-direction: column;
    background: #fff; border-radius: 12px; border-left: 4px solid #2f855a;
    box-shadow: 0 18px 44px rgba(16,16,28,.22); padding: 14px 14px 10px;
    opacity: 0; transform: translateY(14px); transition: opacity .25s ease, transform .25s ease;
}
.expiry-bubble.on { opacity: 1; transform: none; }
.expiry-bubble.t0, .expiry-bubble.t1 { border-left-color: #e53e3e; }
.expiry-bubble.t2 { border-left-color: #722ed1; }
.expiry-bubble.t3 { border-left-color: #2b6cb0; }
.expiry-bubble.t4 { border-left-color: #d69e02; }
.expiry-bubble.t5 { border-left-color: #2f855a; }
.eb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-shrink: 0; }
.eb-icon {
    width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
    background: #2f855a; color: #fff; font-size: 12px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.expiry-bubble.t0 .eb-icon, .expiry-bubble.t1 .eb-icon { background: #e53e3e; }
.expiry-bubble.t2 .eb-icon { background: #722ed1; }
.expiry-bubble.t3 .eb-icon { background: #2b6cb0; }
.expiry-bubble.t4 .eb-icon { background: #d69e02; }
.eb-title { font-size: 14px; font-weight: 700; color: #1a1a2e; flex: 1; }
.eb-close { border: none; background: none; font-size: 20px; line-height: 1; color: #b5b9c4; cursor: pointer; }
.eb-close:hover { color: #e53e3e; }
/* 列表：项目多时长了就内部滚动，仍是一个弹框 */
.eb-body { overflow-y: auto; max-height: 46vh; }
.eb-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 6px;
    border-left: 3px solid #2f855a; border-radius: 6px; background: #f7f8fa;
}
.eb-item.lv0, .eb-item.lv1 { border-left-color: #e53e3e; background: rgba(229,62,62,.07); }
.eb-item.lv2 { border-left-color: #722ed1; background: rgba(114,46,209,.07); }
.eb-item.lv3 { border-left-color: #2b6cb0; background: rgba(43,108,176,.07); }
.eb-item.lv4 { border-left-color: #d69e02; background: rgba(214,158,2,.10); }
.eb-item.lv5 { border-left-color: #2f855a; background: rgba(47,133,90,.07); }
.eb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.eb-name { font-size: 13.5px; color: #1a1a2e; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eb-name i { font-style: normal; color: #b5b9c4; font-size: 11px; margin-left: 6px; font-weight: 400; }
.eb-date { font-size: 11.5px; color: #8a8f9c; }
/* 行首天数标签：颜色与项目列表徽标同一套分档 */
.eb-tag { font-size: 11.5px; font-weight: 700; flex-shrink: 0; padding: 2px 8px; border-radius: 999px; color: #2f855a; background: rgba(47,133,90,.14); }
.eb-tag.lv0, .eb-tag.lv1 { color: #e53e3e; background: rgba(229,62,62,.14); }
.eb-tag.lv2 { color: #722ed1; background: rgba(114,46,209,.14); }
.eb-tag.lv3 { color: #2b6cb0; background: rgba(43,108,176,.14); }
.eb-tag.lv4 { color: #b7791f; background: rgba(214,158,2,.18); }
.eb-tag.lv5 { color: #2f855a; background: rgba(47,133,90,.14); }
.eb-foot { margin-top: 8px; flex-shrink: 0; }
.eb-foot a { font-size: 12.5px; color: #e53e3e; text-decoration: none; }
.eb-foot a:hover { text-decoration: underline; }

/* ---------- 账号管理 / 数据库配置 ---------- */
.tier-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-right: 6px; }
.tier-super { color: #e53e3e; background: rgba(229,62,62,.1); }
.tier-agent { color: #2b6cb0; background: rgba(43,108,176,.1); }
.tier-customer { color: #2f855a; background: rgba(47,133,90,.1); }
.tag-off { font-size: 11px; color: #8a8f9c; background: #eef0f5; padding: 2px 8px; border-radius: 999px; }
.filter-bar { float: right; display: flex; gap: 8px; align-items: center; font-weight: 400; }
.filter-bar select, .filter-bar input { padding: 6px 10px; border: 1px solid #dcdfe6; border-radius: 6px; font-size: 13px; }
.proj-form select { padding: 10px 12px; border: 1px solid #dcdfe6; border-radius: 8px; font-size: 14px; background: #fff; }
.db-mode-tag { float: right; font-weight: 400; font-size: 12px; color: #8a8f9c; }
.db-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.db-form input { padding: 10px 12px; border: 1px solid #dcdfe6; border-radius: 8px; font-size: 14px; flex: 1; min-width: 140px; }
.db-form input:disabled { background: #f5f6f9; color: #4a4f5c; cursor: default; }
.db-form input:focus { outline: none; border-color: #e53e3e; box-shadow: 0 0 0 3px rgba(229,62,62,.12); }
.db-enable { display: block; font-size: 13px; color: #555; margin-bottom: 12px; cursor: pointer; }
.db-ops { display: flex; align-items: center; gap: 10px; }
#db-msg { font-size: 13px; }
.db-note { margin-top: 12px; font-size: 12px; color: #8a8f9c; line-height: 1.6; }

/* ---------- 代理商专属库初始化锁定层 ---------- */
#initdb-overlay { position: fixed; inset: 0; z-index: 999; background: rgba(16,16,28,.82); display: flex; align-items: center; justify-content: center; }
.initdb-card { width: 520px; max-width: 92vw; background: #fff; border-radius: 12px; padding: 28px 30px; box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.initdb-title { font-size: 20px; font-weight: 700; color: #1a1a2e; margin-bottom: 8px; }
.initdb-title::before { content: ''; display: inline-block; width: 4px; height: 18px; background: #e53e3e; border-radius: 2px; margin-right: 8px; vertical-align: -3px; }
.initdb-sub { font-size: 13px; color: #555; line-height: 1.7; margin-bottom: 18px; }
.initdb-foot { margin-top: 16px; text-align: center; font-size: 13px; }
.initdb-foot a { color: #8a8f9c; }

/* 统一确认/提示弹框：遮罩与卡片淡入淡出（确认=品牌红） */
.modal-mask { position: fixed; inset: 0; z-index: 1200; background: rgba(16,16,28,0); display: none; align-items: center; justify-content: center; transition: background .25s ease; }
.modal-mask.show { display: flex; }
.modal-mask.on { background: rgba(16,16,28,.5); }
.modal-card { width: 460px; max-width: 92vw; background: #fff; border-radius: 12px; padding: 24px 26px; box-shadow: 0 24px 60px rgba(0,0,0,.45); opacity: 0; transform: translateY(16px) scale(.96); transition: opacity .25s ease, transform .25s ease; }
.modal-mask.on .modal-card { opacity: 1; transform: none; }
.modal-title { font-size: 17px; font-weight: 700; color: #1a1a2e; margin-bottom: 10px; }
.modal-title::before { content: ''; display: inline-block; width: 4px; height: 16px; background: #e53e3e; border-radius: 2px; margin-right: 8px; vertical-align: -2px; }
.modal-text { font-size: 13.5px; color: #4a4f5c; line-height: 1.8; word-break: break-all; }
.modal-ops { margin-top: 22px; display: flex; justify-content: flex-end; gap: 10px; }
#ini-msg { font-size: 13px; }

/* ---------- 折叠态 ---------- */
.sidebar { transition: width .2s ease; }
.app-shell.collapsed .sidebar { width: 64px; }
.app-shell.collapsed .side-user { padding: 10px 6px; gap: 4px; }
.app-shell.collapsed .side-user-name { display: none; }
.app-shell.collapsed .avatar { width: 28px; height: 28px; }
.app-shell.collapsed .collapse-btn { display: flex; transform: rotate(180deg); padding: 2px; }
.app-shell.collapsed .collapse-btn svg { width: 15px; height: 15px; }
.app-shell.collapsed .menu-item { justify-content: center; }
.app-shell.collapsed .menu-item .txt, .app-shell.collapsed .caret { display: none; }
.app-shell.collapsed .side-projects { flex-direction: column; justify-content: center; padding: 10px 6px; cursor: pointer; }
.app-shell.collapsed .proj-manage .txt, .app-shell.collapsed .proj-switch { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .sidebar { width: 64px; }
    .menu-item .txt, .side-user-name { display: none; }
    .menu-item { justify-content: center; }
}
