/* View-specific cells and forms for Schedules, Webhooks and MCP & Agents.
   Toolbars, segmented controls, cards, tables and empty states come from styles.css
   (.toolbar, .segmented, .surface-card, .data-table, .empty-state); nothing here redraws them.
   Every class is prefixed .wf- so nothing here collides with styles.css. */

.wf-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-3);
  font: 500 12px/1 var(--sans);
  white-space: nowrap;
}

.wf-tag .icon {
  width: 12px;
  height: 12px;
}

/* ---------- table cells ---------- */

/* The free-text column takes the remaining width and truncates instead of stretching the table. */
.data-table .wf-post-cell,
.data-table .wf-url-cell {
  width: 100%;
  max-width: 0;
}

.wf-post {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.wf-marks {
  display: inline-flex;
  flex: none;
  gap: 4px;
}

.wf-post-text {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-post-text.is-muted {
  color: var(--ink-4);
}

.wf-when {
  grid-template-columns: minmax(0, 1fr);
  display: grid;
  gap: 2px;
}

.wf-when-rel {
  color: var(--ink);
  font: 500 13px/18px var(--sans);
  font-variant-numeric: tabular-nums;
}

.wf-when-rel.is-past {
  color: var(--ink-2);
  font-weight: 400;
}

.wf-when-abs {
  color: var(--ink-4);
  font-size: 12px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

.wf-url {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font: 400 12.5px/18px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-mono-dim {
  color: var(--ink-3);
  font: 400 12px/18px var(--mono);
}

.wf-pills {
  display: inline-flex;
  gap: 4px;
}

.wf-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ground);
  color: var(--ink-2);
  font: 400 11.5px/1 var(--mono);
  white-space: nowrap;
}

/* ---------- one-time secret banner ---------- */

.wf-secret {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px 16px 16px 18px;
  border: 1px solid rgba(138, 124, 254, 0.32);
  border-radius: var(--radius);
  background: rgba(138, 124, 254, 0.06);
}

.wf-secret-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(138, 124, 254, 0.34);
  border-radius: 8px;
  color: var(--violet);
}

.wf-secret-icon .icon {
  width: 15px;
  height: 15px;
}

.wf-secret-body {
  grid-template-columns: minmax(0, 1fr);
  display: grid;
  gap: 10px;
  min-width: 0;
}

.wf-secret-title {
  color: var(--ink);
  font: 600 13.5px/18px var(--sans);
}

.wf-secret-sub {
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-secret-sub code,
.wf-secret-note code {
  color: var(--ink-2);
  font: 400 12px/1 var(--mono);
}

.wf-secret-note {
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 18px;
}

/* ---------- modal forms ---------- */

.wf-form {
  grid-template-columns: minmax(0, 1fr);
  display: grid;
  gap: 18px;
  min-width: 0;
}

.wf-field {
  grid-template-columns: minmax(0, 1fr);
  display: grid;
  gap: 8px;
  min-width: 0;
}

.wf-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.wf-label {
  color: var(--ink-2);
  font: 500 12.5px/16px var(--sans);
}

.wf-label-meta {
  color: var(--ink-4);
  font: 400 11.5px/16px var(--mono);
  font-variant-numeric: tabular-nums;
}

.wf-label-meta.is-over {
  color: var(--red);
}

.wf-input,
.wf-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ground);
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  transition: border-color 120ms;
}

.wf-input {
  height: var(--field-h);
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 13px;
}

.wf-textarea {
  min-height: 96px;
  padding: 10px 12px;
  line-height: 20px;
  resize: vertical;
}

.wf-input::placeholder,
.wf-textarea::placeholder {
  color: var(--ink-4);
}

.wf-input:focus,
.wf-textarea:focus {
  border-color: #3a3a3a;
}

.wf-input:focus-visible,
.wf-textarea:focus-visible,
.wf-chip:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

.wf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wf-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ground);
  color: var(--ink-3);
  font: 500 12.5px/1 var(--sans);
  white-space: nowrap;
  transition:
    color 120ms,
    border-color 120ms,
    background-color 120ms;
}

.wf-chip:hover {
  border-color: #2e2e2e;
  color: var(--ink);
}

