/* =========================================================
   Totally Booked – Main Stylesheet
   ========================================================= */

/* Ensure HTML hidden attribute always wins over CSS display rules */
[hidden] { display: none !important; }

:root {
  --tb-blue:       #2563eb;
  --tb-blue-dark:  #1e40af;
  --tb-blue-light: #eff6ff;
  --tb-green:      #16a34a;
  --tb-red:        #dc2626;
  --tb-amber:      #f59e0b;
  --tb-gray-50:    #f9fafb;
  --tb-gray-100:   #f3f4f6;
  --tb-gray-200:   #e5e7eb;
  --tb-gray-400:   #9ca3af;
  --tb-gray-600:   #4b5563;
  --tb-gray-900:   #111827;
  --tb-shadow:     0 4px 24px rgba(37,99,235,0.10);
  --tb-radius:     12px;
  --tb-font:       'Inter', 'Segoe UI', Arial, sans-serif;
}

#tb-app * { box-sizing: border-box; }

#tb-app {
  font-family: var(--tb-font);
  color: var(--tb-gray-900);
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ── Screens ─────────────────────────────────────────────── */
.tb-screen { display: none; }
.tb-screen.active { display: block; }

/* ── Hero ────────────────────────────────────────────────── */
.tb-hero { text-align: center; margin-bottom: 32px; }
.tb-logo {
  font-size: 2rem;
  font-weight: 800;
  color: var(--tb-blue);
  margin: 0 0 8px;
  letter-spacing: -0.5px;
}
.tb-tagline {
  font-size: 1.05rem;
  color: var(--tb-gray-600);
  margin: 0;
}

/* ── Upload Card ─────────────────────────────────────────── */
.tb-upload-card {
  background: #fff;
  border: 1px solid var(--tb-gray-200);
  border-radius: var(--tb-radius);
  padding: 32px;
  box-shadow: var(--tb-shadow);
}

.tb-upload-zone {
  border: 2px dashed var(--tb-blue);
  border-radius: 10px;
  padding: 40px 24px;
  text-align: center;
  background: var(--tb-blue-light);
  transition: background 0.2s;
  cursor: pointer;
}
.tb-upload-zone.drag-over {
  background: #dbeafe;
  border-color: var(--tb-blue-dark);
}
.tb-upload-icon { color: var(--tb-blue); margin-bottom: 12px; }
.tb-upload-text { font-size: 1.05rem; font-weight: 600; margin: 0 0 4px; color: var(--tb-gray-900); }
.tb-upload-sub  { font-size: 0.85rem; color: var(--tb-gray-400); margin: 0 0 16px; }

.tb-banks-logos {
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--tb-gray-400);
}
.tb-banks-logos strong { margin: 0 6px; color: var(--tb-gray-600); }

/* ── Buttons ─────────────────────────────────────────────── */
.tb-btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.tb-btn-primary {
  background: var(--tb-blue);
  color: #fff;
}
.tb-btn-primary:hover { background: var(--tb-blue-dark); }
.tb-btn-ghost {
  background: transparent;
  color: var(--tb-blue);
  border: 1.5px solid var(--tb-blue);
}
.tb-btn-ghost:hover { background: var(--tb-blue-light); }
.tb-btn-lg  { padding: 14px 32px; font-size: 1rem; }
.tb-btn-sm  { padding: 6px 14px; font-size: 0.82rem; }

