/* ==========================================================================
   Seed Quality Classifier - Mobile-First Styling
   Supports Light & Dark Modes with pure CSS Custom Properties
   ========================================================================== */

:root {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #10b981;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  /* Brand / Condition Palette */
  --brand-primary: #059669;
  --brand-primary-hover: #047857;
  --brand-glow: rgba(16, 185, 129, 0.2);

  --badge-normal-bg: #ecfdf5;
  --badge-normal-text: #065f46;
  --badge-normal-border: #a7f3d0;
  
  --badge-abnormal-bg: #fffbeb;
  --badge-abnormal-text: #92400e;
  --badge-abnormal-border: #fde68a;

  --badge-hard-bg: #eff6ff;
  --badge-hard-text: #1e40af;
  --badge-hard-border: #bfdbfe;

  --badge-dead-bg: #f1f5f9;
  --badge-dead-text: #334155;
  --badge-dead-border: #cbd5e1;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px -2px rgba(0,0,0,0.08), 0 2px 6px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 30px -4px rgba(0,0,0,0.12);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0b1120;
  --bg-surface: #131c31;
  --bg-surface-elevated: #1a2540;
  --bg-subtle: #1e293b;
  --border-color: #27354f;
  --border-focus: #34d399;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --brand-primary: #10b981;
  --brand-primary-hover: #34d399;
  --brand-glow: rgba(16, 185, 129, 0.3);

  --badge-normal-bg: rgba(16, 185, 129, 0.15);
  --badge-normal-text: #34d399;
  --badge-normal-border: rgba(52, 211, 153, 0.35);

  --badge-abnormal-bg: rgba(245, 158, 11, 0.15);
  --badge-abnormal-text: #fbbf24;
  --badge-abnormal-border: rgba(251, 191, 36, 0.35);

  --badge-hard-bg: rgba(59, 130, 246, 0.15);
  --badge-hard-text: #60a5fa;
  --badge-hard-border: rgba(96, 165, 250, 0.35);

  --badge-dead-bg: rgba(148, 163, 184, 0.15);
  --badge-dead-text: #cbd5e1;
  --badge-dead-border: rgba(148, 163, 184, 0.3);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px -2px rgba(0,0,0,0.4);
  --shadow-lg: 0 14px 35px -4px rgba(0,0,0,0.6);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

/* App Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 8px var(--brand-glow);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.brand-contact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.74rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.contact-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.contact-sep {
  color: var(--text-muted);
}

.app-footer {
  margin-top: 32px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-credit {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.footer-credit strong {
  color: var(--brand-primary);
}

.footer-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Interactive Buttons */
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.icon-btn:hover {
  background: var(--border-color);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.96);
}

.badge-counter {
  position: absolute;
  top: -3px;
  right: -3px;
  background-color: var(--brand-primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Upload Card & Drop Area */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(16, 185, 129, 0.4);
}

.upload-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px 16px;
  text-align: center;
  background-color: var(--bg-subtle);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.drop-zone.dragover {
  border-color: var(--brand-primary);
  background-color: var(--badge-normal-bg);
  transform: scale(1.01);
}

.drop-zone-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.drop-zone-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.drop-zone-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Action Trigger Buttons */
.action-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary) 0%, #047857 100%);
  color: white;
  box-shadow: 0 2px 8px var(--brand-glow);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
  transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-success {
  background: #10b981;
  color: white;
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: #ef4444;
  color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-outline-danger {
  background: transparent;
  border: 1px solid #ef4444;
  color: #ef4444;
}
.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Sample Quick Picks */
.sample-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
}

.sample-bar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.sample-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.sample-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.sample-chip:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
  border-color: var(--brand-primary);
}

.sample-chip img {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

/* Preview & Scan Section */
.preview-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 380px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter 0.3s ease;
}

/* Scanning Overlay Animation */
.scan-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.05) 0%, rgba(0, 0, 0, 0.4) 100%);
}

.scan-overlay.active {
  display: block;
}

.scan-laser {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: #34d399;
  box-shadow: 0 0 16px 4px #34d399, 0 0 4px #ffffff;
  animation: scanSweep 2s ease-in-out infinite alternate;
}

@keyframes scanSweep {
  0% { top: 6%; }
  100% { top: 92%; }
}

.scan-target-box {
  position: absolute;
  top: 15%;
  left: 15%;
  right: 15%;
  bottom: 15%;
  border: 1px dashed rgba(52, 211, 153, 0.6);
  border-radius: 12px;
}

.scan-target-box::before, .scan-target-box::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: #34d399;
}
.scan-target-box::before {
  top: -2px; left: -2px;
  border-top: 3px solid #34d399;
  border-left: 3px solid #34d399;
}
.scan-target-box::after {
  bottom: -2px; right: -2px;
  border-bottom: 3px solid #34d399;
  border-right: 3px solid #34d399;
}

