/* IoT 设备数据管理平台 - 自定义样式 */
:root {
    --sidebar-width: 232px;
    --sidebar-bg: #1f2d3d;
    --sidebar-active: #2f6feb;
    --topbar-height: 56px;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #212529;
}

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

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cfd8e3;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    color: #fff;
    font-weight: 600;
    letter-spacing: .5px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .brand .logo {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: linear-gradient(135deg, #4f8cff, #7c5cff);
    flex: 0 0 26px;
}

.sidebar nav {
    padding: 10px 8px;
    overflow-y: auto;
    flex: 1;
}

.sidebar .nav-section {
    font-size: 12px;
    color: #7f8ea3;
    padding: 12px 12px 6px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: 6px;
    color: #cfd8e3;
    text-decoration: none;
    font-size: 14px;
}

.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar .nav-link .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

.sidebar .sidebar-footer {
    padding: 10px 16px 16px;
    font-size: 12px;
    color: #7f8ea3;
    border-top: 1px solid rgba(255,255,255,.08);
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar .page-title { font-weight: 600; font-size: 15px; }
.topbar .user-box { display: flex; align-items: center; gap: 12px; color: #495057; }
.topbar .user-box .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: #e7f0ff; color: #2f6feb;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600;
}

.content { padding: 20px; }

.card { border: 1px solid #e9ecef; border-radius: 8px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef1f4; font-weight: 600; border-radius: 8px 8px 0 0 !important; }
.card + .card { margin-top: 16px; }

.stat-card { border-radius: 8px; background: #fff; border: 1px solid #e9ecef; padding: 16px; height: 100%; }
.stat-card .label { color: #6c757d; font-size: 13px; }
.stat-card .value { font-size: 26px; font-weight: 700; line-height: 1.2; margin-top: 6px; }
.stat-card .hint { color: #98a2b3; font-size: 12px; margin-top: 4px; }

.table > :not(caption) > * > * { padding: .6rem .65rem; vertical-align: middle; }
.table thead th { background: #f8f9fb; color: #475467; font-weight: 600; white-space: nowrap; }
.table td .btn-sm { padding: .18rem .5rem; font-size: 12px; }

.badge-soft-success { background: #e7f7ee; color: #0f8a4b; }
.badge-soft-warning { background: #fff6e5; color: #b26a00; }
.badge-soft-danger { background: #ffecec; color: #c92a2a; }
.badge-soft-secondary { background: #f1f3f5; color: #495057; }
.badge-soft-primary { background: #e7f0ff; color: #2f6feb; }

.form-label { font-weight: 500; color: #344054; }
.required::after { content: " *"; color: #e03131; }
.help-text { color: #98a2b3; font-size: 12px; }
.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar { background: #fff; border: 1px solid #e9ecef; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.filter-bar form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 140px; }
.empty-state { text-align: center; color: #98a2b3; padding: 48px 12px; }
.empty-state .icon { font-size: 34px; opacity: .5; }

.pagination { margin: 0; }
.pagination .page-link { color: #475467; }
.pagination .active .page-link { background: var(--sidebar-active); border-color: var(--sidebar-active); color: #fff; }

/* 登录页 */
.auth-body { min-height: 100vh; background: radial-gradient(1200px 600px at 20% 10%, #23345a 0%, #101b2d 55%, #0a1220 100%); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 12px; padding: 34px 30px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.auth-card .title { font-size: 22px; font-weight: 700; color: #1f2d3d; }
.auth-card .subtitle { color: #98a2b3; font-size: 13px; margin-top: 4px; margin-bottom: 22px; }
.auth-foot { text-align: center; color: #98a2b3; font-size: 12px; margin-top: 18px; }

.chart-box { width: 100%; height: 320px; }
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; color: #1f2d3d; }
.kv-list { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 14px; }
.kv-list dt { color: #6c757d; font-weight: 500; }
.kv-list dd { margin: 0; color: #212529; word-break: break-all; }

.alert-flash { position: relative; }
.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 2000; min-width: 260px; max-width: 380px; }

@media (max-width: 900px) {
    .layout { display: block; }
    .sidebar { position: fixed; left: 0; top: 0; z-index: 1040; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .content { padding: 14px; }
    .topbar { padding: 0 14px; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1030; display: none; }
    .sidebar-backdrop.show { display: block; }
}
