/* DealCommander — persistence, import/export and Supabase setup surfaces.
 * Supplies the form, JSON-preview and tone primitives used by the storage
 * panels. Every value derives from tokens.css; no hardcoded colours. */

/* ---- Form primitives ---------------------------------------------------- */

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  min-width: 0;
}

.form-row > .field,
.form-row > label.field {
  flex: 1 1 220px;
  min-width: 0;
}

.input {
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  color: var(--text-primary);
  background: var(--bg-panel-alt);
  border: 1px solid var(--stroke-hairline);
  border-radius: var(--radius-sm);
  transition: border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}

.input:hover { border-color: var(--stroke-strong); }

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.input::placeholder { color: var(--text-tertiary); }

select.input {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: var(--space-5);
}

/* ---- JSON entry and preview -------------------------------------------- */

.textarea-json {
  min-height: 200px;
  resize: vertical;
  font-family: var(--font-num);
  font-size: var(--fs-small);
  line-height: 1.5;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  tab-size: 2;
}

.json-preview {
  border: 1px solid var(--stroke-hairline);
  border-radius: var(--radius-md);
  background: var(--bg-panel-alt);
  padding: var(--space-3) var(--space-4);
}

.json-preview > summary {
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  transition: color 140ms var(--ease-out);
}

.json-preview > summary::-webkit-details-marker { display: none; }

.json-preview > summary::before {
  content: '\25B8';
  display: inline-block;
  margin-right: var(--space-2);
  transition: transform 140ms var(--ease-out);
}

.json-preview[open] > summary::before { transform: rotate(90deg); }

.json-preview > summary:hover { color: var(--text-primary); }

.json-preview > .work-product-preview {
  margin-top: var(--space-3);
  max-height: 340px;
  overflow: auto;
}

/* ---- Layout helpers ----------------------------------------------------- */

.stack-tight {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.button-row-tight {
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ---- Compact button ----------------------------------------------------- */

.btn.btn-small {
  padding: var(--space-1) var(--space-3);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
}

/* ---- Tone text ---------------------------------------------------------- */

.text-positive,
.text-negative,
.text-caution,
.text-info,
.text-secondary,
.text-tertiary {
  font-size: var(--fs-small);
  line-height: 1.5;
  margin: 0;
}

.text-positive { color: var(--positive); }
.text-negative { color: var(--negative); }
.text-caution  { color: var(--caution); }
.text-info     { color: var(--info); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }

/* ---- Saved-deal index --------------------------------------------------- */

.saved-deal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--stroke-hairline);
  min-width: 0;
}

.saved-deal-row:last-child { border-bottom: none; }

.saved-deal-name {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-deal-meta {
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
  white-space: nowrap;
}
