* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #333; }
/* 页面切换由Vue v-show控制 */


/* Header */
.header { background: #1a73e8; color: #fff; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; }
.header-title { font-size: 18px; font-weight: 600; }
.header-user { margin-right: 16px; font-size: 13px; opacity: .9; }

/* Login */
.login-card { max-width: 380px; margin: 120px auto; background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.1); text-align: center; }
.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-subtitle { color: #999; font-size: 13px; margin-bottom: 24px; }

/* Tabs */
.tabs { display: flex; background: #fff; border-bottom: 1px solid #e0e0e0; padding: 0 16px; gap: 0; overflow-x: auto; }
.tab { padding: 12px 20px; cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: #1a73e8; }
.tab.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }

/* Tab Content */
/* Tab Content - 可滚动 */
.tab-content { padding: 16px 24px; max-width: 1400px; margin: 0 auto; overflow-y: auto; max-height: calc(100vh - 120px); }

/* Stats */
.stats-row { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-card { flex: 1; background: #fff; padding: 20px; border-radius: 10px; text-align: center; font-size: 13px; color: #666; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.stat-num { display: block; font-size: 32px; font-weight: 700; margin-top: 4px; }
.stat-total .stat-num { color: #1a73e8; }
.stat-online .stat-num { color: #34a853; }
.stat-alarm .stat-num { color: #ea4335; }

/* Device Grid */
/* Device Grid - 限制高度，支持滚动 */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; max-height: 420px; overflow-y: auto; }
.device-grid::-webkit-scrollbar { width: 4px; }
.device-grid::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
.device-card { background: #fff; border-radius: 10px; padding: 16px; cursor: pointer; border-left: 4px solid #34a853; box-shadow: 0 1px 4px rgba(0,0,0,.06); transition: transform .15s; }
.device-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.device-card.card-alarm { border-left-color: #ea4335; }
.device-card.card-offline { border-left-color: #999; opacity: .7; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-name { font-weight: 600; font-size: 14px; }
.card-status { font-size: 14px; }
.card-temp { font-size: 28px; font-weight: 700; color: #333; }
.card-hum { font-size: 14px; color: #666; margin-top: 2px; }
.card-floor { font-size: 12px; color: #999; margin-top: 6px; }

/* Chart */
.chart-container { background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }

/* Toolbar */
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.search-input { padding: 8px 12px; border: 1px solid #d0d0d0; border-radius: 6px; font-size: 13px; width: 200px; }
.search-input:focus { outline: none; border-color: #1a73e8; }

/* Table */
.table { width: 100%; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.table th { background: #f8f9fa; padding: 10px 12px; text-align: left; font-weight: 600; font-size: 12px; color: #666; white-space: nowrap; }
.table td { padding: 10px 12px; font-size: 13px; border-top: 1px solid #f0f0f0; }
.table tr:hover { background: #f8f9ff; }

/* Buttons */
.btn { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; background: #e8e8e8; color: #333; }
.btn:hover { opacity: .85; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-danger { background: #ea4335; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; padding: 12px; font-size: 15px; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.form-group input, .form-group select { width: 100%; padding: 10px; border: 1px solid #d0d0d0; border-radius: 6px; font-size: 14px; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #1a73e8; }
.form-row { display: flex; gap: 12px; }
.form-row .half { flex: 1; }
.form-error { color: #ea4335; font-size: 13px; margin-bottom: 12px; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal-content { background: #fff; border-radius: 12px; padding: 28px; width: 90%; max-width: 480px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-lg { max-width: 680px; }
.modal-close { position: absolute; top: 12px; right: 16px; font-size: 24px; cursor: pointer; color: #999; }
.modal-content h3 { margin-bottom: 16px; }

/* Detail Modal */
.detail-stats { display: flex; gap: 12px; margin-bottom: 16px; }
.detail-stat { flex: 1; background: #f8f9fa; padding: 16px; border-radius: 8px; text-align: center; font-size: 22px; font-weight: 700; }
.detail-info { font-size: 13px; color: #666; margin-bottom: 16px; line-height: 1.8; }

/* Alarm List */
.alarm-list { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.alarm-list h3 { font-size: 14px; margin-bottom: 12px; }
.alarm-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.alarm-item:last-child { border: none; }
.alarm-icon { font-size: 12px; }
.alarm-msg { flex: 1; }
.alarm-time { color: #999; font-size: 12px; }
.level-critical { background: #fff5f5; }
.level-warning { background: #fffbe6; }

/* Status Tags */
.status-tag { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.status-online { background: #e6f4ea; color: #34a853; }
.status-alarm { background: #fce8e6; color: #ea4335; }
.status-offline { background: #f0f0f0; color: #999; }

.level-tag { padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.level-critical { background: #fce8e6; color: #ea4335; }
.level-warning { background: #fef7e0; color: #f9ab00; }
.level-info { background: #e8f0fe; color: #1a73e8; }

/* Settings */
.settings-form { max-width: 500px; background: #fff; padding: 24px; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }

/* Responsive */
@media (max-width: 768px) {
  .device-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { flex-direction: column; }
  .tab { padding: 10px 14px; font-size: 13px; }
  .tab-content { padding: 12px; }
}
