/* =============================================================================
 *  tools.css — the My Tools index, and the workbench chrome the tools sit in.
 * =============================================================================
 *  Inherits site.css: the tokens, the header, .btn and .wrap all come from
 *  there. This file adds the two-pane workbench (a long form on the left, a
 *  live document on the right) and the controls that fill it.
 * ========================================================================== */

/* ---------------------------------------------------------------- index -- */
.tools-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  margin-top: 26px;
}
.tool-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); text-decoration: none; color: inherit;
  transition: border-color .16s, transform .16s;
}
a.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.tool-card__mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--bg-lift, #2b241f); color: var(--accent); font-size: 1.15rem;
}
.tool-card h3 { margin: 0; font-size: 1.02rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.tool-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.tool-card__tags span {
  font-size: .68rem; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim);
}
.tool-card--soon { opacity: .58; cursor: default; }
.tool-card--soon:hover { border-color: var(--line); transform: none; }

/* ------------------------------------------------------------ workbench -- */
.wb {
  display: grid; grid-template-columns: minmax(360px, 460px) 1fr;
  gap: 18px; align-items: start;
  max-width: 1560px; margin: 0 auto; padding: 18px var(--pad) 60px;
}
.wb__head { max-width: 1560px; margin: 0 auto; padding: 26px var(--pad) 0; }
.wb__head h1 { margin: 6px 0 8px; font-size: clamp(1.5rem, 3vw, 2.05rem); }
.wb__head p { margin: 0; color: var(--muted); max-width: 70ch; line-height: 1.6; }

/*  The privacy line is not decoration. The tool asks for a salary, a home
 *  address and an SSN, so the page says plainly where they go — which is
 *  nowhere, because there is no endpoint to send them to. */
.wb__privacy {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  padding: 8px 13px; border-radius: 999px; font-size: .8rem;
  border: 1px solid #2f5d3f; background: rgba(95, 208, 138, .08); color: var(--ok);
}

.wb__form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wb__out { position: sticky; top: 74px; min-width: 0; }

