:root {
  --bg: #f1efe6;
  --panel: #fcfcf8;
  --ink: #1f2c25;
  --muted: #5f6f64;
  --brand: #1f7a67;
  --accent: #dd8f39;
  --danger: #b7473a;
  --line: #d8ddcf;
  --shadow: 0 12px 30px rgba(26, 44, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 18% 10%, #fff5dc, transparent 34%),
    radial-gradient(circle at 80% 4%, #d8efe7, transparent 33%), var(--bg);
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  opacity: 0.3;
  z-index: 0;
}

.bg-shape-one {
  width: 300px;
  height: 300px;
  border-radius: 56% 44% 64% 36%;
  background: #bad8bf;
  top: -90px;
  right: -60px;
}

.bg-shape-two {
  width: 360px;
  height: 360px;
  border-radius: 33% 67% 41% 59%;
  background: #f2c599;
  bottom: -140px;
  left: -80px;
}

.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 1rem auto 2.5rem;
  position: relative;
  z-index: 1;
}

.hero {
  padding: 1rem 0 1.25rem;
  animation: fadeUp 0.45s ease;
}

.eyebrow {
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  margin: 0 0 0.45rem;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.45rem;
  line-height: 1.2;
}

h1 {
  font-family: "Merriweather", serif;
  font-size: clamp(1.6rem, 2.4vw, 2.35rem);
  max-width: 780px;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.05rem;
}

h4 {
  margin-top: 0.85rem;
  font-size: 0.95rem;
}

.hero-copy {
  max-width: 740px;
  color: var(--muted);
  margin-top: 0.55rem;
}

.tutorial-open-btn {
  margin-top: 0.7rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.connection-card {
  animation: fadeUp 0.5s ease 0.05s both;
}

.muted {
  color: var(--muted);
}

.form-grid {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.92rem;
}

.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.inline-check input {
  width: 1rem;
  height: 1rem;
}

.password-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid #c7cebe;
  border-radius: 9px;
  padding: 0.54rem 0.62rem;
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid #c4e2d9;
  border-color: var(--brand);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.62rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: transform 0.12s ease, filter 0.12s ease;
}

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

button:active {
  transform: translateY(0);
}

.status {
  margin-top: 0.65rem;
  min-height: 1rem;
  font-size: 0.9rem;
}

.dashboard {
  animation: fadeUp 0.45s ease;
}

.hidden {
  display: none;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 33, 28, 0.38);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.tutorial-overlay.hidden {
  display: none;
}

.tutorial-card {
  position: relative;
  width: min(540px, 100%);
  background: #fff;
  border: 1px solid #d8ddcf;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(20, 30, 25, 0.2);
  padding: 1rem;
}

.tutorial-close-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  background: #f4f6f3;
  color: var(--ink);
  border: 1px solid #d0d8cb;
  min-width: 34px;
  padding: 0.3rem;
}

.tutorial-step {
  margin: 0 0 0.35rem;
  color: var(--brand);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tutorial-check {
  margin-top: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.tutorial-actions {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.easteregg-popup {
  position: fixed;
  inset: 0;
  background: rgba(14, 24, 20, 0.4);
  z-index: 42;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.easteregg-popup.hidden {
  display: none;
}

.easteregg-card {
  position: relative;
  width: min(420px, 100%);
  background: #fffdf8;
  border: 1px solid #e2d5c6;
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(29, 34, 28, 0.22);
  padding: 1rem;
}

.easteregg-close-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  background: #f4f6f3;
  color: var(--ink);
  border: 1px solid #d0d8cb;
  min-width: 34px;
  padding: 0.3rem;
}

.terms-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 24, 20, 0.4);
  z-index: 43;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.terms-overlay.hidden {
  display: none;
}

.terms-card {
  position: relative;
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid #d8ddcf;
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(29, 34, 28, 0.22);
  padding: 1rem;
}

.terms-close-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  background: #f4f6f3;
  color: var(--ink);
  border: 1px solid #d0d8cb;
  min-width: 34px;
  padding: 0.3rem;
}

.terms-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.dashboard-head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.summary-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  right: -20px;
  top: -20px;
  background: rgba(31, 122, 103, 0.1);
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  margin: 0.35rem 0 0;
  font-size: 2rem;
  font-weight: 700;
}

.stat-value.small {
  font-size: 1.25rem;
}

.stat-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.student-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.student-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid #dce6dc;
  object-fit: cover;
  background: #eef4f1;
  flex-shrink: 0;
}

.split-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.2fr 1fr;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.toggle input {
  width: 1rem;
  height: 1rem;
}

.coeff-table table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.7rem;
}

.coeff-table th,
.coeff-table td {
  text-align: left;
  padding: 0.52rem 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.coeff-table input {
  width: 88px;
}

.subjects-list,
.exercise-list {
  display: grid;
  gap: 0.75rem;
}

.adaptive-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 0.45rem 0 0.9rem;
}

.subject-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  background: #fff;
}

.subject-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.subject-metrics {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.bar-wrap {
  margin-top: 0.55rem;
  height: 10px;
  border-radius: 999px;
  background: #e2e8dc;
  overflow: hidden;
}

.bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #3ea089);
  transition: width 0.3s ease;
}

.trend-up {
  color: #24844f;
}

.trend-down {
  color: var(--danger);
}

.trend-stable {
  color: #887a3e;
}

.metric-below {
  color: var(--danger);
  font-weight: 700;
}

.metric-above {
  color: #24844f;
  font-weight: 700;
}

.list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.list li {
  margin-bottom: 0.33rem;
}

.eval-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.72rem;
  font-size: 0.86rem;
}

.eval-table th,
.eval-table td {
  border-bottom: 1px dashed var(--line);
  padding: 0.38rem 0.3rem;
  text-align: left;
}

.exercise-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 0.8rem;
  background: #fffdfa;
}

.exercise-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.exercise-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.exercise-actions button {
  padding: 0.4rem 0.55rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

.exercise-actions .light {
  background: #eef4f1;
  color: var(--ink);
}

.icon-btn {
  min-width: 42px;
  padding: 0.54rem 0.45rem;
  background: #eef4f1;
  color: var(--ink);
  border: 1px solid #c7cebe;
}

.icon-btn:hover {
  filter: brightness(1.02);
}

.light-btn {
  background: #eef4f1;
  color: var(--ink);
  border: 1px solid #c7cebe;
  min-width: 96px;
}

#logout-btn {
  background: #f7e2de;
  border-color: #e1b4ab;
}

.establishment-results {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #f8faf7;
  padding: 0.65rem;
  min-height: 48px;
}

.establishment-list {
  display: grid;
  gap: 0.45rem;
}

.establishment-item {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 0.45rem 0.55rem;
}

.establishment-item p {
  margin: 0;
  line-height: 1.3;
}

.establishment-item .url {
  color: var(--muted);
  font-size: 0.82rem;
  word-break: break-all;
}

.establishment-item button {
  white-space: nowrap;
  padding: 0.45rem 0.6rem;
}

.pill {
  display: inline-flex;
  font-size: 0.78rem;
  color: #fff;
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  background: #54686a;
}

.pill-high {
  background: #b7473a;
}

.pill-mid {
  background: #ce862d;
}

.pill-low {
  background: #2a7a5f;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 1rem);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    width: 100%;
    justify-content: space-between;
  }

  .adaptive-grid {
    grid-template-columns: 1fr;
  }
}
