:root {
  --primary: #1e3aff;
  --primary-2: #4f6bff;
  --primary-3: #1930d8;
  --dark: #111827;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-2: #d8deea;
  --panel: #f7f8fb;
  --white: #ffffff;
  --soft-blue: #eef3ff;
  --success: #0f9f6e;
  --warning: #b7791f;
  --danger: #d92d20;
  --shadow-sm: 0 8px 24px rgba(17, 24, 39, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: #f3f6fb;
  font-family: "Inter", Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

button:active {
  transform: translateY(1px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--dark);
  font-size: 19px;
  font-weight: 600;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 9px;
  box-shadow: 0 8px 20px rgba(30, 58, 255, 0.16);
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(30, 58, 255, 0.12), transparent 30%),
    #f4f6f9;
}

.login-panel {
  display: grid;
  gap: 22px;
  width: min(430px, 100%);
  padding: 28px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.1);
}

.login-panel h1 {
  margin: 0;
  color: var(--dark);
  font-size: 28px;
  font-weight: 600;
}

.muted,
.login-copy,
.login-note,
.subtle {
  color: var(--muted);
  line-height: 1.6;
}

.login-copy,
.login-note {
  margin: 8px 0 0;
}

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

.login-form label {
  display: grid;
  gap: 7px;
  color: #374151;
  font-weight: 500;
}

.login-form input,
.filters input,
.filters select,
.search-box input {
  min-height: 38px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.login-form input:focus,
.filters input:focus,
.filters select:focus,
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 255, 0.08);
}

.login-form button,
.create-student {
  min-height: 40px;
  padding: 0 14px;
  color: var(--white);
  background: var(--primary);
  border-radius: 7px;
  font-weight: 500;
}

.forgot-link {
  justify-self: start;
  padding: 0;
  color: var(--primary);
  background: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border-right: 1px solid var(--line-2);
}

.sidebar-brand {
  padding: 18px 18px 16px;
}

.create-student {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 14px 16px;
  box-shadow: 0 10px 24px rgba(30, 58, 255, 0.18);
}

.create-student:hover,
.section-action:hover {
  background: var(--primary-3);
  box-shadow: 0 10px 24px rgba(30, 58, 255, 0.18);
}

.create-student svg,
.section-action svg,
.ghost-icon svg,
.mobile-menu svg,
.row-actions svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-nav,
.side-subnav {
  display: grid;
  gap: 3px;
  padding: 0 10px;
}

.side-nav button,
.side-subnav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 11px;
  color: #374151;
  background: transparent;
  border-radius: 9px;
  font-weight: 400;
  text-align: left;
}

.side-nav button::before {
  content: "";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: var(--soft-blue);
  border: 1px solid rgba(30, 58, 255, 0.08);
  border-radius: 7px;
}

.side-nav button svg {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--primary);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-nav button:hover,
.side-nav button.active,
.side-subnav button:hover {
  color: var(--primary);
  background: rgba(30, 58, 255, 0.075);
}

.side-nav button.active {
  box-shadow: inset 3px 0 0 var(--primary);
}

.side-subnav {
  margin-top: 10px;
  padding-left: 42px;
}

.side-subnav button {
  min-height: 30px;
  font-size: 13px;
}

.side-subnav span {
  padding: 2px 5px;
  color: var(--white);
  background: var(--primary);
  border-radius: 999px;
  font-size: 10px;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: auto;
  padding: 14px;
}

.sidebar-footer button {
  min-height: 34px;
  color: var(--primary);
  background: var(--soft-blue);
  border-radius: 7px;
  font-weight: 500;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(240px, 420px) 42px 42px auto;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line-2);
  backdrop-filter: blur(16px);
}