.scan-status-text {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #34d399;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(52, 211, 153, 0.3);
  border-top-color: #34d399;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Classification Result Card */
.result-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-plant-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-plant-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.result-plant-name {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

/* Condition Badges */
.condition-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  border: 1.5px solid transparent;
  align-self: flex-start;
}

.condition-badge.normal_seedling {
  background-color: var(--badge-normal-bg);
  color: var(--badge-normal-text);
  border-color: var(--badge-normal-border);
}

.condition-badge.abnormal_seedling {
  background-color: var(--badge-abnormal-bg);
  color: var(--badge-abnormal-text);
  border-color: var(--badge-abnormal-border);
}

.condition-badge.hard_seed {
  background-color: var(--badge-hard-bg);
  color: var(--badge-hard-text);
  border-color: var(--badge-hard-border);
}

.condition-badge.dead_seed {
  background-color: var(--badge-dead-bg);
  color: var(--badge-dead-text);
  border-color: var(--badge-dead-border);
}

.badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Metric Bars */
.metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background-color: var(--bg-subtle);
  padding: 12px 14px;
  border-radius: var(--radius-md);
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.metric-title {
  color: var(--text-muted);
  font-weight: 500;
}

.metric-value {
  font-weight: 700;
  color: var(--text-primary);
}

.metric-progress {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* Reason Box */
.reason-box {
  background-color: var(--bg-subtle);
  border-left: 4px solid var(--brand-primary);
  padding: 12px 16px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.reason-box strong {
  color: var(--text-primary);
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

/* Feedback Section */
.feedback-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.feedback-prompt {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.feedback-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Correction Form (when 'Wrong' is tapped) */
.correction-form {
  display: none;
  flex-direction: column;
  gap: 14px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  animation: fadeIn 0.25s ease;
}

.correction-form.active {
  display: flex;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-select, .form-input {
  min-height: 44px;
  padding: 8px 12px;
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-select:focus, .form-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* Confirmed Notification Banner */
.confirmed-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--badge-normal-bg);
  color: var(--badge-normal-text);
  border: 1px solid var(--badge-normal-border);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
}

/* History Section */
.history-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.history-card:hover {
  border-color: var(--brand-primary);
  transform: translateX(2px);
}

.history-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: var(--bg-subtle);
  flex-shrink: 0;
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.history-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 0.86rem;
  background-color: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

/* Modal Dialogs (Guide & Dataset) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.active {
  display: flex;
}

.modal-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--bg-subtle);
}

/* Guide Cards */
.guide-card {
  padding: 14px;
  border-radius: var(--radius-md);
  border-left: 4px solid;
  background-color: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-card.normal { border-left-color: #10b981; }
.guide-card.abnormal { border-left-color: #f59e0b; }
.guide-card.hard { border-left-color: #3b82f6; }
.guide-card.dead { border-left-color: #64748b; }

.guide-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.guide-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.guide-tip {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Dataset Preview Grid */
.dataset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.dataset-item {
  position: relative;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dataset-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.dataset-item-meta {
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

.dataset-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* Toasts / Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
  max-width: 90vw;
}

.toast {
  pointer-events: auto;
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .app-container {
    padding: 10px;
    gap: 14px;
  }
  .action-buttons-grid {
    grid-template-columns: 1fr;
  }
  .brand-title {
    font-size: 1.05rem;
  }
}

/* ==========================================================================
   BATCH UPLOAD & QUALITY REPORT STYLING (UP TO 50 PHOTOS)
   ========================================================================== */

.btn-batch {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-batch:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

/* Batch Processing Progress Header */
.batch-progress-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.batch-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.batch-progress-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.batch-progress-stats {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.batch-progress-bar-bg {
  width: 100%;
  height: 10px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.batch-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.batch-live-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Executive Lot Quality Report Card */
.batch-report-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.report-header-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.report-title-group h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.report-title-group p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.germination-badge-large {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.germination-rate-number {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--brand-primary);
  line-height: 1;
}

.germination-rate-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.lot-grade-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 4px;
}

.lot-grade-high {
  background: var(--badge-normal-bg);
  color: var(--badge-normal-text);
  border: 1px solid var(--badge-normal-border);
}

.lot-grade-mid {
  background: var(--badge-abnormal-bg);
  color: var(--badge-abnormal-text);
  border: 1px solid var(--badge-abnormal-border);
}

.lot-grade-low {
  background: var(--badge-dead-bg);
  color: var(--badge-dead-text);
  border: 1px solid var(--badge-dead-border);
}

/* Metric Stats Grid */
.report-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.report-stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.report-stat-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-normal::before { background: #10b981; }
.stat-abnormal::before { background: #f59e0b; }
.stat-hard::before { background: #3b82f6; }
.stat-dead::before { background: #64748b; }

.report-stat-count {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.report-stat-pct {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.report-stat-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Batch Filter Bar */
.batch-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.filter-pills-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover,
.filter-pill.active {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

/* Batch Grid & Item Card */
.batch-items-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

.batch-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  gap: 12px;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.batch-item-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.batch-item-card.corrected {
  border-left: 4px solid #10b981;
}

.batch-item-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.batch-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.batch-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.batch-item-index {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.batch-item-reason {
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Inline Edit Controls in Batch Card */
.batch-item-controls {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.batch-item-select {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  flex: 1;
}

.batch-item-select:focus {
  border-color: var(--brand-primary);
}

/* Action Toolbar for Batch */
.batch-actions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
}

/* Print Certificate Styles */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .app-header, .upload-card, #previewCard, #resultCard, .history-card, .app-footer, .batch-filter-bar, .batch-actions-toolbar, #batchProgressWrapper, .icon-btn, .header-actions {
    display: none !important;
  }
  #batchSection, #batchReportContent {
    display: block !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .report-header-banner {
    border: 2px solid #10b981 !important;
    background: #f0fdf4 !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .batch-items-container {
    max-height: none !important;
    overflow: visible !important;
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .batch-item-card {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #cbd5e1 !important;
  }
}

