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

:root {
  --primary: #8b1538;
  --primary-hover: #6d102b;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #ddd;
  --border-light: #eee;
  --bg: #fff;
  --success: #2d7a3e;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.disease-select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
}

/* Upload history side pane */
.history-toggle {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 1200;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  border: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  cursor: pointer;
}

.side-pane {
  position: fixed;
  top: 0;
  left: -380px;     /* hidden by default on the left */
  right: auto;
  width: 360px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--border); /* border on right when left aligned */
  box-shadow: 8px 0 30px rgba(0,0,0,0.08);
  z-index: 1150;
  transition: left 0.28s cubic-bezier(.2,.9,.2,1);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.side-pane.open {
  left: 0;
}

.side-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.side-pane-header h3 {
  margin: 0;
  font-size: 1rem;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.history-list {
  overflow-y: auto;
  padding: 0.5rem 0.5rem 1rem 0.5rem;
  flex: 1 1 auto;
}

/* Accordion item */
.accordion-item {
  border-radius: 6px;
  border: 1px solid var(--border-light);
  margin-bottom: 0.5rem;
  overflow: hidden;
  background: #fff;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  cursor: pointer;
  gap: 0.5rem;
}

.accordion-header .meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9rem;
}

.accordion-header .meta .name {
  font-weight: 600;
  color: var(--text);
}

.accordion-header .meta .sub {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.accordion-toggle {
  font-size: 1rem;
  color: var(--primary);
  background: transparent;
  border: none;
  cursor: pointer;
}

.accordion-content {
  padding: 0.75rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-muted);
  display: none;
}

.accordion-item.open .accordion-content {
  display: block;
}

/* Footer */
.side-pane-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Mobile: make pane full width */
@media (max-width: 640px) {
  .side-pane { width: 100%; left: -100%; right: auto; }
  .side-pane.open { left: 0; }
  .history-toggle { left: 12px; right: auto; bottom: 12px; }
}

/* try to center options too (may be ignored by some browsers) */

/* center other selected/visible text elements */
.upload-text,
.upload-hint,
.section-desc,
.section-title,
.upload-disabled-message {
  text-align: center;
}

/* Header */
.header {
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 2rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  height: 48px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--primary);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Organisation unit badge shown in header */
.org-badge {
  display: inline-block;
  background: rgba(139, 21, 56, 0.08);
  color: var(--primary);
  border: 1px solid rgba(139, 21, 56, 0.18);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1;
  white-space: nowrap;
}

/* Ensure hidden class continues to hide when present */
.org-badge.hidden {
  display: none !important;
}

/* Main */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 2rem;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-bottom: 3rem;
  padding: 0 1rem;
}

.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.stepper-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #999;
  border: 2px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.stepper-step.active .stepper-circle,
.stepper-step.completed .stepper-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.stepper-step:not(.active):not(.completed) .stepper-circle {
  background: transparent;
  border-color: #e0e0e0;
  color: #999;
}

