:root {
  --ink: #17202a;
  --muted: #657282;
  --line: #d9e0e8;
  --panel: #ffffff;
  --soft: #f5f7fa;
  --brand: #176b87;
  --brand-strong: #0f4c5c;
  --accent: #c75c2e;
  --good: #1f8a5b;
  --warn: #b7791f;
  --bad: #b42318;
  --shadow: 0 16px 36px rgba(15, 38, 56, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 76, 92, 0.94), rgba(16, 35, 45, 0.96)),
    radial-gradient(circle at 18% 20%, rgba(242, 193, 78, 0.34), transparent 28%),
    radial-gradient(circle at 86% 72%, rgba(75, 160, 180, 0.28), transparent 32%);
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  pointer-events: none;
}

.login-screen::after {
  content: "FinSchool CRM";
  position: absolute;
  right: 32px;
  bottom: 24px;
  color: rgba(255, 255, 255, 0.16);
  font-size: clamp(34px, 7vw, 92px);
  font-weight: 800;
  letter-spacing: 0;
}

.login-screen[hidden],
.app-shell[hidden] {
  display: none !important;
}

.login-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(3, 18, 28, 0.28);
  padding: 28px;
  position: relative;
  z-index: 1;
}

.app-logo {
  display: block;
  max-width: 100%;
  object-fit: contain;
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.login-logo {
  width: min(260px, 82%);
  height: auto;
  max-height: 92px;
}

.login-heading {
  margin-bottom: 20px;
}

.login-heading h2 {
  margin: 0 0 6px;
  font-size: 26px;
  color: #10232d;
}

.login-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form .field {
  gap: 8px;
}

.login-form label {
  font-weight: 800;
  color: #243442;
}

.login-form input {
  min-height: 46px;
  border: 1px solid #c6d6df;
  border-radius: 10px;
  background: #f8fbfd;
  padding: 11px 13px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-form input:focus {
  outline: none;
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(23, 107, 135, 0.13);
}

.login-button {
  width: 100%;
  min-height: 46px;
  border-radius: 10px;
  background: linear-gradient(135deg, #176b87, #0f4c5c);
  box-shadow: 0 14px 24px rgba(15, 76, 92, 0.24);
  margin-top: 4px;
}

.login-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(15, 76, 92, 0.3);
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #b42318;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}

.sidebar {
  background: #10232d;
  color: #f6fbff;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #f2c14e;
  color: #132631;
  font-weight: 800;
  border-radius: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
}

.brand p {
  margin: 4px 0 0;
  color: #abc1cc;
  font-size: 12px;
}

.sidebar-logo-brand {
  justify-content: center;
  padding: 0 0 12px;
}

.sidebar-logo {
  width: calc(100% + 20px);
  max-width: none;
  max-height: 150px;
  background: #ffffff;
  border-radius: 4px;
  padding: 0;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.sidebar-user {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(242, 193, 78, 0.14), rgba(255, 255, 255, 0.06));
  color: #f6fbff;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sidebar-user:empty {
  display: none;
}

.sidebar-user-label {
  color: #abc1cc;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.sidebar-user strong,
.sidebar-user span {
  overflow-wrap: anywhere;
}

.sidebar-user strong {
  font-size: 14px;
}

.sidebar-user span:not(.sidebar-user-label) {
  color: #cddce3;
  font-size: 12px;
}

.sidebar-user em {
  width: fit-content;
  margin-top: 4px;
  border-radius: 999px;
  background: #f2c14e;
  color: #132631;
  padding: 3px 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.nav-group {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.nav-heading {
  color: #abc1cc;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  padding: 10px 12px 2px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  text-align: left;
  color: #edf6fa;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(135deg, #183845, #215064);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 3px 0 0 #f2c14e;
  transform: translateX(2px);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
}

.topbar-actions,
.actions,
.filters,
.segmented {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented button {
  flex: 1 1 170px;
  min-height: 38px;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

#reports .segmented button {
  flex-basis: 210px;
  max-width: 100%;
}

.notification-button {
  position: relative;
}

.top-action-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(15, 38, 56, 0.11);
}

.top-action-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.chat-action {
  background: linear-gradient(135deg, #2c8f82, #66d8a7);
}

.notification-action {
  background: linear-gradient(135deg, #8b6cf6, #d77ff0);
}

.lead-action {
  background: linear-gradient(135deg, #3f8aa2, #66bfd0);
}

.student-action {
  background: linear-gradient(135deg, #42a774, #9bd98f);
}

.logout-action {
  background: linear-gradient(135deg, #d55b5b, #f58b8b);
  box-shadow: 0 6px 14px rgba(153, 27, 27, 0.16);
}

.notification-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  margin-left: 6px;
  border-radius: 999px;
  background: #c75c2e;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.notification-list,
.chat-list {
  display: grid;
  gap: 10px;
}

.notification-card,
.chat-message {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid #c8d8e4;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #f3f9fc);
  box-shadow: 0 8px 18px rgba(15, 38, 56, 0.08);
}

.notification-card h4,
.notification-card p,
.chat-message p {
  margin: 4px 0;
}

.notification-card.unread {
  border-left: 4px solid #176b87;
}

.notification-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #176b87;
  font-size: 12px;
  font-weight: 800;
}

.notification-meta span {
  color: #657282;
  font-weight: 700;
  white-space: nowrap;
}

.notification-card h4 {
  font-size: 15px;
}

.notification-card p {
  color: #3d4b58;
  line-height: 1.4;
}

.chat-drawer {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1200;
  width: min(560px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  background: #f5f8fa;
  border: 1px solid rgba(7, 94, 84, 0.18);
  border-radius: 18px;
  box-shadow: -22px 22px 56px rgba(15, 38, 56, 0.28);
  transform: translateX(calc(100% + 28px));
  transition: transform 220ms ease;
}

.chat-drawer.active {
  transform: translateX(0);
}

.chat-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #075e54, #128c7e 58%, #25d366);
  color: #ffffff;
}

.chat-title-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.chat-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ffffff;
  color: #083b34;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.chat-drawer-header h3,
.chat-drawer-header p {
  margin: 0;
}

.chat-drawer-header p {
  margin-top: 4px;
  color: #e9fffa;
  font-size: 12px;
}

.chat-close-button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-weight: 800;
}

.chat-close-button:hover {
  background: rgba(255, 255, 255, 0.26);
}

.chat-drawer-body {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(240, 247, 246, 0.94), rgba(240, 247, 246, 0.94)),
    radial-gradient(circle at 14px 14px, rgba(7, 94, 84, 0.08) 1px, transparent 1px);
  background-size: auto, 22px 22px;
}

.chat-list {
  align-content: start;
  min-height: 0;
  padding: 18px 18px 22px;
  overflow-y: auto;
}

.chat-row {
  display: flex;
  justify-content: flex-start;
}

.chat-row.own {
  justify-content: flex-end;
}

.chat-bubble {
  width: fit-content;
  max-width: 84%;
  padding: 12px 14px 10px;
  border-radius: 16px 16px 16px 5px;
  background: #ffffff;
  border: 1px solid rgba(7, 94, 84, 0.08);
  box-shadow: 0 8px 20px rgba(15, 38, 56, 0.11);
}

.chat-row.own .chat-bubble {
  border-radius: 16px 16px 5px 16px;
  background: linear-gradient(135deg, #dcf8c6, #efffde);
}

.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #075e54;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.chat-meta span,
.chat-bubble small {
  color: #667781;
  font-size: 11px;
  font-weight: 700;
}

.chat-bubble p {
  margin: 5px 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.chat-attachment-button {
  border: 0;
  border-radius: 10px;
  background: #e7f3ef;
  color: #075e54;
  padding: 7px 10px;
  font-weight: 800;
  max-width: 100%;
  text-align: left;
}

.chat-composer {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #cddfe3;
  box-shadow: 0 -12px 26px rgba(15, 38, 56, 0.08);
}

.chat-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.9fr);
  gap: 10px;
  align-items: end;
}

.chat-controls .field,
.chat-send-row .field {
  margin: 0;
}

.chat-controls label,
.chat-send-row label {
  font-size: 11px;
}

.chat-controls input,
.chat-controls select {
  min-height: 34px;
}

.chat-send-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(90px, auto) auto;
  align-items: center;
  gap: 10px;
}

.chat-send-row textarea {
  min-height: 52px;
  max-height: 110px;
  resize: vertical;
  border-radius: 16px;
  border-color: #c9d7de;
  padding: 12px 14px;
  font-size: 14px;
  background: #ffffff;
}

.chat-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid #c7dce2;
  border-radius: 14px;
  background: #edf7f6;
}

.chat-tab-option {
  margin: 0;
}

.chat-tab-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chat-tab-option span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #075e54;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.chat-tab-option input:checked + span {
  background: linear-gradient(135deg, #075e54, #128c7e);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(7, 94, 84, 0.2);
}

.chat-member-field select {
  min-height: 76px;
  border-radius: 12px;
}

.section-title {
  padding: 4px 2px 0;
}

.section-title h2 {
  margin: 0;
  color: #0f4c5c;
  font-size: 24px;
  letter-spacing: 0;
}

.chat-file-button,
.chat-send-button {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  padding: 0 15px;
  background: #ffffff;
  color: #075e54;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 38, 56, 0.08);
}

.chat-file-button input {
  display: none;
}

.chat-send-button {
  background: linear-gradient(135deg, #25d366, #14b8a6);
  color: #073b2f;
}

.chat-send-button:disabled {
  cursor: not-allowed;
  background: #c9d4d0;
  color: #697a73;
}

.chat-attachment-name {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #075e54;
  font-size: 12px;
  font-weight: 700;
  max-width: 160px;
  overflow: hidden;
}

.chat-attachment-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-remove-file {
  border: 0;
  border-radius: 50%;
  background: #d9534f;
  color: #ffffff;
  width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0;
  font-size: 11px;
  flex: 0 0 auto;
}

.chat-empty-state {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  color: #075e54;
  text-align: center;
  border: 1px dashed #9ccfc9;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.chat-empty-state strong {
  font-size: 17px;
}

.chat-empty-state span {
  color: #657282;
  font-size: 13px;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.inline-actions button {
  flex: 0 0 auto;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.dashboard-band {
  background: #ffffff;
  border: 1px solid #c8d8e4;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(23, 107, 135, 0.1);
}

.metric {
  background: linear-gradient(135deg, #e6f7fb, #ffffff);
  border: 1px solid #b8dce7;
  border-radius: 8px;
  padding: 13px;
  box-shadow: 0 8px 18px rgba(15, 38, 56, 0.08);
  position: relative;
  overflow: hidden;
}

.metric strong {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.15;
}

.metric-button {
  width: 100%;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.metric-button:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--brand);
}

.metric:nth-child(2n) {
  background: linear-gradient(135deg, #fff2dd, #ffffff);
  border-color: #f0c983;
}

.lead-filter-table {
  display: grid;
  gap: 0;
  margin-top: 12px;
  border: 1px solid #c8d8e4;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 38, 56, 0.06);
}

.lead-period-row {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 110px 110px;
}

.lead-search-row {
  grid-template-columns: minmax(150px, 1.1fr) minmax(150px, 1fr) minmax(140px, 1fr) minmax(160px, 1fr) minmax(140px, 1fr) 105px 105px;
}

.fee-report-sort-row {
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.8fr) 150px 150px 150px;
}

.filter-cell,
.filter-actions {
  min-width: 0;
  border-right: 1px solid #dbe7ee;
  background: #fbfdff;
  padding: 8px;
}

.filter-cell:last-child,
.filter-actions:last-child {
  border-right: 0;
}

.filter-cell span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.filter-cell input,
.filter-cell select {
  width: 100%;
}

.filter-actions {
  display: flex;
  align-items: end;
  background: #f3f8fb;
}

.filter-actions button {
  width: 100%;
}

@media (max-width: 1200px) {
  .lead-period-row,
  .lead-search-row,
  .fee-report-sort-row {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .filter-cell,
  .filter-actions {
    border-right: 1px solid #dbe7ee;
    border-bottom: 1px solid #dbe7ee;
  }

  .stacked-filter-actions {
    width: 100%;
  }

  .stacked-filter-actions button {
    flex: 1;
    width: auto;
  }
}

.metric:nth-child(2n)::before {
  background: #d88b24;
}

.metric:nth-child(3n) {
  background: linear-gradient(135deg, #edf8ef, #ffffff);
  border-color: #acdcb8;
}

.metric:nth-child(3n)::before {
  background: var(--good);
}

.metric:nth-child(4n) {
  background: linear-gradient(135deg, #fdeeed, #ffffff);
  border-color: #efb4ad;
}

.metric:nth-child(4n)::before {
  background: var(--bad);
}

.metric span {
  color: #405261;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  position: relative;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  position: relative;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
}

.backup-panel {
  border-top: 4px solid #176b87;
}

.backup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.backup-card {
  border: 1px solid #d8e5ec;
  background: linear-gradient(180deg, #ffffff, #f7fbfd);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 18px rgba(15, 38, 56, 0.06);
}

.backup-card h4 {
  margin: 0 0 10px;
  color: #102f3d;
  font-size: 15px;
}

.backup-card p {
  margin: 6px 0;
  color: #405261;
  line-height: 1.4;
}

.backup-actions {
  flex-wrap: nowrap;
  gap: 5px;
}

.backup-actions .small-button {
  padding: 6px 8px;
  min-height: 30px;
  white-space: nowrap;
}

.danger-inline {
  background: #fff1f2 !important;
  color: #b42318 !important;
  border: 1px solid #fecaca !important;
}

.danger-notice {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
  font-weight: 700;
}

.backup-detail p {
  margin: 0 0 8px;
}

.settings-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #eef3f6;
  color: #31414d;
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

.lead-table {
  border-collapse: separate;
  border-spacing: 0 8px;
  background: #f4f8fb;
  padding: 6px;
}

.lead-table th {
  background: #dcecf2;
  border-bottom: 1px solid #b9cfda;
}

.lead-table tbody tr {
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 38, 56, 0.08);
}

.lead-table tbody tr:nth-child(even) {
  background: #f8fcff;
}

.lead-table tbody td {
  border-top: 1px solid #cfe0e8;
  border-bottom: 1px solid #cfe0e8;
}

.lead-table tbody td:first-child {
  border-left: 5px solid var(--brand);
  border-radius: 8px 0 0 8px;
}

.lead-table tbody td:last-child {
  border-right: 1px solid #cfe0e8;
  border-radius: 0 8px 8px 0;
}

.lead-table tbody tr:hover {
  background: #eef9fc;
}

.lead-report-table {
  min-width: 1360px;
  table-layout: fixed;
}

.lead-report-table th:nth-child(3),
.lead-report-table td:nth-child(3) {
  width: 260px;
}

.lead-report-table th:nth-child(7),
.lead-report-table td:nth-child(7) {
  width: 82px;
}

.lead-report-table th:nth-child(8),
.lead-report-table td:nth-child(8) {
  width: 54px;
  text-align: center;
}

.lead-report-table th {
  background: linear-gradient(135deg, #176b87, #2b95ad);
  color: #ffffff;
  text-align: left;
  vertical-align: middle;
}

.lead-report-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.lead-report-table tbody tr:nth-child(even) {
  background: #f3f9fc;
}

.lead-report-table td {
  max-width: 180px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
  vertical-align: top;
}

.lead-report-table tbody tr:last-child td {
  border-bottom: 1px solid var(--line);
}

.student-list-table {
  min-width: 1320px;
  border-collapse: separate;
  border-spacing: 0;
}

.student-list-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  margin: 12px 0;
  align-items: stretch;
}

.student-list-search-row input {
  min-height: 40px;
  border: 1px solid #c8d8e4;
  border-radius: 8px;
  padding: 9px 12px;
  background: #ffffff;
  font-size: 14px;
}

.student-list-clear-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  background: linear-gradient(135deg, #15803d, #22c55e);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(21, 128, 61, 0.2);
}

.student-list-clear-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.student-list-table th {
  background: linear-gradient(135deg, #176b87, #2b95ad);
  color: #ffffff;
}

.student-list-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.student-list-table tbody tr:nth-child(even) {
  background: #f3f9fc;
}

.student-list-table tfoot td {
  background: #e8f4f8;
  border-top: 2px solid #176b87;
  font-weight: 800;
  white-space: nowrap;
}

.student-list-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.student-id-under-name {
  display: inline-block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
}

.student-list-table th:nth-child(3),
.student-list-table td:nth-child(3),
.student-list-table th:nth-child(6),
.student-list-table td:nth-child(6),
.student-list-table th:nth-child(7),
.student-list-table td:nth-child(7),
.student-list-table th:nth-child(8),
.student-list-table td:nth-child(8),
.student-list-table th:nth-child(11),
.student-list-table td:nth-child(11) {
  white-space: nowrap;
  overflow-wrap: normal;
}

.student-list-table th:nth-child(11),
.student-list-table td:nth-child(11) {
  min-width: 190px;
}

.student-list-table .inline-actions {
  gap: 6px;
}

.student-list-table .inline-actions button {
  min-height: 32px;
  padding: 6px 9px;
}

.fee-report-table {
  min-width: 1220px;
}

.fee-report-table th {
  background: linear-gradient(135deg, #176b87, #2b95ad);
  color: #ffffff;
}

.fee-report-table tbody tr:nth-child(even) {
  background: #f3f9fc;
}

.fee-report-table td:nth-child(7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fee-report-table .inline-actions {
  gap: 4px;
}

.fee-report-table .inline-actions .compact-button {
  min-height: 26px;
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 5px;
}

.expense-report-table {
  min-width: 1080px;
}

.expense-report-table th {
  background: linear-gradient(135deg, #176b87, #2b95ad);
  color: #ffffff;
}

.expense-report-table tbody tr:nth-child(even) {
  background: #f3f9fc;
}

.expense-report-table td:nth-child(7),
.expense-report-table th:nth-child(7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.expense-report-table th:nth-child(2),
.expense-report-table td:nth-child(2),
.expense-table th:nth-child(2),
.expense-table td:nth-child(2) {
  min-width: 130px;
  white-space: nowrap;
}

.expense-report-table th:nth-child(7),
.expense-report-table td:nth-child(7),
.expense-table th:nth-child(7),
.expense-table td:nth-child(7) {
  min-width: 150px;
}

.expense-report-table tbody tr:last-child {
  font-weight: 800;
  background: #fff8e1;
}

.installment-schedule-table {
  min-width: 720px;
}

.installment-schedule-table input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}

.installment-schedule-table select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #ffffff;
}

.installment-schedule-table th {
  background: #e8f5f8;
}

.placement-report-table {
  min-width: 1120px;
  border-collapse: collapse;
}

.placement-report-table th {
  background: linear-gradient(135deg, #176b87, #2b95ad);
  color: #ffffff;
}

.placement-report-table tbody tr:nth-child(even) {
  background: #f3f9fc;
}

.placement-report-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.placement-report-table td:nth-child(10) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.expense-table,
.certificate-table {
  min-width: 1060px;
  border-collapse: collapse;
}

.expense-table th,
.certificate-table th {
  background: linear-gradient(135deg, #176b87, #2b95ad);
  color: #ffffff;
}

.expense-table tbody tr:nth-child(even),
.certificate-table tbody tr:nth-child(even) {
  background: #f3f9fc;
}

.expense-table td,
.certificate-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.expense-table .amount-cell {
  text-align: right;
  font-weight: 700;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: #0f766e;
}

.expense-item-table {
  min-width: 520px;
  margin-top: 14px;
}

.expense-item-wrap {
  margin-top: 12px;
}

.app-log-table {
  min-width: 1320px;
  border-collapse: collapse;
}

.app-log-table th {
  background: linear-gradient(135deg, #0f766e, #176b87);
  color: #ffffff;
}

.app-log-table tbody tr:nth-child(even) {
  background: #f3f9fc;
}

.app-log-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.certificate-export-report {
  display: grid;
  gap: 18px;
}

.certificate-report-title {
  padding: 14px;
  border: 1px solid #b8dce7;
  border-radius: 8px;
  background: linear-gradient(135deg, #e6f7fb, #ffffff);
}

.certificate-report-title h2 {
  margin: 0 0 8px;
}

.certificate-report-title p {
  margin: 3px 0;
  color: var(--muted);
}

.certificate-section {
  border: 1px solid #c8d8e4;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.certificate-section h3 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, #176b87, #2b95ad);
  color: #ffffff;
}

.certificate-section h3 span {
  font-size: 13px;
}

.certificate-section-table th,
.certificate-summary-table th {
  background: #dcecf2;
  color: #17202a;
}

.certificate-section-table tbody tr:nth-child(even) td,
.certificate-summary-table tbody tr:nth-child(even) td {
  background: #f3f9fc;
}

.certificate-section-table td,
.certificate-section-table th,
.certificate-summary-table td,
.certificate-summary-table th {
  border: 1px solid #b9c7d3;
  padding: 8px;
  vertical-align: top;
}

.certificate-export-button {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #176b87, #1f8a5b 55%, #d88b24);
  box-shadow: 0 10px 22px rgba(23, 107, 135, 0.22);
  font-weight: 800;
}

.certificate-export-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.student-ledger-print h2 {
  text-align: center;
  margin: 0 0 20px;
}

.ledger-student-details {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.ledger-student-details p {
  margin: 0;
}

.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #edf2f7;
  color: #344054;
  white-space: nowrap;
}

.status.good {
  background: #e7f6ee;
  color: var(--good);
}

.status.warn {
  background: #fff5df;
  color: var(--warn);
}

.status.bad {
  background: #fdecea;
  color: var(--bad);
}

.status.brand {
  background: #e4f4f8;
  color: var(--brand-strong);
}

.status.info {
  background: #e7f0ff;
  color: #2258a8;
}

.status.muted {
  background: #edf0f2;
  color: #667085;
}

.top-scorer-row {
  background: #fff8df !important;
  box-shadow: inset 4px 0 0 #f2b84b;
}

@media print {
  @page {
    size: landscape;
    margin: 12mm;
  }

  body {
    background: #fff;
    color: #111827;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .sidebar,
  .topbar-actions,
  .actions,
  .form-actions,
  .filters,
  .student-list-search-row,
  .lead-filter-table,
  .segmented,
  .modal-header button,
  .file-button,
  button {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .workspace,
  .panel,
  .dashboard-band,
  .modal,
  .modal-content {
    box-shadow: none !important;
    border: 0;
    padding: 0;
    width: 100%;
    max-height: none;
    overflow: visible;
  }

  .view,
  .view.active {
    display: block;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: auto;
  }

  thead {
    display: table-header-group;
  }

  tr {
    page-break-inside: avoid;
  }

  th,
  td {
    border: 1px solid #b9c7d3 !important;
    padding: 7px;
    vertical-align: top;
  }

  th {
    background: #176b87 !important;
    color: #fff !important;
  }

  .lead-report-table {
    min-width: 0;
    table-layout: auto;
  }
}

@media (max-width: 760px) {
  .chat-drawer {
    top: 6px;
    right: 6px;
    bottom: 6px;
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
    border-radius: 10px;
  }

  .chat-controls,
  .chat-send-row {
    grid-template-columns: 1fr;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .chat-drawer-header {
    align-items: flex-start;
  }

  .chat-title-wrap {
    align-items: flex-start;
  }

  .chat-attachment-name {
    max-width: 100%;
  }

  .chat-file-button,
  .chat-send-button {
    width: 100%;
  }

  .student-list-search-row {
    grid-template-columns: 1fr;
  }
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.file-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
}

.file-button {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}

.file-button input {
  display: none;
}

.primary-button {
  background: linear-gradient(135deg, #3f8aa2, #67bdcf);
  border-color: #67bdcf;
  color: #fff;
  font-weight: 700;
}

.secondary-button:hover,
.icon-button:hover {
  background: #eef3f6;
}

.lead-export-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.11);
}

.lead-export-button.csv {
  background: linear-gradient(135deg, #38a299, #72d7cd);
}

.lead-export-button.excel {
  background: linear-gradient(135deg, #3ea86b, #7ddc99);
}

.lead-export-button.pdf {
  background: linear-gradient(135deg, #dc6a6a, #f3a35d);
}

.lead-export-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.import-button,
.template-button,
.excel-button,
.pdf-button,
.ledger-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.11);
}

.import-button {
  background: linear-gradient(135deg, #5b8ff0, #62cbe0);
}

.template-button {
  background: linear-gradient(135deg, #9674f3, #c084fc);
}

.excel-button {
  background: linear-gradient(135deg, #3ea86b, #7ddc99);
}

.pdf-button {
  background: linear-gradient(135deg, #dc6a6a, #f28b8b);
}

.ledger-button {
  background: linear-gradient(135deg, #38a299, #72d7cd);
  box-shadow: 0 6px 14px rgba(20, 184, 166, 0.16);
}

.ledger-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.expense-dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
}

.opening-balance-wrap {
  margin-top: 14px;
}

.import-button input {
  display: none;
}

.compact-button {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 6px;
}

.danger-button {
  color: var(--bad);
}

.icon-button {
  width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
}

.student-search-field {
  position: relative;
}

.student-lookup-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 255px;
  overflow: auto;
  border: 1px solid #b8dce7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 38, 56, 0.18);
  padding: 6px;
}

.student-lookup-option {
  width: 100%;
  display: grid;
  gap: 2px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 9px 10px;
  text-align: left;
  color: #17202a;
}

.student-lookup-option:hover,
.student-lookup-option:focus {
  background: #e6f7fb;
  outline: none;
}

.student-lookup-option strong {
  font-size: 13px;
}

.student-lookup-option span,
.student-lookup-option small,
.student-lookup-empty {
  color: var(--muted);
  font-size: 12px;
}

.student-lookup-empty {
  padding: 9px 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.password-input-row {
  display: flex;
  gap: 6px;
}

.password-input-row input {
  flex: 1;
  min-width: 0;
}

.password-eye-button {
  flex: 0 0 38px;
}

label {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(11, 24, 33, 0.54);
  z-index: 20;
}

.modal-backdrop.active {
  display: grid;
}

.quick-course-backdrop {
  z-index: 35;
}

.quick-course-modal {
  width: min(720px, 100%);
}

.modal {
  width: min(980px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
}

.modal form,
.modal-content {
  padding: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.notice {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #f2d19b;
  background: #fff8eb;
  color: #664400;
}

.split {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.equal-split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.exam-summary-stack {
  grid-template-columns: 1fr;
}

.dashboard-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

.dashboard-tabs .panel:first-child {
  grid-column: 1 / -1;
}

.dashboard-tabs .birthday-students-panel {
  grid-column: 1 / -1;
}

.dashboard-tabs .lead-bde-panel {
  grid-column: 1 / -1;
}

.lead-bde-panel .lead-report-table {
  min-width: 1200px;
}

.lead-dashboard-search-row {
  margin-bottom: 12px;
}

.lead-dashboard-search-row .filter-cell {
  min-width: 130px;
}

.stacked-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: min(226px, 100%);
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 10px 0 14px;
}

.stacked-filter-actions button {
  width: 109px;
  min-height: 38px;
  padding: 8px 12px;
}

.report-subheader {
  align-items: flex-start;
  background: #f4f9fb;
  border: 1px solid #d8e7ee;
  border-radius: 8px;
  margin: 8px 0 12px;
  padding: 10px 12px;
}

.report-subheader p {
  margin: 4px 0 0;
}

.birthday-students-panel .compact-table table {
  min-width: 760px;
}

.compact-table table {
  min-width: 520px;
}

.student-master-panel {
  display: grid;
  gap: 14px;
}

.student-lead-fetch-actions {
  justify-content: flex-start;
  margin-bottom: 10px;
}

.student-fetch-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 9px 15px;
  background: linear-gradient(135deg, #3ea86b, #7ddc99);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(21, 128, 61, 0.16);
}

.student-fetch-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

#studentLeadFetchPanel {
  margin-bottom: 12px;
  border-color: #b8dce7;
  background: linear-gradient(135deg, #e6f7fb, #ffffff);
}

.student-master-clear-row {
  justify-content: flex-start;
}

.student-master-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.student-master-table {
  min-width: 2100px;
}

.student-master-table th button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 800;
  padding: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

.settings-card table {
  min-width: 760px;
}

.settings-two-column {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(360px, 1fr);
  gap: 16px;
  align-items: start;
}

.settings-left,
.settings-right {
  display: grid;
  gap: 16px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-list button {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.mini-list button.active {
  border-color: var(--brand);
  background: #eaf6f9;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .metric-grid,
  .field-grid,
  .split,
  .dashboard-tabs,
  .student-master-filters,
  .backup-grid,
  .settings-two-column,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}
