* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif; color: #172033; background: #f4f6f8; }
a { color: #2457c5; text-decoration: none; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #0f172a; color: white; border-right: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 38px; height: 38px; border-radius: 8px; background: #2563eb; display: flex; align-items: center; justify-content: center; font-weight: 900; }
.brand strong { display: block; font-size: 16px; }
.brand span { display: block; color: #94a3b8; font-size: 12px; margin-top: 3px; }
.side-nav { padding: 14px 10px; display: grid; gap: 4px; }
.side-nav a { color: #cbd5e1; padding: 11px 12px; border-radius: 8px; font-weight: 700; }
.side-nav a.active, .side-nav a:hover { background: #1d4ed8; color: white; }
.sidebar-user { margin-top: auto; padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 14px; }
.sidebar-user span { display: block; color: #94a3b8; margin: 4px 0 10px; }
.sidebar-user a { color: #bfdbfe; }
.content-shell { min-width: 0; }
.topbar { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: white; color: #111827; border-bottom: 1px solid #e5e7eb; }
.topbar a { color: #1d4ed8; margin-left: 14px; }
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.muted { color: #6b7280; }
.topbar .muted { color: #667085; }
.nav { display: flex; gap: 6px; padding: 10px 22px; background: white; border-bottom: 1px solid #e5e7eb; }
.nav a { padding: 9px 14px; border-radius: 8px; color: #374151; font-weight: 600; }
.nav a.active, .nav a:hover { background: #eef4ff; color: #1d4ed8; }
.page { padding: 22px; }
.card { background: white; border: 1px solid #e5e7eb; border-radius: 8px; padding: 18px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
h1 { margin: 0 0 16px; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 18px; }
h3 { margin: 0 0 8px; font-size: 16px; }
input, select, textarea { width: 100%; padding: 10px 11px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: white; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; color: #374151; }
label span { display: block; margin-bottom: 6px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px 13px; border: 1px solid #1d4ed8; border-radius: 8px; background: #2563eb; color: white; font-weight: 700; cursor: pointer; }
button.secondary, .btn.secondary { background: white; color: #374151; border-color: #d1d5db; }
button.danger, .btn.danger { background: #dc2626; border-color: #dc2626; }
button:disabled { opacity: .55; cursor: not-allowed; }
.table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; }
.table th, .table td { border-bottom: 1px solid #edf0f3; padding: 11px 12px; text-align: left; vertical-align: top; font-size: 14px; }
.table th { background: #f9fafb; color: #475467; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef2ff; color: #3730a3; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.login-wrap, .install-wrap { max-width: 760px; margin: 42px auto; }
.notice { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; background: #eef4ff; color: #1e3a8a; }
.error { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; background: #fee2e2; color: #991b1b; }
.success { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; background: #dcfce7; color: #166534; }
.console { display: grid; grid-template-columns: 360px minmax(420px, 1fr) 330px; gap: 16px; align-items: start; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid #e5e7eb; padding-bottom: 8px; }
.tab { border-color: #d1d5db; background: white; color: #374151; min-height: 34px; padding: 6px 10px; }
.tab.active { background: #2563eb; color: white; border-color: #2563eb; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.item { padding: 12px; border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 10px; background: #fff; }
.item-title { font-weight: 800; margin-bottom: 5px; }
.item-meta { color: #667085; font-size: 13px; line-height: 1.6; }
.preview-frame { width: 100%; aspect-ratio: 16 / 9; border: 1px solid #d1d5db; border-radius: 8px; background: #111827; overflow: hidden; }
.preview-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.device-card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 10px; background: white; }
.device-card.selected { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.asset-img { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid #e5e7eb; background: #f3f4f6; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.job-editor { border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #f9fafb; }
.job-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 800; }
@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .console, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
