/* ============================================================
   Bluestream · Platform styles
   ============================================================
   GMC Matcher + Work Instruction Generator
   Depends on /style.css for base tokens (--accent, --surface, etc.)
   ============================================================ */

/* ---------- Platform header (sticky under main nav) ---------- */
.platform-header {
  position: sticky;
  top: 56px;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-s);
}

.tool-strip {
  display: flex;
  align-items: stretch;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tool-strip::-webkit-scrollbar { display: none; }

.tool-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 28px 13px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-family: var(--sans);
  text-align: left;
  transition: all .18s;
  flex-shrink: 0;
  color: var(--text-mid);
}
.tool-tab:hover { background: var(--surface2); }
.tool-tab.active {
  border-bottom-color: var(--accent);
  background: var(--accent-l);
  color: var(--accent);
}
.tool-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.tool-tab-divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
  margin: 8px 0;
}

.tool-panel { display: none; }
.tool-panel.active { display: block; }

/* ---------- Status strip with crumbs and context pill ---------- */
.platform-status {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 7px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  overflow-x: auto;
  scrollbar-width: none;
}
.platform-status::-webkit-scrollbar { display: none; }
.status-crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.status-crumb.done { color: var(--success); }
.status-crumb.active { color: var(--accent); font-weight: 700; }
.status-sep { color: var(--border-s); }

/* Context pill — GAP #10: carries concept_no + attached file */
.cc-context-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cc-context-pill {
  padding: 2px 10px;
  border-radius: 20px;
  background: var(--accent-l);
  border: 1px solid var(--accent-m);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.cc-file-chip {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 2px 10px 2px 8px;
  border-radius: 20px;
  background: var(--success-l);
  border: 1px solid #bbf7d0;
  color: #15803d;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-file-chip.visible { display: inline-flex; }
.cc-file-chip svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cc-file-chip .chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Main analyse layout (sidebar + results) ---------- */
.analyse-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  min-height: calc(100vh - 105px);
}

.input-panel {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 24px;
  position: sticky;
  top: 105px;
  height: calc(100vh - 105px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-bottom: 10px;
}

/* ---------- Upload zone — GAPS #1, #2 ---------- */
.upload-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--r);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface2);
  position: relative;
  overflow: hidden;
}
.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(26,125,232,0) 0%, rgba(26,125,232,.06) 100%);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.upload-zone:hover,
.upload-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-l);
}
.upload-zone:hover::before,
.upload-zone.dragging::before { opacity: 1; }

.upload-icon-box {
  width: 40px;
  height: 40px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  transition: all .2s;
  position: relative;
  z-index: 1;
}
.upload-zone:hover .upload-icon-box,
.upload-zone.dragging .upload-icon-box {
  background: var(--accent-l);
  border-color: var(--accent-m);
}
.upload-icon-box svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-mid);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .2s;
}
.upload-zone:hover .upload-icon-box svg,
.upload-zone.dragging .upload-icon-box svg { stroke: var(--accent); }

.upload-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
  position: relative;
  z-index: 1;
}
.upload-sub {
  font-size: 11px;
  color: var(--text-dim);
  position: relative;
  z-index: 1;
}
.upload-formats {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.format-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}
/* Size hint under formats */
.upload-limits {
  margin-top: 8px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-dim);
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

#file-input { display: none; }

.file-loaded {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--success-l);
  border: 1px solid #bbf7d0;
  border-radius: var(--r-s);
  margin-top: 8px;
}
.file-loaded.visible { display: flex; }

.file-icon-box {
  width: 30px;
  height: 30px;
  background: #dcfce7;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-icon-box svg {
  width: 14px;
  height: 14px;
  stroke: var(--success);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.file-meta { flex: 1; min-width: 0; }
.file-meta .fname {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta .fsize {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.remove-file {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px;
  transition: color .15s;
  flex-shrink: 0;
}
.remove-file:hover { color: var(--danger); }

/* ---------- Form fields ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
}
.field input,
.field textarea {
  padding: 9px 11px;
  border-radius: var(--r-s);
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.field input:focus,
.field textarea:focus { border-color: var(--accent); }
.field textarea {
  resize: vertical;
  min-height: 60px;
}

/* ---------- Primary action button ---------- */
.run-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: var(--r-s);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--shadow-s);
  margin-top: auto;
}
.run-btn:hover {
  background: #292524;
  box-shadow: var(--shadow-m);
}
.run-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.run-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Results panel ---------- */
.results-panel {
  padding: 28px 32px;
  background: var(--bg);
}

.results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  color: var(--text-dim);
}
.results-empty-icon {
  width: 56px;
  height: 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.results-empty-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-dim);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.results-empty h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 6px;
}
.results-empty p {
  font-size: 13px;
  max-width: 300px;
  line-height: 1.6;
}