.wf-chip[aria-pressed="true"] {
  border-color: #3a3a3a;
  background: var(--raised);
  color: var(--ink);
}

.wf-chip .pf-logo {
  width: 13px;
  height: 13px;
  opacity: 0.55;
  transition: opacity 120ms;
}

.wf-chip[aria-pressed="true"] .pf-logo {
  opacity: 1;
}

.wf-chip-tick {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border: 1px solid #333;
  border-radius: 4px;
  color: transparent;
}

.wf-chip-tick .icon {
  width: 10px;
  height: 10px;
  stroke-width: 2.6;
}

.wf-chip[aria-pressed="true"] .wf-chip-tick {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--ground);
}

.wf-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ground);
}

.wf-summary > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 12px;
  border-left: 1px solid var(--line-soft);
}

.wf-summary > div:first-child {
  border-left: 0;
}

.wf-summary-k {
  color: var(--ink-4);
  font-size: 11.5px;
  line-height: 14px;
}

.wf-summary-v {
  overflow: hidden;
  color: var(--ink);
  font: 500 13px/18px var(--sans);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-summary-sub {
  color: var(--ink-4);
  font-size: 11.5px;
  line-height: 14px;
  font-variant-numeric: tabular-nums;
}

.wf-event-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ground);
}

.wf-event {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 9px 12px;
  border-top: 1px solid var(--line-soft);
}

.wf-event:first-child {
  border-top: 0;
}

.wf-event code {
  color: var(--ink);
  font: 400 12px/18px var(--mono);
}

.wf-event span {
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 18px;
}

.wf-form-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 18px;
}

.wf-form-note .icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  flex: none;
  color: var(--ink-4);
}

.wf-form-note code {
  color: var(--ink-2);
  font: 400 12px/1 var(--mono);
}

.wf-form-error {
  color: var(--red);
  font-size: 12.5px;
  line-height: 18px;
}

.wf-form-error:empty {
  display: none;
}

.wf-form-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}

/* ---------- MCP layout ---------- */

.wf-mcp-pre {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;
  background: var(--ground);
  color: var(--ink-2);
  font: 400 12.5px/1.65 var(--mono);
}

.wf-mcp-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line-soft);
  background: var(--line-soft);
}

.wf-mcp-tool {
  display: grid;
  gap: 6px;
  padding: 14px 20px;
  background: var(--surface);
}

.wf-mcp-tool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wf-mcp-tool-top code {
  color: var(--ink);
  font: 500 12.5px/1.3 var(--mono);
}

.wf-mcp-tool p {
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 18px;
}

.wf-mcp-prompts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.wf-mcp-prompts-label {
  font-size: 12px;
  color: var(--ink-4);
  white-space: nowrap;
}

.wf-mcp-prompt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wf-prompt-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: 400 12.5px/1 var(--sans);
  transition:
    border-color 120ms,
    color 120ms,
    background-color 120ms;
}

.wf-prompt-chip .icon {
  width: 12px;
  height: 12px;
  color: var(--ink-4);
}

.wf-prompt-chip:hover {
  border-color: #36363b;
  background: var(--raised);
  color: var(--ink);
}

.qs-modal-top {
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .wf-mcp-tools {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- MCP code and tool badges ---------- */

.wf-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 6px 20px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-4);
  font: 400 11.5px/1 var(--mono);
}

.wf-tok-key {
  color: var(--ink);
}

.wf-tok-str {
  color: var(--green);
}

.wf-tok-flag {
  color: var(--violet);
}

.wf-tok-var {
  color: var(--amber);
}

.wf-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-3);
  font: 500 11px/1 var(--sans);
  white-space: nowrap;
}

.wf-badge::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  content: "";
}

.wf-badge.is-write {
  border-color: rgba(254, 196, 111, 0.28);
  color: var(--amber);
}

.wf-badge.is-write::before {
  background: var(--amber);
}

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .wf-secret {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .wf-secret-icon {
    display: none;
  }

  .wf-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .wf-summary > div {
    border-top: 1px solid var(--line-soft);
    border-left: 0;
  }

  .wf-summary > div:first-child {
    border-top: 0;
  }

  .wf-event {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}
