/* 商铺微单元安全管理系统 - 全局样式 v2 */
:root {
    --bg: #0b1120;
    --bg-card: #131b2f;
    --bg-card-hover: #1a2540;
    --border: #1e2d4a;
    --border-light: #263554;
    --text: #e8ecf1;
    --text-secondary: #8fa3bf;
    --text-muted: #556885;
    --red: #f87171;
    --orange: #fb923c;
    --yellow: #facc15;
    --green: #4ade80;
    --blue: #60a5fa;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.2s ease;
}

/* 浅色主题 */
body.theme-light { --bg: #f1f5f9; --bg-card: #ffffff; --bg-card-hover: #f8fafc; --border: #e2e8f0; --border-light: #cbd5e1; --text: #0f172a; --text-secondary: #475569; --text-muted: #94a3b8; --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04); --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04); --red: #ef4444; --green: #16a34a; --blue: #2563eb; }
/* 标准主题 */
body.theme-standard { --bg: #dce6f0; --bg-card: #f8fafc; --bg-card-hover: #edf2f7; --border: #cbd5e1; --border-light: #94a3b8; --text: #1e293b; --text-secondary: #475569; --text-muted: #64748b; --primary: #2563eb; --primary-hover: #1d4ed8; --shadow: 0 1px 3px rgba(0,0,0,0.04); --shadow-md: 0 4px 6px rgba(0,0,0,0.04); }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ===== 侧边栏 ===== */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 240px;
    background: var(--bg-card); border-right: 1px solid var(--border);
    padding: 20px 0; z-index: 100; overflow-y: auto;
    box-shadow: var(--shadow);
}

.sidebar-logo {
    padding: 0 20px 20px; font-size: 15px; font-weight: 700;
    color: var(--text); display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap;
}
.sidebar-logo .icon { font-size: 26px; }

.sidebar-nav a {
    display: flex; align-items: center; gap: 10px; padding: 11px 24px;
    color: var(--text-secondary); text-decoration: none; font-size: 13px;
    transition: var(--transition); border-left: 3px solid transparent;
    margin: 2px 0;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    color: var(--text); background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--primary);
}
.sidebar-nav a .nav-icon { font-size: 17px; width: 24px; text-align: center; }

/* ===== 主内容区 ===== */
.main { margin-left: 240px; padding: 28px 36px; min-height: 100vh; transition: var(--transition); }

.page-header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.page-header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.3px; }
.page-header .subtitle { font-size: 13px; color: var(--text-muted); }

