* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: #f3f5f8; color: #1f2937; }
header { padding: 14px 16px; background: #0f172a; color: #fff; display: flex; justify-content: space-between; align-items: center; }
h1 { margin: 0; font-size: 20px; }
h3 { margin: 0 0 8px 0; font-size: 14px; }
hr { border: 0; border-top: 1px solid #d7dce5; margin: 12px 0; }

.layout { display: grid; grid-template-columns: 260px 1fr 320px; gap: 12px; padding: 12px; }
.panel { background: #fff; border: 1px solid #d7dce5; border-radius: 8px; padding: 10px; min-height: 80vh; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
input, textarea, button { width: 100%; margin-bottom: 8px; }
input, textarea { padding: 8px; border: 1px solid #c4cbd8; border-radius: 6px; font: inherit; }
input[type="checkbox"] { width: auto; margin: 0 6px 0 0; padding: 0; vertical-align: middle; }
button, .button-like { padding: 8px 10px; border: 1px solid #2563eb; color: #fff; background: #2563eb; border-radius: 6px; cursor: pointer; text-align: center; text-decoration: none; display: inline-block; }
button.danger { background: #dc2626; border-color: #dc2626; }
.button-like { margin-bottom: 8px; }

.toolbar { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 8px; margin-bottom: 10px; }
.canvas-wrap { overflow: auto; }
.canvas { width: 612px; height: 792px; position: relative; border: 1px solid #94a3b8; background: #fff; box-shadow: 0 10px 22px rgba(0,0,0,.12); margin: 0 auto; }
.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }

.field { position: absolute; color: #1e40af; white-space: nowrap; cursor: move; border-bottom: 1px dashed transparent; padding: 0 2px; }
.field.selected { border-bottom-color: #1e40af; background: rgba(30, 64, 175, 0.08); }
.field.snap-horizontal { border-bottom-color: #1e40af; border-bottom-width: 2px; }

.scroll { max-height: 280px; overflow: auto; border: 1px solid #d7dce5; border-radius: 6px; padding: 6px; background: #fafbfc; }
.pre { font-size: 12px; }
.field-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 12px; }
.field-row button { width: auto; margin: 0; padding: 2px 6px; font-size: 12px; background: #ef4444; border-color: #ef4444; }
#status { font-size: 12px; color: #c7d2fe; }
.available-field { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid #d7dce5; border-radius: 6px; padding: 6px; margin-bottom: 6px; background: #fff; cursor: pointer; font-size: 12px; }
.available-field:hover { background: #eff6ff; border-color: #93c5fd; }
.available-field .count { color: #1d4ed8; font-weight: 700; }

@media (max-width: 1300px) {
  .layout { grid-template-columns: 1fr; }
  .panel { min-height: auto; }
}
