:root {
  --bg:#0b0f17; --bg-2:#0f1420; --card:#141b29; --card-2:#0d1220;
  --fg:#e6ebf5; --muted:#8494ad; --muted-2:#5f6d85;
  --green:#2ecc71; --red:#e74c3c; --amber:#f5a623;
  --accent:#4f8cff; --accent-2:#2f6bde; --accent-soft:rgba(79,140,255,0.14);
  --border:#222c40; --border-2:#1a2233;
  --radius:12px; --shadow:0 4px 18px rgba(0,0,0,0.32);
}
* { box-sizing: border-box; }
html, body { height:100%; }
body { margin:0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background:var(--bg); color:var(--fg); font-size:14px; line-height:1.45; }

/* ---------- Brand ---------- */
.brand { display:flex; align-items:center; gap:10px; color:var(--accent); }
.brand-glyph { width:32px; height:32px; flex:0 0 auto; display:inline-block; }
.brand-glyph svg { width:100%; height:100%; }
.brand-name { font-size:17px; font-weight:600; color:var(--fg); letter-spacing:.2px; }
.brand-name b { color:var(--accent); font-weight:700; }

/* ---------- Login ---------- */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; }
.login-card { width:100%; max-width:360px; }
.brand-login { margin-bottom:18px; justify-content:center; }

/* ---------- App shell ---------- */
.app-shell { display:flex; min-height:100vh; }
.sidebar { width:240px; flex:0 0 240px; background:var(--bg-2); border-right:1px solid var(--border);
  display:flex; flex-direction:column; position:sticky; top:0; height:100vh; }
.sidebar .brand { padding:20px 18px 16px; }
.nav { display:flex; flex-direction:column; gap:2px; padding:8px 10px; flex:1 1 auto; }
.nav-item { display:flex; align-items:center; gap:11px; width:100%; text-align:left;
  background:transparent; color:var(--muted); border:none; border-radius:9px;
  padding:10px 12px; font-size:14px; cursor:pointer; }
.nav-item svg { width:19px; height:19px; flex:0 0 auto; }
.nav-item:hover { background:var(--card); color:var(--fg); filter:none; }
.nav-item.active { background:var(--accent-soft); color:var(--accent); font-weight:600; }
.sidebar-foot { padding:14px 16px; border-top:1px solid var(--border); display:flex;
  flex-direction:column; gap:10px; }
.foot-row { display:flex; align-items:center; justify-content:space-between; gap:8px; }

/* ---------- Content ---------- */
.content { flex:1 1 auto; padding:26px 30px; max-width:1180px; }
.view-title { font-size:22px; font-weight:700; margin:0 0 20px; }

/* ---------- Cards ---------- */
.card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px 20px; margin-bottom:20px; box-shadow:var(--shadow); }
.card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:6px; }
.card-head h2 { margin:0; }
h2 { margin:0 0 14px; font-size:16px; font-weight:600; }
h3 { font-size:12px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted-2);
  margin:20px 0 9px; font-weight:600; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x:auto; }
table { width:100%; border-collapse:collapse; font-size:13px; }
th, td { text-align:left; padding:8px 10px; border-bottom:1px solid var(--border-2); vertical-align:middle; }
th { color:var(--muted); font-weight:600; font-size:12px; }
tr:last-child td { border-bottom:none; }

/* ---------- Buttons / inputs ---------- */
button { background:var(--accent); color:#fff; border:none; border-radius:8px;
  padding:8px 13px; cursor:pointer; font-size:13px; font-weight:500; transition:filter .12s, background .12s; }
button:hover { filter:brightness(1.08); }
button.small { padding:5px 11px; font-size:12px; border-radius:7px; }
button.ghost { background:transparent; color:var(--muted); border:1px solid var(--border); }
button.ghost:hover { background:var(--card-2); color:var(--fg); filter:none; }
button.danger { background:var(--red); }
input, select { background:var(--card-2); border:1px solid var(--border); color:var(--fg);
  border-radius:8px; padding:8px 11px; font-size:13px; font-family:inherit; }