/* ── Alerts ──────────────────────────────────────────────── */
.tb-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-top: 16px;
}
.tb-alert-error   { background: #fef2f2; border-left: 4px solid var(--tb-red);   color: #991b1b; }
.tb-alert-warning { background: #fffbeb; border-left: 4px solid var(--tb-amber); color: #92400e; }
.tb-alert-success { background: #f0fdf4; border-left: 4px solid var(--tb-green); color: #14532d; }

/* ── Progress Bar ────────────────────────────────────────── */
.tb-progress-bar {
  height: 8px;
  background: var(--tb-gray-200);
  border-radius: 99px;
  margin: 16px 0 6px;
  overflow: hidden;
}
.tb-progress-fill {
  height: 100%;
  background: var(--tb-blue);
  border-radius: 99px;
  width: 0%;
  transition: width 0.4s ease;
}
.tb-progress-label {
  text-align: center;
  font-size: 0.85rem;
  color: var(--tb-gray-600);
  margin: 0;
}

/* ── Past Sessions ───────────────────────────────────────── */
.tb-past-sessions { margin-top: 36px; }
.tb-past-sessions h3 { font-size: 0.95rem; color: var(--tb-gray-600); margin-bottom: 12px; }
.tb-sessions-list { display: flex; flex-direction: column; gap: 8px; }
.tb-session-item {
  background: #fff;
  border: 1px solid var(--tb-gray-200);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.tb-session-item:hover { border-color: var(--tb-blue); }
.tb-session-name { font-weight: 600; font-size: 0.9rem; }
.tb-session-meta { font-size: 0.8rem; color: var(--tb-gray-400); margin-top: 2px; }
.tb-session-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
}
.tb-status-COMPLETE       { background: #dcfce7; color: #15803d; }
.tb-status-REVIEW_PENDING { background: #fef3c7; color: #92400e; }
.tb-status-ERROR          { background: #fee2e2; color: #991b1b; }
.tb-status-PARSING, .tb-status-CATEGORISING { background: #eff6ff; color: var(--tb-blue); }

/* ── Processing Screen ───────────────────────────────────── */
.tb-processing-card {
  text-align: center;
  padding: 80px 32px;
}
.tb-spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--tb-gray-200);
  border-top-color: var(--tb-blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tb-steps { margin-top: 32px; display: flex; flex-direction: column; gap: 8px; text-align: left; max-width: 280px; margin-left: auto; margin-right: auto; }
.tb-step { font-size: 0.9rem; color: var(--tb-gray-400); }
.tb-step.active   { color: var(--tb-blue); font-weight: 600; }
.tb-step.complete { color: var(--tb-green); }
.tb-step-icon { margin-right: 8px; }

/* ── Review Summary ──────────────────────────────────────── */
.tb-review-summary-card {
  background: #fff;
  border-radius: var(--tb-radius);
  padding: 40px;
  text-align: center;
  box-shadow: var(--tb-shadow);
  border: 1px solid var(--tb-gray-200);
}
.tb-summary-icons {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.tb-summary-item { text-align: center; }
.tb-summary-num {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
}
.tb-summary-item.success .tb-summary-num { color: var(--tb-green); }
.tb-summary-item.warning .tb-summary-num { color: var(--tb-amber); }
.tb-summary-lbl { font-size: 0.85rem; color: var(--tb-gray-600); margin-top: 4px; display: block; }
.tb-summary-note { color: var(--tb-gray-600); font-size: 0.9rem; margin-bottom: 24px; }

/* ── Review Screen ───────────────────────────────────────── */
.tb-review-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.tb-review-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--tb-gray-200);
  border-radius: 99px;
  overflow: hidden;
  min-width: 120px;
}
.tb-review-progress-fill {
  height: 100%;
  background: var(--tb-blue);
  border-radius: 99px;
  transition: width 0.3s;
  width: 0%;
}
.tb-review-progress-label { font-size: 0.85rem; color: var(--tb-gray-600); white-space: nowrap; }

/* ── Bulk Banner ─────────────────────────────────────────── */
.tb-bulk-banner {
  background: #eff6ff;
  border: 1.5px solid var(--tb-blue);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.tb-bulk-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.tb-bulk-icon { font-size: 1.4rem; margin-top: 2px; }
.tb-bulk-inner > div { flex: 1; }
.tb-bulk-inner p { margin: 4px 0 0; font-size: 0.85rem; color: var(--tb-gray-600); }
.tb-bulk-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Review Card ─────────────────────────────────────────── */
.tb-review-card {
  background: #fff;
  border: 1px solid var(--tb-gray-200);
  border-radius: var(--tb-radius);
  padding: 28px 32px;
  box-shadow: var(--tb-shadow);
}
.tb-txn-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.tb-txn-date   { font-size: 0.85rem; color: var(--tb-gray-400); }
.tb-txn-amount { font-size: 1.4rem; font-weight: 800; }
.tb-txn-amount.credit { color: var(--tb-green); }
.tb-txn-amount.debit  { color: var(--tb-red); }
.tb-txn-desc {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
  word-break: break-word;
}
.tb-txn-flag {
  font-size: 0.82rem;
  color: var(--tb-amber);
  background: #fffbeb;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 20px;
}

.tb-cat-label { font-size: 0.85rem; color: var(--tb-gray-600); margin: 0 0 8px; }
.tb-cat-suggestion {
  background: var(--tb-blue-light);
  border: 1.5px solid var(--tb-blue);
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  color: var(--tb-blue);
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.tb-cat-confidence {
  font-size: 0.78rem;
  color: var(--tb-gray-400);
  font-weight: 400;
  margin-left: 8px;
}

.tb-cat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.tb-cat-opt {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--tb-gray-200);
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.12s;
}
.tb-cat-opt:hover, .tb-cat-opt.selected {
  border-color: var(--tb-blue);
  background: var(--tb-blue-light);
  color: var(--tb-blue);
}
.tb-cat-opt-else {
  border-style: dashed;
  color: var(--tb-gray-600);
}

.tb-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--tb-gray-200);
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  margin-top: 8px;
}
.tb-select:focus { border-color: var(--tb-blue); outline: none; }

.tb-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--tb-gray-200);
  border-radius: 8px;
  font-size: 0.9rem;
}
.tb-input:focus { border-color: var(--tb-blue); outline: none; }

.tb-note-row { margin: 16px 0; }

.tb-review-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ── List Mode Table ─────────────────────────────────────── */
.tb-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 20px;
}
.tb-list-table th {
  background: var(--tb-blue);
  color: #fff;
  padding: 8px 12px;
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
}
.tb-list-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--tb-gray-200);
  vertical-align: middle;
}
.tb-list-table tr:hover td { background: var(--tb-gray-50); }
.tb-list-table select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--tb-gray-200); font-size: 0.82rem; }
.tb-list-table input[type="text"] { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--tb-gray-200); font-size: 0.82rem; width: 120px; }

