/*
 * COUNSIVA v3.7.12 — final operational table polish.
 * Targets the live screenshots from 2026-10-06.
 * Keeps Students/Leads stable while fixing Visitors, Follow-ups,
 * Counselling and Applications visibility/density.
 */

/* Secondary copy stays readable but should never dominate the operational row. */
#visitorList .op-subline,
#followupList .op-subline,
#counsellingList .op-subline,
#view-applications .op-subline,
#visitorList .op-secondary,
#followupList .op-secondary,
#counsellingList .op-secondary,
#view-applications .op-secondary {
  font-size: 9px !important;
  line-height: 1.12 !important;
}

/* ---------- Visitors ---------- */
.visitors-data-table {
  width: 100% !important;
  min-width: 1200px !important;
  table-layout: fixed !important;
}

.visitors-data-table th,
.visitors-data-table td {
  padding: 5px 6px !important;
  overflow: hidden;
}

.visitors-data-table tbody tr {
  height: 68px !important;
}

.visitors-data-table th:nth-child(1),
.visitors-data-table td:nth-child(1) { width: 40px !important; min-width: 40px !important; }
.visitors-data-table th:nth-child(2),
.visitors-data-table td:nth-child(2) { width: 170px !important; min-width: 0 !important; }
.visitors-data-table th:nth-child(3),
.visitors-data-table td:nth-child(3) { width: 160px !important; min-width: 0 !important; }
.visitors-data-table th:nth-child(4),
.visitors-data-table td:nth-child(4) { width: 90px !important; min-width: 0 !important; }
.visitors-data-table th:nth-child(5),
.visitors-data-table td:nth-child(5) { width: 170px !important; min-width: 0 !important; }
.visitors-data-table th:nth-child(6),
.visitors-data-table td:nth-child(6) { width: 150px !important; min-width: 0 !important; }
.visitors-data-table th:nth-child(7),
.visitors-data-table td:nth-child(7) { width: 175px !important; min-width: 0 !important; }
.visitors-data-table th:nth-child(8),
.visitors-data-table td:nth-child(8) { width: 110px !important; min-width: 0 !important; }
.visitors-data-table th:nth-child(9),
.visitors-data-table td:nth-child(9) { width: 190px !important; min-width: 0 !important; }

.visitors-data-table .workflow-table-actions {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(42px, 1fr)) !important;
  gap: 3px !important;
  width: 100% !important;
  min-width: 0 !important;
}

.visitors-data-table .workflow-table-actions .btn {
  min-height: 25px !important;
  padding: 4px 4px !important;
  font-size: 9.25px !important;
}

/* ---------- Follow-ups ---------- */
.followups-data-table {
  width: 100% !important;
  min-width: 1210px !important;
  table-layout: fixed !important;
}

.followups-data-table th,
.followups-data-table td {
  padding: 5px 6px !important;
  overflow: hidden;
}

.followups-data-table tbody tr {
  height: 68px !important;
}

.followups-data-table th:nth-child(1),
.followups-data-table td:nth-child(1) { width: 40px !important; min-width: 40px !important; }
.followups-data-table th:nth-child(2),
.followups-data-table td:nth-child(2) { width: 160px !important; min-width: 0 !important; }
.followups-data-table th:nth-child(3),
.followups-data-table td:nth-child(3) { width: 105px !important; min-width: 0 !important; }
.followups-data-table th:nth-child(4),
.followups-data-table td:nth-child(4) { width: 95px !important; min-width: 0 !important; }
.followups-data-table th:nth-child(5),
.followups-data-table td:nth-child(5) { width: 180px !important; min-width: 0 !important; }
.followups-data-table th:nth-child(6),
.followups-data-table td:nth-child(6) { width: 145px !important; min-width: 0 !important; }
.followups-data-table th:nth-child(7),
.followups-data-table td:nth-child(7) { width: 95px !important; min-width: 0 !important; }
.followups-data-table th:nth-child(8),
.followups-data-table td:nth-child(8) { width: 140px !important; min-width: 0 !important; }
.followups-data-table th:nth-child(9),
.followups-data-table td:nth-child(9) { width: 105px !important; min-width: 0 !important; }
.followups-data-table th:nth-child(10),
.followups-data-table td:nth-child(10) { width: 180px !important; min-width: 0 !important; }