input:focus, select:focus { outline:none; border-color:var(--accent); }
label { display:block; margin:10px 0; color:var(--muted); font-size:13px; }
label input, label select { color:var(--fg); }
label input, label > select { width:100%; margin-top:5px; }

/* ---------- Utilities ---------- */
.mono { font-family: ui-monospace, "Cascadia Code", monospace; }
.hint { color:var(--muted); font-size:12px; }
.err { color:var(--red); font-size:13px; min-height:16px; }
.hidden { display:none !important; }
.pill { font-size:12px; padding:4px 10px; border-radius:20px; background:var(--card);
  border:1px solid var(--border); color:var(--muted); text-align:center; }
.dot { display:inline-block; width:9px; height:9px; border-radius:50%; flex:0 0 auto; }
.dot.on { background:var(--green); box-shadow:0 0 6px var(--green); }
.dot.off { background:var(--muted-2); }
.cmdbar { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
.cmdbar input { flex:1; min-width:200px; }
pre { background:var(--card-2); border:1px solid var(--border); border-radius:8px;
  padding:12px; overflow:auto; font-size:12px; max-height:280px; }

/* ---------- Mode toggle ---------- */
.modetoggle { display:inline-flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.modetoggle .modebtn { background:transparent; color:var(--muted); border:none; border-radius:0;
  padding:5px 12px; font-size:12px; line-height:1.4; font-weight:500; }
.modetoggle .modebtn:hover { background:var(--card); filter:none; }
.modetoggle .modebtn.active { background:var(--accent); color:#fff; }

/* ---------- Icon button ---------- */
button.iconbtn { background:transparent; color:var(--muted); border:1px solid transparent;
  padding:3px 7px; font-size:14px; line-height:1; border-radius:7px; opacity:0.6; }
button.iconbtn:hover { background:rgba(231,76,60,0.16); color:var(--red);
  border-color:var(--red); opacity:1; filter:none; }

/* ---------- Fleet groups ---------- */
.group { background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  margin-bottom:14px; overflow:hidden; box-shadow:var(--shadow); }
.group-head { display:flex; align-items:center; gap:12px; padding:14px 18px; cursor:pointer;
  user-select:none; }
.group-head:hover { background:var(--card-2); }
.group-chevron { transition:transform .18s; color:var(--muted); flex:0 0 auto; display:inline-flex; }
.group.collapsed .group-chevron { transform:rotate(-90deg); }
.group-title { font-size:15px; font-weight:600; }
.group-meta { color:var(--muted); font-size:12px; margin-left:auto; display:flex; gap:14px; align-items:center; }
.group-meta .on-count { color:var(--green); }
.group-body { border-top:1px solid var(--border-2); }
.group.collapsed .group-body { display:none; }
.dev-row { display:flex; align-items:center; gap:14px; padding:12px 18px;
  border-bottom:1px solid var(--border-2); cursor:pointer; }
.dev-row:last-child { border-bottom:none; }
.dev-row:hover { background:var(--card-2); }
.dev-main { flex:1 1 auto; min-width:0; }
.dev-name { font-weight:500; }
.dev-sub { color:var(--muted); font-size:12px; white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis; max-width:100%; }
.dev-actions { display:flex; align-items:center; gap:10px; flex:0 0 auto; }

/* ---------- Screenshots / bg ---------- */
#shotLatest { max-width:100%; max-height:320px; border:1px solid var(--border);
  border-radius:8px; background:var(--card-2); display:block; }
.shot-history { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.shot-history img { width:96px; height:64px; object-fit:cover; border:1px solid var(--border);
  border-radius:6px; background:var(--card-2); }
.shot-history a { line-height:0; }
#bgThumb { max-width:220px; max-height:140px; object-fit:cover; border:1px solid var(--border);
  border-radius:8px; background:var(--card-2); display:block; margin-top:8px; }
#bgThumbLink { line-height:0; display:inline-block; }
#bgFileInput, #menuFileInput, #menuUrlInput { flex:1; min-width:200px; }
.menu-gallery-pick { display:flex; gap:10px; align-items:flex-end; margin-bottom:12px; flex-wrap:wrap; }
.menu-gallery-pick .tel-select { margin:0; flex:1; min-width:200px; }

/* ---------- Licenses ---------- */
.lic-form { display:grid; grid-template-columns:repeat(2, minmax(220px, 1fr)); gap:6px 18px; align-items:end; }
.lic-form button[type="submit"] { grid-column:1 / -1; justify-self:start; margin-top:6px; }
.lic-form .err { grid-column:1 / -1; }
.lic-badge { font-size:12px; padding:3px 10px; border-radius:20px; background:var(--card-2); color:var(--muted); white-space:nowrap; }
.lic-badge.lic-active { background:rgba(46,204,113,0.16); color:var(--green); }
.lic-badge.lic-expired { background:rgba(245,166,35,0.16); color:var(--amber); }
.lic-badge.lic-revoked { background:rgba(231,76,60,0.20); color:var(--red); }
.lic-badge.lic-unknown { background:var(--card-2); color:var(--muted); }

/* ---------- Gallery ---------- */
.gallery-top { display:flex; align-items:center; gap:20px; margin-bottom:20px; }
.storage { flex:1 1 auto; max-width:420px; }
.storage-head { display:flex; justify-content:space-between; margin-bottom:6px; }
.storage-text { font-size:13px; font-weight:500; }
.storage-bar { height:8px; background:var(--card-2); border:1px solid var(--border); border-radius:20px; overflow:hidden; }
.storage-fill { height:100%; background:var(--accent); width:0%; transition:width .3s; }
.storage-fill.warn { background:var(--amber); }
.storage-fill.full { background:var(--red); }
.gallery-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:16px; }
.gcard { background:var(--card-2); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; display:flex; flex-direction:column; }
.gthumb { position:relative; aspect-ratio:16/10; background:#000; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.gthumb img, .gthumb video { width:100%; height:100%; object-fit:cover; }
.gthumb .play-glyph { position:absolute; color:#fff; opacity:.85; width:40px; height:40px; pointer-events:none; }
.gtype-badge { position:absolute; top:8px; left:8px; font-size:11px; padding:2px 8px; border-radius:20px;
  background:rgba(0,0,0,0.6); color:#fff; }
.gbody { padding:10px 12px; display:flex; flex-direction:column; gap:6px; }
.gname { background:transparent; border:1px solid transparent; color:var(--fg); font-size:13px;
  font-weight:500; padding:4px 6px; border-radius:6px; width:100%; }
.gname:hover { border-color:var(--border); }
.gname:focus { border-color:var(--accent); background:var(--bg-2); outline:none; }
.gmeta { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.gmeta .hint { font-size:11px; }

/* ---------- Telemetry ---------- */
.tel-top { display:flex; align-items:center; gap:24px; margin-bottom:18px; flex-wrap:wrap; }
.tel-select { margin:0; min-width:260px; }
.raw-toggle { display:flex; align-items:center; gap:7px; margin:0; }
.raw-toggle input { width:auto; margin:0; }
.tel-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:14px; }
.tel-field { background:var(--card-2); border:1px solid var(--border); border-radius:10px; padding:12px 14px; }
.tel-field .k { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.4px; }
.tel-field .v { font-size:15px; margin-top:4px; word-break:break-word; }
.tel-status-line { display:flex; align-items:center; gap:8px; margin-bottom:16px; font-size:15px; font-weight:500; }

/* ---------- Overlay / drawer / modal ---------- */
.overlay { position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:50;
  display:flex; }
.drawer { margin-left:auto; width:min(680px, 94vw); height:100%; background:var(--card);
  border-left:1px solid var(--border); display:flex; flex-direction:column; box-shadow:-8px 0 30px rgba(0,0,0,0.4); }
.drawer-head { display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:16px 20px; border-bottom:1px solid var(--border); flex:0 0 auto; }
.drawer-head h2 { margin:0; }
.drawer-body { padding:18px 20px; overflow-y:auto; flex:1 1 auto; }
.modal { margin:auto; width:min(460px, 94vw); background:var(--card); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow:var(--shadow); }
.modal-body { padding:18px 20px; }
.modal-actions { display:flex; gap:10px; align-items:center; margin-top:14px; }
.spin { display:inline-block; width:14px; height:14px; border:2px solid var(--muted);
  border-top-color:var(--accent); border-radius:50%; animation:spin .7s linear infinite; vertical-align:middle; margin-right:6px; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width:820px) {
  .sidebar { width:64px; flex-basis:64px; }
  .brand-name, .nav-item span, .sidebar-foot .hint { display:none; }
  .sidebar-foot { align-items:center; }
  .content { padding:20px 16px; }
  .lic-form { grid-template-columns:1fr; }
}

/* ---- Groups & cashiers management + enroll modal ---- */
.manage-cols { display:flex; gap:24px; flex-wrap:wrap; }
.manage-col { flex:1; min-width:240px; }
.manage-col h3 { margin:0 0 8px; }
.manage-list { list-style:none; margin:0 0 10px; padding:0; display:flex; flex-direction:column; gap:6px; }
.manage-list li { display:flex; align-items:center; gap:8px; justify-content:space-between;
  background:var(--card-2); border:1px solid var(--border-2); border-radius:8px; padding:7px 10px; font-size:13px; }
.manage-list .ml-main { display:flex; flex-direction:column; gap:2px; min-width:0; }
.manage-list .ml-sub { color:var(--muted); font-size:11px; word-break:break-all; }
.manage-list .ml-del { color:var(--muted); border-color:var(--border); }
.manage-list .ml-del:hover { color:var(--red); border-color:var(--red); }
.new-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:6px; }
.new-row input { flex:1; min-width:140px; }
.pick-row { display:flex; gap:8px; align-items:center; }
.pick-row select { flex:1; }
.tok-copy { background:var(--accent-soft); border:1px solid var(--accent); color:var(--fg);
  border-radius:7px; padding:8px 10px; font-size:12px; margin-top:8px; word-break:break-all; }
.tok-copy b { color:var(--accent); }

/* ========== Дизайн — full editor chrome ========== */
.dz { position: fixed; inset: 0 0 0 240px; z-index: 6; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg); }
@media (max-width: 820px) { .dz { left: 64px; } }

/* --- top bar --- */
.dz-top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 52px; flex: 0 0 52px; padding: 0 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-2); }
.dz-top-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dz-top-label { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.dz-namepill { display: flex; align-items: center; gap: 4px; background: var(--card);
  border: 1px solid var(--border); border-radius: 9px; padding: 3px 6px 3px 12px; max-width: 320px; }
.dz-namepill input { background: transparent; border: none; color: var(--fg); font-size: 13px;
  font-weight: 600; padding: 3px 2px; min-width: 120px; width: 220px; }
.dz-namepill input:focus { outline: none; }
.dz-dropdown { position: absolute; top: 46px; left: 150px; z-index: 20; width: 300px; max-height: 60vh;
  overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; }
.dz-dropdown.hidden { display: none; }
.dz-dd-h { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted-2);
  font-weight: 700; padding: 8px 10px 4px; }
