/* ========================================
   业务云系统 v2 — Linear Style 设计系统
   ======================================== */

/* --- Reset & Variables --- */
:root {
    --primary: #5e6ad2;
    --primary-hover: #4f5bc2;
    --primary-light: #f0f1ff;
    --success: #0ea05e;
    --success-light: #e6f7ef;
    --warning: #f2a227;
    --warning-light: #fef7e6;
    --danger: #e5484d;
    --danger-light: #fef2f2;
    --bg: #fafafa;
    --bg-sidebar: #f9f9fb;
    --surface: #fff;
    --text: #1a1a2e;
    --text-secondary: #6b6b7b;
    --text-muted: #999;
    --border: #e6e6eb;
    --border-light: #f0f0f3;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 4px 16px rgba(0,0,0,.08);
    --sidebar-width: 232px;
    --topbar-h: 52px;
    --transition: 150ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5;
}

/* ===== 通用 ===== */
a { color: var(--primary); text-decoration: none; } a:hover { color: var(--primary-hover); }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* ===== 登录页 ===== */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #fafafa; padding: 24px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 28px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 14px; color: var(--text-secondary); margin-top: 6px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--radius-lg);
    padding: 32px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.login-card h2 { margin-bottom: 20px; }
.login-footer { font-size: 12px; color: var(--text-muted); margin-top: 20px; text-align: center; }

.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-error { background: var(--danger-light); color: var(--danger); }
.alert-info { background: var(--primary-light); color: var(--primary); }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary);
    margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 14px; color: var(--text); background: #fff; outline: none; transition: border var(--transition), box-shadow var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(94,106,210,.1); }
.form-group select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 10px center; padding-right: 32px; }
.remember-me { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px;
    border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; border: none;
    transition: all var(--transition); line-height: 1.4; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d43d42; }
.btn-ghost { background: none; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-group { display: flex; gap: 8px; }

/* ===== 汉堡菜单按钮 ===== */
.hamburger { display: none; width: 36px; height: 36px; border: none; background: none; cursor: pointer;
    align-items: center; justify-content: center; border-radius: var(--radius); padding: 6px; }
.hamburger:hover { background: var(--bg); }
.hamburger span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 1px;
    transition: var(--transition); position: relative; }
.hamburger span::before, .hamburger span::after { content: ''; display: block; width: 18px; height: 2px;
    background: var(--text); border-radius: 1px; position: absolute; transition: var(--transition); }
.hamburger span::before { top: -5px; }
.hamburger span::after { top: 5px; }
.hamburger.open span { background: transparent; }
.hamburger.open span::before { top: 0; transform: rotate(45deg); }
.hamburger.open span::after { top: 0; transform: rotate(-45deg); }

/* ===== 侧边栏 ===== */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-width);
    background: var(--bg-sidebar); border-right: 1px solid var(--border); z-index: 200;
    display: flex; flex-direction: column; transition: transform var(--transition); }
.sidebar-header { padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sidebar-header h2 { font-size: 17px; color: var(--text); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-group { margin-bottom: 2px; }
.nav-group-title { padding: 16px 20px 6px; font-size: 10px; letter-spacing: .06em;
    color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 20px; font-size: 13px;
    color: var(--text-secondary); transition: all var(--transition); border-radius: 0; }
.nav-item:hover { background: #eef0ff; color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.nav-icon { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }

/* ===== 顶栏 ===== */
.topbar { position: fixed; top: 0; left: var(--sidebar-width); right: 0; height: var(--topbar-h);
    background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center;
    justify-content: space-between; padding: 0 24px; z-index: 100; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.company-badge { font-size: 12px; padding: 2px 10px; background: var(--primary-light); color: var(--primary);
    border-radius: 20px; }
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 12px; color: var(--text-muted); }

/* ===== 主内容区 ===== */
.main-content { margin-left: var(--sidebar-width); margin-top: var(--topbar-h); padding: 24px;
    min-height: calc(100vh - var(--topbar-h)); }
.page-container { }

/* ===== 卡片 ===== */
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 24px;
    border: 1px solid var(--border); transition: box-shadow var(--transition); }
.card:hover { box-shadow: var(--shadow-lg); }
.card-icon { font-size: 28px; margin-bottom: 12px; }
.card h3 { font-size: 16px; margin-bottom: 8px; }
.card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; }
.card-link { font-size: 13px; font-weight: 500; }

.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 16px; margin-top: 20px; }

/* ===== 统计卡片 ===== */
.stats-row { display: flex; gap: 12px; margin-bottom: 20px; }
.stat-card { flex: 1; background: var(--surface); border-radius: var(--radius-lg); padding: 20px;
    border: 1px solid var(--border); text-align: center; }
