* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #1a73e8;
  --danger: #dc3545;
  --warning: #f0ad4e;
  --success: #28a745;
  --bg: #f5f7fa;
  --card: #fff;
  --border: #e0e0e0;
  --text: #333;
  --text-secondary: #666;
  --radius: 8px;
}
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }

/* Layout */
.app-header { background: var(--card); border-bottom: 1px solid var(--border); padding: 0 24px; display: flex; align-items: center; height: 56px; position: sticky; top: 0; z-index: 100; }
.app-header h1 { font-size: 18px; font-weight: 600; margin-right: 32px; white-space: nowrap; }
.app-header nav { display: flex; gap: 4px; }
.app-header nav a { padding: 8px 16px; border-radius: 6px; font-size: 14px; color: var(--text-secondary); transition: all .2s; }
.app-header nav a:hover, .app-header nav a.active { background: var(--primary); color: #fff; }
.app-header .status { margin-left: auto; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.app-header .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.app-header .dot.ok { background: var(--success); }
.app-header .dot.err { background: var(--danger); }

.container { max-width: 1400px; margin: 0 auto; padding: 20px 24px; }

/* Cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); }
.stat-card .label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .value.danger { color: var(--danger); }

/* Panels */
.panel { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 20px; }
.panel-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.panel-body { padding: 16px 20px; }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8f9fa; font-weight: 600; white-space: nowrap; }
td { color: var(--text-secondary); }
tr:hover td { background: #f8f9fa; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.badge.critical { background: #fde8e8; color: var(--danger); }
.badge.warning { background: #fff3cd; color: #856404; }
.badge.info { background: #d1ecf1; color: #0c5460; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="password"], textarea, select {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit;
}
textarea { resize: vertical; min-height: 80px; }
.btn { display: inline-flex; align-items: center; padding: 8px 20px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn + .btn { margin-left: 8px; }

/* Filters */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .form-group { margin-bottom: 0; }
.filters select, .filters input { width: auto; min-width: 140px; }

/* Grid layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Alert list */
.alert-item { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.alert-item:last-child { border-bottom: none; }
.alert-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.alert-icon.critical { background: #fde8e8; color: var(--danger); }
.alert-icon.warning { background: #fff3cd; color: #856404; }
.alert-info { flex: 1; }
.alert-info .title { font-size: 14px; font-weight: 500; }
.alert-info .meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.pagination button { padding: 6px 14px; border: 1px solid var(--border); background: var(--card); border-radius: 4px; cursor: pointer; font-size: 13px; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .5; cursor: default; }

/* Toggle switch */
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; inset: 0; background: #ccc; border-radius: 24px; cursor: pointer; transition: .3s; }
.toggle .slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.toggle input:checked + .slider { background: var(--primary); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-secondary); }

/* Sidebar tree */
.sidebar { width: 260px; flex-shrink: 0; }
.tree-item { padding: 8px 12px; cursor: pointer; border-radius: 6px; font-size: 13px; }
.tree-item:hover { background: #f0f0f0; }
.tree-item.active { background: #e8f0fe; color: var(--primary); font-weight: 500; }
.tree-group { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding: 12px 12px 4px; text-transform: uppercase; }
.data-layout { display: flex; gap: 20px; }
.data-main { flex: 1; min-width: 0; }
