/*
 * Add System to Existing DAT — page styles.
 * Grid, cards and drop zones come from style.css; this file only adds the
 * two-up upload row, the locked/new card states and the conflict panel.
 */

.as-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.as-upload-grid .card { margin-bottom: 0; }
.as-upload-grid + #workspace,
.as-upload-grid { margin-bottom: 20px; }

.as-summary {
  margin-top: 12px;
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.as-field-label { font-size: 0.82rem; color: var(--muted); }
.as-check {
  display: flex;
  gap: 8px;
  align-items: baseline;
  cursor: pointer;
}

/* Target controller picker (multi-controller .dat) */
.as-ctrl-prompt { color: var(--dark); font-size: 0.875rem; }
.as-ctrl-list { display: flex; flex-direction: column; gap: 6px; }
.as-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: var(--white);
  transition: border-color 0.1s, background 0.1s;
}
.as-ctrl:hover { border-color: #bbb; }
.as-ctrl.is-clean { border-color: #a5d6b4; background: #f3faf5; }
.as-ctrl.is-checked { border: 2px solid var(--red); padding: 7px 9px; }
.as-ctrl input { accent-color: var(--red); margin: 0; flex-shrink: 0; }
.as-ctrl-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.as-ctrl-name { font-weight: 600; }
.as-ctrl-meta { font-size: 0.78rem; color: var(--muted); }
.as-fit {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.as-fit-ok  { background: #e8f5e9; color: #1e7b45; }
.as-fit-bad { background: #fdecea; color: #c0392b; }
.as-switch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--dark);
}

/* Toolbar + legend */
.as-toolbar { flex-wrap: wrap; }
.as-target-name { font-weight: 700; }
.as-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 4px 0 12px;
}
.as-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.as-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.as-swatch-locked { background: repeating-linear-gradient(135deg, #ececec 0 4px, #f7f7f7 4px 8px); }
.as-swatch-new    { background: var(--white); border: 2px solid var(--red); }

/* Card states */
.group-card.as-locked {
  cursor: not-allowed;
  background: repeating-linear-gradient(135deg, #ececec 0 6px, #f4f4f4 6px 12px);
  color: var(--gray);
}
.group-card.as-locked:hover { background: repeating-linear-gradient(135deg, #ececec 0 6px, #f4f4f4 6px 12px); border-color: var(--border); }
.group-card.as-new {
  background: var(--white);
  border: 2px solid var(--red);
}
.group-card.as-new:hover { background: var(--red-light); }
.group-card.as-new:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.group-card.as-conflict {
  border-color: #c0392b;
  box-shadow: inset 4px 0 0 #c0392b;
}

/* Same box as .group-tag so the shared .group-tag-edit input overlays it. */
.as-name {
  position: relative;
  font-weight: 600;
  font-size: 0.82rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.as-locked .as-name { font-weight: 500; }

/* Conflict / overflow panels */
.as-panel-title { font-weight: 700; margin-bottom: 8px; }
.as-conflict-panel > div:last-child { margin-top: 8px; }
.as-conflict-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: var(--white);
  color: var(--dark);
}
.as-conflict-table th,
.as-conflict-table td {
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid #f5c6cb;
}
.as-conflict-table th { font-weight: 600; background: #fbe3e0; }
.as-mono { font-family: monospace; font-weight: 700; }

@media (max-width: 680px) {
  .as-upload-grid { grid-template-columns: 1fr; }
  .as-ctrl { flex-wrap: wrap; }
}