.status-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  box-shadow: var(--shadow-s);
}
.status-bar.visible { display: flex; }
.status-text {
  font-size: 13px;
  color: var(--text-mid);
}

.error-bar {
  display: none;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--danger-l);
  border: 1px solid #fecaca;
  border-radius: var(--r-s);
  font-size: 13px;
  color: var(--danger);
}
.error-bar.visible { display: block; }

.results-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.results-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.results-count {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-s);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.summary-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.summary-label-row .summary-label { margin-bottom: 0; }
.summary-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: 6px;
  font-family: var(--mono);
}
.summary-text {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.65;
}

.doc-status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: var(--mono);
  letter-spacing: .04em;
  border: 1px solid;
}
.doc-status-badge.no-doc {
  background: var(--surface2);
  color: var(--text-dim);
  border-color: var(--border);
}
.doc-status-badge.unreadable {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.doc-status-badge.read {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

/* ---------- No-match prompt ---------- */
.no-match-prompt {
  display: none;
  margin-bottom: 20px;
  padding: 16px 20px;
  border-radius: var(--r);
  background: #fef9c3;
  border: 1px solid #fde68a;
}
.no-match-prompt.visible {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.no-match-prompt svg {
  width: 20px;
  height: 20px;
  stroke: #d97706;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  margin-top: 1px;
}
.no-match-prompt-title {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 4px;
}
.no-match-prompt-text {
  font-size: 12px;
  color: #a16207;
  line-height: 1.55;
}
.no-match-prompt-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 14px;
  border-radius: var(--r-s);
  background: #92400e;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  font-family: var(--sans);
  transition: opacity .15s;
}
.no-match-prompt-link:hover { opacity: .85; }

/* ---------- Match cards ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 12px;
  box-shadow: var(--shadow-s);
  overflow: hidden;
  animation: fadeUp .3s ease both;
  transition: box-shadow .2s, border-color .2s;
}
.match-card:hover { box-shadow: var(--shadow-m); }
.match-card:nth-child(1) { animation-delay: .00s; }
.match-card:nth-child(2) { animation-delay: .05s; }
.match-card:nth-child(3) { animation-delay: .10s; }
.match-card:nth-child(4) { animation-delay: .15s; }
.match-card:nth-child(5) { animation-delay: .20s; }

.match-card-top {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}
.match-card-top:hover { background: var(--surface2); }

.donut-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.donut-svg {
  width: 48px;
  height: 48px;
  transform: rotate(-90deg);
}
.donut-bg {
  fill: none;
  stroke: var(--bg2);
  stroke-width: 4;
}
.donut-fg {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}
.donut-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
}

.match-main {
  flex: 1;
  min-width: 0;
}
.match-id {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}
.match-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.match-meta {
  font-size: 12px;
  color: var(--text-dim);
}

.match-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.expand-icon {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform .25s;
}
.match-card-top.open .expand-icon { transform: rotate(180deg); }

.match-card-body {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.match-card-body.open { display: block; }

/* Plan ID hero */
.plan-id-hero { padding: 20px 20px 0; }
.plan-id-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
}
.plan-id-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-bottom: 4px;
}
.plan-id-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .02em;
}
.plan-id-desc {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 2px;
}
.copy-btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: var(--r-s);
  background: var(--accent-l);
  border: 1px solid var(--accent-m);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  gap: 6px;
}
.copy-btn:hover { background: #dbeafe; }
.copy-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rationale-row {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.65;
}
.rationale-row strong {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  display: block;
  margin-bottom: 5px;
}

.attrs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.attr-cell {
  background: var(--surface2);
  padding: 12px 16px;
}
.attr-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-bottom: 4px;
}
.attr-val {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

/* PM section inside match card */
.pm-section { padding: 20px; }
.pm-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pm-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.pm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.pm-table thead tr { background: var(--bg2); }
.pm-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  font-family: var(--mono);
  border-bottom: 1px solid var(--border);
}
.pm-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-mid);
  vertical-align: top;
  line-height: 1.4;
}
.pm-table tr:last-child td { border-bottom: none; }
.pm-table tr:hover td { background: rgba(29, 78, 216, .03); }