.stat-card.stat-warning { border-left: 3px solid var(--warning); }
.stat-card.stat-danger { border-left: 3px solid var(--danger); }
.stat-card.stat-success { border-left: 3px solid var(--success); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ===== 区块 ===== */
.section { background: var(--surface); border-radius: var(--radius-lg); padding: 20px;
    border: 1px solid var(--border); margin-bottom: 16px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2 { font-size: 15px; }

/* ===== 表格 ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border-light);
    font-size: 13px; }
.data-table th { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .03em; background: transparent; }
.data-table tbody tr:hover { background: var(--bg); }
.actions { display: flex; gap: 6px; }

/* ===== Badge ===== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ===== 弹窗 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); display: flex;
    align-items: center; justify-content: center; z-index: 500; animation: fadeIn .15s ease; }
@keyframes fadeIn{from{opacity:0}}
.modal-box { background: var(--surface); border-radius: var(--radius-lg); width: 90%; max-width: 440px;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: modalIn .15s ease; }
@keyframes modalIn{from{transform:translateY(8px);opacity:0}}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 15px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px; }

/* ===兼容旧弹窗类名=== */
.adjust-modal { position: fixed; inset: 0; background: rgba(0,0,0,.3); display: none;
    align-items: center; justify-content: center; z-index: 500; animation: fadeIn .15s ease; }
.adjust-box { background: var(--surface); border-radius: var(--radius-lg); padding: 24px;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: modalIn .15s ease;
    max-height: 90vh; overflow-y: auto; }
.adjust-box h3 { margin-bottom: 16px; font-size: 15px; }
.adjust-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ===== 表单输入组件 ===== */
.input-field { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13px; outline: none; transition: border var(--transition); }
.input-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(94,106,210,.1); }

/* ===== Toast ===== */
.toast-fixed { position: fixed; top: 68px; right: 20px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px; }

/* ===== 内联表单 ===== */
.inline-form .form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13px; outline: none; }
.inline-form input:focus, .inline-form select:focus { border-color: var(--primary); }

/* ===== 超管布局 ===== */
.sa-layout { display: flex; min-height: 100vh; }
.sa-sidebar { width: 200px; background: #1a1a2e; color: #c4c4d4; flex-shrink: 0; display: flex; flex-direction: column; }
.sa-logo { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sa-logo h2 { color: #fff; font-size: 16px; }
.sa-logo small { color: #666; font-size: 11px; }
.sa-nav { list-style: none; flex: 1; }
.sa-nav li a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: #9da; font-size: 13px;
    text-decoration: none; transition: var(--transition); border-left: 2px solid transparent; }
.sa-nav li a:hover { background: rgba(255,255,255,.04); color: #ddd; }
.sa-nav li a.active { background: rgba(255,255,255,.06); color: #fff; border-left-color: var(--primary); }
.sa-main { flex: 1; background: var(--bg); overflow-y: auto; }
.sa-topbar { background: var(--surface); padding: 12px 24px; display: flex; justify-content: space-between;
    align-items: center; border-bottom: 1px solid var(--border); }
.sa-topbar h1 { font-size: 17px; }
.sa-content { padding: 24px; }
.sa-user { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 12px; }
.sa-footer { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11px; color: #555; }

/* ===== 工具类 ===== */
.flex { display: flex; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.w-full { width: 100%; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }

/* ===== 产品配置卡片 ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 12px; }
.product-card { background: var(--surface); border-radius: var(--radius-lg); padding: 20px;
    border: 1px solid var(--border); cursor: pointer; transition: all var(--transition); position: relative; }
.product-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.product-card.active { border-color: var(--success); background: var(--success-light); }
.product-card .p-name { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.product-card .p-meta { font-size: 12px; color: var(--text-muted); }
.product-card .p-check { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px;
    border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); }
.product-card.active .p-check { background: var(--success); border-color: var(--success); color: #fff; font-size: 13px; }

/* ===== 权限管理 ===== */
.perm-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.perm-roles { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; }
.perm-role-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border-light);
    font-size: 13px; transition: all var(--transition); }
.perm-role-item:hover { background: var(--bg); }
.perm-role-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.perm-main { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--border); }
.perm-group { margin-bottom: 20px; }
.perm-group-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .03em; }
.perm-check { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.perm-check.sub { padding-left: 22px; }
.perm-check input[type="checkbox"] { accent-color: var(--primary); }

/* ===== 报价计算器 ===== */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.calc-card { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--border); }
.calc-card h3 { font-size: 14px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-light); }
.calc-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }
.calc-row label { width: 80px; font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.calc-row input, .calc-row select { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13px; }
.calc-result-box { background: var(--primary); color: #fff; border-radius: var(--radius-lg); padding: 20px; }
.calc-result-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.15); font-size: 13px; }
.calc-result-total { font-size: 22px; font-weight: 700; padding-top: 10px; }

/* ===== Tag 输入（产品配置页） ===== */
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--border);
    border-radius: var(--radius); min-height: 38px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; background: var(--primary-light);
    color: var(--primary); border-radius: 4px; font-size: 12px; }
.tag .remove { cursor: pointer; opacity: .6; } .tag .remove:hover { opacity: 1; }
.tag-input input { border: none; outline: none; flex: 1; min-width: 70px; font-size: 13px; }

/* ===== 帮助提示 ===== */
.help-dot { display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
    cursor: help; vertical-align: middle; margin-left: 4px; line-height: 1;
    transition: opacity var(--transition); }
.help-dot:hover { opacity: .85; }

/* ===== 响应式（手机端） ===== */
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .topbar { left: 0; }
    .main-content { margin-left: 0; padding: 16px; }
    .dashboard-cards, .calc-grid, .perm-layout { grid-template-columns: 1fr; }
    .stats-row { flex-direction: column; }
    .sa-layout { flex-direction: column; }
    .sa-sidebar { width: 100%; height: auto; flex-direction: row; align-items: center; }
    .sa-nav { display: flex; flex-wrap: wrap; }
    .sa-nav li a { padding: 8px 12px; font-size: 12px; }
    .data-table { display: block; overflow-x: auto; white-space: nowrap; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .actions { flex-wrap: wrap; }
}