/* ── Reports Screen ──────────────────────────────────────── */
.tb-reports-header {
  text-align: center;
  margin-bottom: 32px;
}
.tb-reports-header h2 { font-size: 1.8rem; font-weight: 800; margin: 0 0 6px; }
.tb-reports-header p  { color: var(--tb-gray-600); font-size: 0.9rem; margin: 0 0 20px; }

.tb-report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.tb-summary-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--tb-gray-200);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.tb-summary-card-label { font-size: 0.78rem; text-transform: uppercase; color: var(--tb-gray-400); margin-bottom: 8px; letter-spacing: 0.5px; }
.tb-summary-card-val   { font-size: 1.35rem; font-weight: 800; color: var(--tb-gray-900); }
.tb-summary-card-val.positive { color: var(--tb-green); }
.tb-summary-card-val.negative { color: var(--tb-red); }

.tb-report-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--tb-gray-200);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tb-tab {
  padding: 10px 18px;
  background: none;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--tb-gray-600);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  margin-bottom: -2px;
  transition: all 0.12s;
}
.tb-tab:hover { color: var(--tb-blue); }
.tb-tab.active {
  color: var(--tb-blue);
  border-bottom-color: var(--tb-blue);
}

.tb-report-content {
  background: #fff;
  border: 1px solid var(--tb-gray-200);
  border-radius: var(--tb-radius);
  padding: 28px;
  margin-bottom: 32px;
  min-height: 300px;
}

.tb-report-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tb-report-table th { background: var(--tb-blue); color: #fff; padding: 8px 14px; text-align: left; }
.tb-report-table td { padding: 8px 14px; border-bottom: 1px solid var(--tb-gray-100); }
.tb-report-table .amount { text-align: right; font-family: monospace; }
.tb-report-table tr.section { background: var(--tb-blue-light); }
.tb-report-table tr.section td { font-weight: 700; color: var(--tb-blue-dark); padding: 10px 14px; }
.tb-report-table tr.subtotal td { border-top: 2px solid var(--tb-blue); font-weight: 700; }
.tb-report-table tr.grand-total td { background: var(--tb-blue-dark); color: #fff; font-weight: 800; }
.tb-amount-positive { color: var(--tb-green); }
.tb-amount-negative { color: var(--tb-red); }

.tb-report-disclaimer {
  font-size: 0.8rem;
  color: var(--tb-gray-400);
  border-top: 1px solid var(--tb-gray-200);
  margin-top: 20px;
  padding-top: 12px;
}
.tb-report-warning {
  background: #fffbeb;
  border-left: 4px solid var(--tb-amber);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #92400e;
  margin-bottom: 16px;
}

.tb-download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.tb-download-item {
  background: #fff;
  border: 1px solid var(--tb-gray-200);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}
.tb-download-item strong { font-weight: 600; }
.tb-download-item a { color: var(--tb-blue); font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.tb-download-item a:hover { text-decoration: underline; }

/* ── Modals ──────────────────────────────────────────────── */
.tb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.tb-modal {
  background: #fff;
  border-radius: var(--tb-radius);
  padding: 36px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.tb-modal h3 { margin: 0 0 8px; font-size: 1.25rem; }
.tb-modal p  { color: var(--tb-gray-600); font-size: 0.9rem; margin-bottom: 20px; }

.tb-entity-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.tb-entity-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid var(--tb-gray-200);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.tb-entity-option:has(input:checked) { border-color: var(--tb-blue); background: var(--tb-blue-light); color: var(--tb-blue); }
.tb-opening-bal-row {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tb-opening-bal-row label { font-size: 0.88rem; white-space: nowrap; }
.tb-opening-bal-row .tb-input { flex: 1; }

.tb-modal-actions { display: flex; gap: 12px; }

/* ── Login notice ────────────────────────────────────────── */
.tb-login-notice {
  text-align: center;
  padding: 40px;
  color: var(--tb-gray-600);
}
.tb-login-notice a { color: var(--tb-blue); font-weight: 600; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .tb-review-card { padding: 20px 16px; }
  .tb-summary-icons { gap: 20px; }
  .tb-summary-num { font-size: 2rem; }
  .tb-upload-card { padding: 20px; }
  .tb-report-tabs { gap: 0; }
  .tb-tab { padding: 8px 12px; font-size: 0.8rem; }
}
