/*
 * COUNSIVA — Operational Workspace Readability Refresh
 * 2026-11-03. Scoped to seven staff-facing operational modules.
 * No changes to permissions, record data, endpoints, filters or actions.
 */
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) {
  --op-ink: #102c4f;
  --op-muted: #586e85;
  --op-border: #dce8f0;
  --op-accent: #058da0;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .page-head {
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .page-head h2 {
  color: var(--op-ink);
  font-size: clamp(24px, 2vw, 29px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.16;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .page-head p {
  max-width: 660px;
  margin-top: 5px;
  color: var(--op-muted);
  font-size: 12px;
  line-height: 1.45;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .panel {
  border: 1px solid var(--op-border);
  border-radius: 18px;
  box-shadow: 0 5px 22px rgba(13,54,85,.055);
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .panel-body {
  padding: 15px 17px !important;
  min-width: 0;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .page-head .actions {
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .page-head .btn {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .btn:focus-visible,
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .work-queue-btn:focus-visible,
.op-expand-button:focus-visible {
  outline: 3px solid #55b9c9;
  outline-offset: 2px;
}

/* Intentional rows: no single Search button hanging on its own line. */
#view-students .filters,
#view-leads .filters,
#view-visitors .filters,
#view-followups .filters,
#view-counselling .filters,
#view-classes .filters,
#view-tasks .filters {
  gap: 10px !important;
  align-items: end;
  margin-bottom: 13px !important;
  padding: 12px !important;
  background: #f8fbfd;
  border: 1px solid #e7eef4;
  border-radius: 14px;
}
#view-students .filters {
  grid-template-columns: minmax(210px,1.55fr) repeat(3,minmax(142px,1fr)) !important;
}
:is(#view-leads,#view-visitors,#view-followups,#view-counselling) .filters {
  grid-template-columns: minmax(230px,1.7fr) repeat(3,minmax(140px,1fr)) minmax(118px,.65fr) !important;
}
#view-tasks .filters {
  grid-template-columns: repeat(6,minmax(0,1fr)) !important;
}
#view-tasks .filters .field.wide { grid-column: span 2 !important; }
#view-classes .filters {
  grid-template-columns: repeat(6,minmax(0,1fr)) !important;
}
#view-classes .filters .field:first-child { grid-column: span 2 !important; }
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-counselling,#view-classes) .filters .field.wide {
  grid-column: auto !important;
}
#view-classes .filters .field:first-child.wide { grid-column: span 2 !important; }
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .filters .field {
  min-width: 0;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .filters label {
  margin: 0 0 5px !important;
  color: #42607a;
  font-size: 11px !important;
  font-weight: 750;
  line-height: 1.25;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .filters :is(input,select) {
  width: 100%;
  min-width: 0;
  min-height: 39px !important;
  font-size: 12px;
  color: #173351;
  border-color: #cfdfeb;
  border-radius: 9px;
  background-color: #fff;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .filters .btn {
  min-width: 0;
  min-height: 39px;
  padding: 7px 11px;
  font-size: 12px;
  border-radius: 9px;
}
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .filters input:focus-visible,
:is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .filters select:focus-visible {
  outline: 2px solid #65c3d0;
  outline-offset: 1px;
  border-color: #038da0;
}

/* Queue cards stay in a continuous aligned row where there is room. */
:is(#view-leads,#view-visitors,#view-classes) .work-queue-bar {
  gap: 10px;
  margin-bottom: 15px;
}
:is(#view-leads,#view-visitors,#view-classes) .work-queue-btn {
  min-width: 0;
  overflow-wrap: anywhere;
  border-radius: 13px;
  box-shadow: 0 3px 11px rgba(12,58,86,.04);
}
:is(#view-leads,#view-visitors,#view-classes) .work-queue-btn span {
  color: #547089;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .015em;
}
:is(#view-leads,#view-visitors,#view-classes) .work-queue-btn b {
  color: #102e53;
  font-variant-numeric: tabular-nums;
}
#view-classes #classWorkQueue {
  display: grid !important;
  grid-template-columns: repeat(7,minmax(0,1fr)) !important;
}
#view-classes #classWorkQueue .work-queue-btn {
  min-width: 0 !important;
  padding: 13px 12px;
}
#view-classes .guide-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px !important;
}
#view-classes .guide-strip .badge {
  padding: 5px 9px;
  line-height: 1.3;
}

/* All scrolling is local to the table, never the page. Keep identity and actions easy to scan. */
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList,#taskManagerList) .table-wrap,
#view-classes .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #a7bfce #eff5f8;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table {
  border-spacing: 0;
  border-collapse: separate;
  color: #153452;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table thead th {
  padding: 10px 8px !important;
  color: #46617e;
  background: #f3f8fb;
  border-bottom: 1px solid #d5e5ee;
  font-size: 10.5px !important;
  font-weight: 800;
  line-height: 1.25 !important;
  letter-spacing: .018em;
  white-space: normal;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table tbody td {
  padding: 10px 8px !important;
  border-bottom: 1px solid #e6eef3;
  color: #173452;
  font-size: 12px !important;
  line-height: 1.35 !important;
  vertical-align: middle;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table tbody tr {
  height: auto !important;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table tbody tr:hover td {
  background: #f6fbfe;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .op-primary {
  color: #0f3054;
  font-size: 13px !important;
  font-weight: 800;
  line-height: 1.25 !important;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) :is(.op-subline,.op-secondary) {
  color: #60748a !important;
  font-size: 10.75px !important;
  line-height: 1.3 !important;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .badge {
  font-size: 10px !important;
  padding: 3px 6px !important;
  line-height: 1.2 !important;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .op-wrap {
  max-width: none;
  overflow-wrap: anywhere;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .op-clamp-2 {
  -webkit-line-clamp: 3 !important;
  line-clamp: 3 !important;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .op-clamp-1 {
  -webkit-line-clamp: 2 !important;
  line-clamp: 2 !important;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .op-expanded {
  display: block !important;
  white-space: pre-wrap !important;
  overflow: visible !important;
  max-height: none !important;
  -webkit-line-clamp: unset !important;
  line-clamp: unset !important;
}
.op-expand-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  margin-top: 2px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #007f92;
  font-size: 10.5px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .row-number {
  color: #667f95;
  font-size: 11px !important;
  font-variant-numeric: tabular-nums;
}
#studentList .student-data-table { min-width: 1130px !important; }
#leadList .leads-data-table { min-width: 1280px !important; }
#visitorList .visitors-data-table { min-width: 1440px !important; }
#followupList .followups-data-table { min-width: 1500px !important; }
#counsellingList .counselling-data-table { min-width: 1460px !important; }

/* Action rail: two readable columns instead of overflowing four tiny buttons. */
#studentList .student-actions {
  min-width: 150px !important;
  display: grid !important;
  grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  gap: 5px !important;
}
#leadList .lead-table-actions,
#visitorList .visitors-data-table .workflow-table-actions,
#followupList .followups-data-table .workflow-table-actions,
#counsellingList .counselling-data-table .workflow-table-actions {
  display: grid !important;
  grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  align-items: stretch;
  gap: 5px !important;
  min-width: 0 !important;
  width: 100% !important;
}
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) :is(.student-actions,.workflow-table-actions) .btn {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 31px !important;
  padding: 5px 6px !important;
  border-radius: 8px;
  font-size: 10.5px !important;
  line-height: 1.22 !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  text-align: center;
}
#studentList .student-data-table :is(th,td):last-child { min-width: 165px !important; width: 165px !important; }
#leadList .leads-data-table :is(th,td):last-child { min-width: 218px !important; width: 218px !important; }
#visitorList .visitors-data-table :is(th,td):last-child { min-width: 222px !important; width: 222px !important; }
#followupList .followups-data-table :is(th,td):last-child { min-width: 220px !important; width: 220px !important; }
#counsellingList .counselling-data-table :is(th,td):last-child { min-width: 220px !important; width: 220px !important; }
:is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table :is(th,td):last-child {
  overflow: visible !important;
  background: #fff;
}
@media (min-width: 1100px) {
  :is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table :is(th,td):last-child {
    position: sticky !important;
    right: 0;
    z-index: 5;
    box-shadow: -5px 0 10px -9px rgba(7,47,75,.5), -1px 0 0 #d7e6ee;
  }
  :is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table thead th:last-child {
    z-index: 7;
    background: #f3f8fb;
  }
  :is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table tbody tr:hover td:last-child { background: #f6fbfe; }
}

/* Tasks: readable current action, visually distinct urgency, history remains discoverable. */
#view-tasks .kpis { gap: 12px; }
#view-tasks .kpi {
  min-width: 0;
  padding: 16px 18px;
  border-radius: 15px;
  border-color: var(--op-border);
  box-shadow: 0 4px 14px rgba(12,54,81,.05);
}
#view-tasks .kpi label { color: #556f89; font-size: 11px; font-weight: 800; }
#view-tasks .kpi b { color: #113457; font-size: 29px; line-height: 1.15; }
#view-tasks .task-center-tabs { overflow-x: auto; white-space: nowrap; }
#view-tasks #taskManagerList .data-table { min-width: 1130px; }
#view-tasks #taskManagerList .data-table th {
  padding: 10px 9px;
  color: #496580;
  background: #f3f8fb;
  font-size: 10.5px;
  white-space: nowrap;
}
#view-tasks #taskManagerList .data-table td {
  padding: 11px 9px;
  font-size: 12px;
  line-height: 1.35;
}
#view-tasks #taskManagerList .data-table :is(td,th):last-child {
  min-width: 270px;
  background: #fff;
}
#view-tasks #taskManagerList .task-row-actions {
  gap: 5px;
  flex-wrap: wrap !important;
  white-space: normal !important;
}
#view-tasks #taskManagerList .task-row-actions .btn {
  min-height: 32px;
  padding: 6px 9px !important;
  font-size: 10.5px;
  white-space: nowrap;
}
#view-tasks .task-center-note { color: #637b91; font-size: 11px; line-height: 1.4; }
@media (min-width: 1100px) {
  #view-tasks #taskManagerList .data-table :is(td,th):last-child {
    position: sticky;
    right: 0;
    z-index: 4;
    box-shadow: -1px 0 0 #d8e5ed;
  }
  #view-tasks #taskManagerList .data-table th:last-child { z-index: 6; background: #f3f8fb; }
}