.followups-data-table .workflow-table-actions {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(40px, 1fr)) !important;
  gap: 3px !important;
  width: 100% !important;
  min-width: 0 !important;
}

.followups-data-table .workflow-table-actions .btn {
  min-height: 25px !important;
  padding: 4px 4px !important;
  font-size: 9.15px !important;
}

/* ---------- Counselling ---------- */
.counselling-data-table {
  width: 100% !important;
  min-width: 1230px !important;
  table-layout: fixed !important;
}

.counselling-data-table th,
.counselling-data-table td {
  padding: 5px 6px !important;
  overflow: hidden;
}

.counselling-data-table tbody tr {
  height: 68px !important;
}

.counselling-data-table th:nth-child(1),
.counselling-data-table td:nth-child(1) { width: 40px !important; min-width: 40px !important; }
.counselling-data-table th:nth-child(2),
.counselling-data-table td:nth-child(2) { width: 160px !important; min-width: 0 !important; }
.counselling-data-table th:nth-child(3),
.counselling-data-table td:nth-child(3) { width: 85px !important; min-width: 0 !important; }
.counselling-data-table th:nth-child(4),
.counselling-data-table td:nth-child(4) { width: 120px !important; min-width: 0 !important; }
.counselling-data-table th:nth-child(5),
.counselling-data-table td:nth-child(5) { width: 140px !important; min-width: 0 !important; }
.counselling-data-table th:nth-child(6),
.counselling-data-table td:nth-child(6) { width: 150px !important; min-width: 0 !important; }
.counselling-data-table th:nth-child(7),
.counselling-data-table td:nth-child(7) { width: 150px !important; min-width: 0 !important; }
.counselling-data-table th:nth-child(8),
.counselling-data-table td:nth-child(8) { width: 140px !important; min-width: 0 !important; }
.counselling-data-table th:nth-child(9),
.counselling-data-table td:nth-child(9) { width: 105px !important; min-width: 0 !important; }
.counselling-data-table th:nth-child(10),
.counselling-data-table td:nth-child(10) { width: 180px !important; min-width: 0 !important; }

.counselling-data-table .workflow-table-actions {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(40px, 1fr)) !important;
  gap: 3px !important;
  width: 100% !important;
  min-width: 0 !important;
}

.counselling-data-table .workflow-table-actions .btn {
  min-height: 25px !important;
  padding: 4px 4px !important;
  font-size: 9.15px !important;
}

/*
 * Do not let the right action rail cover Notes / Date columns.
 * Keep the header vertically sticky, but remove right-side stickiness.
 */
@media (min-width: 1100px) {
  .visitors-data-table th:last-child,
  .followups-data-table th:last-child,
  .counselling-data-table th:last-child {
    position: sticky !important;
    top: 0 !important;
    right: auto !important;
    z-index: 2 !important;
    box-shadow: none !important;
    background: #f6fafc !important;
  }

  .visitors-data-table td:last-child,
  .followups-data-table td:last-child,
  .counselling-data-table td:last-child {
    position: static !important;
    right: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
    background: inherit !important;
  }
}

/* ---------- Applications ---------- */
/*
 * The old inline table style kept Actions sticky-right. That hid Intake,
 * Stage, Status, Next Task and Date in the live screen. The final layout
 * intentionally fits the complete operational sequence in the viewport.
 */
#view-applications .data-table {
  width: 100% !important;
  min-width: 1240px !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

#view-applications .data-table th {
  padding: 5px 4px !important;
  font-size: 8.6px !important;
  line-height: 1.08 !important;
  letter-spacing: 0.18px !important;
}

#view-applications #appBody td {
  padding: 5px 4px !important;
  font-size: 10px !important;
  line-height: 1.14 !important;
  vertical-align: middle !important;
  overflow: hidden;
}

#view-applications #appBody tr {
  height: 66px !important;
}

#view-applications .data-table th:nth-child(1),
#view-applications .data-table td:nth-child(1) {
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  position: static !important;
  left: auto !important;
  box-shadow: none !important;
}

