/*
 * The Whetstone (1:1 coaching sessions): card UI. WHETSTONE-CSS-V2
 * Every rule is scoped to .bs-whetstone (the root of each tab). Model: the-gauge .../css/backshack-gauge.css.
 * Buttons use !important because the theme's backshack-custom.css styles every `main#content button:not(...)` at a
 * higher specificity than a class-scoped rule. Lists are avoided on purpose (the theme restyles
 * `main#content .entry-content li`); rows are divs. The site theme has no dark mode, so every colour is set
 * explicitly and the root declares color-scheme: light. Loaded only on the tool page (register.php).
 */

.bs-whetstone {
  --ws-ink: #0f172a;
  --ws-body: #334155;
  --ws-muted: #475569;
  --ws-line: #e2e8f0;
  --ws-field-line: #64748b;
  --ws-surface: #ffffff;
  --ws-tint: #f8fafc;
  --ws-accent: #4f46e5;
  --ws-accent-dark: #4338ca;
  --ws-accent-tint: #eef2ff;
  --ws-ok: #166534;
  --ws-ok-tint: #f0fdf4;
  --ws-ok-line: #86efac;
  --ws-warn: #92400e;
  --ws-warn-tint: #fffbeb;
  --ws-warn-line: #f59e0b;
  --ws-danger: #b91c1c;
  --ws-neutral-line: #94a3b8;
  color-scheme: light;
  color: var(--ws-body);
  font-size: 14px;
  line-height: 1.5;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 0 24px;
}

.bs-whetstone [hidden] {
  display: none !important;
}

.bs-whetstone :focus-visible {
  outline: 3px solid var(--ws-accent-dark);
  outline-offset: 2px;
}

.bs-whetstone .ws-program {
  margin: 0 0 12px;
  color: var(--ws-ink);
  font-weight: 600;
}

/* Two panes: the list on the left, the workspace on the right. One column below 860px. */
.bs-whetstone .ws-split {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 860px) {
  .bs-whetstone .ws-split {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* WHETSTONE-CSS-STACK: one full-width column (the Action plan tab: the plan card first, Version history last). */
.bs-whetstone .ws-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.bs-whetstone .ws-stack > .ws-card {
  margin: 0;
}

/* Cards */
.bs-whetstone .ws-card {
  margin: 0 0 16px;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: var(--ws-surface);
}

.bs-whetstone .ws-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ws-line);
  border-radius: 10px 10px 0 0;
  background: var(--ws-tint);
}

.bs-whetstone .ws-card-title {
  margin: 0;
  color: var(--ws-ink);
  font-size: 16px;
  font-weight: 700;
}

.bs-whetstone .ws-card-body {
  padding: 16px;
}

/* Fields: the label sits above the input */
.bs-whetstone .ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 16px;
}

.bs-whetstone .ws-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 12px;
}

.bs-whetstone .ws-field.ws-field-flush {
  margin: 0;
}

.bs-whetstone .ws-field > label {
  color: var(--ws-ink);
  font-weight: 600;
}

.bs-whetstone input[type="text"],
.bs-whetstone input[type="email"],
.bs-whetstone input[type="date"],
.bs-whetstone select,
.bs-whetstone textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--ws-field-line);
  border-radius: 6px;
  background: var(--ws-surface);
  color: var(--ws-ink);
  font: inherit;
}

.bs-whetstone textarea {
  min-height: 90px;
  resize: vertical;
}

.bs-whetstone .ws-hint {
  margin: 0 0 8px;
  color: var(--ws-muted);
  font-size: 13px;
}

.bs-whetstone .ws-more {
  margin: 0 0 12px;
}

.bs-whetstone .ws-more > summary {
  color: var(--ws-accent-dark);
  font-weight: 600;
  cursor: pointer;
}

/* Buttons and actions */
.bs-whetstone .ws-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
}

.bs-whetstone .ws-btn {
  padding: 8px 16px !important;
  border: 1px solid var(--ws-accent) !important;
  border-radius: 6px !important;
  background: var(--ws-surface) !important;
  color: var(--ws-accent-dark) !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  transform: none !important;
  cursor: pointer;
}

