/* Drape.Studio Styles */

/* Color Theme Variables - Configurable */
:root {
  /* Primary Colors */
  --bg: #0a0e14;
  --panel: #151921;
  --text: #e8eaed;
  --muted: #9aa0a6;

  --brand-primary: #ff8a29;
  --brand-secondary: #3b1670;
  --brand-primary-rgb: 255, 138, 41;
  --brand-secondary-rgb: 59, 22, 112;
  
  /* Accent Colors - Warm gold/amber for Indian fashion aesthetic */
  --accent: var(--brand-primary);
  --accent-hover: #e8741c;
  --accent-light: var(--brand-secondary);
  
  /* Status Colors */
  --danger: #ef4444;
  --success: #10b981;
  --warning: #fbbf24;
  
  /* UI Elements */
  --border: #2a2f3a;
  --input-bg: #0d1117;
  --overlay-bg: rgba(10, 14, 20, 0.85);
}

/* Alternative Theme (Uncomment to use) */
/*
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-light: #93c5fd;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #fbbf24;
  --border: #2a2f3a;
  --input-bg: #0c0f14;
  --overlay-bg: rgba(11, 16, 32, 0.85);
}
*/

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
body {
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 2.333fr; /* 30% : 70% */
  gap: 16px;
  padding: 16px;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  min-height: 0;
  overflow: auto;
}

.left {
  display: flex;
  flex-direction: column;
}

.right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Branding */
.app-title {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.app-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.4;
}

/* Form */
.form {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* Main mode tabs (Create / Refine) */
.main-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.main-tabs .tab {
  position: relative;
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.main-tabs .tab.active {
  background: var(--input-bg);
  border-color: var(--border);
  border-bottom-color: var(--input-bg);
  color: var(--text);
}

.main-tabs .tab.disabled {
  opacity: 0.5;
  cursor: default;
}

#tabPanelCreate,
#tabPanelRefine {
  margin-top: 8px;
}

/* Accordion Styles */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow: auto;
  padding-right: 4px;
}

.accordion-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  transition: all 0.2s ease;
}

.accordion-item:hover {
  border-color: rgba(var(--brand-primary-rgb), 0.3);
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.accordion-header:hover {
  background: rgba(var(--brand-primary-rgb), 0.08);
}

.accordion-header.active {
  background: rgba(var(--brand-primary-rgb), 0.12);
}

.step-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.accordion-header.active .step-number {
  background: var(--accent);
  color: #0a0e14;
}

.accordion-header.completed .step-number {
  background: var(--success);
  color: #fff;
}

.step-title {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}

.step-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.step-status {
  font-size: 16px;
  flex-shrink: 0;
}

.accordion-header.completed .step-status::after {
  content: '✓';
  color: var(--success);
}

.chevron {
  font-size: 12px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--muted);
}

/* Pre-created models grid in Choose Model modal */
.precreated-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.precreated-card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.precreated-card:hover {
  border-color: rgba(var(--brand-primary-rgb), 0.5);
  box-shadow: 0 0 0 1px rgba(var(--brand-primary-rgb), 0.3);
}

.precreated-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(var(--brand-primary-rgb), 0.6);
  transform: translateY(-1px);
}

.precreated-img {
  width: 100%;
  border-radius: 6px;
  object-fit: contain;
}

.precreated-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.precreated-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.precreated-line {
  font-size: 11px;
}

.step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.selected-model-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.selected-model-thumb {
  flex-shrink: 0;
  width: 72px;
}

.selected-model-thumb .preview-img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: cover;
  aspect-ratio: 9 / 16;
}

.selected-model-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.selected-model-title {
  font-weight: 600;
  color: var(--text);
}

.selected-model-subtitle {
  font-size: 11px;
  color: var(--muted);
}

.accordion-header.active .chevron {
  transform: rotate(0deg);
  color: var(--accent);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 14px;
}

.accordion-content.expanded {
  max-height: 600px;
  padding: 14px;
  overflow: auto;
}

.step-description {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px 0;
}

.config-section {
  margin-bottom: 16px;
}

.config-section:last-child {
  margin-bottom: 0;
}

.config-section label {
  display: block;
  margin-bottom: 8px;
}

/* Summary Styles */
.summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(var(--brand-primary-rgb), 0.05);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.summary-label {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.summary-value {
  color: var(--muted);
  font-size: 13px;
}

.summary-value.ready {
  color: var(--success);
}

/* Garment ID Display */
.garment-id {
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(var(--brand-primary-rgb), 0.1);
  border-radius: 6px;
  font-size: 12px;
  color: var(--accent);
}

/* Chip styles for annotation pill */
.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--brand-secondary-rgb), 0.16);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(var(--brand-secondary-rgb), 0.30);
}

