/* =========================================================
   Layout editor
   ========================================================= */
.layout-editor-modal { width: min(1120px, 97vw); }
.layout-editor-modal .modal-body { padding: 16px 18px 14px; }
.layout-editor { display: grid; grid-template-columns: minmax(0, 1fr) 276px; gap: 16px; }
.layout-editor-main { min-width: 0; display: flex; flex-direction: column; }
.layout-editor-toolbar { display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.layout-tool-field { display: flex; flex-direction: column; gap: 3px; font-size: 8px; color: var(--text-faint); }
.layout-tool-field .select { height: 30px; font-size: 9.5px; min-width: 145px; }
.layout-tool-field.size { width: 67px; }
.layout-tool-field.size .input { height: 30px; font-size: 10px; padding: 0 7px; }
.layout-times { color: var(--text-faint); font-size: 10px; padding-bottom: 8px; }
.layout-size-hint { font-size: 8px; color: #6e7c90; padding-bottom: 9px; white-space: nowrap; }
.layout-toolbar-spacer { flex: 1; }
.add-region-select { height: 30px; font-size: 9px; width: 110px; }
.layout-board-wrap { display: flex; justify-content: center; align-items: center; min-height: 380px; padding: 10px; background: rgba(5, 9, 14, 0.35); border-radius: 10px; border: 1px solid rgba(148, 174, 210, 0.07); }
.layout-editor-board {
  position: relative; width: min(100%, calc(480px * var(--ar))); max-height: 480px;
  border-radius: 8px; border: 1px solid rgba(148, 174, 210, 0.22);
  background: #080d14; overflow: hidden; box-shadow: 0 20px 55px rgba(0, 0, 0, 0.35);
  touch-action: none;
}
.layout-board-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(148,174,210,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(148,174,210,.055) 1px, transparent 1px); background-size: 8.333% 8.333%; pointer-events: none; }
.layout-board-size { position: absolute; left: 8px; bottom: 6px; font-size: 8px; color: rgba(148, 174, 210, 0.4); pointer-events: none; letter-spacing: 0.06em; }
.layout-editor-region {
  position: absolute; border-radius: 5px; border: 1px solid color-mix(in srgb, var(--rc) 48%, transparent);
  background: color-mix(in srgb, var(--rc) 10%, rgba(10, 16, 24, 0.72));
  color: #dce7f4; cursor: move; overflow: hidden; min-width: 22px; min-height: 18px;
  transition: box-shadow 0.12s, border-color 0.12s;
}
.layout-editor-region:hover { border-color: color-mix(in srgb, var(--rc) 78%, transparent); }
.layout-editor-region.selected { border-color: var(--rc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--rc) 35%, transparent), 0 8px 24px rgba(0, 0, 0, 0.3); background: color-mix(in srgb, var(--rc) 16%, rgba(10, 16, 24, 0.82)); }
.layout-editor-region.dragging { cursor: grabbing; }
.ler-label { display: flex; align-items: center; gap: 3px; padding: 5px; font-size: 8.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: color-mix(in srgb, var(--rc) 82%, #fff 15%); pointer-events: none; }
.ler-handle { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 46%, var(--rc) 47% 53%, transparent 54% 62%, var(--rc) 63% 69%, transparent 70%); opacity: 0.8; }
.layout-editor-help { display: flex; align-items: center; gap: 5px; font-size: 8.5px; color: var(--text-faint); padding-top: 9px; }
.layout-editor-side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--border); padding-left: 14px; }
.layout-side-head { display: flex; justify-content: space-between; align-items: center; font-size: 9px; color: var(--text-dim); padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.layout-side-head > span:last-child { color: var(--accent); font-variant-numeric: tabular-nums; }
.layout-region-list { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; padding-right: 2px; }
.layout-region-item { display: flex; align-items: center; gap: 7px; width: 100%; padding: 7px; border-radius: 6px; border: 1px solid transparent; text-align: left; color: var(--text-dim); transition: all 0.13s; }
.layout-region-item:hover { background: rgba(148, 174, 210, 0.05); border-color: var(--border); }
.layout-region-item.active { background: rgba(94, 214, 196, 0.07); border-color: rgba(94, 214, 196, 0.2); }
.lri-icon { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 6px; display: grid; place-items: center; color: var(--rc); background: color-mix(in srgb, var(--rc) 11%, transparent); }
.lri-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lri-text strong { font-size: 9.5px; color: #c9d4e2; font-weight: 600; }
.lri-text small { font-size: 7.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layout-region-item > svg { color: var(--text-faint); flex: 0 0 auto; }
.layout-region-editor { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); overflow-y: auto; min-height: 0; flex: 1; }
.layout-editor-selected { display: flex; align-items: center; gap: 7px; padding: 8px; border-radius: 7px; background: rgba(148, 174, 210, 0.035); border: 1px solid var(--border); margin-bottom: 9px; }
.les-icon { width: 27px; height: 27px; flex: 0 0 27px; border-radius: 7px; display: grid; place-items: center; color: var(--rc); background: color-mix(in srgb, var(--rc) 11%, transparent); }
.layout-editor-selected > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.layout-editor-selected strong { font-size: 9.5px; color: #d4deeb; }
.layout-editor-selected small { font-size: 7.5px; color: var(--text-faint); line-height: 1.4; }
.layout-edit-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 7px; font-size: 8px; color: var(--text-faint); }
.layout-edit-field .input { height: 29px; font-size: 9.5px; }
.layout-coord-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 8px; }
.layout-coord-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 8px; color: var(--text-faint); }
.layout-coord-grid .input { height: 28px; font-size: 9.5px; padding: 0 6px; }
.layout-delete-region { width: 100%; }
.layout-region-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 25px 10px; color: var(--text-faint); font-size: 9px; text-align: center; }
.layout-side-foot { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); font-size: 7.5px; line-height: 1.6; color: var(--text-faint); display: flex; gap: 4px; }
.layout-side-foot svg { flex: 0 0 auto; margin-top: 1px; }
@media (max-width: 980px) {
  .layout-editor { grid-template-columns: 1fr; }
  .layout-editor-side { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; padding-top: 10px; }
  .layout-region-list { max-height: 120px; }
}