.center-name {
  color: var(--dark);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.search-box {
  position: relative;
  display: block;
}

.search-box span {
  position: absolute;
  top: 50%;
  left: 11px;
  color: #9ca3af;
  transform: translateY(-50%);
}

.search-box input {
  width: 100%;
  padding-left: 68px;
  background: #f8faff;
  border-color: #dfe5f2;
}

.lang-button,
.ghost-icon,
.mobile-menu {
  min-width: 36px;
  min-height: 36px;
  color: var(--ink);
  background: #f8faff;
  border: 1px solid #dfe5f2;
  border-radius: 9px;
}

.ghost-icon,
.mobile-menu,
.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.ghost-icon:hover,
.lang-button:hover,
.mobile-menu:hover {
  color: var(--primary);
  background: var(--soft-blue);
}

.mobile-menu {
  display: none;
}

.logout-button {
  padding: 0 12px;
}

.content {
  padding: 20px;
}

.license-banner {
  margin-bottom: 18px;
  padding: 11px 14px;
  color: #374151;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 14px;
}

.page-head h1 {
  margin: 0;
  color: var(--dark);
  font-size: 23px;
  font-weight: 600;
}

.page-head span {
  color: var(--muted);
  margin-left: auto;
}

.section-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 13px;
  color: var(--white);
  background: var(--primary);
  border-radius: 9px;
  font-weight: 500;
}

.smart-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.smart-grid article,
.alerts-panel {
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #f8faff);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.smart-grid span,
.smart-grid small {
  display: block;
  color: var(--muted);
}

.smart-grid strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--dark);
  font-size: 24px;
  font-weight: 600;
}

.alerts-panel {
  margin-bottom: 18px;
}

.alerts-panel p {
  margin: 8px 0 0;
  padding: 10px 12px;
  color: #344054;
  background: #f8faff;
  border: 1px solid #edf0f6;
  border-radius: 8px;
}

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

.chart-card {
  min-height: 260px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.chart-card .page-head h1 {
  font-size: 18px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 180px;
  padding-top: 10px;
}

.bar-chart div {
  position: relative;
  display: grid;
  align-content: end;
  min-height: 170px;
  gap: 6px;
}

.bar-chart i {
  display: block;
  min-height: 8px;
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
  border-radius: 8px 8px 4px 4px;
  box-shadow: 0 8px 18px rgba(30, 58, 255, 0.18);
}

.bar-chart span,
.bar-chart strong {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.bar-chart strong {
  color: var(--dark);
  font-weight: 600;
}

.funnel-chart,
.rank-list {
  display: grid;
  gap: 12px;
}

.funnel-chart div {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-bottom: 13px;
}

.funnel-chart i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 7px;
  background: var(--primary);
  border-radius: 999px;
}

.funnel-chart span,
.rank-list span {
  color: var(--muted);
}

.funnel-chart strong,
.rank-list strong {
  color: var(--dark);
  font-weight: 600;
}

.rank-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 12px;
  background: #f8faff;
  border: 1px solid #edf0f6;
  border-radius: 8px;
}

.metric-grid article,
.page-card,
.notice,
.empty-state,
.reminder-grid article,
.finance-summary article {
  background: #ffffff;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.metric-grid article {
  position: relative;
  min-height: 104px;
  padding: 17px;
  overflow: hidden;
}

.metric-grid article::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -28px;
  width: 82px;
  height: 82px;
  background: radial-gradient(circle, rgba(30, 58, 255, 0.1), transparent 68%);
}

.metric-grid span,
.finance-summary span {
  display: block;
  color: var(--muted);
}

.metric-grid strong {
  display: block;
  margin-top: 12px;
  color: var(--dark);
  font-size: 30px;
  font-weight: 600;
}

.page-card,
.notice {
  padding: 16px;
}

.tabs,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tabs button,
.filters button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--primary);
  background: var(--soft-blue);
  border: 1px solid rgba(30, 58, 255, 0.08);
  border-radius: 8px;
  font-weight: 500;
}

.filters input,
.filters select {
  min-width: 180px;
}

