/* ToyNex 公共样式 - 与 index.html 风格统一 */

:root {
    --primary: #007AFF;
    --bg: #F5F5F7;
    --bg-white: #FFFFFF;
    --bg-secondary: #F5F5F7;
    --text: #1D1D1F;
    --text-secondary: #86868B;
    --border: #E5E5EA;
    --success: #34C759;
    --warning: #FF9500;
    --error: #FF3B30;
    --radius-sm: 6px;
    --radius-md: 8px;
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

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

.layout-with-sidebar {
    display: flex;
    flex-direction: row;
    min-height: calc(100vh - 44px);
    height: calc(100vh - 44px);
    overflow: hidden;
}

.layout-with-sidebar .sidebar-left {
    width: 220px;
    min-width: 220px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.layout-with-sidebar .main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.layout-with-sidebar .main {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar-left-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-left-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sidebar-left-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sidebar-left-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.sidebar-left-item:hover {
    background: var(--bg);
}

.sidebar-left-item.active {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary);
}

.sidebar-left-item-name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-left-item-count {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 8px;
    flex-shrink: 0;
}

.sidebar-left-item.active .sidebar-left-item-count {
    background: rgba(0, 122, 255, 0.15);
    color: var(--primary);
}

.sidebar-left-item-actions {
    display: none;
    gap: 4px;
}

.sidebar-left-item:hover .sidebar-left-item-actions {
    display: flex;
}

.sidebar-left-item:hover .sidebar-left-item-count {
    display: none;
}

.sidebar-left-action-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.sidebar-left-action-btn:hover {
    background: var(--border);
    color: var(--text);
}

.sidebar-left-action-btn svg {
    width: 12px;
    height: 12px;
}

.sidebar-left-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.sidebar-left-footer-btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
}

.sidebar-left-footer-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0, 122, 255, 0.05);
}

.sidebar-left-footer-btn svg {
    width: 14px;
    height: 14px;
}

/* 顶部导航 - 与 index.html 一致 */
.header {
    height: 44px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.nav {
    display: flex;
    gap: 4px;
}

.nav a {
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}

.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--primary); color: #fff; }

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #0066CC; }
.btn-secondary { background: var(--bg); color: var(--text); }
.btn-secondary:hover { background: var(--border); }

.btn svg {
    width: 14px;
    height: 14px;
}

/* 主内容区 */
.main {
    flex: 1;
    padding: 16px;
}

/* 统计卡片 */
.stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    flex: 1;
    background: var(--bg-white);
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border);
}

.stat-card .label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.stat-card .value {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
}

.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.error .value { color: var(--error); }

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.search-box {
    flex: 1;
    max-width: 300px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 7px 12px 7px 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-white);
}

.search-box svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.filter-select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-white);
    cursor: pointer;
}

/* 卡片 */
.card {
    background: var(--bg-white);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
}

.page-info {
    font-size: 12px;
    color: var(--text-secondary);
}

.card-body {
    padding: 0;
}

/* 表格 */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--bg);
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 4px;
}

.btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-icon.danger:hover {
    background: #FFF1F0;
    color: var(--error);
}

.btn-icon svg {
    width: 14px;
    height: 14px;
}

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success { background: #E8F5E9; color: var(--success); }
.badge-warning { background: #FFF8E1; color: var(--warning); }

/* 状态标签 */
.status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status.active::before { background: var(--success); }
.status.inactive::before { background: var(--text-secondary); }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 13px;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-white);
    border-radius: 10px;
    width: 420px;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* 表单 */
.form-group {
    margin-bottom: 14px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.15s;
    font-family: inherit;
    background: var(--bg-white);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}

/* 图片上传 */
.image-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.image-upload-preview {
    width: 180px;
    height: 180px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
    background: var(--bg);
}

.image-upload-preview:hover {
    border-color: var(--primary);
}

.image-upload-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.image-upload-preview .placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
    gap: 6px;
    color: var(--text-secondary);
}

.image-upload-preview .placeholder svg {
    width: 36px;
    height: 36px;
    opacity: 0.4;
}

.image-upload-preview .placeholder span {
    font-size: 11px;
}

.image-upload input[type="file"] {
    display: none;
}

.image-upload-hint {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.warning { background: var(--warning); }

/* 角色网格 - roles.html */
.category-section {
    margin-bottom: 14px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 8px;
}

.category-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 12px;
}

.category-icon {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.category-icon svg {
    width: 10px;
    height: 10px;
}

.category-count {
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--bg-white);
    padding: 2px 6px;
    border-radius: 8px;
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.role-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.15s;
}

.role-card:hover {
    border-color: var(--primary);
}

