/* === Tool Save — Save to Job button + Recent Results drawer === */

/* --- Save to Job button --- */
.save-to-job-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-accent-strong);
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-user-select: none;
  user-select: none;
}

.save-to-job-btn:active {
  background: var(--color-accent);
  transform: scale(0.98);
}

.save-to-job-btn .save-icon {
  font-size: 14px;
}

/* Pulse feedback on successful save */
.save-to-job-btn.saved {
  background: #22c55e;
  transition: background 0.15s ease;
}

/* --- Recent Results Drawer --- */
.recent-drawer {
  margin-top: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--display-bg);
}

.recent-drawer[hidden] { display: none; }

.recent-drawer-toggle {
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.recent-drawer-toggle .chevron {
  transition: transform 0.2s ease;
  font-size: 10px;
}

.recent-drawer.open .recent-drawer-toggle .chevron {
  transform: rotate(180deg);
}

.recent-drawer-body {
  display: none;
  border-top: 1px solid var(--color-border);
}

.recent-drawer.open .recent-drawer-body {
  display: block;
}

/* --- Recent Row --- */
.recent-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
  border-bottom: 1px solid var(--color-border);
}

.recent-row:last-child { border-bottom: none; }

.recent-row-info {
  flex: 1;
  min-width: 0;
}

.recent-row-primary {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-row-expr {
  font-size: 10px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-row-time {
  font-size: 10px;
  color: var(--color-text-muted);
  flex: 0 0 auto;
}

.recent-row-save {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.recent-row-save:active {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.recent-empty {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
}

/* --- Label Dialog --- */
.tool-label-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
}

.tool-label-dialog {
  background: var(--display-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  width: 100%;
  max-width: 320px;
}

.tool-label-dialog h3 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
}

.tool-label-dialog input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
  box-sizing: border-box;
}

.tool-label-dialog input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.tool-label-actions {
  display: flex;
  gap: var(--space-2);
}

.tool-label-actions button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.tool-label-cancel {
  background: var(--color-border);
  color: var(--color-text);
}

.tool-label-save {
  background: var(--color-accent-strong);
  color: #fff;
}

.tool-label-save:active { background: var(--color-accent); }

/* === Trade badges (for measurement list & report) === */
.trade-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* === Job Report View === */
.job-report { display: flex; flex-direction: column; height: 100%; }
.job-report[hidden] { display: none; }

.job-report-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.job-report-back {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  cursor: pointer;
  touch-action: manipulation;
}

.job-report-title {
  flex: 1;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.job-report-share {
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-accent-strong);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.job-report-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-3) var(--space-4);
}

.report-section {
  margin-bottom: var(--space-4);
}

.report-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 2px solid var(--color-border);
}

.report-section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.report-section-name {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
}

.report-section-count {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-left: auto;
}

.report-entry {
  background: var(--display-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}

.report-entry-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.report-entry-tool {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.report-entry-results {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.report-result-item {
  font-size: 12px;
}

.report-result-label {
  color: var(--color-text-muted);
}

.report-result-value {
  font-weight: 600;
  color: var(--color-text);
}

.report-entry-inputs {
  margin-top: 4px;
  font-size: 10px;
  color: var(--color-text-muted);
  font-style: italic;
}

.report-empty {
  text-align: center;
  padding: var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
