:root {
  color-scheme: light;
  --ink: #202a25;
  --muted: #788079;
  --paper: #f5f2eb;
  --white: #fffefa;
  --green: #2f5c48;
  --green-dark: #234634;
  --line: #e8e5dc;
  --orange: #e9a66c;
  font-family: "Nirmala UI", "Mangal", "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5.2vw;
  border-bottom: 1px solid #e8e4da;
  background: rgba(255, 254, 250, 0.7);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px 10px 10px 3px;
  color: #fff;
  background: var(--green);
  font-size: 16px;
}

.brand-light {
  font-weight: 500;
}

.access-status {
  color: var(--muted);
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(230px, 29%) 1fr;
  max-width: 1500px;
  min-height: calc(100vh - 74px);
  margin: 0 auto;
  padding: 0 5.2vw;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: calc(100vh - 74px);
  min-height: calc(100vh - 74px);
  flex-direction: column;
  padding: 70px 38px 28px 0;
  border-right: 1px solid #e6e2d9;
}

.eyebrow,
.nav-label {
  margin: 0;
  color: #92958b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.sidebar h1 {
  margin: 17px 0 11px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: clamp(32px, 3.2vw, 46px);
  font-weight: 700;
  letter-spacing: -2.4px;
  line-height: 1.1;
}

.intro {
  max-width: 230px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.nav-group {
  margin-top: 49px;
}

.group-tabs {
  display: flex;
  gap: 8px;
  margin-top: 13px;
}

.group-tab {
  padding: 8px 13px;
  border: 1px solid #ddded5;
  border-radius: 7px;
  color: #626b64;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  transition: background 150ms, color 150ms, border-color 150ms;
}

.group-tab.active {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.section-nav {
  display: grid;
  gap: 5px;
  margin-top: 39px;
}

.section-nav .nav-label {
  margin-bottom: 10px;
}

.category-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.category-filter .nav-label {
  margin-right: 5px;
}

.category-tab {
  padding: 7px 11px;
  border: 1px solid #ddded5;
  border-radius: 6px;
  color: #626b64;
  background: transparent;
  font-size: 10px;
  font-weight: 600;
  transition: background 150ms, color 150ms, border-color 150ms;
}

.category-tab.active {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.category-tab:hover:not(.active) {
  color: var(--green-dark);
  background: #eae9df;
}

.section-tab,
.admin-link {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  color: #69716b;
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  transition: background 150ms, color 150ms;
}

.section-tab:hover,
.admin-link:hover {
  color: var(--green-dark);
  background: #eae9df;
}

.section-tab.active {
  color: var(--green-dark);
  background: #e5e9df;
}

.nav-icon {
  color: #a4a89e;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
}

.sidebar-bottom {
  margin-top: auto;
}

.admin-link {
  position: relative;
  z-index: 4;
  width: 100%;
  margin-bottom: 19px;
}

.admin-link span {
  color: #bd8054;
  font-size: 15px;
}

.sidebar-bottom p {
  margin: 0;
  color: #9a9b91;
  font-size: 10px;
}

.content {
  min-width: 0;
  padding: 67px 0 80px 6.3vw;
}

.home-section {
  max-width: 740px;
  line-height: 1.8;
}

.home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 30px;
}

.home-links a {
  color: var(--green);
  font-size: 13px;
  text-decoration: none;
}

.home-links a:hover {
  text-decoration: underline;
}

.home-hero h2 {
  margin: 15px 0;
  font-size: clamp(26px, 3.2vw, 42px);
  letter-spacing: -0.5px;
  line-height: 1.5;
}

.home-hero > p:not(.eyebrow),
.home-block > p,
.home-grid p {
  color: var(--muted);
  font-size: 14px;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin: 24px 0 36px;
}

.hero-actions .primary-button {
  width: auto;
  margin: 0;
  font-size: 13px;
}

.home-block {
  padding: 30px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 20px;
}

.home-block h2 {
  margin: 0 0 20px;
  font-size: 23px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
}

.home-grid .card,
.practice-card,
.application-form {
  padding: 22px;
}

.home-grid h3 {
  margin: 8px 0;
  color: var(--green);
  font-size: 17px;
}

.home-grid p {
  margin: 0;
}

.subject-tag {
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--green-dark);
  background: #e5e9df;
  font-size: 11px;
}

.home-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 24px;
  font-size: 14px;
}

.home-steps li {
  padding: 10px;
}

.quiz-option {
  display: block;
  width: 100%;
  margin: 9px 0;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
}

.quiz-option.correct {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.quiz-option.incorrect {
  border-color: #9c453a;
  color: #fff;
  background: #9c453a;
}

.quiz-feedback {
  min-height: 28px;
  margin-bottom: 0;
  font-size: 14px;
}

.application-form {
  max-width: 500px;
}

.application-form label {
  margin-top: 14px;
  font-size: 13px;
}

.application-form label:first-child {
  margin-top: 0;
}

.application-form input,
.application-form select {
  font-size: 14px;
}

.application-form .consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
}

.consent-label input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 4px 0 0;
  accent-color: var(--green);
}

.form-success {
  color: var(--green-dark);
  font-size: 13px;
}

.form-success:empty {
  margin: 0;
}

.home-footer {
  padding: 25px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.content-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 31px;
}

.content-heading h2 {
  margin: 9px 0 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 31px;
  font-weight: 700;
  letter-spacing: -1.3px;
}

.item-count {
  margin: 0 0 5px;
  color: #8d928a;
  font-size: 11px;
}