/* Strategy pills */
.strategy-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  border: 1px solid;
  white-space: nowrap;
}
.s-calendar {
  color: var(--accent);
  border-color: #bfdbfe;
  background: var(--accent-l);
}
.s-condition {
  color: var(--success);
  border-color: #bbf7d0;
  background: var(--success-l);
}
.s-firstline {
  color: var(--warn);
  border-color: #fde68a;
  background: var(--warn-l);
}

.freq-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.pm-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* ---------- Intervals section — GAPS #6, #8, #16 ---------- */
.routines-section {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
}
.routines-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.routines-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.routines-empty {
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 0;
}

/* Strategy legend — GAP #16 */
.strategy-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: var(--r-s);
  background: var(--bg2);
  border: 1px solid var(--border);
  font-size: 11px;
}
.strategy-legend-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
}
.strategy-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-mid);
}
.strategy-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.strategy-legend-dot.cal { background: var(--accent); }
.strategy-legend-dot.cond { background: var(--success); }
.strategy-legend-dot.fl { background: var(--warn); }

/* Cascade hint — GAP #6 */
.cascade-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-s);
  background: var(--accent-l);
  border: 1px solid var(--accent-m);
  font-size: 11px;
  color: #1d4ed8;
  line-height: 1.55;
  margin-bottom: 12px;
}
.cascade-hint svg {
  width: 14px;
  height: 14px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  margin-top: 1px;
}
.cascade-hint strong { font-weight: 700; }
.cascade-hint-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 4px;
  opacity: .6;
  transition: opacity .15s;
}
.cascade-hint-close:hover { opacity: 1; }

/* Interval cards */
.interval-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  overflow: hidden;
  margin-bottom: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.interval-card:hover {
  border-color: var(--accent-m);
  box-shadow: 0 2px 8px rgba(29, 78, 216, .08);
}

.interval-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
}
.interval-freq {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.interval-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.interval-task-row {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  align-items: flex-start;
}
.interval-task-row:last-child { border-bottom: none; }
.interval-task-type {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  padding-top: 1px;
  min-width: 32px;
}
.interval-task-desc { color: var(--text-mid); }

.interval-carried {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--accent-l);
  border-radius: var(--r-s);
  border: 1px solid var(--accent-m);
}

/* Generate WI button — GAP #8 prominence */
.wi-gen-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: var(--r-s);
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, #1a4b82, #1a7de8);
  border: 1px solid var(--accent);
  color: #fff;
  cursor: pointer;
  transition: all .18s;
  font-family: var(--sans);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(26, 125, 232, .25);
}
.wi-gen-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 125, 232, .35);
}
.interval-card:hover .wi-gen-btn {
  box-shadow: 0 3px 10px rgba(26, 125, 232, .3);
}
.wi-gen-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
.wi-gen-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Work Instruction panel ---------- */
.wi-panel {
  padding: 32px 40px;
  max-width: 680px;
  margin: 0 auto;
}
.wi-panel-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.wi-panel-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 28px;
  line-height: 1.6;
}

.wi-context-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.wi-context-item label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  font-family: var(--mono);
  display: block;
  margin-bottom: 3px;
}
.wi-context-item span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.wi-doc-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: var(--r-s);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
  border: 1px solid;
}
.wi-doc-status.has-doc {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}
.wi-doc-status.no-doc {
  background: #fef9c3;
  border-color: #fde68a;
  color: #92400e;
}
.wi-doc-status svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
}

/* Asset form — GAP #3 grouping */
.wi-form-section {
  margin-bottom: 18px;
}
.wi-form-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wi-form-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.wi-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.wi-form-grid.three-col {
  grid-template-columns: 1fr 1fr 1fr;
}

.wi-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wi-field.span-2 { grid-column: span 2; }