.dz-dd-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13px; color: var(--fg); }
.dz-dd-item:hover { background: var(--card-2); }
.dz-dd-item.active { background: var(--accent-soft); color: var(--accent); }
.dz-dd-item svg { color: var(--muted); flex: 0 0 auto; }
.dz-dd-item.accent svg { color: var(--accent); }
.dz-dd-sep { height: 1px; background: var(--border-2); margin: 6px 4px; }
.dz-icn { background: transparent; border: none; color: var(--muted); padding: 4px; border-radius: 6px;
  display: inline-flex; cursor: pointer; }
.dz-icn:hover { background: var(--card-2); color: var(--fg); filter: none; }
.dz-top-r { display: flex; align-items: center; gap: 4px; }
.dz-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.dz-tbtn { display: inline-flex; align-items: center; gap: 7px; background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 8px; padding: 7px 9px; font-size: 13px; font-weight: 500;
  cursor: pointer; line-height: 1; }
.dz-tbtn:hover { background: var(--card); color: var(--fg); filter: none; }
.dz-tbtn.dz-wide { padding: 7px 13px; }
.dz-tbtn:disabled { opacity: .38; cursor: default; background: transparent; color: var(--muted); }
.dz-tbtn svg { flex: 0 0 auto; }
.dz-primary { display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; padding: 8px 15px; font-size: 13px; font-weight: 600; cursor: pointer; }
.dz-primary:hover { filter: brightness(1.08); }