.finance-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.pipeline article {
  padding: 13px;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.pipeline span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.pipeline strong {
  display: block;
  margin-top: 6px;
  color: var(--dark);
  font-size: 22px;
  font-weight: 500;
}

.kanban-column {
  min-height: 190px;
}

.kanban-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kanban-column button {
  display: grid;
  width: 100%;
  gap: 4px;
  margin-top: 8px;
  padding: 10px;
  color: var(--ink);
  background: #f8faff;
  border: 1px solid #edf0f6;
  border-radius: 8px;
  text-align: left;
}

.kanban-column button b {
  font-weight: 600;
}

.kanban-column button small {
  color: var(--muted);
}

.profile-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.profile-grid article {
  padding: 12px;
  background: #f8faff;
  border: 1px solid #edf0f6;
  border-radius: 8px;
}

.profile-grid span,
.profile-columns span {
  display: block;
  color: var(--muted);
}

.profile-grid strong {
  display: block;
  margin-top: 6px;
  color: var(--dark);
}

.profile-columns {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-columns section {
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 8px;
}

.profile-columns h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.profile-columns p {
  margin: 8px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #edf0f6;
}

.table {
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.table > div {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(130px, 1fr);
  align-items: center;
  min-width: 820px;
  border-bottom: 1px solid #edf0f6;
}

.table > div:not(:first-child):hover {
  background: #fbfcff;
}

.table > div:last-child {
  border-bottom: 0;
}

.table b,
.table span {
  min-height: 46px;
  padding: 12px;
  border-right: 1px solid #edf0f6;
  font-weight: 400;
  line-height: 1.45;
}

.table b {
  color: #4b5563;
  background: #f8faff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.table-empty {
  display: block !important;
  min-width: 820px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: #fff;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 10px 0 16px;
  color: var(--muted);
}

.table-pager span {
  margin-right: auto;
}

.table-pager select,
.table-pager button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 7px;
}

.table-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.table .row-actions {
  display: flex;
  gap: 6px;
  border-right: 0;
  padding: 8px;
}

.row-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  color: var(--primary);
  background: var(--soft-blue);
  border-radius: 6px;
  font-size: 12px;
}

.row-actions button:last-child {
  color: #b42318;
  background: #fff1f0;
}

.empty-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(248, 250, 255, 0.72), rgba(255, 255, 255, 0.92)),
    #fff;
}

.status-badge,
.money {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 26px !important;
  padding: 4px 9px !important;
  border: 0 !important;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-active,
.status-paid,
.status-present {
  color: #047857;
  background: #ecfdf3;
}

.status-new,
.status-trial,
.status-late {
  color: var(--warning);
  background: #fffbeb;
}

.status-contacted,
.status-frozen,
.status-excused {
  color: var(--primary);
  background: var(--soft-blue);
}

.status-lost,
.status-left,
.status-debtor,
.status-absent,
.money-danger {
  color: var(--danger);
  background: #fff1f0;
}

.money {
  color: #344054;
  background: #f2f4f7;
}

.notice strong {
  display: block;
  color: var(--primary);
  font-weight: 500;
}

.notice p {
  margin: 8px 0 0;
  color: var(--muted);
}

.reminder-grid,
.finance-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.reminder-grid article,
.finance-summary article {
  padding: 16px;
}

.reminder-grid strong,
.finance-summary strong {
  display: block;
  margin: 8px 0;
  color: var(--dark);
  font-size: 24px;
  font-weight: 500;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: 360px;
  padding: 13px 15px;
  color: var(--white);
  background: var(--dark);
  border-radius: 8px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.34);
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 28px 90px rgba(17, 24, 39, 0.22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  color: var(--dark);
  font-size: 20px;
  font-weight: 600;
}

.modal-head button {
  width: 32px;
  height: 32px;
  color: var(--muted);
  background: var(--panel);
  border-radius: 7px;
}

.modal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}

.modal-form label {
  display: grid;
  gap: 7px;
  color: #374151;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  min-height: 40px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.modal-form textarea {
  min-height: 88px;
  padding-top: 10px;
  resize: vertical;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.modal-actions button {
  min-height: 38px;
  padding: 0 14px;
  background: var(--panel);
  border-radius: 7px;
}

.modal-actions button[type="submit"] {
  color: var(--white);
  background: var(--primary);
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(260px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .mobile-menu {
    display: block;
  }

  .topbar {
    grid-template-columns: auto auto minmax(150px, 1fr) auto auto auto;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .search-box,
  .ghost-icon {
    display: none;
  }

  .content {
    padding: 12px;
  }

  .metric-grid,
  .smart-grid,
  .dashboard-grid,
  .reminder-grid,
  .finance-summary,
  .pipeline,
  .modal-form {
    grid-template-columns: 1fr;
  }

  .profile-grid,
  .profile-columns {
    grid-template-columns: 1fr;
  }

  .filters input,
  .filters select,
  .filters button {
    width: 100%;
  }
}