.bs-whetstone .ws-btn-primary {
  background: var(--ws-accent) !important;
  color: #ffffff !important;
}

.bs-whetstone .ws-btn-primary:hover {
  background: var(--ws-accent-dark) !important;
}

.bs-whetstone .ws-btn-danger {
  border-color: var(--ws-danger) !important;
  color: var(--ws-danger) !important;
}

.bs-whetstone .ws-btn-small {
  padding: 4px 10px !important;
  font-size: 13px !important;
}

.bs-whetstone .ws-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.bs-whetstone .ws-status {
  color: var(--ws-muted);
  font-size: 13px;
}

.bs-whetstone .ws-status.is-error {
  color: var(--ws-danger);
}

.bs-whetstone .ws-status.is-ok {
  color: var(--ws-ok);
}

/* Phase switch: Before | During | After */
.bs-whetstone .ws-phases {
  display: flex;
  gap: 0;
  margin: 4px 0 12px;
  border-bottom: 2px solid var(--ws-line);
}

.bs-whetstone .ws-phase-tab {
  margin: 0 0 -2px !important;
  padding: 8px 18px !important;
  border: 0 !important;
  border-bottom: 3px solid transparent !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: var(--ws-muted) !important;
  font-weight: 600 !important;
  min-height: 44px;
  cursor: pointer;
}

.bs-whetstone .ws-phase-tab[aria-selected="true"] {
  border-bottom-color: var(--ws-accent) !important;
  color: var(--ws-accent-dark) !important;
}

.bs-whetstone .ws-panel {
  margin: 0 0 8px;
}

/* Rows */
.bs-whetstone .ws-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.bs-whetstone .ws-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--ws-line);
  border-left-width: 5px;
  border-radius: 8px;
  background: var(--ws-surface);
}

.bs-whetstone .ws-row.is-planned {
  border-left-color: var(--ws-warn-line);
}

.bs-whetstone .ws-row.is-held {
  border-left-color: var(--ws-ok-line);
}

.bs-whetstone .ws-row.is-cancelled,
.bs-whetstone .ws-row.is-ended {
  border-left-color: var(--ws-neutral-line);
}

.bs-whetstone .ws-row.is-active {
  border-left-color: var(--ws-ok-line);
}

.bs-whetstone .ws-row.is-paused {
  border-left-color: var(--ws-warn-line);
}

.bs-whetstone .ws-row.is-selected {
  background: var(--ws-accent-tint);
  border-color: var(--ws-accent);
}

.bs-whetstone .ws-row-main {
  flex: 1 1 160px;
  min-width: 0;
  text-align: left;
}

.bs-whetstone .ws-row-open {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: inherit !important;
  cursor: pointer;
  display: block !important;
  text-align: left !important;
}