.role-card-image {
    width: 100%;
    height: 90%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.role-card-image img {
    width: 90%;
    height: 80%;
    object-fit: cover;
}

.role-card-content {
    padding: 8px;
}

.role-name {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-category {
    text-align: center;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 11px;
    background: var(--bg-white);
    border: 1px dashed var(--border);
    border-radius: 6px;
}

/* 角色配置页 - role-config.html */
.role-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    padding: 14px;
}

.role-list .role-card-image {
    height: 140px;
    position: relative;
    cursor: pointer;
}

.role-list .role-card-image:hover .upload-overlay {
    opacity: 1;
}

.role-card-image:hover .upload-overlay {
    opacity: 1;
}

.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.upload-overlay svg {
    width: 28px;
    height: 28px;
    color: white;
}

.role-list .role-card-content {
    padding: 10px;
}

.role-card-category {
    font-size: 9px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 3px;
}

.role-card-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.role-card-actions {
    display: flex;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.role-card-actions .btn {
    flex: 1;
    font-size: 11px;
    padding: 5px 8px;
    justify-content: center;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
}

/* 扫描相关 - index.html */
.scan-result {
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 8px;
}

.scan-result .name {
    font-weight: 600;
    margin-bottom: 2px;
}

.scan-result .info {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 设备类型图标 */
.device-type-icon {
    width: 32px;
    height: 32px;
    background: var(--bg);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.device-type-icon svg {
    width: 16px;
    height: 16px;
}

/* 代码显示 */
.code {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 实用类 */
.text-secondary {
    color: var(--text-secondary);
    font-size: 12px;
}

.text-muted {
    color: var(--text-secondary);
}

.text-small {
    font-size: 11px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.w-full {
    width: 100%;
}

.w-100 {
    width: 100px;
}

.hidden {
    display: none;
}

/* 响应式 */
@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }
    
    .header-left {
        gap: 12px;
    }
    
    .logo {
        font-size: 14px;
    }
    
    .nav a {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .stats {
        flex-wrap: wrap;
    }
    
    .stat-card {
        min-width: calc(50% - 6px);
    }
    
    .toolbar {
        flex-wrap: wrap;
    }
    
    .search-box {
        max-width: 100%;
    }
}

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

/* 表格头部 - index.html */
.table-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h3 { font-size: 13px; font-weight: 600; }
.table-count { font-size: 12px; color: var(--text-secondary); }

/* 统计卡片 - index.html */
.stat {
    background: var(--bg-white);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    min-width: 100px;
}

.stat-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 600; }

/* 搜索框 - index.html */
.search {
    flex: 1;
    position: relative;
}

.search input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-white);
}

.search input:focus { outline: none; border-color: var(--primary); }

.search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.filter {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-white);
    cursor: pointer;
    min-width: 120px;
}

/* 状态徽章 - index.html */
.status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.status-on { background: rgba(52,199,89,0.1); color: var(--success); }
.status-off { background: rgba(255,149,0,0.1); color: var(--warning); }

/* 操作按钮 - index.html */
.actions {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.action-btn:hover { background: var(--bg); color: var(--text); }
.action-btn.danger:hover { background: #FFF1F0; color: var(--error); }
.action-btn svg { width: 14px; height: 14px; }

/* 空状态 - index.html */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 12px; }
.empty p { font-size: 13px; }

/* 表单行 - index.html */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* 紧凑顶部栏 - index.html */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.stats-inline {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-item .stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-item .stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.stat-item .stat-active { color: var(--success); }
.stat-item .stat-inactive { color: var(--warning); }
.stat-item .stat-rate { color: var(--primary); }

.stat-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
}

.search-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-inline {
    position: relative;
    width: 240px;
}

.search-inline input {
    width: 100%;
    padding: 6px 10px 6px 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    background: var(--bg);
}

.search-inline input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-white);
}

.search-inline svg {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    color: var(--text-secondary);
}

.filter-inline {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    background: var(--bg);
    cursor: pointer;
    min-width: 90px;
}

.filter-inline:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-white);
}

.table-footer {
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    text-align: right;
}

/* 蓝牙扫描 - index.html */
.scan-box {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.scan-device {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.scan-device:last-child { border-bottom: none; }
.scan-device:hover { background: var(--bg); }
.scan-device.selected { background: rgba(0,122,255,0.1); }

.scan-name { font-weight: 500; }
.scan-id { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.scan-status {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg);
    border-radius: 4px;
    margin-top: 6px;
}

/* 右侧侧边栏 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90%;
    height: 100vh;
    background: var(--bg-white);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.sidebar.show {
    transform: translateX(0);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.sidebar-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.sidebar-close:hover {
    background: var(--bg);
    color: var(--text);
}

.sidebar-close svg {
    width: 18px;
    height: 18px;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.sidebar-tab:hover {
    color: var(--text);
    background: var(--bg);
}

.sidebar-tab.active {
    color: var(--primary);
}

.sidebar-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

textarea.form-input {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.logs-summary {
    margin-bottom: 16px;
}

.logs-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: 8px;
}

.logs-total-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.logs-total-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
}

.logs-list {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.logs-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
}

.log-item:last-child {
    margin-bottom: 0;
}

.log-item-index {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.log-item-time {
    font-size: 12px;
    color: var(--text-secondary);
}