.chip.clickable { cursor: pointer; }
.chip.clickable:hover {
  background: rgba(var(--brand-primary-rgb), 0.12);
  border-color: var(--accent);
}

/* Chip color variants */
.chip-success { background: rgba(16,185,129,0.15); color: var(--success); border-color: rgba(16,185,129,0.35); }
.chip-warning { background: rgba(251,191,36,0.15); color: var(--warning); border-color: rgba(251,191,36,0.35); }
.chip-info { background: rgba(var(--brand-secondary-rgb),0.15); color: rgba(255,255,255,0.92); border-color: rgba(var(--brand-secondary-rgb),0.35); }
.chip-muted { background: rgba(var(--brand-secondary-rgb),0.10); color: rgba(255,255,255,0.70); border-color: rgba(var(--brand-secondary-rgb),0.22); }

/* Strong red chip for exhausted trials */
.chip-danger {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  border-color: rgba(239,68,68,0.4);
}

/* Compare modal layout: full-size saree vs generated */
.modal-compare {
  max-width: 95vw;
  max-height: 80vh;
  width: 95vw;
  height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-compare-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 32px;
  padding: 20px;
}

.modal-compare-body .compare-modal-pane {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--input-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.modal-compare-body .compare-modal-pane img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.modal-catalog {
  max-width: 99vw;
  max-height: 88vh;
  width: 99vw;
  height: auto;
  display: flex;
  flex-direction: column;
}

.modal-catalog-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
}

.catalog-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 0;
  flex: 0 0 280px;
}

.catalog-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.catalog-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Let width drive the 9:16 shape; avoid height-driven stretching that makes
     the frame appear unnaturally tall/narrow. */
  flex: 0 0 auto;
}

.catalog-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: var(--input-bg);
}

.catalog-frame img[src=""],
.catalog-frame img:not([src]) {
  display: none;
}

.catalog-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-top: auto;
}



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

label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

/* File Input */
input[type="file"] {
  width: 100%;
  padding: 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

input[type="file"]:hover {
  border-color: var(--accent);
}

input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.1);
}

/* Image Preview */
.preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview img {
  height: 80px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}

/* Segmented Controls */
.segmented {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented .seg {
  flex: 1;
  min-width: fit-content;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.segmented .seg:hover {
  background: rgba(var(--brand-primary-rgb), 0.1);
  border-color: var(--accent);
}

.segmented .seg.selected,
.segmented .seg[aria-pressed="true"] {
  background: var(--accent);
  color: #0a0e14;
  border-color: transparent;
  font-weight: 700;
}

/* Buttons */
button {
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

button.primary {
  width: 100%;
  background: var(--accent);
  color: #0a0e14;
  font-weight: 700;
  font-size: 15px;
  border: none;
  padding: 14px 20px;
  border-radius: 10px;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb), 0.3);
}

button.primary:active:not(:disabled) {
  transform: translateY(0);
}

button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: rgba(var(--brand-secondary-rgb), 0.08);
  border: 1px solid rgba(var(--brand-secondary-rgb), 0.40);
  color: rgba(255,255,255,0.92);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

button.secondary:hover:not(:disabled) {
  background: rgba(var(--brand-secondary-rgb), 0.14);
  border-color: rgba(var(--brand-secondary-rgb), 0.58);
}

button.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status */
.status {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: var(--success);
}

.status.warning {
  color: var(--warning);
}

/* Choose Model modal: keep height stable across tabs */
#modalChooseModel .modal-body {
  height: 360px; /* approx 16:9 with 760px width */
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#modalChooseModel .tab-panel {
  flex: 1;
}

/* Footer */
.footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Output Section */
.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.output-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.output-actions {
  display: flex;
  gap: 8px;
}

.result-area {
  position: relative;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Saree lens zoom overlay */
.zoom-lens {
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.25);
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  background-repeat: no-repeat;
  background-position: 0 0;
  background-color: rgba(0,0,0,0.02);
  pointer-events: none;
  z-index: 30;
}

/* Saree refine modal textareas */
#modalSareeRefine textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  resize: vertical;
}

.placeholder {
  color: var(--muted);
  text-align: center;
  font-size: 15px;
}

