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

:root {
  --primary: #1a365d;
  --primary-light: #2a5298;
  --accent: #e53e3e;
  --bg: #f7f8fc;
  --card-bg: #ffffff;
  --text: #1a202c;
  --text-muted: #718096;
  --border: #e2e8f0;
  --success: #38a169;
  --warning: #d69e2e;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  color: var(--primary);
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary-light);
  background: rgba(42, 82, 152, 0.03);
}

.dropzone-content svg {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.dropzone-content p {
  color: var(--text-muted);
}

.dropzone-content .small {
  font-size: 0.8rem;
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--success);
}

.btn-small {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

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

th {
  background: var(--primary);
  color: white;
  padding: 0.5rem 0.6rem;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}

td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

tr:hover td {
  background: rgba(42, 82, 152, 0.03);
}

tr.warn td {
  background: #fffbeb;
}

.badge {
  background: var(--primary-light);
  color: white;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-weight: 600;
}

/* Warnings */
.warnings {
  border-color: var(--warning);
  background: #fffdf0;
}

.warnings h2 {
  color: var(--warning);
  border-bottom-color: var(--warning);
}

.warnings ul {
  list-style: none;
  font-size: 0.85rem;
}

.warnings li {
  padding: 0.3rem 0;
  color: #744210;
}

.warnings li::before {
  content: '\26A0\FE0F ';
}

/* Summary */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .summary-grid { grid-template-columns: 1fr; }
}

.summary-grid h3 {
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* Actions */
.actions {
  text-align: center;
  margin: 2rem 0;
}

.btn {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #c53030;
}

.btn-primary:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
}

/* Loading */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

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

footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}