#view-applications .data-table th:nth-child(2),
#view-applications .data-table td:nth-child(2) { width: 30px !important; min-width: 30px !important; max-width: 30px !important; }
#view-applications .data-table th:nth-child(3),
#view-applications .data-table td:nth-child(3) { width: 72px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(4),
#view-applications .data-table td:nth-child(4) { width: 46px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(5),
#view-applications .data-table td:nth-child(5) { width: 130px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(6),
#view-applications .data-table td:nth-child(6) { width: 105px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(7),
#view-applications .data-table td:nth-child(7) { width: 108px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(8),
#view-applications .data-table td:nth-child(8) { width: 155px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(9),
#view-applications .data-table td:nth-child(9) { width: 68px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(10),
#view-applications .data-table td:nth-child(10) { width: 82px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(11),
#view-applications .data-table td:nth-child(11) { width: 65px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(12),
#view-applications .data-table td:nth-child(12) { width: 100px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(13),
#view-applications .data-table td:nth-child(13) { width: 72px !important; min-width: 0 !important; }
#view-applications .data-table th:nth-child(14),
#view-applications .data-table td:nth-child(14) { width: 185px !important; min-width: 0 !important; }

#view-applications .student-cell,
#view-applications .application-cell {
  min-width: 0 !important;
}

#view-applications .mono-id {
  font-size: 9.25px !important;
  letter-spacing: 0 !important;
}

#view-applications .data-table th:last-child {
  position: sticky !important;
  top: 0 !important;
  right: auto !important;
  z-index: 2 !important;
  box-shadow: none !important;
  background: #f6fafc !important;
}

#view-applications .data-table td:last-child {
  position: static !important;
  right: auto !important;
  z-index: auto !important;
  box-shadow: none !important;
  background: inherit !important;
}

#view-applications .application-actions,
#view-applications #appBody .actions {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(48px, 1fr)) !important;
  gap: 3px !important;
  width: 100% !important;
  min-width: 0 !important;
}

#view-applications .application-actions .btn,
#view-applications #appBody .actions .btn,
#view-applications #appBody td:last-child > .btn,
#view-applications #appBody .cai-context-action {
  min-height: 24px !important;
  padding: 3px 4px !important;
  font-size: 8.9px !important;
  line-height: 1.05 !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

#view-applications .application-actions .return-processing,
#view-applications #appBody .actions .return-processing {
  grid-column: 1 / -1 !important;
}

#view-applications #appBody td:nth-child(8) .op-clamp-2,
#view-applications #appBody td:nth-child(10),
#view-applications #appBody td:nth-child(12) .op-clamp-2 {
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

/* Leads were already visually healthy; only create a touch more separation. */
.leads-data-table th:nth-child(7),
.leads-data-table td:nth-child(7) {
  padding-right: 9px !important;
}
.leads-data-table th:last-child,
.leads-data-table td:last-child {
  border-left: 1px solid #e5edf2;
}

@media (max-width: 1320px) {
  .visitors-data-table,
  .followups-data-table,
  .counselling-data-table,
  #view-applications .data-table {
    min-width: 1180px !important;
  }
}

@media (max-width: 760px) {
  .visitors-data-table,
  .followups-data-table,
  .counselling-data-table,
  #view-applications .data-table {
    min-width: 1120px !important;
    table-layout: fixed !important;
  }

  .visitors-data-table tbody tr,
  .followups-data-table tbody tr,
  .counselling-data-table tbody tr,
  #view-applications #appBody tr {
    height: auto !important;
  }
}

/* COUNSIVA v3.7.13 — action-fit correction from live screenshots.
 * Prevent action labels from forcing horizontal overflow/cropping.
 */

.visitors-data-table .workflow-table-actions,
.followups-data-table .workflow-table-actions,
.counselling-data-table .workflow-table-actions,
#view-applications .application-actions,
#view-applications #appBody .actions {
  min-width: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.visitors-data-table .workflow-table-actions,
.followups-data-table .workflow-table-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.counselling-data-table .workflow-table-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.visitors-data-table .workflow-table-actions .btn,
.followups-data-table .workflow-table-actions .btn,
.counselling-data-table .workflow-table-actions .btn,
#view-applications .application-actions .btn,
#view-applications #appBody .actions .btn,
#view-applications #appBody .cai-context-action {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}

