/* Graystone Survey – minimal styles */

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  background: #f5f5f5;
  color: #222;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.login-card .subtitle {
  margin: 0 0 1.5rem;
  color: #666;
  font-size: 0.9rem;
}

.login-form label {
  display: block;
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.login-form input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-top: 0.25rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.login-form button {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.6rem 1rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

.login-form button:hover {
  background: #1d4ed8;
}

.error {
  color: #b91c1c;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

/* Dashboard */
.dashboard-page {
  min-height: 100vh;
}

.header {
  background: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.header .user {
  margin-left: auto;
  color: #555;
  font-size: 0.9rem;
}

.btn-logout {
  padding: 0.4rem 0.75rem;
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
}

.btn-logout:hover {
  background: #f5f5f5;
}

.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.upload-section {
  margin-bottom: 1.5rem;
}

/* Reconciliation (by file) */
.reconciliation-section {
  margin-bottom: 1.5rem;
}
.reconciliation-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}
.reconciliation-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.reconciliation-table th,
.reconciliation-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}
.reconciliation-table th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #64748b;
}
.reconciliation-table td {
  font-size: 0.9rem;
}
.reconciliation-table tbody tr.empty td {
  text-align: center;
  color: #64748b;
  padding: 1.5rem;
}

.btn-primary {
  padding: 0.6rem 1.2rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.upload-progress-wrap {
  margin-top: 0.75rem;
  max-width: 320px;
}
.upload-progress-wrap.hidden {
  display: none;
}
.upload-progress-text {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: #475569;
}
.upload-progress-bar {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  overflow: hidden;
}
.upload-progress-bar::-webkit-progress-bar {
  background: #e2e8f0;
}
.upload-progress-bar::-webkit-progress-value {
  background: #2563eb;
  border-radius: 4px;
}
.upload-progress-bar::-moz-progress-bar {
  background: #2563eb;
  border-radius: 4px;
}

.jobs-section h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.jobs-table th,
.jobs-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}
.jobs-table th:last-child,
.jobs-table td.action-cell {
  min-width: 140px;
}

.jobs-table th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #64748b;
}

.jobs-table td {
  font-size: 0.9rem;
}

.jobs-table a.download-link {
  color: #2563eb;
  text-decoration: none;
}

.jobs-table a.download-link:hover {
  text-decoration: underline;
}

.status-queued { color: #64748b; }
.status-processing { color: #0ea5e9; }
.status-completed { color: #059669; }
.status-failed { color: #b91c1c; }

.tooltip-wrap {
  position: relative;
}

.tooltip-wrap[title] {
  cursor: help;
}

#jobsBody tr.empty td {
  text-align: center;
  color: #64748b;
  padding: 2rem;
}

/* Error button (failed jobs) */
.btn-error {
  padding: 0.4rem 0.75rem;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
}
.btn-error:hover {
  background: #fee2e2;
}

.btn-retry {
  padding: 0.4rem 0.75rem;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
}
.btn-retry:hover {
  background: #dbeafe;
}

.btn-reprocess {
  padding: 0.4rem 0.75rem;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
}
.btn-reprocess:hover {
  background: #d1fae5;
}

.btn-debug {
  padding: 0.4rem 0.75rem;
  background: #f5f5f5;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
}
.btn-debug:hover {
  background: #e5e7eb;
}

/* Action column: icon-only buttons and links – single row */
.action-cell {
  white-space: nowrap;
}
.action-icons-cell {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  width: max-content;
}
.action-icons-cell .btn-icon,
.action-icons-cell .btn-icon-link {
  flex: 0 0 32px;
  min-width: 32px;
  max-width: 32px;
}
.btn-icon,
.btn-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  box-sizing: border-box;
  padding: 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #475569;
  background: transparent;
  text-decoration: none;
}
.btn-icon:hover,
.btn-icon-link:hover {
  color: #0369a1;
  background: #f0f9ff;
}
.btn-icon:focus,
.btn-icon-link:focus {
  outline: 2px solid #0369a1;
  outline-offset: 2px;
}
.btn-view-summary {
  color: #0369a1;
}
.btn-view-summary:hover {
  background: #e0f2fe;
}
.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.action-icon svg {
  display: block;
}

.progress-step {
  font-size: 0.85rem;
  color: #64748b;
}

.debug-thumb {
  max-width: 100%;
  border: 1px solid #ddd;
  margin-bottom: 10px;
}

/* Modal */
.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-backdrop {
  position: absolute;
  inset: 0;
}
.modal-content {
  position: relative;
  background: #fff;
  padding: 20px;
  max-width: 700px;
  width: 90%;
  max-height: 90vh;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}
.modal-content h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}
.modal-content .muted {
  margin: 0 0 0.5rem;
  color: #64748b;
  font-size: 0.9rem;
}
.error-box {
  background: #f8f8f8;
  color: #b00020;
  padding: 12px;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
}
.modal-content .btn-primary {
  align-self: flex-start;
}

/* Summary modal */
.summary-dl {
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.summary-dl dt {
  font-weight: 600;
  color: #374151;
  margin-top: 0.75rem;
}
.summary-dl dt:first-child {
  margin-top: 0;
}
.summary-dl dd {
  margin: 0.25rem 0 0;
  color: #1f2937;
}
.summary-dl dd + dt {
  margin-top: 0.5rem;
}

.summary-by-type-table {
  width: auto;
  min-width: 200px;
  border-collapse: collapse;
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}
.summary-by-type-table td {
  padding: 0.35rem 1rem 0.35rem 0;
  border-bottom: 1px solid #eee;
}
.summary-by-type-table td:first-child {
  font-weight: 500;
  color: #374151;
}
.summary-by-type-table td:last-child {
  text-align: right;
}

.summary-no-data {
  margin: 0 0 0.75rem;
  padding: 0.5rem;
  background: #fef3c7;
  color: #92400e;
  border-radius: 4px;
  font-size: 0.875rem;
}

.view-icon {
  margin-right: 0.25em;
}

.jobs-table td .btn-view-summary {
  margin-right: 0.5rem;
}
