/* 管理后台样式（PC） */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #e1251b;
    --sidebar: #1f2733;
    --sidebar-active: #2d3a4d;
    --bg: #f0f2f5;
    --card: #fff;
    --text: #1f2329;
    --muted: #8a9099;
    --border: #e5e6eb;
    --green: #16a34a;
    --orange: #f59e0b;
    --blue: #2563eb;
}

body {
    font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg); color: var(--text); font-size: 14px;
}

.layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar { width: 210px; background: var(--sidebar); color: #c8cfd8; flex-shrink: 0; }
.sidebar .logo { padding: 22px 20px; font-size: 17px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .logo span { color: var(--primary); }
.nav { padding: 12px 0; }
.nav a {
    display: block; padding: 13px 20px; color: #c8cfd8; text-decoration: none;
    font-size: 14px; border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.05); }
.nav a.active { background: var(--sidebar-active); color: #fff; border-left-color: var(--primary); }
.nav .nav-group { padding: 14px 20px 6px; font-size: 12px; color: #6b7686; }

/* 主内容 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header {
    background: #fff; height: 58px; display: flex; align-items: center;
    justify-content: space-between; padding: 0 24px; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.header h2 { font-size: 17px; font-weight: 700; }
.header .admin-info { font-size: 13px; color: var(--muted); }
.header .admin-info a { color: var(--primary); text-decoration: none; margin-left: 14px; }
.content { padding: 24px; flex: 1; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 6px rgba(0,0,0,.04); }
.stat-card .lbl { font-size: 13px; color: var(--muted); }
.stat-card .num { font-size: 28px; font-weight: 700; margin-top: 8px; }
.stat-card .num.red { color: var(--primary); }
.stat-card .num.orange { color: var(--orange); }
.stat-card .num.green { color: var(--green); }
.stat-card .num.blue { color: var(--blue); }

/* 面板块 */
.panel { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 6px rgba(0,0,0,.04); margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-head h3 { font-size: 15px; font-weight: 700; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
.table th { background: #f7f8fa; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tr:hover td { background: #fafbfc; }
.table .link-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 标签 */
.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag.gray { background: #f0f1f3; color: #6b7686; }
.tag.green { background: #e6f7ec; color: var(--green); }
.tag.red { background: #fde8e6; color: var(--primary); }
.tag.orange { background: #fef3e0; color: #b45309; }
.tag.blue { background: #e8f0fe; color: var(--blue); }

/* 按钮 */
.btn { border: none; border-radius: 8px; padding: 8px 16px; font-size: 13px; cursor: pointer; font-weight: 600; background: #f0f1f3; color: var(--text); }
.btn:hover { opacity: .88; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
.form-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.form-row label { font-size: 13px; color: var(--muted); min-width: 70px; }
.input, select.input {
    border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
    font-size: 13px; outline: none; background: #fff; min-width: 140px;
}
.input:focus { border-color: var(--primary); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form .input { min-width: 90px; padding: 6px 8px; }

/* 上传区 */
.upload-zone {
    border: 2px dashed #c9cdd4; border-radius: 12px; padding: 40px; text-align: center;
    color: var(--muted); background: #fafbfc;
}
.upload-zone .big { font-size: 15px; margin-bottom: 8px; color: var(--text); }
.upload-zone input[type=file] { margin: 14px auto; }

/* 筛选条 */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar .input { min-width: 120px; }

/* 分页 */
.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: flex-end; align-items: center; }
.pagination a, .pagination span {
    padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px;
    text-decoration: none; font-size: 13px; color: var(--text); background: #fff;
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: #c9cdd4; }

/* 登录页 */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1f2733, #384557); }
.login-box { background: #fff; border-radius: 16px; padding: 34px 30px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.login-box .logo { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.login-box .logo span { color: var(--primary); }
.login-box .tip { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-box .form-group { margin-bottom: 16px; }
.login-box .input { width: 100%; min-width: 0; padding: 12px 14px; }
.login-box .btn { width: 100%; padding: 12px; font-size: 15px; }
.login-err { background: #fde8e6; color: var(--primary); border-radius: 8px; padding: 10px; font-size: 13px; margin-bottom: 16px; }

/* 提示消息 */
.flash { border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; font-size: 13px; }
.flash.ok { background: #e6f7ec; color: var(--green); }
.flash.err { background: #fde8e6; color: var(--primary); }

/* 额外按钮颜色 */
.btn-danger { background: #dc2626; color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-info { background: var(--blue); color: #fff; }

/* 邀请信息 */
.invite-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.big-code { font-size: 22px; font-weight: 800; letter-spacing: 2px; color: var(--blue); }
.invite-link { color: var(--muted); word-break: break-all; }

/* 表格空态 */
.empty { text-align: center; color: var(--muted) !important; }

/* 行内编辑控件 */
.inline-edit { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mini-input {
    width: 78px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
    font-size: 12px; outline: none;
}
.mini-input:focus { border-color: var(--primary); }
.tree-toggle { display: inline-block; width: 16px; text-align: center; cursor: pointer; color: #8a9099; font-size: 11px; margin-right: 4px; user-select: none; }
.tree-toggle.placeholder { cursor: default; }
.tree-toggle:hover { color: var(--primary); }
.tree-name { display: flex; align-items: center; }
.name-agent { font-weight: 700; color: var(--text); }
.name-staff { color: #5b6472; }
.team-tag {
    display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 3px;
    background: #eaf1fe; color: #2f6fed; font-size: 11px; line-height: 16px; vertical-align: 1px;
}
.inline-edit { flex-wrap: nowrap; }
.table td.ops-col { min-width: 380px; }
.table td.ops-col .mini-input { width: 62px; }
.table td.ops-col .btn-sm { padding: 5px 9px; }
.table td { white-space: nowrap; }
.table td.tree-col { white-space: nowrap; }

/* ---------- 手机端自适应（页面不用另做一套，直接这个样式生效） ---------- */
@media (max-width: 900px) {
    .layout { display: block; }
    .sidebar { width: 100%; }
    .sidebar .logo { padding: 14px 16px; font-size: 15px; border-bottom: none; }
    .nav { display: flex; overflow-x: auto; padding: 0 8px 10px; gap: 6px; -webkit-overflow-scrolling: touch; }
    .nav a { display: inline-block; white-space: nowrap; padding: 8px 13px; border-radius: 6px; }
    .nav-group { display: none; }
    .nav::-webkit-scrollbar { display: none; }
    .header { padding: 10px 14px; }
    .header h2 { font-size: 15px; }
    .header .admin-info { font-size: 12px; }
    .content { padding: 10px; }
    .panel { padding: 13px; border-radius: 10px; margin-bottom: 14px; }
    .panel-head { flex-wrap: wrap; gap: 8px; }
    .panel-head h3 { font-size: 14px; }
    .panel > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { min-width: 760px; }
    .table th, .table td { padding: 10px 9px; font-size: 12px; }
    .table td.ops-col { min-width: 0; }
    .btn, .btn-sm { width: auto !important; flex: 0 0 auto; }
    .filter-bar .input { min-width: 96px; }
    .panel form > .btn { width: auto !important; }
}