.items-section,
.admin-section {
  width: 100%;
  max-width: 740px;
}

.items-list {
  display: grid;
  gap: 12px;
}

.item-card,
.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.item-card {
  padding: 22px 24px;
  animation: rise-in 260ms ease both;
}

.item-card:nth-child(2) {
  animation-delay: 50ms;
}

.item-card:nth-child(3) {
  animation-delay: 100ms;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: #90958c;
  font-size: 10px;
}

.item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

.item-card h3 {
  margin: 0 0 9px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.item-content {
  margin: 0;
  color: #747c75;
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 78px 20px;
  border: 1px dashed #dedbd1;
  border-radius: 10px;
  text-align: center;
}

.empty-state > span {
  color: var(--orange);
  font-size: 24px;
}

.empty-state h3 {
  margin: 13px 0 6px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}

.empty-state p,
.admin-intro > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.access-panel {
  position: fixed;
  z-index: 3;
  inset: 74px 0 0;
  display: grid;
  place-items: center;
  padding: 25px;
  background: rgba(245, 242, 235, 0.94);
  backdrop-filter: blur(7px);
}

.access-panel[hidden],
[hidden] {
  display: none !important;
}

.access-card {
  width: min(100%, 390px);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--white);
  box-shadow: 0 18px 60px rgba(48, 57, 48, 0.08);
}

.access-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  margin-bottom: 23px;
  border-radius: 10px;
  color: var(--green);
  background: #e8ede5;
}

.access-card h2,
.admin-intro h2 {
  margin: 9px 0 8px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 23px;
  letter-spacing: -0.9px;
}

.access-card > p:not(.eyebrow) {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

label {
  display: block;
  margin: 0 0 7px;
  color: #5a645c;
  font-size: 11px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #deded5;
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  transition: border-color 150ms, box-shadow 150ms;
}

input,
select {
  height: 41px;
  padding: 0 11px;
}

textarea {
  min-height: 130px;
  padding: 11px;
  line-height: 1.6;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #70917c;
  box-shadow: 0 0 0 3px rgba(47, 92, 72, 0.09);
}

.primary-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--green);
  font-size: 11px;
  font-weight: 700;
  transition: background 150ms, transform 150ms;
}

.primary-button:hover {
  background: var(--green-dark);
}

.primary-button:active {
  transform: translateY(1px);
}

.form-error {
  min-height: 0;
  margin: 0;
  color: #a23b31;
  font-size: 11px;
}

.form-error:not(:empty) {
  margin-top: 10px;
}

.page-error {
  margin-top: 15px;
}

.admin-intro {
  margin-bottom: 22px;
}

.admin-exit {
  margin-top: 12px;
  padding: 0;
}

.admin-intro h2 {
  margin-bottom: 6px;
}

.admin-login {
  max-width: 390px;
  padding: 23px;
}

.admin-workspace {
  display: grid;
  gap: 27px;
}

.editor,
.admin-items {
  padding: 23px;
}

.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.editor-heading h3 {
  margin: 6px 0 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  letter-spacing: -0.4px;
}

.text-button {
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.editor > label,
.editor-grid + label {
  margin-top: 15px;
}

.admin-items-list {
  display: grid;
  gap: 9px;
}

.admin-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-item-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
}

.admin-item-row small {
  color: var(--muted);
  font-size: 10px;
}

.row-actions {
  display: flex;
  gap: 7px;
}

.row-actions button {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--green-dark);
  background: transparent;
  font-size: 10px;
}

.row-actions button:hover {
  background: #f1f2eb;
}

.row-actions .delete-button {
  color: #9c453a;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .topbar {
    height: 62px;
    padding: 0 20px;
  }

  .layout {
    display: block;
    min-height: calc(100vh - 62px);
    padding: 0 20px;
  }

  .sidebar {
    position: relative;
    height: auto;
    min-height: auto;
    padding: 29px 0 14px;
    border-right: 0;
    border-bottom: 1px solid #e6e2d9;
  }

  .sidebar h1,
  .intro,
  .section-nav .nav-label {
    display: none;
  }

  .sidebar-bottom {
    display: block;
  }

  .sidebar-bottom p {
    display: none;
  }

  .nav-group {
    display: flex;
    align-items: center;
    margin-top: 12px;
  }

  .nav-group .nav-label {
    display: none;
  }

  .group-tabs {
    margin-top: 0;
  }

  .section-nav {
    display: flex;
    gap: 6px;
    margin-top: 18px;
    overflow-x: auto;
  }

  .section-tab {
    min-height: 37px;
    flex-shrink: 0;
    padding: 0 10px;
    font-size: 11px;
  }

  .nav-icon {
    display: none;
  }

  .content {
    padding: 27px 0 55px;
  }

  .access-panel {
    inset: 62px 0 0;
  }

  .access-card {
    padding: 27px;
  }

  .admin-link {
    position: fixed;
    z-index: 4;
    right: 16px;
    bottom: 14px;
    width: auto;
    min-height: 36px;
    margin: 0;
    padding: 0 11px;
    border: 1px solid var(--line);
    background: var(--white);
    box-shadow: 0 4px 16px rgba(32, 42, 37, 0.08);
  }
}

@media (max-width: 430px) {
  .access-status {
    max-width: 130px;
    text-align: right;
  }

  .content-heading h2 {
    font-size: 26px;
  }

  .item-card {
    padding: 18px;
  }

  .editor-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .admin-item-row {
    align-items: flex-start;
  }
}
