:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-hover: #e2e8f0;
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-sub: #475569;
  --border: #e2e8f0;
  --border-focus: #2563eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-hover: #059669;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  letter-spacing: -0.011em;
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

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

.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 18px;
  height: 18px;
}

.site-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.privacy-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-light);
  color: #065f46;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid #a7f3d0;
}

.privacy-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
}

/* Main */
main {
  flex: 1;
  padding: 24px 0 40px;
}

/* Single Unified Workspace Card */
.workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 20px;
}

/* Segmented Tabs */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  margin-bottom: 18px;
}

.seg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  min-height: 38px;
}

.seg-btn:hover {
  color: var(--text-main);
}

.seg-btn.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 600;
  border-color: rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.seg-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.seg-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
}

/* Mode Context Header */
.mode-header {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-title svg {
  width: 17px;
  height: 17px;
  color: var(--primary);
}

.mode-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Dropzone (Empty State) */
.dropzone {
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 44px 20px;
  text-align: center;
  background: #fafbfc;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 12px;
  transition: var(--transition);
}

.dropzone:hover .dropzone-icon-box, .dropzone.dragover .dropzone-icon-box {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.12);
}

.dropzone-icon-box svg {
  width: 24px;
  height: 24px;
}

.dropzone-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Active Workspace (When files uploaded) */
.active-workspace {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Session Status Bar */
.session-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
  gap: 8px;
}

.session-summary {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.summary-size {
  font-size: 12px;
  color: var(--text-muted);
}

.session-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #92400e;
  background: var(--amber-light);
  border: 1px solid #fef3c7;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
}

.timer-chip svg {
  width: 14px;
  height: 14px;
}

.timer-val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.btn-clear-session {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--danger);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}

.btn-clear-session:hover {
  background: var(--danger-light);
}

.btn-clear-session svg {
  width: 13px;
  height: 13px;
}

/* Files Table */
.files-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  gap: 12px;
  transition: var(--transition);
}

.file-row:hover {
  border-color: #cbd5e1;
}

.file-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.file-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.file-badge.image {
  background: #e0e7ff;
  color: #3730a3;
}

.file-badge.pdf {
  background: #fee2e2;
  color: #b91c1c;
}

.file-details {
  min-width: 0;
  flex: 1;
}

.file-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.file-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.target-select {
  font-family: inherit;
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  height: 34px;
}

.target-select:focus {
  border-color: var(--primary);
}

.btn-remove-row {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-remove-row:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.btn-remove-row svg {
  width: 15px;
  height: 15px;
}

/* Compact Add More Bar */
.add-more-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: #fafbfc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
  transition: var(--transition);
}

.add-more-strip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.add-more-strip svg {
  width: 15px;
  height: 15px;
}

/* Batch Action Toolbar */
.batch-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.batch-label {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-sub);
}

.batch-buttons-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.batch-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  height: 32px;
}

.batch-pill-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.batch-pill-btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.batch-pill-btn.primary:hover {
  background: var(--primary-hover);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  min-height: 36px;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: #cbd5e1;
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: var(--success-hover);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
  min-height: 32px;
}

/* Results Section */
.results-box {
  background: #fcfdfd;
  border: 1px solid #d1fae5;
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.results-heading {
  font-size: 14.5px;
  font-weight: 600;
  color: #065f46;
  display: flex;
  align-items: center;
  gap: 6px;
}

.results-heading svg {
  width: 17px;
  height: 17px;
  color: var(--success);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  gap: 12px;
}

.result-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.saved-tag {
  background: var(--success-light);
  color: #065f46;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid #a7f3d0;
}

.results-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

/* Progress bar */
.progress-bar-container {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin: 6px 0;
  display: none;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.3s ease;
}

/* Footer note */
.footer-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 680px) {
  .container {
    padding: 0 12px;
  }
  .workspace-card {
    padding: 14px;
  }
  .segmented-control {
    grid-template-columns: repeat(2, 1fr);
  }
  .dropzone {
    padding: 30px 12px;
  }
  .file-row, .result-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .file-left {
    width: 100%;
  }
  .file-controls {
    width: 100%;
    justify-content: space-between;
  }
  .batch-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .batch-buttons-group {
    width: 100%;
  }
  .batch-buttons-group .batch-pill-btn {
    flex: 1;
    justify-content: center;
  }
  .session-status-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
