:root {
  font-family: "Manrope", "Segoe UI", "Trebuchet MS", sans-serif;
  color: #24364d;
  background:
    radial-gradient(circle at 8% -4%, rgba(121, 80, 242, 0.10), transparent 30%),
    radial-gradient(circle at 92% 0%, rgba(34, 184, 207, 0.10), transparent 32%),
    radial-gradient(circle at 50% 110%, rgba(76, 110, 245, 0.08), transparent 40%),
    linear-gradient(180deg, #f5f7fb 0%, #eef2f8 100%);
}

/* Акцентный цвет каждой вкладки */
body {
  --accent: #4c6ef5;
  --accent-2: #748ffc;
  --accent-soft: rgba(76, 110, 245, 0.09);
  --accent-border: rgba(76, 110, 245, 0.24);
}

body[data-tab="students"] {
  --accent: #7950f2;
  --accent-2: #9775fa;
  --accent-soft: rgba(121, 80, 242, 0.09);
  --accent-border: rgba(121, 80, 242, 0.24);
}

body[data-tab="education"] {
  --accent: #0ca678;
  --accent-2: #38d9a9;
  --accent-soft: rgba(12, 166, 120, 0.09);
  --accent-border: rgba(12, 166, 120, 0.24);
}

body[data-tab="statuses"] {
  --accent: #1971c2;
  --accent-2: #4dabf7;
  --accent-soft: rgba(25, 113, 194, 0.09);
  --accent-border: rgba(25, 113, 194, 0.24);
}

body[data-tab="social"] {
  --accent: #d6336c;
  --accent-2: #f06595;
  --accent-soft: rgba(214, 51, 108, 0.08);
  --accent-border: rgba(214, 51, 108, 0.22);
}

body[data-tab="professionalitet"] {
  --accent: #7048e8;
  --accent-2: #b197fc;
  --accent-soft: rgba(112, 72, 232, 0.09);
  --accent-border: rgba(112, 72, 232, 0.24);
}

body[data-tab="scholarships"] {
  --accent: #f08c00;
  --accent-2: #ffc078;
  --accent-soft: rgba(240, 140, 0, 0.10);
  --accent-border: rgba(240, 140, 0, 0.26);
}

body[data-tab="contracts"] {
  --accent: #e8590c;
  --accent-2: #ffa94d;
  --accent-soft: rgba(232, 89, 12, 0.09);
  --accent-border: rgba(232, 89, 12, 0.24);
}

body[data-tab="employment"] {
  --accent: #2f9e44;
  --accent-2: #69db7c;
  --accent-soft: rgba(47, 158, 68, 0.09);
  --accent-border: rgba(47, 158, 68, 0.24);
}

body[data-tab="table"] {
  --accent: #1098ad;
  --accent-2: #66d9e8;
  --accent-soft: rgba(16, 152, 173, 0.09);
  --accent-border: rgba(16, 152, 173, 0.24);
}

h1,
h2 {
  font-family: "Unbounded", "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  padding: 24px;
}

body.modal-open {
  overflow: hidden;
}

.auth-body {
  display: grid;
  place-items: center;
}

.auth-shell {
  width: min(100%, 520px);
}

.auth-card {
  padding: 34px;
  border-radius: 36px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e6ebf4;
  box-shadow: 0 30px 80px rgba(37, 55, 84, 0.12);
}

.auth-head h1 {
  margin: 0 0 10px;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
}

.auth-error {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff2f2;
  border: 1px solid #f1d0d0;
  color: #a12626;
  font-weight: 700;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form span {
  color: #5e7491;
  font-size: 0.92rem;
}

.auth-form input {
  width: 100%;
  border: 1px solid #dbe4ef;
  border-radius: 16px;
  background: #fbfdff;
  padding: 14px 16px;
  color: #24364d;
}

.auth-button {
  justify-content: center;
  margin-top: 6px;
}

button,
select,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.page-shell {
  max-width: 1720px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 36px;
  border: 1px solid #e6ebf4;
  box-shadow: 0 30px 80px rgba(37, 55, 84, 0.08);
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 28px 14px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 3px 10px var(--accent-border);
}

.topbar h1,
.hero-card h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.topbar-note {
  color: #7d8ca1;
  font-size: 0.94rem;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logout-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid #d8e2ef;
  background: #f7faff;
  color: #436789;
  text-decoration: none;
  font-weight: 700;
}

.logout-link:hover {
  background: #eef4fb;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent, #6d87aa);
}

.muted {
  color: #6f7f95;
}

.tabs-strip {
  display: flex;
  gap: 6px;
  padding: 0 28px;
  border-bottom: 1px solid #e7edf6;
  overflow-x: auto;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  color: #8593a8;
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.tab-link:hover {
  color: #324860;
  background: #f4f7fb;
}

.tab-link.active {
  color: var(--accent);
  font-weight: 700;
  background: #ffffff;
  border-color: #e3e9f3;
  border-top: 3px solid var(--accent);
  position: relative;
  top: 1px;
}

.dashboard-layout {
  padding: 24px 28px 32px;
  display: grid;
  gap: 18px;
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 22px 24px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, var(--accent-soft), transparent 52%),
    linear-gradient(180deg, #f8fbff 0%, #f1f5fb 100%);
  border: 1px solid var(--accent-border);
}

.hero-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.hero-upload-button {
  min-width: 220px;
  min-height: 54px;
}

.hero-meta span {
  padding: 10px 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e6ecf5;
  color: #58708f;
  font-size: 0.92rem;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  gap: 18px;
}

.card {
  background: #ffffff;
  border: 1px solid #e8edf5;
  border-radius: 28px;
  padding: 22px;
  box-shadow:
    inset 0 0 0 1px rgba(245, 248, 252, 0.9),
    0 14px 32px rgba(47, 64, 89, 0.05);
}

.upload-card,
.filters-card,
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.upload-card h3,
.empty-card h3,
.chart-card h3 {
  margin: 0 0 8px;
}

.upload-actions {
  display: flex;
  align-items: center;
}

.upload-card-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 100%;
  max-width: 320px;
  text-align: right;
  color: #6f7f95;
  line-height: 1.5;
}

.action-button {
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--accent, #4c6ef5), var(--accent-2, #748ffc));
  color: white;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 22px var(--accent-border, rgba(76, 110, 245, 0.24));
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.action-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px var(--accent-border, rgba(76, 110, 245, 0.3));
}

.action-button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.filters-grid label {
  display: grid;
  gap: 8px;
}

.filters-grid span {
  font-size: 0.88rem;
  color: #64748b;
}

.filters-grid select {
  width: 100%;
  border: 1px solid #dbe4ef;
  border-radius: 16px;
  background: #fbfdff;
  padding: 12px 14px;
  color: #24364d;
}

.error-card {
  color: #a12626;
  background: #fff5f5;
  border-color: #f0d6d6;
}

.empty-card {
  text-align: center;
  padding: 34px 24px;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 18px;
}

.metric-card {
  --mc: #4c6ef5;
  --mc-soft: rgba(76, 110, 245, 0.08);
  min-height: 152px;
  border-radius: 28px;
  padding: 22px;
  background: linear-gradient(180deg, var(--mc-soft) 0%, #ffffff 78%);
  border: 1px solid #e6ecf5;
  border-top: 4px solid var(--mc);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.9),
    0 12px 26px rgba(57, 78, 107, 0.05);
}

.metric-card:nth-child(2) {
  --mc: #7950f2;
  --mc-soft: rgba(121, 80, 242, 0.08);
}

.metric-card:nth-child(3) {
  --mc: #0ca678;
  --mc-soft: rgba(12, 166, 120, 0.08);
}

.metric-card:nth-child(4) {
  --mc: #f08c00;
  --mc-soft: rgba(240, 140, 0, 0.09);
}

.metric-card:nth-child(5) {
  --mc: #1098ad;
  --mc-soft: rgba(16, 152, 173, 0.08);
}

.metric-card p,
.metric-card span {
  margin: 0;
  color: #6f7f95;
}

.metric-card p {
  font-weight: 700;
  color: #44546c;
}

.metric-card strong {
  display: block;
  margin: 14px 0 8px;
  font-family: "Unbounded", "Manrope", sans-serif;
  font-weight: 600;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--mc);
}

.overview-grid,
.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.table-board {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 0.8fr;
  gap: 18px;
  align-items: start;
}

.table-board-secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-section-banner {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  border-radius: 24px;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  border: 1px solid var(--accent-border);
  color: #ffffff;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 12px 26px var(--accent-border);
}

.table-section-banner span {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.table-section-banner strong {
  font-size: 1.04rem;
  font-weight: 700;
}

.chart-card {
  min-height: 460px;
  cursor: zoom-in;
  transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.chart-card:hover {
  border-color: var(--accent-border);
  box-shadow:
    inset 0 0 0 1px rgba(245, 248, 252, 0.9),
    0 18px 40px rgba(47, 64, 89, 0.1);
  transform: translateY(-2px);
}

.empty-topic-card:hover {
  transform: none;
  border-color: #e8edf5;
  box-shadow:
    inset 0 0 0 1px rgba(245, 248, 252, 0.9),
    0 14px 32px rgba(47, 64, 89, 0.05);
}

.chart-card.wide {
  grid-column: span 2;
}

.card-head h3 {
  margin: 0;
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-head span {
  color: #90a0b4;
  font-size: 0.9rem;
  white-space: nowrap;
}

.chart-open-button {
  border: 1px solid #d8e2ef;
  background: #f7faff;
  color: #436789;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.chart-open-button:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.chart-card canvas {
  width: 100% !important;
  height: 380px !important;
  margin-top: 14px;
}

.pie-card {
  min-height: 660px;
}

.bar-card {
  min-height: 520px;
}

.pie-canvas-box {
  width: min(100%, 760px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pie-card canvas {
  width: 100% !important;
  height: 100% !important;
  margin-top: 0;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: center;
}

.chart-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.chart-total {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--accent-soft, #f5f8fc);
  border: 1px solid var(--accent-border, #e8edf5);
  color: #51657f;
}

.chart-total strong {
  color: var(--accent, #24364d);
  font-size: 1.05rem;
}

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

.chart-stat-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid #e8edf5;
}

.chart-stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7);
}

.chart-stat-label {
  color: #4a607b;
  font-size: 0.92rem;
}

.chart-stat-value {
  font-weight: 700;
  color: #24364d;
}

.chart-stat-percent {
  color: #6d87aa;
  font-size: 0.88rem;
}

.empty-topic-card {
  cursor: default;
  min-height: 320px;
}

.empty-topic-body {
  min-height: 220px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 14px;
  padding: 18px 4px 6px;
}

.empty-topic-placeholder {
  width: 100%;
  min-height: 120px;
  border-radius: 24px;
  border: 1px dashed #d7e2f0;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
  color: #6f86a4;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-weight: 700;
}

.category-section {
  display: grid;
  gap: 18px;
}

.category-section .chart-card {
  min-height: 540px;
}

.category-section .chart-card canvas {
  height: 420px !important;
}

.table-card {
  min-height: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: 24px;
}

.table-card.compact {
  min-width: 0;
}

.wide-table {
  grid-column: span 1;
}

.table-card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 20px 0;
}

.table-card-head h3 {
  margin: 0 0 8px;
}

.summary-table-wrap {
  padding: 14px 18px 18px;
  overflow-x: auto;
}

.summary-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 520px;
  background: #fdfefe;
  table-layout: fixed;
}

.summary-table th,
.summary-table td {
  border-right: 1px solid #d7e2f0;
  border-bottom: 1px solid #d7e2f0;
  padding: 10px 12px;
  text-align: center;
  vertical-align: middle;
  font-size: 0.88rem;
  line-height: 1.25;
}

.summary-table th:first-child,
.summary-table td:first-child {
  border-left: 1px solid #d7e2f0;
}

.summary-table thead th {
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 130%);
  color: #ffffff;
  font-weight: 700;
  border-top: 1px solid var(--accent-border);
}

.summary-table thead th:first-child {
  border-top-left-radius: 18px;
}

.summary-table thead th:last-child {
  border-top-right-radius: 18px;
}

.summary-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 18px;
}

.summary-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 18px;
}