/* ===== 统计卡片 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px 20px;
    transition: var(--transition); box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 3px; background: transparent; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-light); }
.stat-card.red::before { background: var(--red); }
.stat-card.orange::before { background: var(--orange); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.green::before { background: var(--green); }
.stat-card.blue::before { background: var(--blue); }
.stat-card .stat-value { font-size: 34px; font-weight: 800; margin-bottom: 6px; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); }
.stat-card.red .stat-value { color: var(--red); }
.stat-card.orange .stat-value { color: var(--orange); }
.stat-card.yellow .stat-value { color: var(--yellow); }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.blue .stat-value { color: var(--blue); }

/* ===== 卡片容器 ===== */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
    box-shadow: var(--shadow); transition: var(--transition);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.card-header h2 { font-size: 16px; font-weight: 600; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th {
    color: #fff; font-weight: 600; font-size: 13px;
    letter-spacing: 0.3px; border-bottom: 2px solid var(--primary);
    background: #1e3a5f; position: sticky; top: 0; z-index: 1;
    padding: 13px 14px;
}
/* 浅色/标准主题下表头 */
body.theme-light th, body.theme-standard th {
    color: #1e293b; background: #e2e8f0;
    border-bottom: 2px solid #94a3b8;
}
tbody tr { transition: var(--transition); }
tbody tr:hover td { background: var(--bg-card-hover); }
tbody tr:nth-child(even) td { background: rgba(255,255,255,0.015); }

/* ===== 徽标 ===== */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
}
.badge-red { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-orange { background: rgba(251,146,60,0.15); color: var(--orange); }
.badge-yellow { background: rgba(250,204,21,0.15); color: var(--yellow); }
.badge-green { background: rgba(74,222,128,0.15); color: var(--green); }
.badge-blue { background: rgba(96,165,250,0.15); color: var(--blue); }
.badge-gray { background: rgba(148,163,184,0.1); color: var(--text-secondary); }
.badge-purple { background: rgba(167,139,250,0.15); color: #a78bfa; }
.badge-teal { background: rgba(45,212,191,0.15); color: #2dd4bf; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: var(--radius-sm); border: none;
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: var(--transition); text-decoration: none;
    letter-spacing: 0.2px;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #eab308; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg-card-hover); border-color: var(--border-light); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ===== 表单元素 ===== */
input, select, textarea {
    padding: 10px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg);
    color: var(--text); font-size: 13px; transition: var(--transition);
    outline: none; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
input::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 60px; }

/* ===== 搜索栏 ===== */
.search-bar { display: flex; gap: 10px; margin-bottom: 18px; align-items: center; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 200px; }
.search-bar select { min-width: 120px; }

/* ===== 进度条 ===== */
.progress-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-fill.red { background: linear-gradient(90deg, var(--red), #f87171); }
.progress-fill.orange { background: linear-gradient(90deg, var(--orange), #fb923c); }
.progress-fill.yellow { background: linear-gradient(90deg, var(--yellow), #facc15); }
.progress-fill.green { background: linear-gradient(90deg, var(--green), #4ade80); }
.progress-fill.blue { background: linear-gradient(90deg, var(--blue), #60a5fa); }

/* ===== 弹窗 ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center; z-index: 200;
    backdrop-filter: blur(2px);
}
.modal {
    background: var(--bg-card); border-radius: 16px; padding: 32px;
    max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.4); border: 1px solid var(--border);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.modal h2 { margin-bottom: 16px; font-size: 18px; }

/* ===== 双列/三列布局 ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ===== 四色分布条 ===== */
.color-distribution { display: flex; gap: 10px; margin-bottom: 16px; }
.color-bar {
    flex: 1; text-align: center; padding: 18px 8px; border-radius: var(--radius);
    background: var(--bg); border: 1px solid var(--border);
    transition: var(--transition);
}
.color-bar:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.color-bar .count { font-size: 28px; font-weight: 700; display: block; }
.color-bar .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.color-bar .pct { font-size: 11px; color: var(--text-secondary); }
.color-bar.red .count { color: var(--red); }
.color-bar.orange .count { color: var(--orange); }
.color-bar.yellow .count { color: var(--yellow); }
.color-bar.green .count { color: var(--green); }

/* ===== 评分卡片 ===== */
.score-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.score-item {
    background: var(--bg); padding: 18px; border-radius: var(--radius);
    text-align: center; border: 1px solid var(--border); transition: var(--transition);
}
.score-item:hover { border-color: var(--primary); transform: translateY(-2px); }
.score-item .dim-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.score-item .dim-value { font-size: 24px; font-weight: 700; }
.score-item .dim-max { font-size: 11px; color: var(--text-muted); }

/* ===== 巡检清单 ===== */
.checklist-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checklist-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border);
    cursor: pointer; transition: var(--transition);
}
.checklist-item:hover { border-color: var(--primary); background: var(--bg-card-hover); }
.checklist-item.selected { border-color: var(--primary); background: rgba(59,130,246,0.08); }
.checklist-item .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--text-muted); flex-shrink: 0; }
.checklist-item .dot.normal { background: var(--green); border-color: var(--green); }
.checklist-item .dot.abnormal { background: var(--red); border-color: var(--red); }
.checklist-item .item-text { flex: 1; font-size: 13px; }
.checklist-item .item-cat { font-size: 11px; color: var(--text-muted); padding: 2px 8px; background: var(--bg-card); border-radius: 4px; }

/* ===== 业态分布 ===== */
.biz-dist-layout { display: flex; gap: 20px; align-items: flex-start; }
.biz-table-wrap { flex: 1; min-width: 0; max-height: 420px; overflow-y: auto; }
.biz-table-wrap table { font-size: 12px; }
.biz-table-wrap th, .biz-table-wrap td { padding: 5px 8px; }
.biz-chart-wrap { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
.biz-chart-wrap canvas { width: 100% !important; height: auto !important; max-height: 380px; }

/* ===== 链接 ===== */
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

.hidden { display: none !important; }

/* ===== 汉堡菜单（移动端） ===== */
.hamburger { display: none; position: fixed; top: 12px; left: 12px; z-index: 300; width: 44px; height: 44px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: var(--shadow); }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 1px; transition: 0.2s; }
.sidebar-open .hamburger span:nth-child(1) { transform: rotate(45deg) translate(4px,4px); }
.sidebar-open .hamburger span:nth-child(2) { opacity: 0; }
.sidebar-open .hamburger span:nth-child(3) { transform: rotate(-45deg) translate(4px,-4px); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 149; backdrop-filter: blur(2px); }
.sidebar-open .sidebar-overlay { display: block; }

/* ===== 移动端 ===== */
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .sidebar { position: fixed; left: -280px; top: 0; bottom: 0; width: 260px; z-index: 150; transition: left 0.25s ease; box-shadow: 2px 0 16px rgba(0,0,0,0.4); }
    .sidebar-open .sidebar { left: 0; }
    .sidebar-nav { display: block; overflow-x: visible; padding: 0; }
    .sidebar-nav a { padding: 12px 20px; white-space: normal; border-left: 3px solid transparent; border-bottom: none; font-size: 14px; }
    .sidebar-nav a.active { border-left-color: var(--primary); border-bottom: none; }
    .main { margin-left: 0; padding: 16px 14px; }
    .card { overflow-x: auto; }
    table { min-width: 600px; font-size: 11px; }
    th, td { padding: 8px 10px; }
    .two-col, .three-col { grid-template-columns: 1fr; }
    .score-grid { grid-template-columns: repeat(2, 1fr); }
    .checklist-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .biz-dist-layout { flex-direction: column; }
    .biz-chart-wrap { width: 100%; max-height: 300px; }
    .modal-overlay { padding: 0; align-items: flex-start; }
    .modal { max-width: 100%; width: 100%; height: 100vh; max-height: 100vh; border-radius: 0; padding: 16px; }
    .modal h2 { font-size: 16px; }
    .form-row { flex-direction: column; gap: 8px; }
    .form-group { flex: 1; }
    input, select, textarea, button { font-size: 16px !important; }
    input[type="text"], input[type="search"], input[type="date"], select, textarea { padding: 10px 12px; min-height: 44px; }
    .btn { padding: 10px 16px; min-height: 44px; font-size: 14px; }
    .btn-sm { padding: 8px 12px; min-height: 36px; }
    .toolbar { flex-wrap: wrap; gap: 6px; }
    .toolbar > * { flex: 1 1 auto; min-width: 0; }
}