.visitors-data-table .workflow-table-actions .btn,
.followups-data-table .workflow-table-actions .btn,
.counselling-data-table .workflow-table-actions .btn {
  min-height: 24px !important;
  padding: 3px 3px !important;
  font-size: 8.5px !important;
  line-height: 1 !important;
}

#view-applications .application-actions,
#view-applications #appBody .actions {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

#view-applications .application-actions .btn,
#view-applications #appBody .actions .btn,
#view-applications #appBody .cai-context-action {
  min-height: 23px !important;
  padding: 3px 3px !important;
  font-size: 8.35px !important;
}

/* Give action rails enough room without sacrificing the operational columns. */
.visitors-data-table th:nth-child(9),
.visitors-data-table td:nth-child(9) {
  width: 205px !important;
}

.followups-data-table th:nth-child(10),
.followups-data-table td:nth-child(10) {
  width: 195px !important;
}

.counselling-data-table th:nth-child(10),
.counselling-data-table td:nth-child(10) {
  width: 170px !important;
}

#view-applications .data-table th:nth-child(14),
#view-applications .data-table td:nth-child(14) {
  width: 195px !important;
}

/* Reclaim space from low-density columns so tables fit without lateral drift. */
.visitors-data-table th:nth-child(3),
.visitors-data-table td:nth-child(3) { width: 150px !important; }
.visitors-data-table th:nth-child(6),
.visitors-data-table td:nth-child(6) { width: 140px !important; }

.followups-data-table th:nth-child(5),
.followups-data-table td:nth-child(5) { width: 170px !important; }
.followups-data-table th:nth-child(6),
.followups-data-table td:nth-child(6) { width: 135px !important; }
.followups-data-table th:nth-child(8),
.followups-data-table td:nth-child(8) { width: 130px !important; }

.counselling-data-table th:nth-child(5),
.counselling-data-table td:nth-child(5) { width: 130px !important; }
.counselling-data-table th:nth-child(6),
.counselling-data-table td:nth-child(6) { width: 140px !important; }
.counselling-data-table th:nth-child(7),
.counselling-data-table td:nth-child(7) { width: 140px !important; }

#view-applications .data-table th:nth-child(8),
#view-applications .data-table td:nth-child(8) { width: 145px !important; }
#view-applications .data-table th:nth-child(12),
#view-applications .data-table td:nth-child(12) { width: 92px !important; }

/* Multi-word headers wrap cleanly instead of visually running into the next column. */
.followups-data-table th,
.counselling-data-table th {
  white-space: normal !important;
  line-height: 1.05 !important;
  overflow-wrap: anywhere;
}

.followups-data-table th:nth-child(7),
.followups-data-table th:nth-child(8),
.counselling-data-table th:nth-child(5),
.counselling-data-table th:nth-child(7) {
  text-align: left;
}

/* With action min-content overflow removed, these fit inside the desktop panel. */
.visitors-data-table { min-width: 1180px !important; }
.followups-data-table { min-width: 1180px !important; }
.counselling-data-table { min-width: 1180px !important; }
#view-applications .data-table { min-width: 1180px !important; }

@media (max-width: 1320px) {
  .visitors-data-table,
  .followups-data-table,
  .counselling-data-table,
  #view-applications .data-table {
    min-width: 1160px !important;
  }
}

/* Live QA follow-up: keep every data column accessible, and fit Visa actions. */
.student-data-table th:last-child,
.leads-data-table th:last-child {
  right: auto !important;
  box-shadow: none !important;
}
.student-data-table td:last-child,
.leads-data-table td:last-child {
  position: static !important;
  right: auto !important;
  box-shadow: none !important;
}
#view-visa #visaBody .actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  width: 100%;
  gap: 4px;
}
#view-visa #visaBody .actions .btn {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
#view-visa #visaBody td:last-child {
  min-width: 140px;
  width: 140px;
}
/* Secondary information must remain legible at normal desktop zoom. */
.operational-data-table small,
.operational-data-table .op-subline,
#view-applications #appBody small,
#view-applications #appBody .mono-id,
#view-applications #appBody .list-date {
  font-size: 10px !important;
  line-height: 1.2 !important;
}
#view-applications .data-table th {
  font-size: 10px !important;
  white-space: normal !important;
}
#view-applications #appBody td {
  font-size: 11px !important;
  line-height: 1.2 !important;
}