.bs-whetstone .ws-row-title {
  display: block;
  margin: 0;
  color: var(--ws-ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.bs-whetstone .ws-row-meta {
  display: block;
  margin: 2px 0 0;
  color: var(--ws-muted);
  font-size: 13px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.bs-whetstone .ws-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Empty state and gate */
.bs-whetstone .ws-empty {
  margin: 8px 0 0;
  padding: 12px;
  border: 1px dashed var(--ws-line);
  border-radius: 8px;
  color: var(--ws-muted);
}

.bs-whetstone .ws-gate {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--ws-warn-line);
  border-radius: 8px;
  background: var(--ws-warn-tint);
  color: var(--ws-warn);
}

/* Status chips */
.bs-whetstone .ws-chip {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--ws-neutral-line);
  border-radius: 999px;
  background: var(--ws-tint);
  color: var(--ws-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.bs-whetstone .ws-chip.is-held,
.bs-whetstone .ws-chip.is-active {
  border-color: var(--ws-ok-line);
  background: var(--ws-ok-tint);
  color: var(--ws-ok);
}

.bs-whetstone .ws-chip.is-planned,
.bs-whetstone .ws-chip.is-paused {
  border-color: var(--ws-warn-line);
  background: var(--ws-warn-tint);
  color: var(--ws-warn);
}

/* RAID log of a session (tab 1, under the phase panels). WHETSTONE-CSS-RAID
 * Type pills follow the colour per type of a RAID card; status shows as the row's left border. */
.bs-whetstone .ws-raid {
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--ws-line);
}

.bs-whetstone .ws-raid-head {
  margin: 0 0 8px;
}

.bs-whetstone .ws-raid-title {
  margin: 0 0 2px;
  color: var(--ws-ink);
  font-size: 15px;
  font-weight: 700;
}

.bs-whetstone .ws-raid-sub {
  margin: 16px 0 0;
  color: var(--ws-ink);
  font-size: 13px;
  font-weight: 700;
}

.bs-whetstone .ws-raid-form {
  min-width: 0;
  margin: 0 0 8px;
  padding: 12px;
  border: 1px solid var(--ws-line);
  border-radius: 8px;
  background: var(--ws-tint);
}

.bs-whetstone .ws-raid-form[disabled] {
  opacity: 0.6;
}

.bs-whetstone .ws-raid-legend {
  padding: 0 4px;
  color: var(--ws-ink);
  font-weight: 600;
}

.bs-whetstone .ws-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.bs-whetstone .ws-raid-row-status select {
  width: auto;
  padding: 4px 8px;
  font-size: 13px;
}

.bs-whetstone .ws-row.is-raid-open {
  border-left-color: var(--ws-accent);
}

.bs-whetstone .ws-row.is-raid-in_progress {
  border-left-color: #1d4ed8;
}

.bs-whetstone .ws-row.is-raid-blocked {
  border-left-color: var(--ws-danger);
}

.bs-whetstone .ws-row.is-raid-closed {
  border-left-color: var(--ws-ok-line);
  background: var(--ws-tint);
}

.bs-whetstone .ws-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #64748b;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bs-whetstone .ws-pill.is-type-risk {
  background: #b91c1c;
}

.bs-whetstone .ws-pill.is-type-issue {
  background: #c2410c;
}

.bs-whetstone .ws-pill.is-type-assumption {
  background: #854d0e;
}

.bs-whetstone .ws-pill.is-type-action {
  background: #15803d;
}

.bs-whetstone .ws-pill.is-type-dependency {
  background: #6d28d9;
}

.bs-whetstone .ws-pill.is-type-decision {
  background: #0369a1;
}

.bs-whetstone .ws-chip.is-priority-high {
  border-color: #fca5a5;
  background: #fef2f2;
  color: var(--ws-danger);
}

.bs-whetstone .ws-chip.is-priority-low {
  border-color: var(--ws-line);
  background: var(--ws-surface);
  color: var(--ws-muted);
}

/* WHETSTONE-CSS-PART3: stacked card rows and the file input on the People tab */
.bs-whetstone .ws-split + .ws-split {
  margin-top: 16px;
}

.bs-whetstone input[type="file"] {
  display: block;
  max-width: 100%;
  font-size: 14px;
}

/* WHETSTONE-CSS-PART4: the stage editor on the Frameworks tab */
.bs-whetstone .ws-stage-list {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.bs-whetstone .ws-stage {
  padding: 12px;
  border: 1px solid var(--ws-neutral-line);
  border-radius: 10px;
  background: var(--ws-tint);
}

/* WHETSTONE-CSS-PART5: the AI suggestion blocks in the phase panels */
.bs-whetstone .ws-ai {
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--ws-neutral-line);
  border-radius: 10px;
}

.bs-whetstone .ws-ai-title,
.bs-whetstone .ws-ai-result-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.bs-whetstone .ws-ai-disclaimer {
  margin: 0 0 10px;
  color: var(--ws-muted);
  font-size: 13px;
}

.bs-whetstone .ws-ai-output:not(:empty) {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ws-neutral-line);
}

.bs-whetstone .ws-ai-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* WHETSTONE-CSS-ACTION-PLAN: the session summary card, the RAID picks and the Action plan tab */
.bs-whetstone .ws-summary-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--ws-line);
  border-radius: 10px;
  background: var(--ws-tint);
}

.bs-whetstone .ws-raid-picks .ws-check {
  display: block;
  margin: 4px 0;
}

