/* ===================================================================
   Android 设备远程管理面板 - 后台样式
   布局：左侧 250px 深色导航 + 顶部 60px 栏 + 自适应内容区
   =================================================================== */

:root {
    --sidebar-width: 250px;
    --topbar-height: 60px;
    --brand: #1565c0;
    --brand-dark: #0d47a1;
    --sidebar-bg: #1e293b;
    --sidebar-active: rgba(255, 255, 255, 0.12);
    --border: #e2e8f0;
    --muted: #64748b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #f1f5f9;
    color: #0f172a;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #1565c0 100%);
    padding: 16px;
}
.login-card {
    background: #fff;
    width: 100%;
    max-width: 380px;
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .3);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card .form-control { margin-bottom: 16px; }

/* ---------------- 整体布局 ---------------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    z-index: 1030;
}
.sidebar .brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #cbd5e1;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.sidebar nav a.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: #60a5fa;
}
.sidebar nav .group-title {
    padding: 14px 20px 6px;
    font-size: 11px;
    letter-spacing: .08em;
    color: #64748b;
    text-transform: uppercase;
}

.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.topbar .page-title { font-size: 17px; font-weight: 600; }
.topbar .user-box { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

.content { padding: 24px; flex: 1; }

/* ---------------- 卡片 / 表格 ---------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border);
}
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 30px; font-weight: 700; margin-top: 6px; }
.stat-card .value.online { color: #16a34a; }
.stat-card .value.offline { color: #dc2626; }

.panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 20px;
}
.panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.panel-body { padding: 18px; }

.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.data th, table.data td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data th { background: #f8fafc; color: #475569; font-weight: 600; }
table.data tr:hover td { background: #f8fafc; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge.online { background: #dcfce7; color: #15803d; }
.badge.offline { background: #fee2e2; color: #b91c1c; }
.badge.pending { background: #fef9c3; color: #a16207; }
.badge.done { background: #dcfce7; color: #15803d; }
.badge.failed { background: #fee2e2; color: #b91c1c; }

/* ---------------- 相册网格 ---------------- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.photo-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.photo-item .thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f1f5f9;
}
.photo-item .thumb.placeholder {
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: 13px;
}
.photo-item .meta { padding: 8px 10px; font-size: 12px; color: var(--muted); }
.photo-item .meta .name {
    color: #0f172a;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------------- 分页 / 工具栏 ---------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #334155;
}
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

#map { width: 100%; height: 360px; border-radius: 8px; }
.chart-box { position: relative; height: 280px; }

.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: #dcfce7; color: #15803d; }
.flash.error { background: #fee2e2; color: #b91c1c; }

/* ---------------- 响应式 ---------------- */
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 1199px) {
    :root { --sidebar-width: 210px; }
}

@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        width: 250px;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed; inset: 0;
        background: rgba(15, 23, 42, .45);
        z-index: 1025;
    }
    .main { margin-left: 0; }
    .sidebar-toggle {
        display: inline-flex;
        margin-right: 10px;
    }
    .content { padding: 14px; }
    table.data { display: block; }
    table.data thead { display: none; }
    table.data tr {
        display: block;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 10px;
        padding: 6px 4px;
    }
    table.data td {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        white-space: normal;
        border-bottom: 1px dashed var(--border);
    }
    table.data td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 600;
    }
}