/* Review follow-up: identifiers stay readable; settings use accessible tabs. */
#reportBody .report-record-id { white-space: nowrap; min-width: 125px; }
#view-settings .settings-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
#view-settings .settings-tabs button {
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 12px;
  background: #fff; color: #183153; font: inherit; cursor: pointer;
}
#view-settings .settings-tabs button.active { background: #0b6474; color: #fff; border-color: #0b6474; }
#view-settings .settings-tabs button:focus-visible { outline: 3px solid #34b6cb; outline-offset: 2px; }


/* Student 360 application actions + Visa & Success desktop fit */
.profile-applications-table {
  min-width: 980px;
}
.profile-applications-table th:last-child,
.profile-applications-table td:last-child {
  min-width: 150px;
  width: 150px;
}
.profile-application-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.profile-application-actions .btn {
  white-space: nowrap;
}

#view-visa .data-table {
  width: 1260px !important;
  min-width: 1260px !important;
  max-width: 1260px !important;
  table-layout: fixed;
}
#view-visa .data-table th,
#view-visa .data-table td {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}
#view-visa .data-table th:nth-child(1),
#view-visa .data-table td:nth-child(1) { width: 44px; }
#view-visa .data-table th:nth-child(2),
#view-visa .data-table td:nth-child(2) { width: 90px; }
#view-visa .data-table th:nth-child(3),
#view-visa .data-table td:nth-child(3) { width: 180px; }
#view-visa .data-table th:nth-child(4),
#view-visa .data-table td:nth-child(4) { width: 190px; }
#view-visa .data-table th:nth-child(5),
#view-visa .data-table td:nth-child(5) { width: 100px; }
#view-visa .data-table th:nth-child(6),
#view-visa .data-table td:nth-child(6) { width: 165px; }
#view-visa .data-table th:nth-child(7),
#view-visa .data-table td:nth-child(7) { width: 100px; }
#view-visa .data-table th:nth-child(8),
#view-visa .data-table td:nth-child(8),
#view-visa .data-table th:nth-child(9),
#view-visa .data-table td:nth-child(9) { width: 92px; }
#view-visa .data-table th:nth-child(10),
#view-visa .data-table td:nth-child(10) { width: 105px; }
#view-visa .data-table th:nth-child(11),
#view-visa .data-table td:nth-child(11) { width: 90px; }
#view-visa .data-table th:nth-child(12),
#view-visa .data-table td:nth-child(12) { width: 155px; }
#view-visa #visaBody .actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(64px, 1fr));
  gap: 5px;
  width: 100%;
}
#view-visa #visaBody .actions .btn {
  min-width: 64px;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  padding: 7px 8px;
}
#view-visa #visaBody .actions .return-processing {
  white-space: nowrap;
}
#view-visa .visa-application-id .op-subline {
  display: block;
  margin-top: 4px;
}

#view-visa .visa-university,
#view-visa .visa-level,
#view-visa .visa-application-id {
  overflow: hidden;
  text-overflow: ellipsis;
}
#view-visa .visa-university {
  white-space: normal;
}
#view-visa .visa-level,
#view-visa .visa-application-id {
  white-space: nowrap;
}


/* COUNSIVA Visa text-overflow polish — 2026-10-07 */
#view-visa .data-table th {
  white-space: normal !important;
  line-height: 1.08 !important;
  overflow-wrap: anywhere !important;
}

#view-visa #visaBody td {
  vertical-align: middle !important;
  overflow: hidden !important;
}

#view-visa .visa-student-name,
#view-visa .visa-student-meta,
#view-visa .visa-application-id .mono-id,
#view-visa .visa-category,
#view-visa .visa-reference {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-visa .visa-student-meta {
  margin-top: 3px;
}

#view-visa .visa-university > b {
  display: -webkit-box;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal !important;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.18;
  max-height: 2.36em;
}

#view-visa .visa-level .badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-visa .visa-application-id {
  white-space: normal !important;
}

#view-visa .visa-application-id .op-subline {
  display: block;
  min-width: 0;
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}

#view-visa .visa-date {
  white-space: nowrap !important;
}

#view-visa #visaBody .actions,
#view-visa #visaBody .actions .btn {
  min-width: 0 !important;
  max-width: 100% !important;
}

#view-visa #visaBody .actions .btn {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