.bs-whetstone .ws-plan-action {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 6px;
  margin-bottom: 6px;
}

.bs-whetstone .ws-plan-readonly {
  white-space: pre-wrap;
}

/* WHETSTONE-CSS-QUIET: the Version history card is secondary to the plan above it. */
.bs-whetstone .ws-card-quiet .ws-card-head {
  background: transparent;
}

.bs-whetstone .ws-card-quiet .ws-card-title {
  color: var(--ws-muted);
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .bs-whetstone .ws-plan-action {
    grid-template-columns: 1fr;
  }

  /* Phone touch targets: every Whetstone button (New session's ws-btn-small was 26px) at least 44px tall. */
  .bs-whetstone .ws-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* WHETSTONE-CSS-PART6: the ask-the-coach dialog */
.bs-whetstone .ws-dialog {
  width: min(720px, 94vw);
  max-height: 88vh;
  padding: 18px;
  border: 1px solid var(--ws-neutral-line);
  border-radius: 12px;
}

.bs-whetstone .ws-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.bs-whetstone .ws-chat-log {
  max-height: 40vh;
  overflow-y: auto;
  margin: 10px 0;
}

.bs-whetstone .ws-chat-question {
  margin: 10px 0 4px;
  font-weight: 700;
}

.bs-whetstone .ws-chat-answer {
  padding: 8px 12px;
  border-left: 3px solid var(--ws-neutral-line);
  white-space: pre-wrap;
}

/* WHETSTONE-CSS-PART7: the external AI round trip (prompt box, import form, Recommendations card). */
.bs-whetstone .ws-external {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--ws-neutral-line);
}

.bs-whetstone .ws-external-include {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid var(--ws-neutral-line);
  border-radius: 8px;
}

.bs-whetstone .ws-external-include .ws-check {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.bs-whetstone .ws-external-text {
  max-height: 40vh;
  overflow-y: auto;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid var(--ws-neutral-line);
  border-radius: 8px;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bs-whetstone .ws-external-card,
.bs-whetstone .ws-external-import {
  margin-top: 10px;
}

/* WHETSTONE-CSS-PART8: copy to another group and anonymize (the Edit person tools, the two dialogs, the Anonymized chip). */
.bs-whetstone .ws-client-tools {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ws-line);
}

.bs-whetstone .ws-chip.is-anonymized {
  border-color: var(--ws-neutral-line);
  background: var(--ws-surface);
  color: var(--ws-ink);
}

.bs-whetstone .ws-anonymize-list {
  margin: 0 0 12px;
  padding-left: 20px;
}

.bs-whetstone .ws-anonymize-list li {
  margin-bottom: 4px;
}

.bs-whetstone .ws-anonymize-linked {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--ws-neutral-line);
  border-radius: 8px;
}

/* Working with: the active person strip shown at the top of every tab (WHETSTONE-JS-ACTIVE-PERSON) */
.bs-whetstone .ws-working {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--ws-line);
  border-radius: 8px;
  background: var(--ws-tint);
  color: var(--ws-ink);
  font-weight: 600;
}

.bs-whetstone .ws-working.is-none {
  font-weight: 400;
  font-style: italic;
}

/* The active person's row in the People list */
.bs-whetstone .ws-row.is-active-person {
  border-color: var(--ws-ink);
  box-shadow: inset 4px 0 0 var(--ws-ink);
}

/* Filters in a row above a list (Sessions, the person Tracker) */
.bs-whetstone .ws-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin: 0 0 8px;
}

.bs-whetstone .ws-filters .ws-field {
  min-width: 150px;
}

/* The Tracker is a card of its own on every tab; the Draft email card keeps the AI card look */
.bs-whetstone .ws-email .ws-email-result {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ws-line);
}

.bs-whetstone .ws-email textarea[data-bs-whetstone-field="email_body"] {
  min-height: 220px;
}

.bs-whetstone .ws-plan-picks {
  margin-top: 8px;
}

/* WHETSTONE-CSS-FRAMEWORK-AI: the prompt for another AI on the Frameworks tab */
.bs-whetstone textarea[data-bs-whetstone-field="framework_ai_prompt"] {
  box-sizing: border-box;
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