/* Classes: the seventh KPI remains aligned with the other six; class details are legible. */
#view-classes .data-table { min-width: 1280px; }
#view-classes .data-table th {
  background: #f3f8fb;
  color: #47637f;
  font-size: 10.5px !important;
  line-height: 1.3;
  padding: 9px !important;
}
#view-classes .data-table td {
  color: #163452;
  font-size: 12px !important;
  line-height: 1.4 !important;
  padding: 10px 9px !important;
  border-bottom: 1px solid #e6eef3;
}
#view-classes .data-table td small {
  color: #627a91;
  font-size: 10.75px;
}
#view-classes .data-table tbody tr:hover td { background: #f7fbfe; }

@media (max-width: 1480px) {
  #view-classes #classWorkQueue { grid-template-columns: repeat(4,minmax(0,1fr)) !important; }
  #view-classes .filters { grid-template-columns: repeat(4,minmax(0,1fr)) !important; }
  #view-tasks .filters { grid-template-columns: repeat(4,minmax(0,1fr)) !important; }
}
@media (max-width: 1200px) {
  #view-students .filters,
  :is(#view-leads,#view-visitors,#view-followups,#view-counselling) .filters {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
  #view-students .filters .field:first-child,
  :is(#view-leads,#view-visitors,#view-followups,#view-counselling) .filters .field:first-child {
    grid-column: span 2 !important;
  }
  #view-tasks .filters,
  #view-classes .filters { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
}
@media (max-width: 800px) {
  :is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .page-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  :is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .page-head .actions {
    justify-content: flex-start;
  }
  #view-classes #classWorkQueue { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  #view-tasks .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #view-tasks #taskManagerList .data-table :is(td,th):last-child,
  :is(#studentList,#leadList,#visitorList,#followupList,#counsellingList) .operational-data-table :is(td,th):last-child {
    position: static !important;
  }
}
@media (max-width: 540px) {
  #view-students .filters,
  :is(#view-leads,#view-visitors,#view-followups,#view-counselling,#view-tasks,#view-classes) .filters { grid-template-columns: minmax(0,1fr) !important; }
  #view-students .filters .field:first-child,
  :is(#view-leads,#view-visitors,#view-followups,#view-counselling,#view-tasks,#view-classes) .filters .field:first-child,
  #view-tasks .filters .field.wide { grid-column: auto !important; }
  #view-classes #classWorkQueue { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
}
@media (prefers-reduced-motion: reduce) {
  :is(#view-students,#view-leads,#view-visitors,#view-followups,#view-tasks,#view-counselling,#view-classes) .btn {
    transition-duration: 0s;
  }
}
