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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f6fa;
  color: #2d3436;
  min-height: 100vh;
}

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 16px 32px;
}

header h1 {
  font-size: 20px;
  font-weight: 600;
  color: #1a73e8;
}

.container {
  max-width: 960px;
  margin: 40px auto;
  padding: 0 24px;
}

.legal-link {
  font-size: 13px;
  color: #636e72;
  margin-bottom: 16px;
}

.legal-link a {
  color: #1a73e8;
  text-decoration: none;
}

.legal-link a:hover {
  text-decoration: underline;
}

.legal-list {
  list-style: disc;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: #2d3436;
}

.legal-list strong {
  font-weight: 600;
}

.legal-section {
  margin-bottom: 40px;
}

.legal-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #2d3436;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e0e0;
}

.legal-meta {
  font-size: 13px;
  color: #636e72;
  margin-bottom: 24px;
}

/* Home page */
.page-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.page-subtitle {
  color: #636e72;
  margin-bottom: 32px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.tool-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s;
  display: block;
}

.tool-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  border-color: #1a73e8;
}

.tool-card h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.tool-card p {
  font-size: 14px;
  color: #636e72;
  line-height: 1.5;
}

/* Reconciliation page */
.page-header {
  margin-bottom: 32px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}

.page-header p {
  color: #636e72;
  font-size: 14px;
}

.card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 24px;
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #1a73e8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 13px;
}

.form-group input[type="text"] + .helper-text {
  margin-top: 6px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input[type="text"]:focus {
  border-color: #1a73e8;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.upload-box {
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.15s;
}

.upload-box.uploaded {
  border-color: #27ae60;
  background: #f0faf4;
}

.upload-box.uploading {
  border-color: #1a73e8;
  background: #f0f6ff;
}

.upload-box label {
  font-size: 13px;
  font-weight: 600;
  display: block;
  margin-bottom: 10px;
  color: #636e72;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.upload-box .file-name {
  font-size: 13px;
  color: #2d3436;
  margin-top: 8px;
  word-break: break-all;
}

.upload-box .upload-status {
  font-size: 12px;
  margin-top: 6px;
}

.upload-box.uploaded .upload-status { color: #27ae60; }
.upload-box.uploading .upload-status { color: #1a73e8; }

.btn-upload {
  display: inline-block;
  padding: 8px 18px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-upload:hover { background: #1558b0; }
.btn-upload:disabled { background: #b0c4de; cursor: not-allowed; }

input[type="file"] { display: none; }

.upload-hint {
  margin-top: 8px;
  margin-bottom: 0;
}

.refresh-hint {
  font-size: 13px;
  color: #636e72;
  margin-bottom: 16px;
}

.helper-text {
  font-size: 13px;
  color: #636e72;
  margin-bottom: 20px;
}

/* Column mapping */
.col-mapping-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.col-mapping-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: #636e72;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 14px;
}

.mapping-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.mapping-row span {
  font-size: 13px;
  min-width: 110px;
  color: #2d3436;
}

.mapping-row select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
}

.mapping-row select:focus { border-color: #1a73e8; }

/* Process button */
.btn-process {
  display: block;
  width: auto;
  margin: 0 auto;
  padding: 14px 48px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-process:hover { background: #1558b0; }
.btn-process:disabled { background: #b0c4de; cursor: not-allowed; }

/* Spinner */
.spinner-wrap {
  text-align: center;
  padding: 24px;
}

.spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 4px solid #e0e0e0;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

.spinner-wrap p {
  font-size: 14px;
  color: #636e72;
}

/* Output downloads */
.output-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.output-item {
  background: #f0faf4;
  border: 1px solid #27ae60;
  border-radius: 8px;
  padding: 16px;
}

.output-item p {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #2d3436;
}

.btn-download {
  display: inline-block;
  padding: 7px 16px;
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.btn-download:hover { background: #1e8449; }

/* Error / alert */
.alert {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fdecea;
  border: 1px solid #e74c3c;
  color: #c0392b;
}

.hidden { display: none; }

@media (max-width: 640px) {
  .upload-row, .col-mapping-grid, .output-list { grid-template-columns: 1fr; }
}