/* --- body 3-column --- */
.dz-body { flex: 1 1 auto; display: flex; min-height: 0; }
.dz-left, .dz-right { flex: 0 0 auto; background: var(--bg-2); display: flex; flex-direction: column;
  min-height: 0; overflow: hidden; }
.dz-left { width: 250px; border-right: 1px solid var(--border); }
.dz-right { width: 288px; border-left: 1px solid var(--border); }
.dz-center { flex: 1 1 auto; min-width: 0; position: relative; display: flex; flex-direction: column; }

/* --- tabs --- */
.dz-tabs { display: flex; flex: 0 0 auto; padding: 8px 8px 0; gap: 4px; border-bottom: 1px solid var(--border); }
.dz-tab { flex: 1; background: transparent; color: var(--muted); border: none; border-bottom: 2px solid transparent;
  border-radius: 7px 7px 0 0; padding: 8px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.dz-tab:hover { color: var(--fg); background: var(--card); filter: none; }
.dz-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }
.dz-pane { flex: 1 1 auto; overflow-y: auto; padding: 12px; min-height: 0; }

/* --- search + element tiles --- */
.dz-search { display: flex; align-items: center; gap: 8px; background: var(--card-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; margin-bottom: 12px; }
.dz-search svg { color: var(--muted-2); flex: 0 0 auto; }
.dz-search input { flex: 1; background: transparent; border: none; color: var(--fg); padding: 8px 0; font-size: 13px; }
.dz-search input:focus { outline: none; }
.dz-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.dz-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; color: var(--fg);
  padding: 14px 6px; font-size: 12px; font-weight: 500; cursor: pointer; text-align: center; min-height: 74px; }
