:root {
  --bg: #12141a; --panel: #1b1e26; --panel2: #232733; --line: #343a48; --text: #e6e8ee; --muted: #9aa1b2;
  --accent: #f2a33a; --accent2: #4fb3ff; --ok: #57c785; --bad: #ef5b5b;
  font-family: system-ui, "Segoe UI", sans-serif; font-size: 14px; color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; overflow: hidden; }
.hidden { display: none !important; }
.small { font-size: 12px; color: var(--muted); }
.error { color: var(--bad); }
button, .button, select, input {
  font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 9px; text-decoration: none; display: inline-block;
}
button, .button { cursor: pointer; }
button:hover, .button:hover { border-color: var(--accent2); }
button.active { background: var(--accent2); color: #0b1220; border-color: var(--accent2); }
.primary { background: var(--accent); color: #1b1203; border-color: var(--accent); font-weight: 600; }
.danger { color: var(--bad); border-color: var(--bad); }
.danger:hover { background: #3b1f1f; border-color: var(--bad); }
.screen { display: flex; align-items: center; justify-content: center; height: 100vh; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.screen .card { max-width: 420px; text-align: center; }
header { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); height: 50px; }
header .brand { color: var(--accent); white-space: nowrap; }
#model-info { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#model-select { max-width: 280px; }
header nav { display: flex; white-space: nowrap; }
header nav button { margin-right: 4px; }
.spacer { flex: 1; }
.badge { padding: 3px 8px; border-radius: 10px; font-size: 12px; }
.badge.on { background: #1f3b2b; color: var(--ok); }
.badge.off { background: #3b1f1f; color: var(--bad); }
#main { height: 100vh; display: flex; flex-direction: column; }
.tab { flex: 1; display: flex; min-height: 0; }
aside { background: var(--panel); overflow-y: auto; padding: 10px; }
aside.tools { width: 210px; border-right: 1px solid var(--line); }
aside.props { width: 300px; border-left: 1px solid var(--line); }
aside h3 { margin: 6px 0; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
aside .group { margin-bottom: 14px; }
aside .group button, aside .group .button, aside .group select { width: 100%; margin-bottom: 4px; text-align: left; }
aside label { display: block; margin: 4px 0; }
aside label select { width: auto; }
.canvas-wrap { flex: 1; position: relative; min-width: 0; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #0d0f14; }
.status { position: absolute; left: 8px; bottom: 6px; font-size: 12px; color: var(--muted); pointer-events: none; }
.overlay { position: absolute; left: 8px; top: 6px; pointer-events: none; }
.dirty { position: absolute; right: 8px; top: 6px; background: #3b2f12; color: var(--accent); padding: 3px 8px; border-radius: 6px; font-size: 12px; }
.props .field { margin: 6px 0; }
.props .field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.props .field input, .props .field select { width: 100%; }
.props .row { display: flex; gap: 6px; }
.props .row > * { flex: 1; }
.props h2 { font-size: 15px; margin: 4px 0 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; padding: 14px; overflow-y: auto; width: 100%; align-content: start; }
.admin-grid h2 { margin-top: 0; font-size: 16px; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
td, th { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; font-size: 13px; }
#user-form { display: flex; gap: 6px; flex-wrap: wrap; }
#user-form input { flex: 1; min-width: 120px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; z-index: 10; }
.toast.bad { border-color: var(--bad); color: var(--bad); }
.legend span { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; vertical-align: middle; }