.stepper-label {
  font-size: 0.875rem;
  color: #999;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.stepper-step.active .stepper-label,
.stepper-step.completed .stepper-label {
  color: var(--text);
  font-weight: 600;
}

.stepper-line {
  width: 80px;
  height: 2px;
  background: #e0e0e0;
  margin-top: 19px;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.stepper-step.completed + .stepper-line {
  background: var(--primary);
}

/* Upload section */
.upload-section .section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.section-desc {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2.5rem;
  text-align: center;
  background: #fafafa;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone.dragover {
  border-color: var(--primary);
  background: #fff5f7;
}

.upload-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

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

.upload-text {
  margin: 0;
  font-size: 1rem;
}

.upload-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  padding: 0.65rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  margin-top: 0.5rem;
}

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

.btn-secondary {
  background: #e0e0e0;
  color: var(--text);
}

.btn-secondary:hover {
  background: #d0d0d0;
}

/* Guidelines */
.guidelines {
  margin-top: 2rem;
}

.guidelines-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.guidelines-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.guidelines-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.check {
  color: var(--success);
  font-weight: bold;
}

.guidelines-list a {
  color: var(--primary);
  text-decoration: none;
}

.guidelines-list a:hover {
  text-decoration: underline;
}

/* Preview section */
.preview-section {
  margin-top: 0;
}

.preview-section .section-title {
  margin-bottom: 1rem;
}

.preview-table-wrapper {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  max-height: 600px;
  overflow-y: auto;
}

.preview-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.preview-table th,
.preview-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.preview-table th {
  background: #fff;
  font-weight: 600;
  color: var(--text);
  font-size: 0.875rem;
  position: relative;
  white-space: nowrap;
  border-bottom: 2px solid var(--border-light);
}

.preview-table th:not(:last-child) {
  border-right: none;
}

.preview-table th:last-child {
  width: 50px;
  text-align: center;
}

.preview-table th .sort-icon {
  display: inline-block;
  margin-left: 0.5rem;
  opacity: 0.5;
  font-size: 0.7rem;
  vertical-align: middle;
  transition: opacity 0.2s;
}

.preview-table th:hover .sort-icon {
  opacity: 0.8;
}

.preview-table tbody tr {
  transition: background-color 0.15s ease;
}

.preview-table tbody tr:nth-child(even) {
  background-color: #fafafa;
}

.preview-table tbody tr:hover {
  background-color: #f0f0f0;
}

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

.preview-table td {
  color: var(--text);
  vertical-align: middle;
}

.preview-table td:last-child {
  text-align: center;
  width: 50px;
}

.preview-table .row-actions {
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-muted);
  user-select: none;
  font-size: 1.2rem;
  line-height: 1;
  display: inline-block;
  transition: color 0.2s;
  vertical-align: middle;
}

.upload-disabled-message {
  text-align: center;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #fff8c6;
  color: #333;
  border: 1px solid #f0e1a0;
  border-radius: 4px;
}

.preview-table .row-actions:hover {
  color: var(--text);
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.hidden {
  display: none !important;
}

/* Error message */
.upload-error {
  color: #c62828;
  font-size: 0.875rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #ffebee;
  border-left: 3px solid #c62828;
  border-radius: 4px;
  text-align: left;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Login page centered layout and form styles */
.login-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px); /* leave space for header */
  padding: 2rem;
}

.login-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  text-align: left;
}

.login-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.login-sub {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-form input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  width: 100%;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(139, 21, 56, 0.06);
}

.visually-hidden {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.login-help {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  text-align: right;
}

.login-help a {
  color: var(--primary);
  text-decoration: none;
}

.login-help a:hover {
  text-decoration: underline;
}

@media (max-width: 420px) {
  .login-card {
    padding: 1rem;
    border-radius: 8px;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .stepper {
    flex-wrap: wrap;
    justify-content: center;
  }

  .stepper-line {
    width: 30px;
  }

  .preview-table-wrapper {
    overflow-x: auto;
  }

  .preview-table {
    min-width: 600px;
  }
}

/* ...existing code... */

#parseProgressWrap {
  background: #f5f6f8;               /* soft grey */
  border: 1px solid #e3e6ea;
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

/* nicer native progress styling */
#parseProgress {
  width: 100%;
  height: 10px;
  border-radius: 6px;
  background: #eee;
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
}
/*#parseProgress::-webkit-progress-bar { background: #eee; }
#parseProgress::-webkit-progress-value {
  background: linear-gradient(90deg,#4a90e2,#6fb3ff);
}
#parseProgress::-moz-progress-bar {
  background: linear-gradient(90deg,#4a90e2,#6fb3ff);
}*/
#parseProgress::-webkit-progress-value {
  background: linear-gradient(90deg,#8b1538 0%, #b21f48 100%); /* maroon gradient */
}
#parseProgress::-webkit-progress-bar {
  background: #eee;
}

/* Firefox */
#parseProgress::-moz-progress-bar {
  background: linear-gradient(90deg,#8b1538,#b21f48);
}

/* center the textual progress/status */
#parseProgressPct,
#parseProgressStatus {
  text-align: center;
  width: 100%;
  color: var(--text-muted);
  font-size: 0.85rem
}

/* keep cancel button aligned to the right */
#parseCancelBtn {
  align-self: flex-end;
  margin-top: 4px;
  padding: 6px 10px;
  font-size: 0.85rem;
}