.dz-tile:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--fg); filter: none; }
.dz-tile svg { color: var(--accent); }
.dz-tile span { line-height: 1.15; }
.dz-tile.dz-hidden { display: none; }

/* --- left canvas section --- */
.dz-section { border-top: 1px solid var(--border-2); margin-top: 12px; padding-top: 12px; }
.dz-section:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.dz-section-h { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted-2);
  font-weight: 700; margin-bottom: 10px; }
.dz-field { display: block; color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.dz-field select, .dz-field input, .dz-full { width: 100%; margin-top: 5px; }
.dz-full { width: 100%; }
.dz-field-row { display: flex; gap: 8px; margin-bottom: 8px; }
.dz-field-row > * { flex: 1; }
.dz-swatch { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--card-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--muted); }
.dz-swatch input[type=color] { width: 34px; height: 24px; padding: 0; border: 1px solid var(--border);
  border-radius: 6px; background: none; cursor: pointer; margin: 0; }
.dz-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 8px 12px;
  font-size: 12px; font-weight: 500; cursor: pointer; }
.dz-btn:hover { filter: brightness(1.08); }
.dz-btn.sm { padding: 7px 10px; }
.dz-btn.full { width: 100%; margin-bottom: 8px; }
.dz-btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.dz-btn.ghost:hover { background: var(--card); color: var(--fg); filter: none; }
.dz-btn.danger { background: transparent; color: var(--red); border: 1px solid var(--border); }
.dz-btn.danger:hover { background: rgba(231,76,60,.14); border-color: var(--red); filter: none; }