.summary-table tbody td {
  background: #ffffff;
  color: #24364d;
}

.summary-table tbody tr:nth-child(even) td {
  background: #f7faff;
}

.summary-table .row-heading {
  text-align: left;
  font-weight: 700;
  color: var(--accent, #355c7d);
  min-width: 140px;
  word-break: break-word;
}

.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.chart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 32, 48, 0.56);
  backdrop-filter: blur(6px);
}

.chart-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(1500px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #ffffff;
  border-radius: 30px;
  border: 1px solid #dfe7f3;
  box-shadow: 0 30px 80px rgba(23, 34, 52, 0.24);
  padding: 24px;
}

.chart-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.chart-modal-header h2 {
  margin: 0 0 6px;
  font-size: 1.3rem;
  font-weight: 600;
}

.chart-modal-close {
  border: 1px solid #d8e2ef;
  background: #f7faff;
  color: #436789;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.chart-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.chart-modal-canvas-box {
  min-height: 620px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-modal-canvas-box canvas {
  width: 100% !important;
  height: 620px !important;
  margin: 0 !important;
}

.chart-modal[data-chart-type="pie"] .chart-modal-body {
  grid-template-columns: minmax(0, 1fr) 310px;
}

.chart-modal[data-chart-type="pie"] .chart-modal-canvas-box {
  min-height: 0;
  width: min(100%, 860px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

.chart-modal[data-chart-type="pie"] .chart-modal-canvas-box canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

.chart-modal-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

@media (max-width: 1280px) {
  .control-row,
  .overview-grid,
  .section-grid {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 860px) {
  body {
    padding: 12px;
  }

  .topbar,
  .hero-card,
  .upload-card,
  .filters-card,
  .chart-modal-header {
    flex-direction: column;
  }

  .control-row,
  .overview-grid,
  .section-grid,
  .table-board,
  .table-board-secondary,
  .filters-grid,
  .metrics-grid,
  .chart-modal-body {
    grid-template-columns: 1fr;
  }

  .topbar-note,
  .card-head span {
    white-space: normal;
  }

  .table-section-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .chart-card.wide {
    grid-column: span 1;
  }

  .chart-modal {
    padding: 12px;
  }

  .chart-modal-canvas-box {
    min-height: 360px;
  }

  .chart-modal-canvas-box canvas {
    height: 360px !important;
  }

  .chart-modal[data-chart-type="pie"] .chart-modal-canvas-box {
    width: min(100%, 520px);
    min-height: 0;
  }

  .chart-modal[data-chart-type="pie"] .chart-modal-canvas-box canvas {
    height: 100% !important;
  }
}
