.language-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: #eff0f6;
  border: 1px solid var(--line);
  border-radius: 24px;
  flex-shrink: 0;
}
.language-toggle button {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.language-toggle button[aria-pressed="true"] {
  background: white;
  color: var(--accent);
  box-shadow: 0 2px 6px #2023340b;
}
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.profile-avatar {
  width: 34px;
  height: 34px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-avatar.large {
  width: 82px;
  height: 82px;
  font-size: 32px;
}
.profile-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  max-width: 180px;
}
.profile-link > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.sidebar-profile small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.subject-card {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition:
    transform 0.2s,
    border-color 0.2s;
  min-width: 0;
}
.subject-card:hover {
  border-color: #c9c5ee;
}
.subject-card h3 {
  margin: 22px 0 10px;
  font-size: 1.3rem;
}
.subject-card p {
  min-height: 52px;
  font-size: 14px;
}
.subject-card .card-meta {
  margin-top: 24px;
}
.subject-card .pill {
  font-size: 11px;
}
.enroll-button {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #fff;
  padding: 5px 9px;
  border-radius: 8px;
}
.enroll-button.enrolled {
  color: var(--accent);
  border-color: #d8d4ff;
  background: var(--accent-soft);
}
.enroll-button .icon {
  width: 14px;
  height: 14px;
}
.personal-subjects {
  margin-bottom: 44px;
}
.catalog-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 36px;
  flex-wrap: wrap;
}
.catalog-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}
.catalog-search input {
  border: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
  outline: 0;
  font-size: 14px;
}
.catalog-search:focus-within {
  outline: 3px solid #a29aff;
  outline-offset: 2px;
}
.area-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.area-filters button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 13px;
  background: white;
  color: var(--muted);
}
.area-filters button.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #d6d2fc;
}
.area-section {
  margin: 0 0 36px;
}
.area-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.area-heading p {
  font-size: 13px;
  margin-top: 4px;
}
.area-heading .topic-symbol {
  width: 42px;
  height: 42px;
}
.empty-state {
  padding: 35px;
  border: 1px dashed #ccc7ed;
  border-radius: var(--radius);
  background: #f0effd;
}
.empty-state p {
  margin-top: 10px;
}
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 24px;
  align-items: start;
}
.profile-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}
.profile-identity h2 {
  overflow-wrap: anywhere;
}
.profile-identity p {
  font-size: 13px;
  margin-top: 8px;
}
.profile-editor form {
  display: grid;
  gap: 12px;
}
.profile-editor .field-label {
  margin-top: 10px;
}
.profile-input {
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 11px 13px;
  width: 100%;
  min-width: 0;
}
.profile-editor input[type="file"] {
  font-size: 13px;
  max-width: 100%;
}
.profile-editor form .button {
  margin-top: 12px;
  justify-self: start;
}
.profile-grid > .aside-card {
  min-width: 0;
}
.profile-editor .profile-input {
  background: var(--bg);
  color: var(--ink);
}
.profile-editor .field-label {
  color: var(--ink);
}
.profile-photo-field {
  margin: 8px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.profile-photo-field .field-label {
  margin-top: 0;
}
.profile-photo-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.profile-photo-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.16s,
    background 0.16s;
}
.profile-photo-picker:hover {
  border-color: var(--accent);
}
.profile-photo-picker:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.profile-photo-picker .icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}
.profile-photo-picker.processing {
  opacity: 0.6;
  cursor: wait;
}
.profile-photo-actions > [hidden] {
  display: none;
}
.profile-photo-status {
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}
.profile-photo-status[data-state="saved"] {
  color: var(--accent);
}
.profile-photo-status[data-state="error"] {
  color: #b52d42;
}
[data-theme="dark"] .profile-photo-status[data-state="error"] {
  color: #ff9aad;
}
.profile-photo-status[data-state="processing"]::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: profile-photo-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes profile-photo-spin {
  to {
    transform: rotate(360deg);
  }
}
.profile-form-status:empty,
.enrollment-settings #enrollment-status:empty {
  display: none;
}
.profile-file-card {
  position: relative;
  overflow: hidden;
}
.profile-file-emblem {
  display: inline-grid;
  place-items: center;
  width: 50px;
  height: 50px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 24px;
}
.profile-file-emblem .icon {
  width: 22px;
  height: 22px;
}
.profile-file-card .eyebrow {
  margin-bottom: 12px;
}
.profile-file-card h2 {
  max-width: 340px;
  font-size: 1.55rem;
  line-height: 1.3;
  letter-spacing: -0.04em;
}
.profile-file-intro {
  margin-top: 14px;
  font-size: 14px;
}
.profile-file-contents {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 16px;
  padding: 22px 0;
  margin: 6px 0;
}
.profile-file-contents span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
}
.profile-file-contents .icon {
  color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.profile-file-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 15px;
  margin-top: 20px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
}
.profile-file-note > .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 3px;
}
.profile-file-note p {
  font-size: 12px;
  line-height: 1.7;
}
.profile-file-format {
  margin-top: 14px;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.file-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 43px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 10px;
  transition:
    background 0.16s,
    border-color 0.16s;
}
.file-action .icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex-shrink: 0;
}
.file-action:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.file-action:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.file-actions--compact {
  grid-template-columns: 1fr;
  gap: 0;
  margin: 10px 0 4px;
}
.file-actions--compact .file-action {
  justify-content: flex-start;
  min-height: 32px;
  padding: 7px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.file-actions--compact .file-action:hover:not(:disabled) {
  color: var(--accent);
  background: transparent;
}
.enrollment-settings {
  margin-top: 24px;
}
.enrollment-settings > p {
  margin: 10px 0 20px;
}
.enrollment-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.enrollment-list label {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 12px;
}
.enrollment-list small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.enrollment-list strong {
  font-size: 14px;
}
.enrollment-list input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.storage-note {
  background: #fff2d3;
  padding: 10px 18px;
  color: #6d5012;
  font-size: 13px;
}
.progress-track span,
.sidebar-progress span {
  transition: width 0.45s ease;
}
.catalog-no-results {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.subject-card[hidden],
.area-section[hidden],
.catalog-no-results[hidden] {
  display: none;
}
.catalog-heading {
  margin-bottom: 38px;
}
.global-sidebar .primary-nav {
  margin-bottom: 22px;
}
@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .profile-link > span:last-child {
    display: none;
  }
  .subject-grid {
    gap: 16px;
  }
  .subject-card {
    padding: 20px;
  }
}
@media (max-width: 600px) {
  .subject-grid,
  .enrollment-list {
    grid-template-columns: 1fr;
  }
  .subject-card p {
    min-height: 0;
  }
  .topbar-tools {
    gap: 8px;
  }
  .language-toggle button {
    padding: 3px 6px;
  }
  .language-toggle button span {
    display: none;
  }
  .breadcrumb {
    font-size: 12px;
    min-width: 0;
  }
  .breadcrumb span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .profile-identity {
    gap: 12px;
  }
  .profile-avatar.large {
    width: 64px;
    height: 64px;
  }
  .profile-file-contents {
    gap: 12px 8px;
  }
  .profile-file-contents span {
    font-size: 11px;
  }
  .file-actions:not(.file-actions--compact) {
    grid-template-columns: 1fr;
  }
  .catalog-controls {
    gap: 12px;
  }
  .catalog-search {
    max-width: none;
    width: 100%;
  }
  .area-heading p {
    font-size: 12px;
  }
  .catalog-heading h1 {
    overflow-wrap: anywhere;
  }
}
@media (prefers-reduced-motion: reduce) {
  .progress-track span,
  .sidebar-progress span,
  .subject-card,
  .file-action,
  .profile-photo-picker {
    transition: none;
  }
  .profile-photo-status[data-state="processing"]::before {
    animation: none;
  }
}