/* --- layers panel --- */
.dz-pane.only-layers .dz-elonly { display: none; }
.dz-pane.only-layers .dz-layers-sec { border-top: none; margin-top: 0; padding-top: 0; }
.dz-layers-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 2px 2px 10px; }
.dz-layers-head span:first-child { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted-2); }
.dz-hint-sm { color: var(--muted-2); font-size: 11px; }
.dz-pad { padding: 6px 2px; }
.dz-layers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.dz-layer { display: flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid transparent;
  border-radius: 8px; padding: 7px 8px; cursor: pointer; user-select: none; }
.dz-layer:hover { background: var(--card-2); }
.dz-layer.active { background: var(--accent-soft); border-color: var(--accent); }
.dz-layer.hiddenlayer .dz-layer-name { opacity: .45; }
.dz-layer-grip { color: var(--muted-2); cursor: grab; display: inline-flex; flex: 0 0 auto; }
.dz-layer-ic { color: var(--muted); flex: 0 0 auto; display: inline-flex; }
.dz-layer-name { flex: 1 1 auto; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; background: transparent; border: none; color: var(--fg); padding: 2px; }
.dz-layer-name:focus { outline: 1px solid var(--accent); border-radius: 4px; background: var(--bg-2); }
.dz-layer-btn { background: transparent; border: none; color: var(--muted-2); padding: 3px; border-radius: 5px;
  display: inline-flex; cursor: pointer; flex: 0 0 auto; }
.dz-layer-btn:hover { background: var(--bg); color: var(--fg); filter: none; }
.dz-layer-btn.on { color: var(--accent); }
.dz-layer.dragover { border-top: 2px solid var(--accent); }

/* --- zoom bar / center --- */
.dz-zoombar { display: flex; align-items: center; gap: 6px; height: 44px; flex: 0 0 44px; padding: 0 12px;
  border-bottom: 1px solid var(--border); background: var(--bg-2); }
.dz-flex { flex: 1 1 auto; }
.dz-zbtn { background: var(--card); border: 1px solid var(--border); color: var(--fg); width: 30px; height: 30px;
  border-radius: 8px; font-size: 16px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; padding: 0; }
.dz-zbtn:hover { background: var(--card-2); filter: none; }
.dz-zpct { background: var(--card); border: 1px solid var(--border); color: var(--fg); border-radius: 8px;
  padding: 0 10px; height: 30px; font-size: 12px; font-weight: 600; cursor: pointer; min-width: 52px; }
.dz-zpct.sm { min-width: 44px; }
.dz-canvassize { color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 12px; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; }
/* Thin, subtle scrollbars app-wide (panels, lists) instead of chunky native ones. */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px;
  border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

.dz-stage { flex: 1 1 auto; overflow: auto; position: relative; background: #0a0d14; }
.dz-stage.dz-panning { cursor: grabbing; }
/* No scrollbars on the canvas viewport — pan with right-drag / wheel (Figma-like). */
.dz-stage { scrollbar-width: none; }
.dz-stage::-webkit-scrollbar { width: 0; height: 0; display: none; }
/* Large floating space so the artboard can be panned at ANY zoom (even when it's
   smaller than the viewport). The canvas is absolutely centered inside it. */
.dz-scroll { position: relative; background-color: #0a0d14;
  background-image: radial-gradient(circle at center, rgba(255,255,255,.055) 1.3px, transparent 1.3px);
  background-size: 24px 24px; }
.dz-scroll.dz-nogrid { background-image: none; }
#dzScroll .canvas-container { position: absolute !important; left: 50%; top: 50%;
  transform: translate(-50%, -50%); }