.wi-field label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  font-family: var(--mono);
}
.wi-field input {
  padding: 8px 10px;
  border-radius: var(--r-s);
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.wi-field input:focus { border-color: var(--accent); }
.wi-field input.warn {
  border-color: #fde68a;
  background: #fffbeb;
}

/* Soft hint block — GAP #13 */
.wi-soft-hint {
  display: none;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  margin-bottom: 16px;
  border-radius: var(--r-s);
  background: #fef9c3;
  border: 1px solid #fde68a;
  font-size: 12px;
  color: #92400e;
  line-height: 1.55;
}
.wi-soft-hint.visible { display: flex; }
.wi-soft-hint svg {
  width: 14px;
  height: 14px;
  stroke: #92400e;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  margin-top: 1px;
}
.wi-soft-hint-actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wi-soft-hint button {
  background: none;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--sans);
  transition: background .15s;
}
.wi-soft-hint button:hover { background: #fef3c7; }
.wi-soft-hint button.primary {
  background: #92400e;
  color: #fff;
  border-color: #92400e;
}
.wi-soft-hint button.primary:hover { background: #78350f; }

.wi-generate-btn {
  width: 100%;
  padding: 13px;
  border-radius: var(--r-s);
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #1a4b82, #1a7de8);
  color: #fff;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: all .2s;
  box-shadow: 0 4px 16px rgba(26, 125, 232, .3);
}
.wi-generate-btn:hover {
  opacity: .9;
  transform: translateY(-1px);
}
.wi-generate-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
.wi-generate-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Clarification panel — GAP #4 framing */
.wi-clarify-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.wi-clarify-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-l);
  border: 1px solid var(--accent-m);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wi-clarify-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wi-clarify-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.wi-clarify-progress {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.wi-clarify-reassure {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 16px;
  font-style: italic;
  padding-left: 48px;
}

.wi-clarify-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-s);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.wi-clarify-card-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  font-family: var(--mono);
  margin-bottom: 6px;
}
.wi-clarify-card-q {
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
}

.wi-clarify-answer-wrap {
  margin-bottom: 16px;
}
.wi-clarify-answer-wrap label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  font-family: var(--mono);
  display: block;
  margin-bottom: 4px;
}
.wi-clarify-answer-wrap textarea {
  padding: 9px 11px;
  border-radius: var(--r-s);
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  outline: none;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s;
}
.wi-clarify-answer-wrap textarea:focus { border-color: var(--accent); }
.wi-clarify-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.wi-clarify-actions {
  display: flex;
  gap: 10px;
}
.wi-clarify-cancel {
  padding: 13px 18px;
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--text-mid);
  border: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.wi-clarify-cancel:hover { background: var(--surface2); }

.wi-clarify-history {
  margin-top: 24px;
  display: none;
}
.wi-clarify-history.visible { display: block; }
.wi-clarify-history-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-bottom: 10px;
}
.wi-clarify-history-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wi-clarify-history-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  padding: 10px 13px;
  font-size: 12px;
}
.wi-clarify-history-item .hi-label {
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 3px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.wi-clarify-history-item .hi-q { color: var(--text-mid); margin-bottom: 8px; }
.wi-clarify-history-item .hi-a { color: var(--text); }

/* Done panel — GAP #14 planner reminder */
.wi-result {
  padding: 20px;
  border-radius: var(--r-s);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  margin-bottom: 16px;
}
.wi-result-title {
  font-size: 14px;
  font-weight: 700;
  color: #15803d;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wi-result-title svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}
.wi-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--r-s);
  border: none;
  cursor: pointer;
  background: #15803d;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--sans);
  transition: all .15s;
}
.wi-download-btn:hover { background: #166534; }
.wi-download-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wi-planner-reminder {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: var(--r-s);
  font-size: 12px;
  color: #92400e;
  line-height: 1.55;
  margin-bottom: 16px;
}
.wi-planner-reminder svg {
  width: 14px;
  height: 14px;
  stroke: #92400e;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  margin-top: 2px;
}
.wi-planner-reminder strong { font-weight: 700; }

.wi-regenerate {
  padding: 9px 18px;
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--text-mid);
  border: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.wi-regenerate:hover { background: var(--surface2); }

/* No-match state */
.wi-no-match {
  padding: 48px 32px;
  text-align: center;
  color: var(--text-dim);
}
.wi-no-match svg {
  width: 48px;
  height: 48px;
  stroke: var(--border);
  fill: none;
  stroke-width: 1.5;
  margin-bottom: 16px;
}
.wi-no-match p {
  font-size: 15px;
  margin-bottom: 16px;
}
.wi-no-match button {
  padding: 10px 24px;
  border-radius: var(--r-s);
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--sans);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .analyse-layout { grid-template-columns: 1fr; }
  .input-panel { position: static; height: auto; }
  .attrs-grid { grid-template-columns: 1fr 1fr; }
  .wi-form-grid.three-col { grid-template-columns: 1fr 1fr; }
  .wi-panel { padding: 24px 20px; }
}