.result-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Compare toggle button */
.preview-compare {
  position: absolute;
  top: 12px;
  right: 12px; /* top-right corner */
  background: rgba(59,130,246,0.15);
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,0.35);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.15s ease;
}
.preview-compare[disabled] { opacity: 0.5; cursor: not-allowed; }
.preview-compare.active { background: rgba(59,130,246,0.9); color: #fff; border-color: rgba(59,130,246,1); }
.preview-compare:hover:not([disabled]) { transform: scale(1.05); }

/* 3-up Compare Board */
.compare-board {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.compare-board[hidden] { display: none !important; }
.compare-board .tile {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
}
.compare-board .tile-caption {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.compare-board .tile-img {
  position: relative;
  flex: 1;
  min-height: 160px;
  background: var(--canvas, #0f172a);
  border-radius: 6px;
  overflow: hidden;
}
.compare-board .tile-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;       /* normalize sizes with padding */
  object-position: center;   /* center inside viewport */
  background: var(--input-bg);
}
/* Hide img elements until they have a valid src to prevent broken icons */
.compare-board .tile-img img[src=""],
.compare-board .tile-img img:not([src]) { display: none; }

/* Lock button on the center stage */
.preview-lock {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.15s ease;
}

.preview-lock:hover { background: rgba(0,0,0,0.8); transform: scale(1.05); }
.preview-lock:active { transform: scale(1.0); }

/* Strong color cues for lock states */
.preview-lock.lock--on {
  background: rgba(16,185,129,0.9); /* green */
}
.preview-lock.lock--on:hover { background: rgba(16,185,129,1); }

.preview-lock.lock--off {
  background: rgba(239,68,68,0.9); /* red */
}
.preview-lock.lock--off:hover { background: rgba(239,68,68,1); }

/* Status label under the stage */
.preview-status {
  margin-top: 6px;
  min-height: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* Spinner */
.spinner-overlay {
  position: fixed; /* cover whole viewport */
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17,24,39,0.6); /* grey/charcoal */
  z-index: 2000; /* above modals */
  backdrop-filter: blur(2px);
  pointer-events: all; /* block clicks */
  cursor: progress;
}
.spinner-overlay[hidden] { display: none !important; }

/* Visually hidden utility for accessible labels */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.spinner-overlay[hidden] {
  display: none !important;
}

.spinner {
  width: 64px;
  height: 64px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Actions in Left Panel */
.actions {
  margin-top: 16px;
  margin-bottom: 16px;
}

.actions .primary {
  width: 100%;
}

/* Utility button accents */
.danger-text { color: var(--danger) !important; }
.success-outline { border-color: var(--success) !important; color: var(--success) !important; }
.success-outline:hover:not(:disabled) { background: rgba(16,185,129,0.12); border-color: var(--success); }

/* Status Bar */
.status-bar {
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.status-bar .status {
  text-align: center;
}

.status-bar__left {
  justify-self: start;
  min-width: 0;
  display: inline-flex;
  align-items: center;
}

.status-bar__right {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#userStatusChip {
  flex-shrink: 0;
}

/* ------------------------------ */
/* Modal Styles                   */
/* ------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden { display: none; }

.modal-content {
  width: min(720px, 92vw);
  max-height: 86vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 50px rgba(0,0,0,0.5);
  overflow: hidden;
}

.modal-content.modal-catalog {
  width: 90vw;
  max-width: 90vw;
  max-height: 88vh;
}

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

.modal-header h3 { font-size: 16px; }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 20px;
}

.modal-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.tab.active {
  background: var(--accent);
  color: #0a0e14;
  border-color: transparent;
  font-weight: 700;
}

.tab.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.modal-body {
  padding: 0 0 0;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

/* Catalog modal: override base modal-body flex layout to allow 3-up grid */
.modal-body.modal-catalog-body {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
}

.modal-body-scroll {
  padding: 14px 18px 12px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  background: rgba(var(--brand-primary-rgb), 0.04);
  color: var(--muted);
  cursor: pointer;
}

.dropzone:hover {
  border-color: var(--accent);
  background: rgba(var(--brand-primary-rgb), 0.08);
  color: var(--text);
}

.preview-area {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.preview-area img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.asset-grid.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.hidden { display: none !important; }

.link.subtle {
  color: var(--muted);
  font-size: 12px;
}

/* Responsive */
@media (max-width: 980px) {
  #app {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
  
  .result-area {
    height: 50vh;
  }
  
  .app-title {
    font-size: 24px;
  }
  
  .segmented .seg {
    flex: 1 1 45%;
  }
  
  .status-bar {
    padding: 10px 12px;
  }
}

@media (max-width: 640px) {
  .panel {
    padding: 16px;
  }
  
  .result-area {
    height: 40vh;
  }
  
  .segmented {
    flex-direction: column;
  }
  
  .segmented .seg {
    flex: 1;
  }
}
