/* ============================================================
   FinToolbox — DCA & Average Down Calculator (tool-specific)
   Global styles (.card .fld .input .bk .btn .tag …) live in
   /css/styles.css. Mirrors the .r-* tab recipe used by ROI, namespaced
   as .d-* so the tools stay independent.
   ============================================================ */

/* Hidden must win over any conditional display:flex/grid on panels. */
.dca-tool [hidden] { display: none !important; }

/* ---------- Tab strip ---------- */
.d-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  /* No bottom margin — the panel below provides the spacing via its own
     padding-top. Without this, panel padding-top stacks on top of margin-
     bottom and the gap between tabs and inputs balloons. */
  margin-bottom: 0;
}
.d-tab {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 6px 6px 0 0;
}
.d-tab:hover { color: var(--text); background: var(--card-hi); }
.d-tab.on { color: var(--text); border-bottom-color: var(--green); }
.d-tab:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* The panels sit inside the tab-card and need their own padding so input
   and result columns don't hug the card edge. The inputs sub-card declares
   inline padding:0 (so its h3/grid are flush within its own bounds), which
   means edge breathing room has to live here, not on the inputs sub-card. */
.d-panel { display: none; padding: 18px 16px 16px; }
.d-panel.on { display: block; }
@media (max-width: 560px) { .d-panel { padding: 14px 12px 12px; } }

/* ---------- Input grid ---------- */
.d-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) { .d-form { grid-template-columns: 1fr; } }
.d-form .fld.d-full { grid-column: 1 / -1; }

/* ---------- Buy-rows list (dynamic) ---------- */
.d-buys {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0;
}
.d-buy {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}
.d-buy .fld { margin: 0; }
.d-buy-num {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 4px;
}
.d-buy-remove {
  appearance: none;
  background: var(--card-2);
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.d-buy-remove:hover { color: var(--red); border-color: var(--red); }
.d-buy-remove:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.d-buy.d-buy-locked .d-buy-remove { visibility: hidden; }

.d-add {
  appearance: none;
  background: transparent;
  color: var(--green);
  border: 1px dashed color-mix(in srgb, var(--green) 50%, transparent);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.12s, border-color 0.12s;
}
.d-add:hover { background: color-mix(in srgb, var(--green) 8%, transparent); border-style: solid; }
.d-add:disabled {
  color: var(--text-4);
  border-color: var(--line-soft);
  background: transparent;
  cursor: not-allowed;
}
.d-add:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- Output ---------- */
.d-out h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.d-out .bk .v,
.d-out .bk .tag { padding-right: 10px; }

/* ---------- Bottom disclaimer card ---------- */
.d-disclaimer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--yellow) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--yellow) 30%, transparent);
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
}
.d-disclaimer .icon { flex: 0 0 auto; font-size: 18px; line-height: 1; }
.d-disclaimer b { color: var(--text); font-weight: 700; }
