.container { max-width: 1120px; margin: 20px auto; display: flex; flex-direction: column; gap: 24px; padding: 0 16px; }
.wrap-head { text-align: center; margin-top: 24px; }
.card-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sources-grid, .sets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; margin-top: 12px; }
.item-card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; position: relative; transition: border-color 0.2s; }
.item-card:hover { border-color: var(--primary); }
.item-card .menu-3dots { position: absolute; top: 10px; right: 10px; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--mute); }
.builder-step { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; background: var(--panel); margin-bottom: 16px; }
.builder-step legend { font-size: 0.95rem; color: var(--primary); font-weight: 600; padding: 0 8px; }
.pivot-layout-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; margin-top: 16px; }
.pivot-box { background: var(--bg); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); padding: 12px; min-height: 90px; }
.pivot-box.highlight-box { border-color: var(--primary); }
.pivot-box h5 { margin: 0 0 8px 0; color: var(--mute); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
.drop-zone { min-height: 50px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-field { background: var(--surface-raised); border: 1px solid var(--primary); padding: 4px 8px; border-radius: 4px; font-size: 0.85rem; cursor: grab; user-select: none; }
.tags-pool { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; padding: 8px; background: var(--bg); border-radius: var(--r-sm); border: 1px solid var(--line); }
.scroll-table { max-height: min(46vh, 420px); overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: 8px; }
.row-flex { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.checklist-box { max-height: 150px; overflow-y: auto; border: 1px solid var(--line); padding: 8px; border-radius: var(--r-sm); background: var(--bg); }
.btn-close { background: none; border: none; font-size: 1.5rem; color: var(--mute); cursor: pointer; }
.btn-close:hover { color: var(--ink); }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-header h2, .modal-header h3 { margin: 0; }
.modal-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.modal-footer input[type=text] { flex: 1 1 220px; min-width: 0; }
dialog.large-modal { padding: 0; overflow: hidden; width: min(1100px, calc(100vw - 24px)); max-width: none; height: auto; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
dialog.large-modal[open] { display: flex; flex-direction: column; }
#builderModal { height: min(900px, calc(100vh - 24px)); height: min(900px, calc(100dvh - 24px)); }
.large-modal .modal-header { flex: none; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.large-modal .modal-footer { flex: none; padding: 16px 24px; background: var(--panel); }
.large-modal .modal-body, .large-modal .builder-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 20px 24px; }
.builder-body { display: flex; flex-direction: column; gap: 16px; }
#previewModal .scroll-table { max-height: none; }
@media (max-width: 640px), (max-height: 520px) {
  dialog.large-modal { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border-inline: 0; }
  #builderModal { height: 100vh; height: 100dvh; }
  .large-modal .modal-header, .large-modal .modal-footer { padding: 12px 16px; }
  .large-modal .modal-body, .large-modal .builder-body { padding: 16px; }
}
