/* UTM Builder — P0 + P1 styles (hygiene, presets, templates, bulk, matrix, history, custom params) */

.lc-tools-utm-builder .lc-utm-presets,
.lc-tools-utm-builder .lc-utm-templates,
.lc-tools-utm-builder .lc-utm-hygiene,
.lc-tools-utm-builder .lc-utm-custom,
.lc-tools-utm-builder .lc-utm-parse {
  margin-top: 6px;
}

.lc-tools-utm-builder .lc-utm-parse-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.lc-tools-utm-builder .lc-utm-parse-row .lc-tool-input {
  flex: 1 1 220px;
  min-width: 0;
}

.lc-tools-utm-builder .lc-utm-parse-row .lc-btn {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 12.5px;
  white-space: nowrap;
}

.lc-tools-utm-builder #lc-utm-parse-status {
  margin: 8px 0 0;
  min-height: 1.2em;
}

.lc-tools-utm-builder .lc-utm-custom-hint {
  margin: 6px 0 0;
}

.lc-tools-utm-builder .lc-utm-custom-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.lc-tools-utm-builder .lc-utm-custom-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.lc-tools-utm-builder .lc-utm-custom-row .lc-utm-custom-key,
.lc-tools-utm-builder .lc-utm-custom-row .lc-utm-custom-val {
  flex: 1 1 140px;
  min-width: 0;
}

.lc-tools-utm-builder .lc-utm-custom-row .lc-utm-custom-remove {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 12.5px;
  white-space: nowrap;
}

.lc-tools-utm-builder #lc-utm-custom-add {
  margin-top: 10px;
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12.5px;
}

.lc-tools-utm-builder .lc-utm-preset-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.lc-tools-utm-builder .lc-utm-preset-btns .lc-btn {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12.5px;
}

.lc-tools-utm-builder .lc-utm-template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.lc-tools-utm-builder .lc-utm-template-row .lc-tool-select,
.lc-tools-utm-builder .lc-utm-template-row .lc-tool-input {
  flex: 1 1 180px;
  min-width: 0;
}

.lc-tools-utm-builder .lc-utm-template-row .lc-btn {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 12.5px;
  white-space: nowrap;
}

.lc-tools-utm-builder .lc-utm-template-row--io {
  margin-top: 10px;
}

.lc-tools-utm-builder .lc-utm-file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0;
}

.lc-tools-utm-builder .lc-utm-hygiene .lc-tool-toggles {
  margin-top: 8px;
}

.lc-tools-utm-builder .lc-utm-hygiene-hint {
  margin: 10px 0 0;
}

.lc-tools-utm-builder .lc-utm-output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.lc-tools-utm-builder .lc-utm-output-actions .lc-btn {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12.5px;
}

.lc-tools-utm-builder .lc-utm-output-actions .lc-btn:disabled,
.lc-tools-utm-builder .lc-utm-qr-link[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.lc-tools-utm-builder .lc-utm-qr-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lc-tools-utm-builder .lc-utm-history {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e4ebf0;
}

.lc-tools-utm-builder .lc-utm-history-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
}

.lc-tools-utm-builder .lc-utm-history-head .lc-tool-label {
  margin: 0;
}

.lc-tools-utm-builder .lc-utm-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lc-tools-utm-builder .lc-utm-history-actions .lc-btn {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12.5px;
}

.lc-tools-utm-builder .lc-utm-history-actions .lc-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lc-tools-utm-builder #lc-utm-history-meta {
  margin: 8px 0 0;
  min-height: 1.2em;
}

.lc-tools-utm-builder .lc-utm-history-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.lc-tools-utm-builder .lc-utm-history-item {
  margin: 0;
}

.lc-tools-utm-builder .lc-utm-history-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #e4ebf0;
  background: #f7fafc;
  color: #1a3a5c;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lc-tools-utm-builder .lc-utm-history-link:hover,
.lc-tools-utm-builder .lc-utm-history-link:focus {
  border-color: #b8c9d9;
  background: #eef3f6;
  outline: none;
}

.lc-tools-utm-builder .lc-utm-matrix-panel,
.lc-tools-utm-builder .lc-utm-bulk-panel {
  display: block;
  margin-top: 22px;
}

.lc-tools-utm-builder .lc-utm-bulk-head {
  margin-bottom: 18px;
}

.lc-tools-utm-builder .lc-utm-bulk-title {
  margin: 0;
  font-family: 'Sora', sans-serif;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: #10233f;
}

.lc-tools-utm-builder .lc-utm-bulk-lede {
  margin: 8px 0 0;
  max-width: 720px;
  color: #52606d;
  font-size: 14px;
  line-height: 1.6;
}

.lc-tools-utm-builder .lc-utm-bulk-lede code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #1a3a5c;
  background: #eef3f6;
  padding: 1px 5px;
  border-radius: 4px;
}

.lc-tools-utm-builder .lc-utm-matrix-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.lc-tools-utm-builder .lc-utm-matrix-fields .lc-tool-field {
  margin: 0;
}

.lc-tools-utm-builder .lc-utm-matrix-fields .lc-tool-textarea {
  min-height: 96px;
  resize: vertical;
}

.lc-tools-utm-builder #lc-utm-bulk-input {
  min-height: 180px;
  margin-bottom: 12px;
}

.lc-tools-utm-builder .lc-utm-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.lc-tools-utm-builder .lc-utm-bulk-actions .lc-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lc-tools-utm-builder #lc-utm-bulk-meta,
.lc-tools-utm-builder #lc-utm-matrix-meta {
  margin: 0 0 14px;
  min-height: 1.2em;
}

.lc-tools-utm-builder #lc-utm-bulk-output,
.lc-tools-utm-builder #lc-utm-matrix-output {
  min-height: 140px;
  resize: vertical;
}

.lc-tools-utm-builder #lc-utm-template-status {
  flex: 1 1 100%;
  margin: 0;
  min-height: 1.2em;
}

@media (max-width: 900px) {
  .lc-tools-utm-builder .lc-utm-matrix-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .lc-tools-utm-builder .lc-utm-bulk-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .lc-tools-utm-builder .lc-utm-bulk-actions .lc-btn {
    width: 100%;
  }

  .lc-tools-utm-builder .lc-utm-template-row .lc-btn,
  .lc-tools-utm-builder .lc-utm-parse-row .lc-btn,
  .lc-tools-utm-builder .lc-utm-output-actions .lc-btn,
  .lc-tools-utm-builder .lc-utm-output-actions .lc-utm-qr-link,
  .lc-tools-utm-builder .lc-utm-history-actions .lc-btn {
    flex: 1 1 auto;
  }

  .lc-tools-utm-builder .lc-utm-output-actions,
  .lc-tools-utm-builder .lc-utm-history-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .lc-tools-utm-builder .lc-utm-history-head {
    align-items: stretch;
  }
}