.dz-stage canvas { box-shadow: 0 8px 40px rgba(0,0,0,.55); }
.dz-empty { position: absolute; inset: 44px 0 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; pointer-events: none; }
.dz-empty[hidden] { display: none; }
.dz-botzoom { position: absolute; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 5px 7px;
  box-shadow: var(--shadow); }
.dz-statusbar { flex: 0 0 auto; min-height: 22px; padding: 3px 16px; border-top: 1px solid var(--border);
  background: var(--bg-2); color: var(--muted); font-size: 12px; display: flex; align-items: center; }

/* --- attach-to-points floating bar --- */
.dz-attach { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 10px 8px 14px; box-shadow: var(--shadow); max-width: calc(100% - 40px); }
.dz-attach svg { color: var(--accent); flex: 0 0 auto; }
.dz-attach-label { font-size: 13px; font-weight: 600; white-space: nowrap; }
.dz-attach select { min-width: 220px; max-width: 340px; font-size: 12px; padding: 6px 10px; }
.dz-attach-x { background: transparent; border: none; color: var(--muted-2); cursor: pointer; padding: 4px 6px;
  border-radius: 6px; font-size: 13px; }
.dz-attach-x:hover { background: var(--card-2); color: var(--fg); filter: none; }
.dz-attach.hidden { display: none; }

/* --- right inspector --- */
.dz-inspector { display: flex; flex-direction: column; }
.dz-insp-sec { border-top: 1px solid var(--border-2); padding: 12px 0; }
.dz-inspector > .dz-insp-sec:first-child { border-top: none; padding-top: 2px; }
.dz-insp-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted-2); font-weight: 700;
  margin-bottom: 12px; user-select: none; }
.dz-insp-head .chev { transition: transform .18s; color: var(--muted-2); }
.dz-insp-sec.collapsed .chev { transform: rotate(-90deg); }
.dz-insp-sec.collapsed .dz-insp-body { display: none; }
.dz-insp-body { display: flex; flex-direction: column; gap: 11px; }
.dz-row { display: flex; flex-direction: column; gap: 5px; }
.dz-row > label, .dz-lbl { font-size: 12px; color: var(--muted); }
.dz-row input, .dz-row select, .dz-row textarea { width: 100%; }
.dz-row textarea { resize: vertical; min-height: 44px; font-family: inherit; }
.dz-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dz-inline { display: flex; align-items: center; gap: 9px; }
.dz-inline .dz-colorbox { flex: 0 0 auto; }
.dz-inline input[type=text] { flex: 1 1 auto; }
.dz-colorbox { width: 30px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 6px;
  background: none; cursor: pointer; }
.dz-align { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.dz-align button { flex: 1; background: transparent; color: var(--muted); border: none; border-radius: 0;
  padding: 7px 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dz-align button.active { background: var(--accent); color: #fff; }
.dz-align button:hover:not(.active) { background: var(--card); filter: none; }
.dz-slider { display: flex; align-items: center; gap: 10px; }
.dz-slider input[type=range] { flex: 1; accent-color: var(--accent); }
.dz-slider .val { min-width: 42px; text-align: right; font-size: 12px; color: var(--fg); }
.dz-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.dz-check input { width: auto; margin: 0; }
.dz-designlist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dz-designlist li { display: flex; align-items: center; gap: 8px; background: var(--card-2);
  border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 10px; font-size: 13px; cursor: pointer; }
.dz-designlist li:hover { background: var(--card); }
.dz-designlist li.active { border-color: var(--accent); color: var(--accent); }

@media (max-width: 1080px) {
  .dz-left { width: 200px; } .dz-right { width: 240px; }
}
