:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #34d399;
  --bg-main: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.12);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.1);
  --radius: 16px;
  --radius-sm: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Soft Background */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
  z-index: -2;
}

.bg-blur {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.04) 0%, transparent 40%);
  z-index: -1;
  filter: blur(80px);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* Header */
header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
}

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

.logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.section-icon {
  width: 36px;
  height: 36px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.section-icon.processing {
  animation: spin 2s linear infinite;
}

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

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.badge {
  margin-left: auto;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary-dark);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Input Group */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.input-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.input-group input,
.input-group select {
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s;
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.input-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 44px;
}

/* Document Grid */
.document-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.document-card {
  position: relative;
}

.document-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.card-content {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.document-card:hover .card-content {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.document-card input:checked + .card-content {
  background: rgba(16, 185, 129, 0.05);
  border-color: var(--primary);
}

.card-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-main);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.25s;
}

.document-card input:checked + .card-content .card-icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary);
}

.card-text {
  flex: 1;
  min-width: 0;
}

.card-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.card-desc {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-check {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.25s;
  flex-shrink: 0;
  background: white;
}

.document-card input:checked + .card-content .card-check {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Actions Bar */
.actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: white;
}

.action-buttons-left {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn-ghost:hover {
  background: white;
  color: var(--text-primary);
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Status Section */
.status-section {
  background: rgba(16, 185, 129, 0.03);
  border-color: rgba(16, 185, 129, 0.15);
}

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

.status-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.status-item .status-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.status-item .status-icon.loading {
  animation: spin 1s linear infinite;
}

.status-item .status-icon.complete {
  color: var(--primary);
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ========== Tab Switcher ========== */
.tab-switcher {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.tab-btn {
  padding: 10px 20px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.tab-btn:hover {
  background: white;
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========== Step Indicator ========== */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px;
  gap: 0;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.5;
  transition: all 0.3s;
}

.step.active {
  opacity: 1;
}

.step.completed {
  opacity: 1;
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.3s;
}

.step.active .step-number {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.step.completed .step-number {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.step-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.step.active .step-label {
  color: var(--text-primary);
}

.step-line {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
}

.step-content {
  display: none;
}

.step-content.active {
  display: block;
}

/* ========== Template Grid ========== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.template-card {
  position: relative;
  cursor: pointer;
}

.template-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.template-content {
  padding: 16px;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.template-card:hover .template-content {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.template-card input:checked + .template-content {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}

.template-name {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.template-file {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========== Dropzone ========== */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  transition: all 0.3s;
  position: relative;
  margin: 20px 0;
}

.dropzone:hover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.02);
}

.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.dropzone-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.dropzone-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.file-select-btn {
  margin-top: 8px;
}

.dropzone-active {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(16, 185, 129, 0.1);
  border-radius: var(--radius);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--primary);
}

.dropzone.dragover .dropzone-content {
  opacity: 0;
}

.dropzone.dragover .dropzone-active {
  display: flex;
}

/* ========== File Info ========== */
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.file-icon {
  color: var(--primary);
}

.file-details {
  flex: 1;
}

.file-name {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
}

.file-size {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-sm {
  padding: 8px;
}

/* ========== Validation Result ========== */
.validation-result {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.validation-result.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.validation-result.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.validation-result.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.validation-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.validation-result.success .validation-icon {
  color: var(--primary);
}

.validation-result.error .validation-icon {
  color: #ef4444;
}

.validation-result.warning .validation-icon {
  color: #f59e0b;
}

.validation-message {
  flex: 1;
  font-size: 0.9rem;
}

/* ========== Preview Table ========== */
.preview-table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.preview-table th,
.preview-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.preview-table th {
  background: var(--bg-main);
  font-weight: 600;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
}

.preview-table tr:last-child td {
  border-bottom: none;
}

.preview-table tr:hover td {
  background: rgba(16, 185, 129, 0.03);
}

/* ========== Step Actions ========== */
.step-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ========== CSV Info Grid ========== */
.csv-info-grid {
  margin-bottom: 16px;
}

/* ========== Responsive ========== */
/* ========== Batch Mode ========== */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.mode-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.mode-toggle-label input[type="checkbox"] {
  width: 44px;
  height: 24px;
  appearance: none;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-toggle-label input[type="checkbox"]::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.mode-toggle-label input[type="checkbox"]:checked {
  background: var(--primary);
}

.mode-toggle-label input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

.mode-toggle-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.mode-toggle-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* Batch Section */
.batch-section {
  display: none;
}

.batch-section.active {
  display: block;
}

/* Batch Dropzone */
.batch-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  margin-bottom: 20px;
}

.batch-dropzone:hover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.02);
}

.batch-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}

.batch-dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.batch-dropzone-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.batch-dropzone-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.batch-dropzone-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Batch File List */
.batch-file-list {
  margin: 16px 0;
  max-height: 300px;
  overflow-y: auto;
}

.batch-file-list .no-files {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}

.batch-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.batch-file-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.batch-file-item .file-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.batch-file-item .file-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-file-item .file-size {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.batch-file-item .btn-remove {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
  transition: all 0.2s;
}

.batch-file-item .btn-remove:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Batch Actions */
.batch-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

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

/* Batch Progress */
.batch-progress {
  display: none;
  margin: 20px 0;
  padding: 16px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
}

.batch-progress-bar-container {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.batch-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.batch-progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

/* Batch Status */
.batch-status {
  display: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-size: 0.9rem;
}

.batch-status.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--primary-dark);
}

.batch-status.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.batch-status.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #d97706;
}

.batch-status.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #2563eb;
}

/* Workers Status */
.workers-status-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.workers-status {
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 4px;
}

.workers-status.available {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary-dark);
}

.workers-status.unavailable {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.workers-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.workers-toggle-label input[type="checkbox"] {
  width: 36px;
  height: 20px;
  appearance: none;
  background: var(--border);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.workers-toggle-label input[type="checkbox"]::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.workers-toggle-label input[type="checkbox"]:checked {
  background: var(--primary);
}

.workers-toggle-label input[type="checkbox"]:checked::before {
  transform: translateX(16px);
}

.workers-toggle-label input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== Responsive ========== */
@media (max-width: 640px) {
  .container {
    padding: 16px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .document-grid {
    grid-template-columns: 1fr;
  }

  .template-grid {
    grid-template-columns: 1fr;
  }

  .actions-bar {
    flex-direction: column;
    gap: 12px;
  }

  .action-buttons-left {
    width: 100%;
  }

  .action-buttons-left .btn {
    flex: 1;
    justify-content: center;
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .logo {
    flex-direction: column;
    text-align: center;
  }

  .tab-switcher {
    width: 100%;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
  }

  .step-indicator {
    flex-wrap: wrap;
    gap: 8px;
  }

  .step-line {
    display: none;
  }

  .step-label {
    display: none;
  }

  .dropzone {
    padding: 24px;
  }
}
