/* The firm's workflow library (js/workflows.js): the table of her templates, a template's eight stages with their
   steps, a step opened under its row. Phone first: at 600px and below the table turns into one card per template and
   every cell names its column; nothing scrolls sideways at 390px. */
.wf-page { max-width: 1040px; }
.wf-card { background: var(--card); border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); overflow: hidden; }
.wf-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.wf-table th { font-size: 12px; font-weight: 700; color: var(--muted); text-align: left; padding: 12px 14px 8px; border-bottom: 2px solid var(--line); letter-spacing: .02em; }
.wf-table td { padding: 12px 14px; border-bottom: 1.5px solid var(--line); vertical-align: top; color: var(--text); }
.wf-table tr:last-child td { border-bottom: none; }
.wf-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.wf-tr { cursor: pointer; }
.wf-name { font-weight: 800; color: var(--ink); text-decoration: none; }
.wf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--lilac); color: var(--ink); white-space: nowrap; }
.wf-h1 { overflow-wrap: anywhere; }
.wf-meta { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.45; }

.wf-stage { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.wf-sh { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; border-bottom: 2px solid var(--line); padding-bottom: 6px; }
.wf-sh h2 { margin: 0; font-size: 19px; font-weight: 800; color: var(--ink); }
.wf-n { font-size: 13px; color: var(--muted); }
.wf-steps { display: flex; flex-direction: column; gap: 6px; }
.wf-step { font: inherit; width: 100%; text-align: left; cursor: pointer; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: 'who t form' 'who sub form'; align-items: center; gap: 2px 12px; padding: 10px 12px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; color: var(--text); }
.wf-step.on { border-color: var(--ink); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.wf-who { grid-area: who; justify-self: start; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 999px; border: 2px solid var(--ink); background: var(--card); color: var(--ink); }
.wf-who.wf-agent { background: var(--lilac); border-color: var(--violet); color: var(--violet); }
.wf-who.wf-you { background: var(--yellow); }
.wf-who.wf-client { background: var(--paper); border-color: var(--muted); color: var(--muted); }
.wf-t { grid-area: t; font-size: 15px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.wf-sub { grid-area: sub; font-size: 13px; color: var(--muted); }
.wf-form { grid-area: form; font-size: 12px; font-weight: 700; color: var(--muted); border: 1.5px solid var(--line); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.wf-open { display: flex; flex-direction: column; }
.wf-detail { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; background: var(--card); border: 2px solid var(--ink); border-top: none; border-radius: 0 0 12px 12px; }
.wf-detail .btn { align-self: flex-start; }
.wf-line { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; font-size: 14px; line-height: 1.45; }
.wf-k { font-weight: 700; color: var(--muted); }
.wf-v { color: var(--text); overflow-wrap: anywhere; }
/* Editing (js/workflow-edit.js): the old app's rows, Step, Role, Team role, Related form, Stage, ↑ ↓ ✕; stacked below
   1180px, where the column is too narrow for six boxes in a line. */
.wf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.wf-note { font-size: 13px; color: var(--muted); margin: 0; }
.wf-note.err { color: var(--red); font-weight: 700; }
.wf-editor { display: flex; flex-direction: column; gap: 10px; }
.wf-k2 { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.wf-formpick { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-fp { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--card); font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.wf-fp input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.wf-sh .grow { flex: 1; }
.wf-labels, .wf-row { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(4, minmax(0, 1fr)) auto; gap: 6px; align-items: center; }
.wf-labels { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 2px; }
.wf-in, .wf-sel { font: inherit; font-size: 14px; min-height: 38px; width: 100%; min-width: 0; padding: 0 8px; border: 2px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); }
.wf-in:focus, .wf-sel:focus { border-color: var(--ink); outline: none; }
.wf-btns { display: flex; gap: 4px; }
.wf-btns .btn { min-width: 34px; padding: 0 8px; }
.wf-undo { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 60; display: flex; align-items: center; gap: 12px; width: min(420px, calc(100vw - 32px)); padding: 10px 12px; border-radius: 12px; background: var(--card); color: var(--ink); font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.wf-undo .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1180px) {
  .wf-labels { display: none; }
  .wf-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); }
  .wf-row .wf-in { grid-column: 1 / -1; }
  .wf-row .wf-btns { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (hover: hover) {
  .wf-tr:hover td { background: var(--lilac); }
  .wf-step:hover { border-color: var(--ink); }
}

@media (max-width: 600px) {
  .wf-table thead { display: none; }
  .wf-table, .wf-table tbody, .wf-table tr, .wf-table td { display: block; width: 100%; }
  .wf-table tr { padding: 10px 14px; border-bottom: 1.5px solid var(--line); }
  .wf-table tr:last-child { border-bottom: none; }
  .wf-table td { border: none; padding: 3px 0; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
  .wf-table td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 2px; }
  .wf-table td:first-child { display: block; padding-bottom: 6px; }
  .wf-table td:first-child::before { content: none; }
  .wf-table .num { text-align: left; }
  .wf-step { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'who form' 't t' 'sub sub'; gap: 4px 8px; }
  .wf-line { grid-template-columns: 1fr; gap: 1px; }
}
