/* === Action Bar (Save + History buttons) === */
.action-bar {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  flex-shrink: 0;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 6px var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
}

.action-btn:active {
  background: rgba(65, 135, 255, 0.1);
}

.action-icon { font-size: 14px; }

.history-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--color-accent-strong);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.history-badge:empty { display: none; }

/* === Cut List Panel (slide-up overlay) === */
.cutlist-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 430px;
  margin: 0 auto;
  max-height: 70vh;
  background: var(--color-bg);
  border-top: 2px solid var(--color-accent-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
}

.cutlist-panel[hidden] { display: none; }

.cutlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.cutlist-header h2 {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.cutlist-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.cutlist-action-btn {
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-accent);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.cutlist-action-btn:active { background: rgba(65, 135, 255, 0.1); }

.cutlist-action-btn.danger {
  color: var(--color-error);
  border-color: rgba(248, 113, 113, 0.3);
}

.cutlist-action-btn.danger:active { background: rgba(248, 113, 113, 0.1); }

.cutlist-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.cutlist-close:active { background: rgba(255, 255, 255, 0.05); }

.cutlist-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-2) 0;
}

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

/* === Cut List Item === */
.cutlist-item {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid rgba(65, 135, 255, 0.06);
  gap: var(--space-3);
}

.cutlist-item:active { background: rgba(65, 135, 255, 0.05); }

.cutlist-item-body {
  flex: 1;
  min-width: 0;
}

.cutlist-item-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
  min-height: 1.3em;
}

.cutlist-item-label:empty::before {
  content: 'tap to label';
  font-style: italic;
  opacity: 0.5;
}

.cutlist-item-label:focus {
  outline: 1px solid var(--color-accent);
  border-radius: 2px;
  color: var(--color-text);
}

.cutlist-item-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.cutlist-item-expr {
  font-size: 10px;
  color: var(--color-text-muted);
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cutlist-item-time {
  font-size: 9px;
  color: var(--color-text-muted);
  opacity: 0.4;
  white-space: nowrap;
}

.cutlist-item-delete {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-base);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}

.cutlist-item-delete:active {
  color: var(--color-error);
  background: rgba(248, 113, 113, 0.1);
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 20px;
  border-radius: 20px;
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  z-index: 200;
  white-space: nowrap;
  max-width: 430px;
}

.toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .cutlist-panel { transition: none; }
}
