/* ==========================================================================
   Thinkneering — Tool components
   Shared by the dashboard, the /tools/ index and every individual tool page.
   Loaded after global.css. Contains no raw values — tokens only.
   ========================================================================== */

/* ---------- Tool card grid ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 190px;
}

.tool-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.tool-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.tool-card__icon svg { width: 19px; height: 19px; }

.tool-card__name { font-size: var(--text-base); margin: 0; }

.tool-card__summary {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0;
  flex: 1;
}

.tool-card__link {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  padding-top: var(--space-1);
}
.tool-card__link:hover { text-decoration: none; }

.tool-card.is-soon { opacity: 0.55; }
.tool-card.is-soon .tool-card__icon { background: var(--color-surface-sunken); color: var(--color-text-muted); }

/* ---------- Tool page: two-column controls + result ---------- */
.tool-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}
@media (max-width: 860px) {
  .tool-split { grid-template-columns: minmax(0, 1fr); }
}

/* Sticky result column on wide screens — the answer stays in view while you
   scroll a long control list. */
@media (min-width: 861px) {
  .tool-split__sticky { position: sticky; top: calc(var(--header-h) + var(--space-4)); }
}

/* ---------- Swap / arrow button between two selects ---------- */
.swap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease);
}
.swap-btn:hover { color: var(--color-primary); border-color: var(--color-primary); }
.swap-btn:active { transform: rotate(180deg); }
.swap-btn svg { width: 17px; height: 17px; }

/* ---------- Result row list (converter output, breakdowns) ---------- */
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.result-list li:last-child { border-bottom: 0; }
.result-list .result-list__label { color: var(--color-text-muted); }
.result-list .result-list__value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  text-align: right;
  word-break: break-word;
}
.result-list li.is-total {
  border-top: 2px solid var(--color-text);
  border-bottom: 0;
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  font-weight: 600;
}
.result-list li.is-total .result-list__label { color: var(--color-text); }
.result-list li.is-total .result-list__value { font-size: var(--text-lg); }

/* ---------- Copyable output block ---------- */
.output-block { position: relative; }
.output-block textarea {
  min-height: 200px;
  background: var(--color-surface-sunken);
}
.output-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

/* ---------- Checklist ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  transition: background-color var(--dur) var(--ease);
}
.checklist li:last-child { border-bottom: 0; }
.checklist li:hover { background: var(--color-surface-sunken); }
.checklist input[type="checkbox"] { margin-top: 3px; }
.checklist .task-text { flex: 1; min-width: 0; word-break: break-word; }
.checklist li.is-done .task-text { text-decoration: line-through; color: var(--color-text-muted); }
.checklist .task-remove {
  border: 0;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease);
}
.checklist li:hover .task-remove,
.checklist .task-remove:focus-visible { opacity: 1; }
.checklist .task-remove:hover { color: var(--color-danger); }
.checklist .task-remove svg { width: 16px; height: 16px; display: block; }

/* Progress bar */
.progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--color-success);
  border-radius: var(--radius-pill);
  transition: width 240ms var(--ease);
}

/* ---------- Invoice ---------- */
.invoice-sheet {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}
.invoice-sheet__head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--color-text);
  margin-bottom: var(--space-4);
}
.invoice-sheet__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  margin: 0;
}
.invoice-parties {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.invoice-parties h4 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}
.invoice-parties p { white-space: pre-line; font-size: 14px; margin: 0; }

.line-row {
  display: grid;
  grid-template-columns: 1fr 80px 110px 36px;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-2);
}
.line-row input { font-size: 14px; padding: 9px 11px; }
@media (max-width: 560px) {
  .line-row { grid-template-columns: 1fr 1fr; grid-template-areas: "d d" "q p" "r r"; }
  .line-row > :nth-child(1) { grid-area: d; }
  .line-row > :nth-child(2) { grid-area: q; }
  .line-row > :nth-child(3) { grid-area: p; }
  .line-row > :nth-child(4) { grid-area: r; justify-self: end; }
}

@media print {
  .invoice-sheet { border: 0; padding: 0; }
  .invoice-sheet__head { border-bottom-color: #000; }
}

/* ---------- Tips block at the foot of a tool page ---------- */
.tips { font-size: 14px; color: var(--color-text-muted); }
.tips ul { margin: 0; padding-left: var(--space-4); }
.tips li { margin-bottom: var(--space-1); }
