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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  font-size: 14px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  height: 56px;
  flex-shrink: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #1a56db;
}
.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #64748b;
}

/* ── Layout ── */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 16px 0;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0 16px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  color: #475569;
  font-size: 13px;
  transition: background .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: #f8fafc; color: #1e293b; }
.nav-item.active {
  background: #eff6ff;
  color: #1a56db;
  border-left-color: #1a56db;
  font-weight: 600;
}
.nav-icon { font-size: 14px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}
.nav-badge.warn { background: #fef3c7; color: #92400e; }
.nav-badge.ok { background: #d1fae5; color: #065f46; }
.nav-badge.err { background: #fee2e2; color: #991b1b; }

/* ── Content ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}
.page-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}
.page-subtitle {
  color: #64748b;
  line-height: 1.6;
  max-width: 780px;
  margin-bottom: 20px;
}
.tab-pane { display: block; }

/* ── Buttons ── */
.btn-primary {
  background: #1a56db;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-outline {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-outline:hover { background: #f9fafb; }
.btn-back {
  background: #f8fafc;
  color: #1a56db;
  border: 1px solid #bfdbfe;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-back:hover { background: #eff6ff; border-color: #1a56db; }
.btn-sm {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #374151;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
}
.btn-sm:hover { background: #e2e8f0; }
.btn-clear-single {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
}
.btn-clear-single:hover { background: #ffe4e6; }

/* ── AI top button (next to Reconcile Now) ── */
.btn-ai-top {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, box-shadow .15s;
  box-shadow: 0 2px 6px rgba(124,58,237,0.35);
  letter-spacing: 0.2px;
}
.btn-ai-top:hover { opacity: 0.88; box-shadow: 0 4px 12px rgba(124,58,237,0.5); }

/* ── Recon actions bar ── */
.recon-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.data-req {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 5px 10px;
  border-radius: 4px;
}

/* ── Result area ── */
.result-area { margin-top: 4px; }

.result-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
}
.summary-card .label { font-size: 11px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.summary-card .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.summary-card.green { border-color: #bbf7d0; background: #f0fdf4; }
.summary-card.green .value { color: #15803d; }
.summary-card.red { border-color: #fecaca; background: #fff1f2; }
.summary-card.red .value { color: #dc2626; }
.summary-card.yellow { border-color: #fde68a; background: #fffbeb; }
.summary-card.yellow .value { color: #b45309; }
.summary-card.blue { border-color: #bfdbfe; background: #eff6ff; }
.summary-card.blue .value { color: #1d4ed8; }

/* ── 3B vs 1 Section headers ── */
.recon-section-hdr {
  background: linear-gradient(90deg, #1F4E79 0%, #1a56db 100%);
  border-radius: 8px 8px 0 0;
  padding: 12px 18px 10px;
  margin-top: 24px;
  margin-bottom: 0;
}
.recon-section-hdr + .result-table-wrap {
  border-top: none;
  border-radius: 0 0 8px 8px;
  margin-top: 0;
  margin-bottom: 28px;
}
.recon-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
}
.recon-section-sub {
  font-size: 11.5px;
  color: #bfdbfe;
  margin-top: 3px;
}
.recon-sub-label { font-weight: 700; color: #93c5fd; }

/* ── Tables ── */
.result-table-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 20px;
}
.table-header {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 13px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.table-header .count-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #475569;
}
table { width: 100%; border-collapse: collapse; }
th {
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; font-family: 'SF Mono', 'Consolas', monospace; }
.td-diff-pos { color: #16a34a; font-weight: 600; } /* positive diff = green */
.td-diff-neg { color: #dc2626; font-weight: 600; } /* negative diff = red   */
.td-zero { color: #64748b; }
.row-match { background: #f0fdf4 !important; }
.row-mismatch { background: #fff7f7 !important; }
.row-warn { background: #fffbeb !important; }

/* ── Tags / chips ── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-purple { background: #ede9fe; color: #6d28d9; }
.tag-green { background: #d1fae5; color: #065f46; }
.tag-teal { background: #ccfbf1; color: #0f766e; }
.tag-orange { background: #ffedd5; color: #c2410c; }
.tag-red { background: #fee2e2; color: #991b1b; }
.tag-indigo { background: #e0e7ff; color: #3730a3; }

.chip-match { background: #d1fae5; color: #065f46; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.chip-mismatch { background: #fee2e2; color: #991b1b; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.chip-warn { background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.chip-info { background: #dbeafe; color: #1e40af; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.chip-ok   { background: #ccfbf1; color: #0f766e; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }

/* ── Status dot ── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-left: auto;
}
.status-dot.red { background: #ef4444; }
.status-dot.green { background: #22c55e; }

/* ── Data cards ── */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.data-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
}
.data-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 13px;
}
input[type="file"] { display: none; }
.upload-label {
  display: block;
  text-align: center;
  padding: 14px 10px 10px;
  border: 2px dashed #cbd5e1;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  font-size: 12px;
  margin-bottom: 6px;
  transition: all .15s;
  position: relative;
}
.upload-label::before {
  content: "📎 Click to browse  OR  drag & drop file here";
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #1a56db;
  margin-bottom: 4px;
  letter-spacing: 0.2px;
}
.upload-label:hover { border-color: #1a56db; color: #1a56db; background: #eff6ff; }
.upload-label.loaded { border-color: #22c55e; color: #15803d; background: #f0fdf4; border-style: solid; }
.upload-label.loaded::before { content: "✓ File loaded — click to replace  OR  drag new file"; color: #15803d; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
  font-size: 15px;
}

/* ── Alert boxes ── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-err { background: #fff1f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-icon { font-size: 16px; margin-top: 1px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 28px;
  width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-large { width: 680px; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 24px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.form-row input, .form-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 13px;
  background: #fff;
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: #1a56db; }
.form-section { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; margin: 18px 0 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Section divider ── */
.section-divider {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  margin: 24px 0 12px;
}

/* ── Dashboard ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.dash-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
}
.dash-card .recon-name { font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.dash-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; }
.dash-row .dl { color: #64748b; }

/* ── XLSDeal Extension Panel ── */
.ext-panel {
  margin-top: 24px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 16px 18px;
}
.ext-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.ext-status {
  font-size: 12px;
  color: #0369a1;
  font-weight: 600;
}
.ext-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 10px;
}
.ext-log {
  font-family: monospace;
  font-size: 11px;
  color: #334155;
  background: #fff;
  border: 1px solid #e0f2fe;
  border-radius: 4px;
  padding: 8px 10px;
  max-height: 80px;
  overflow-y: auto;
  white-space: pre-wrap;
  min-height: 30px;
}

/* ── Download from Portal Button ── */
.btn-download {
  background: #0f766e;
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-download:hover { background: #0d6460; }

/* ── Download Modal ── */
.dl-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}
.dl-step {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: #94a3b8;
}
.dl-step.active { background: #1a56db; color: #fff; }
.dl-step.done   { background: #15803d; color: #fff; }

.dl-note {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 16px;
  line-height: 1.6;
}
.dl-period-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.captcha-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
}
.captcha-img {
  max-height: 60px;
  max-width: 200px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.dl-progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.dl-ret {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ret-icon { font-size: 16px; }
.ret-icon.ok  { color: #15803d; }
.ret-icon.err { color: #dc2626; }

.dl-log {
  font-family: monospace;
  font-size: 11px;
  color: #334155;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 8px 10px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.7;
}
.dl-log div { border-bottom: 1px solid #f1f5f9; }

.alert-err  { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-warn { background: #fffbeb; border-color: #fcd34d; color: #92400e; }

/* ═══════════════════════════════════════════════════════
   SMART PROMPT MODALS
   ═══════════════════════════════════════════════════════ */
.sp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}
.sp-modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  width: 100%;
  max-width: 680px;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px;
}
.sp-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.sp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.sp-count {
  font-size: 12.5px;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 20px;
}
.sp-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-shrink: 0;
}

/* ── Client table ── */
.sp-table-wrap {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.sp-table-wrap::-webkit-scrollbar { width: 5px; }
.sp-table-wrap::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }

.sp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sp-table thead tr {
  background: #1F4E79;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1;
}
.sp-table th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .03em;
}
.sp-table th input[type=checkbox] { accent-color: #fff; transform: scale(1.15); }
.sp-table tbody tr { transition: background .1s; cursor: pointer; }
.sp-table tbody tr:hover { background: #eff6ff; }
.sp-table tbody tr.sp-selected { background: #dbeafe; }
.sp-table tbody tr:not(:last-child) { border-bottom: 1px solid #f1f5f9; }
.sp-table td { padding: 10px 14px; }
.sp-table td:first-child { text-align: center; }
.sp-table input[type=checkbox] { accent-color: #1a56db; transform: scale(1.15); }
.sp-num-cell { color: #94a3b8; font-size: 12px; }
.sp-name-cell { font-weight: 500; color: #0f172a; }
.sp-gstin-cell { font-family: 'Cascadia Code','Consolas',monospace; font-size: 12px; color: #475569; }

/* FY / Month / Returns use the same .sp-table layout as Client — no separate styles needed */

/* No-captcha / OTP info note */
.dl-info-note {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #15803d;
  margin-bottom: 8px;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════
   DOWNLOADER TAB — Split layout + Terminal
   ═══════════════════════════════════════════════════════ */
#tab-downloader {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
}
.dl-split {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100%;
  overflow: hidden;
}

/* ── Left controls panel ── */
.dl-ctrl-panel {
  background: #fff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 20px 16px;
}
.dl-ctrl-panel::-webkit-scrollbar { width: 4px; }
.dl-ctrl-panel::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

.dl-sec-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin: 18px 0 10px;
  padding-left: 2px;
}
.dl-sec-label:first-child { margin-top: 0; }

.dl-phase-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}
.dl-phase-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.dl-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #fff;
  flex-shrink: 0;
}
.dl-badge-blue   { background: #1a56db; }
.dl-badge-orange { background: #ea580c; }
.dl-badge-green  { background: #16a34a; }

.dl-phase-name { font-size: 13px; font-weight: 700; color: #0f172a; flex: 1; }
.dl-phase-sub  { font-size: 11px; color: #64748b; margin-top: 1px; }

.dl-phase-body { padding: 12px 14px 14px; }
.dl-phase-desc { font-size: 12px; color: #64748b; line-height: 1.55; margin-bottom: 12px; }

.dl-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 11.5px;
  color: #9a3412;
  line-height: 1.5;
  margin-bottom: 12px;
}
.dl-notice-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

.script-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  transition: all .15s;
  margin-bottom: 8px;
  text-align: left;
}
.script-btn:last-child { margin-bottom: 0; }
.script-btn:hover:not(:disabled) { background: #eff6ff; border-color: #1a56db; color: #1a56db; }
.script-btn:hover:not(:disabled) .script-file { color: #93c5fd; }
.script-btn:disabled { opacity: .45; cursor: not-allowed; }
.script-btn.running-this { background: #0f172a; border-color: #0f172a; color: #fff; }
.script-btn.running-this .script-file { color: rgba(255,255,255,.5); }
.script-left  { display: flex; align-items: center; gap: 10px; }
.script-icon  { font-size: 15px; }
.script-info  { display: flex; flex-direction: column; gap: 2px; }
.script-name  { font-size: 13px; font-weight: 600; }
.script-file  { font-size: 10.5px; color: #94a3b8; font-family: 'Cascadia Code','Consolas',monospace; }
.script-arrow {
  width: 27px; height: 27px; border-radius: 6px;
  background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0; transition: background .15s;
}
.script-btn:hover:not(:disabled) .script-arrow { background: #dbeafe; color: #1a56db; }
.script-btn.running-this .script-arrow { background: rgba(255,255,255,.15); color: #fff; }

/* ── Server status badge (header) ── */
.srv-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
}
.srv-dot { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; transition: background .3s; flex-shrink: 0; }
.srv-dot.ok { background: #22c55e; }

/* ── Terminal panel ── */
.dl-term-panel {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  overflow: hidden;
  position: relative;
}
.term-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  flex-shrink: 0;
}
.term-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1e40af;
}
.term-dots { display: flex; gap: 5px; }
.term-dot { width: 11px; height: 11px; border-radius: 50%; }
.term-dot-red    { background: #ff5f57; }
.term-dot-yellow { background: #ffbd2e; }
.term-dot-green  { background: #28c840; }

.term-right { display: flex; align-items: center; gap: 8px; }
.run-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; padding: 3px 10px;
  border-radius: 20px; background: #dbeafe;
  color: #1e40af; border: 1px solid #bfdbfe;
}
.run-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: #93c5fd; transition: all .3s; }
.run-pill-dot.running { background: #16a34a; animation: termBlink 1.2s ease-in-out infinite; }
.run-pill-dot.done    { background: #1a56db; }
.run-pill-dot.error   { background: #dc2626; }
@keyframes termBlink { 0%,100%{opacity:1} 50%{opacity:.3} }

.btn-kill {
  padding: 4px 10px; border-radius: 5px; background: transparent;
  border: 1px solid #dc2626; color: #dc2626; font-size: 11px;
  font-weight: 600; cursor: pointer; display: none; transition: all .15s;
}
.btn-kill:hover { background: #dc2626; color: #fff; }
.btn-kill.visible { display: block; }
.btn-reopen {
  padding: 4px 10px; border-radius: 5px; background: transparent;
  border: 1px solid #1a56db; color: #1a56db; font-size: 11px;
  font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn-reopen:hover { background: #1a56db; color: #fff; }
.btn-clr {
  padding: 4px 10px; border-radius: 5px; background: transparent;
  border: 1px solid #bfdbfe; color: #64748b; font-size: 11px;
  cursor: pointer; transition: all .15s;
}
.btn-clr:hover { color: #1e40af; border-color: #93c5fd; }

.term-out {
  flex: 1; overflow-y: auto; padding: 14px 18px;
  font-family: 'Cascadia Code','Consolas','Courier New',monospace;
  font-size: 12.5px; line-height: 1.65; color: #1e293b;
  background: #ffffff;
}
.term-out::-webkit-scrollbar { width: 5px; }
.term-out::-webkit-scrollbar-thumb { background: #bfdbfe; border-radius: 3px; }

.term-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; gap: 14px; color: #93c5fd;
}
.term-placeholder .big-icon { font-size: 42px; opacity: .5; }
.term-placeholder p { font-size: 13px; color: #64748b; }
.term-placeholder .hint { font-size: 11.5px; color: #93c5fd; font-family: 'Consolas',monospace; }

/* Terminal line colours — dark text on white background */
.tl-sep  { color: #bfdbfe; }
.tl-hdr  { color: #1a56db; font-weight: 600; }
.tl-ok   { color: #16a34a; }
.tl-err  { color: #dc2626; }
.tl-warn { color: #d97706; }
.tl-skip { color: #94a3b8; }
.tl-info { color: #2563eb; }
.tl-done { color: #16a34a; font-weight: 700; }
.tl-prompt { color: #ea580c; font-weight: 500; }
.tl-echo   { color: #0d9488; font-style: italic; }
.tl-plan   { color: #7c3aed; }

.term-input-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: #eff6ff;
  border-top: 1px solid #bfdbfe; flex-shrink: 0;
}
.prompt-sym { color: #1a56db; font-family: 'Consolas',monospace; font-size: 15px; font-weight: 700; flex-shrink: 0; }
.term-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #0f172a; font-family: 'Cascadia Code','Consolas',monospace;
  font-size: 13px; padding: 3px 0;
}
.term-input::placeholder { color: #93c5fd; }
.term-input:disabled { opacity: .4; cursor: not-allowed; }
.btn-send {
  padding: 6px 16px; border-radius: 5px; background: #1a56db;
  color: #fff; border: none; cursor: pointer; font-size: 12px;
  font-weight: 600; flex-shrink: 0; transition: background .15s;
}
.btn-send:hover:not(:disabled) { background: #1d4ed8; }
.btn-send:disabled { background: #dbeafe; color: #93c5fd; cursor: not-allowed; }

.scroll-pill {
  position: absolute; right: 20px; bottom: 68px;
  background: #1a56db; color: #fff; font-size: 11px;
  padding: 4px 12px; border-radius: 20px; cursor: pointer;
  display: none; z-index: 20; box-shadow: 0 2px 8px rgba(26,86,219,.3);
}

/* btn-download in header */
.btn-download {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #86efac;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-download:hover { background: #dcfce7; }

/* ── Period Selector Bar ── */
.period-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.period-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: #1e40af;
  white-space: nowrap;
}
.period-btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.period-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #bfdbfe;
  background: #fff;
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.period-btn:hover { background: #dbeafe; }
.period-btn.active {
  background: #1a56db;
  color: #fff;
  border-color: #1a56db;
}

/* ── Loaded Month Chips on Data Cards ── */
.loaded-months {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 2px;
  min-height: 0;
}
.month-chip {
  padding: 2px 8px;
  border-radius: 12px;
  background: #dcfce7;
  color: #15803d;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid #86efac;
}

/* ── R1 Month-wise reconciliation table ── */
.r1-month-wrap {
  overflow-x: auto;
  border-top: none;
  border-radius: 0 0 8px 8px;
}
.r1-month-tbl {
  min-width: 1100px;
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
}
.r1-month-tbl th, .r1-month-tbl td {
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  text-align: right;
  white-space: nowrap;
}
.r1-month-tbl th {
  background: #1F4E79;
  color: #fff;
  font-weight: 600;
  font-size: 11.5px;
}
/* Group header row */
.th-grp {
  text-align: center !important;
  font-size: 12px !important;
  letter-spacing: .3px;
}
.th-grp-1    { background: #1e40af !important; }
.th-grp-3b   { background: #065f46 !important; }
.th-grp-rev   { background: #9a3412 !important; } /* ITC Reversals 4B(1)+4B(2) — amber-red */
.th-grp-inelg { background: #7f1d1d !important; } /* 4D(1) Ineligible ITC — deep red */
.th-grp-net   { background: #0e7490 !important; } /* Net ITC — teal */
.th-grp-diff  { background: #5b21b6 !important; }

.th-month, .th-status {
  text-align: center !important;
  vertical-align: middle;
}
/* Column separator between groups */
.td-grp-sep {
  border-left: 2px solid #94a3b8 !important;
}
.r1-month-tbl thead tr:nth-child(2) th { font-size: 11px !important; }

/* Data rows */
.r1-month-tbl tbody tr td { text-align: right; }
.r1-month-tbl tbody tr .td-month { text-align: center; font-weight: 700; color: #1e293b; }
/* Remarks column — allow text wrap */
.r1-month-tbl td.td-remarks {
  white-space: normal !important;
  word-break: break-word;
  text-align: left !important;
  min-width: 280px;
  max-width: 340px;
  vertical-align: middle;
  padding: 6px 12px;
  font-size: 11px;
  line-height: 1.6;
}

/* Total row — global: bold in ALL tables regardless of parent class */
.row-total td { font-weight: 700; }

/* Total row — scoped styles for r1-month-tbl */
.r1-month-tbl .row-total td {
  background: #f0f9ff;
  font-weight: 700;
  border-top: 2px solid #94a3b8;
}
.r1-month-tbl .row-match  td { background: #f0fdf4; }
.r1-month-tbl .row-mismatch td { background: #fff1f2; }
.r1-month-tbl .row-total.row-match td    { background: #dcfce7; }
.r1-month-tbl .row-total.row-mismatch td { background: #fee2e2; }

/* ── Books of Accounts Section ── */
.books-section-hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 12px;
  padding: 14px 18px;
  background: linear-gradient(90deg, #78350f 0%, #b45309 100%);
  border-radius: 10px;
}
.books-section-icon { font-size: 22px; }
.books-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.books-section-sub {
  font-size: 11.5px;
  color: #fde68a;
  margin-top: 2px;
}
.books-grid { margin-top: 0; }
.books-card { border-top: 3px solid #b45309; }

.books-hint {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 5px;
  line-height: 1.5;
  padding: 5px 8px;
  background: #f8fafc;
  border-radius: 5px;
  border: 1px solid #e2e8f0;
}
.sample-download-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  color: #1a56db;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.sample-download-link:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}
/* Drag-and-drop visual feedback */
.upload-label.drag-active {
  border-color: #1a56db !important;
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  transform: scale(1.02);
  box-shadow: 0 0 0 3px #bfdbfe;
}
#tab-data.drag-over {
  outline: 3px dashed #1a56db;
  outline-offset: -4px;
}

/* Extra tag colours for Books */
.tag-amber { background: #fef3c7; color: #92400e; }
.tag-lime  { background: #ecfccb; color: #3f6212; }

/* ── New Reconciliation Styles (R9–R12) ──────────────────────────────── */
.section-hdr {
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  padding: 8px 14px;
  border-radius: 0 6px 6px 0;
  margin: 14px 0 10px;
}

.result-sub-section {
  margin: 8px 0 12px;
  border-radius: 6px;
  padding: 8px 12px 10px;
  border: 1px solid #e2e8f0;
}

.result-sub-section .recon-sub-label {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #374151;
}

.ok-bg   { background: #f0fdf4; border-color: #bbf7d0 !important; }
.warn-bg { background: #fffbeb; border-color: #fde68a !important; }
.err-bg  { background: #fef2f2; border-color: #fecaca !important; }
.ok-bg   .recon-sub-label { color: #166534; }
.warn-bg .recon-sub-label { color: #92400e; }
.err-bg  .recon-sub-label { color: #991b1b; }

.td-mo { font-weight: 600; color: #374151; min-width: 52px; }
.tr-total td { background: #f1f5f9 !important; font-weight: 700; border-top: 2px solid #cbd5e1 !important; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ── Party-match "none" indicator ───────────────────── */
.none-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  margin: 6px 0 4px;
}

/* ── Diff colour helpers ─────────────────────────────── */
.diff-neg { color: #dc2626 !important; font-weight: 600; }
.diff-pos { color: #dc2626 !important; font-weight: 600; } /* positive diff also red */

/* ── Per-tab Export buttons ─────────────────────────── */
.btn-export {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #86efac;
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-export:hover { background: #dcfce7; border-color: #4ade80; }

/* ── Export All button (prominent green) ────────────── */
.btn-export-all {
  background: #16a34a;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-export-all:hover { background: #15803d; }

/* ── Persistent client info bar (above all recon tabs) ─ */
.client-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e3a5f;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.cib-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cib-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #94a3b8;
}
.cib-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #f1f5f9;
}
.cib-sep {
  color: #475569;
  font-size: 14px;
}
.cib-gstin {
  font-size: 13px;
  font-weight: 600;
  color: #bfdbfe;
  font-family: monospace;
  background: rgba(255,255,255,.08);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: .5px;
}
.cib-fy {
  font-size: 13px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251,191,36,.12);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: .4px;
}
.cib-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.client-info-bar .btn-export-all {
  background: #22c55e;
  font-size: 12px;
  padding: 6px 14px;
}
.client-info-bar .btn-export-all:hover { background: #16a34a; }

/* ── Period modal input fields ──────────────────────── */
.form-row input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}
.form-row input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px #bfdbfe;
}

/* ── Client dropdown row ────────────────────────────── */
.client-select-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-add-client {
  white-space: nowrap;
  background: #1a56db;
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-add-client:hover { background: #1d4ed8; }

/* ── Add / Edit client fields panel ─────────────────── */
.add-client-fields {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px 10px;
  margin: 6px 0 4px;
}
.add-client-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 4px;
}
.btn-del-client {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-del-client:hover { background: #fecaca; }

/* ── Selected client info strip ─────────────────────── */
.selected-client-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  padding: 8px 12px;
  margin: 4px 0;
  flex-wrap: wrap;
}
.sci-name {
  font-weight: 700;
  font-size: 14px;
  color: #1e3a8a;
  flex: 1;
}
.sci-gstin {
  font-size: 12px;
  color: #475569;
  font-family: monospace;
  background: #e0e7ff;
  padding: 2px 8px;
  border-radius: 4px;
}
.btn-edit-client {
  background: transparent;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  border-radius: 5px;
  padding: 4px 9px;
  font-size: 12px;
  cursor: pointer;
  margin-left: auto;
}
.btn-edit-client:hover { background: #dbeafe; }
