/* Agentic workbench (prototype) — Claude-Code-shaped three-region layout.
 * Reuses tokens.css + web.css (masthead, .toggle/.level-btn, .submit-btn,
 * .error-box, .body-copy). Structural ink hairlines, white paper, no radius. */

.workbench {
  display: block;
}

/* Three columns separated by ink hairlines (the gap shows the ink background). */
.wb-grid {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 340px;
  gap: 1px;
  background: var(--ink);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
@media (max-width: 1040px) {
  .wb-grid {
    grid-template-columns: 1fr;
  }
}

.wb-col {
  background: var(--paper);
  padding: 20px;
  min-width: 0;
}

.wb-col-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 18px;
}
.wb-index {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
}
.wb-col-title {
  font-size: 16px;
  font-weight: 700;
}

/* Cards — structural ink border, never a tinted fill. */
.wb-card {
  border: 1px solid var(--ink);
  padding: 14px;
  margin-bottom: 16px;
}
.wb-card-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.wb-card-note {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}

.wb-rule-list {
  list-style: none;
  margin-top: 10px;
  font-size: 14px;
}
.wb-rule-list li {
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2);
}
.wb-rule-list li:last-child {
  border-bottom: none;
}
.wb-rule-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue);
  margin-right: 8px;
}

/* Left column toggle inherits .toggle/.level-btn from web.css. */
.wb-context .toggle {
  width: 100%;
}

/* --- center: source + document ------------------------------------------ */
.wb-textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  padding: 12px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
  margin-bottom: 14px;
}
.wb-source.wb-collapsed {
  display: none;
}

.wb-url-row {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}
.wb-url-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}
.wb-load-btn {
  flex: 0 0 auto;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-left: none;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
.wb-load-btn:hover {
  background: var(--blue);
  border-color: var(--blue);
}
.wb-load-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.wb-document {
  position: relative;
  margin-top: 8px;
  /* A fixed-height, scrollable box so the document never resizes the page as it
   * loads — the article scrolls inside instead. The user can drag the bottom
   * edge to make it taller. */
  height: 460px;
  min-height: 200px;
  overflow-y: auto;
  resize: vertical;
  border: 1px solid var(--rule);
  padding: 16px 18px;
  background: var(--paper);
}
.wb-document.wb-busy {
  opacity: 0.55;
  pointer-events: none;
}
.wb-doc-placeholder {
  color: var(--ink-3);
  font-style: italic;
  padding: 8px 0;
}

/* progress signal in the column head */
.wb-progress {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wb-progress-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.wb-progress-bar {
  display: block;
  width: 110px;
  height: 6px;
  background: var(--off);
  border: 1px solid var(--ink);
}
.wb-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
  transition: width 0.3s ease;
}

/* --- inline lint underlines --------------------------------------------- */
.wb-lint {
  text-decoration: underline wavy;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  cursor: help;
}
.wb-lint-warn {
  text-decoration-color: var(--blue);
}
.wb-lint-error {
  text-decoration-color: var(--error);
}
.wb-lint-info {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink-3);
}
.wb-lint-sentence {
  background: var(--blue-wash);
  border-left: 3px solid var(--blue);
  padding-left: 8px;
}

/* --- floating span-action toolbar --------------------------------------- */
.wb-span-toolbar {
  position: fixed;
  z-index: 50;
  display: flex;
  gap: 1px;
  background: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 0 2px 10px rgba(12, 26, 42, 0.28);
}
.wb-span-toolbar button {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 11px;
  background: var(--paper);
  color: var(--ink);
  border: none;
  cursor: pointer;
}
.wb-span-toolbar button:hover {
  background: var(--blue);
  color: #fff;
}

/* --- right: tool log + tasks -------------------------------------------- */
.wb-log,
.wb-tasks {
  list-style: none;
  font-size: 13px;
}
.wb-log {
  max-height: 320px;
  overflow: auto;
}
.wb-log-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
.wb-log-tool {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
}
.wb-log-label {
  font-size: 13px;
  color: var(--ink);
}
.wb-log-running .wb-log-label::after {
  content: " · läuft …";
  color: var(--ink-3);
}
.wb-log-done .wb-log-tool::before {
  content: "✓ ";
  color: var(--ok);
}
.wb-log-summary {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--ink-3);
}
.wb-log-note {
  color: var(--error);
  font-size: 13px;
  padding: 8px 0;
}
.wb-log-clean {
  color: var(--ok);
  font-weight: 700;
  padding: 8px 0;
}
.wb-log-empty {
  color: var(--ink-3);
  font-size: 13px;
  font-style: italic;
}

.wb-task-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  text-transform: none;
  letter-spacing: 0;
}
.wb-task {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  align-items: flex-start;
}
.wb-task-box {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  margin-top: 2px;
}
.wb-task-error .wb-task-box {
  border-color: var(--error);
}
.wb-task-body {
  min-width: 0;
}
.wb-task-rule {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.wb-task-msg {
  font-size: 13px;
  color: var(--ink-2);
}
.wb-task-done {
  opacity: 0.55;
}
.wb-task-done .wb-task-box {
  background: var(--ok);
  border-color: var(--ok);
}
.wb-task-done .wb-task-msg {
  text-decoration: line-through;
}

/* Clickable open tasks — the user can ask the agent to fix one. */
.wb-task-clickable {
  cursor: pointer;
}
.wb-task-clickable:hover {
  background: var(--blue-wash);
}
.wb-task-action {
  display: inline-block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.wb-task-clickable:hover .wb-task-action {
  opacity: 1;
}
/* Advisory (info) findings read as optional hints, not blocking violations. */
.wb-task-advisory .wb-task-box {
  border-style: dashed;
}
/* A task being fixed right now. */
.wb-task-working {
  opacity: 0.6;
  pointer-events: none;
}
.wb-task-working .wb-task-action {
  opacity: 1;
}
.wb-task-working .wb-task-action::after {
  content: " …läuft";
}

.submit-btn.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

/* Beta chip used in the home masthead link. */
.beta-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  background: var(--blue);
  color: #fff;
  padding: 1px 4px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.05em;
}