/* ------------------------------------------------------------- sections -- */
.sec { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.sec > summary {
  list-style: none; cursor: pointer; padding: 13px 15px;
  display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .92rem;
  user-select: none;
}
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after {
  content: '+'; margin-left: auto; color: var(--dim); font-size: 1.1rem; line-height: 1;
}
.sec[open] > summary::after { content: '\2013'; }
.sec > summary:hover { background: rgba(255,255,255,.03); }
.sec__n {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  background: var(--bg-lift, #2b241f); color: var(--accent); font-size: .72rem; font-weight: 700;
}
.sec__body { padding: 4px 15px 16px; border-top: 1px solid var(--line); }
.sec__hint { margin: 10px 0 0; font-size: .76rem; color: var(--dim); line-height: 1.5; }

/* --------------------------------------------------------------- fields -- */
.row { display: grid; gap: 10px; margin-top: 12px; }
.row--2 { grid-template-columns: 1fr 1fr; }
.row--3 { grid-template-columns: 1fr 1fr 1fr; }
.row--21 { grid-template-columns: 2fr 1fr; }
.row--12 { grid-template-columns: 1fr 2fr; }

.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f > label { font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); }
.f input[type=text], .f input[type=number], .f input[type=date], .f input[type=email], .f select {
  width: 100%; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: .87rem;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  transition: border-color .14s;
}
.f input:focus, .f select:focus { outline: none; border-color: var(--accent); }
.f input[type=color] {
  width: 100%; height: 36px; padding: 2px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
.f input[type=range] { width: 100%; accent-color: var(--accent); }
.f--check { flex-direction: row; align-items: center; gap: 9px; }
.f--check input { accent-color: var(--accent); width: 15px; height: 15px; }
.f--check label { text-transform: none; letter-spacing: 0; font-size: .84rem; color: var(--text); }
.f__note { font-size: .7rem; color: var(--dim); }

/* ------------------------------------------------------- repeating rows -- */
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.item {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px;
  background: rgba(255,255,255,.015);
}
.item__top { display: flex; align-items: center; gap: 8px; }
.item__top input[type=text] { flex: 1; }
.item__drop {
  background: none; border: 1px solid var(--line); color: var(--dim);
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer; flex: none; font-size: 1rem;
}
.item__drop:hover { border-color: #b4483a; color: #ff8d7a; }
.item .row { margin-top: 8px; }
.add {
  align-self: flex-start; background: none; border: 1px dashed var(--line);
  color: var(--muted); padding: 8px 13px; border-radius: 8px; cursor: pointer; font: inherit;
  font-size: .82rem;
}
.add:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------- preview -- */
.pv { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.pv__bar {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.pv__title { font-size: .8rem; color: var(--muted); }
.pv__spacer { flex: 1; }
.pv__nav { display: flex; align-items: center; gap: 4px; }
.pv__nav button {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer; font-size: .9rem; line-height: 1;
}
.pv__nav button:disabled { opacity: .35; cursor: default; }
.pv__count { font-size: .76rem; color: var(--dim); min-width: 84px; text-align: center; }
.pv__frame { width: 100%; height: min(1180px, 108vh); border: 0; background: #33302d; display: block; }
.pv__empty { padding: 60px 20px; text-align: center; color: var(--dim); font-size: .88rem; }

.dl { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.dl .btn { font-size: .84rem; padding: 9px 14px; }

.wb__status {
  font-size: .78rem; color: var(--dim); padding: 0 12px 12px;
}
.wb__status b { color: var(--ok); font-weight: 600; }
.wb__status.is-err b { color: #ff8d7a; }

/* ---------------------------------------------------------- the figures -- */
.tot { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); }
.tot div { background: var(--surface); padding: 11px 12px; }
.tot span { display: block; font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.tot b { display: block; margin-top: 3px; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.tot div:last-child b { color: var(--ok); }

/* --------------------------------------------------------------- series -- */
.periods { margin-top: 12px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.periods table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.periods th {
  text-align: left; padding: 7px 9px; background: rgba(255,255,255,.03);
  color: var(--dim); font-weight: 600; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase;
}
.periods td { padding: 5px 9px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.periods td.num { text-align: right; color: var(--muted); }
.periods input {
  width: 72px; padding: 4px 6px; font: inherit; font-size: .78rem; text-align: right;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text);
}
.periods input:focus { outline: none; border-color: var(--accent); }

.logo-prev {
  margin-top: 10px; display: none; align-items: center; gap: 12px;
  padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.logo-prev.is-on { display: flex; }
.logo-prev img { max-width: 130px; max-height: 46px; display: block; }
.logo-prev button {
  margin-left: auto; background: none; border: 1px solid #ccc; color: #444;
  padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: .76rem;
}

@media (max-width: 1080px) {
  .wb { grid-template-columns: 1fr; }
  .wb__out { position: static; }
  .pv__frame { height: 86vh; }
}
@media (max-width: 560px) {
  .row--3, .row--2, .row--21, .row--12 { grid-template-columns: 1fr; }
  .tot { grid-template-columns: 1fr 1fr; }
}

/* ------------------------------------------------------------- docugen -- */
.wb__form textarea {
  width: 100%; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: .87rem;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  resize: vertical; line-height: 1.5;
}
.wb__form textarea:focus { outline: none; border-color: var(--accent); }

#editor {
  font-family: var(--mono); font-size: .82rem; line-height: 1.6;
  background: #16130f; color: var(--text); border: 0; padding: 20px; border-radius: 0;
}
#editor:focus { outline: none; }

.pv__nav button[data-on="1"] { background: var(--accent); border-color: var(--accent); color: #1a120c; }
.pv__nav button { width: auto; padding: 0 11px; font-size: .74rem; font-weight: 600; }

.doc-row { cursor: pointer; }
.doc-row.is-on { background: rgba(255,122,69,.10); }
.doc-row td.title { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row button {
  background: none; border: 1px solid var(--line); color: var(--dim);
  padding: 2px 7px; border-radius: 6px; cursor: pointer; font-size: .72rem;
}
.doc-row button:hover { border-color: var(--accent); color: var(--accent); }

.gen-busy { opacity: .6; pointer-events: none; }
