*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  line-height: 1.5;
  color: #1a1a1a;
  background: #f6f7f9;
}

:root[data-theme="dark"] body {
  color: #f3f4f6;
  background: #111827;
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .cabinet-header {
  background: #1f2937;
  color: #f3f4f6;
}

:root[data-theme="dark"] .form__field input,
:root[data-theme="dark"] .form__field select,
:root[data-theme="dark"] .form-select {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

:root[data-theme="dark"] .cabinet-nav__link {
  color: #d1d5db;
}

:root[data-theme="dark"] .cabinet-nav__link.active {
  background: #1e3a5f;
  color: #93c5fd;
}

:root[data-theme="dark"] a {
  color: #93c5fd;
}

:root[data-theme="dark"] .btn--primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #f9fafb;
}

:root[data-theme="dark"] .btn--ghost {
  color: #e5e7eb;
  border-color: #4b5563;
}

:root[data-theme="dark"] .btn--ghost:hover {
  background: #374151;
}

:root[data-theme="dark"] .alert--ok {
  background: #064e3b;
  color: #a7f3d0;
}

:root[data-theme="dark"] .alert--warn {
  background: #78350f;
  color: #fde68a;
}

:root[data-theme="dark"] .session-list__item {
  border-bottom-color: #374151;
}

:root[data-theme="dark"] .modal-backdrop {
  background: rgb(0 0 0 / 65%);
}

a {
  color: #1d4ed8;
}

.shell {
  min-height: 100vh;
}

.shell--auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

.shell__brand {
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 1.25rem;
}

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

.card {
  width: 100%;
  max-width: 28rem;
  padding: 1.5rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}

.card--wide {
  max-width: 40rem;
}

.shell--cabinet .card {
  margin: 0 auto 2rem;
}

.cabinet-main {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
}

.settings-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-page > h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.settings-page > .alert,
.settings-page > .form__hint {
  margin: 0;
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}

.settings-card__kicker {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
}

.settings-card__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-card__body > .form {
  margin-top: 0;
}

.settings-card__body > h2:not(.settings-card__kicker) {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.settings-card__link {
  margin: 0;
  font-size: 0.95rem;
  color: #374151;
}

:root[data-theme="dark"] .settings-card {
  background: #1f2937;
  box-shadow: 0 1px 3px rgb(0 0 0 / 35%);
}

:root[data-theme="dark"] .settings-card__kicker {
  color: #9ca3af;
}

:root[data-theme="dark"] .settings-card__link {
  color: #d1d5db;
}

.cabinet-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.cabinet-header__brand {
  font-weight: 700;
  margin-right: auto;
}

.cabinet-nav {
  display: flex;
  gap: 0.75rem;
}

.cabinet-nav__link {
  text-decoration: none;
  color: #444;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.cabinet-nav__link.active {
  color: #1d4ed8;
  background: #eff6ff;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.form__field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.form__field-label {
  font-weight: 500;
  color: #374151;
}

.form__field-control {
  width: 100%;
}

.form__field input,
.form__field select,
.form__field textarea,
.form-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: inherit;
}

.form__field select,
.form-select {
  appearance: none;
  padding-right: 2.25rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 viewBox=%270 0 12 12%27%3E%3Cpath fill=%27none%27 stroke=%27%236b7280%27 stroke-width=%271.5%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 d=%27M2.5 4.5 6 8l3.5-3.5%27/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

.form--settings {
  gap: 1rem;
}

.theme-segment {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #eceff3;
}

.theme-segment__item {
  margin: 0;
  cursor: pointer;
}

.theme-segment__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.theme-segment__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  color: #6b7280;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.theme-segment__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.theme-segment__input:checked + .theme-segment__btn {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 3px rgb(0 0 0 / 12%);
}

.theme-segment__input:focus-visible + .theme-segment__btn {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}

:root[data-theme="dark"] .theme-segment {
  background: #374151;
  border-color: #4b5563;
}

:root[data-theme="dark"] .theme-segment__btn {
  color: #9ca3af;
}

:root[data-theme="dark"] .theme-segment__input:checked + .theme-segment__btn {
  background: #1f2937;
  color: #f9fafb;
}

.pill-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-choice__item {
  margin: 0;
  cursor: pointer;
}

.pill-choice__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pill-choice__pill {
  display: inline-block;
  min-height: 2.25rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  line-height: 1.35;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.pill-choice__input:checked + .pill-choice__pill {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

.pill-choice__input:focus-visible + .pill-choice__pill {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.pill-choice__input:disabled + .pill-choice__pill {
  opacity: 0.55;
  cursor: not-allowed;
}

:root[data-theme="dark"] .form__field-label {
  color: #e5e7eb;
}

:root[data-theme="dark"] .pill-choice__pill {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

:root[data-theme="dark"] .pill-choice__input:checked + .pill-choice__pill {
  background: #2563eb;
  border-color: #2563eb;
  color: #f9fafb;
}

@media (prefers-reduced-motion: reduce) {
  .pill-choice__pill {
    transition: none;
  }
}

.pill-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.notif-product-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.notif-product-group__hint {
  margin: 0;
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.45;
}

:root[data-theme="dark"] .notif-product-group {
  background: #1f2937;
  border-color: #4b5563;
}

:root[data-theme="dark"] .notif-product-group__hint {
  color: #9ca3af;
}

.pill-toggle__label {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  line-height: 1.45;
}

.pill-toggle__control {
  position: relative;
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.5rem;
}

.pill-toggle__input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.pill-toggle__input:disabled {
  cursor: not-allowed;
}

.pill-toggle:has(.pill-toggle__input:disabled) .pill-toggle__label {
  cursor: not-allowed;
  opacity: 0.65;
}

.pill-toggle__track {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #d1d5db;
  transition: background 0.15s ease;
}

.pill-toggle__thumb {
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 18%);
  transition: transform 0.15s ease;
}

.pill-toggle__input:checked + .pill-toggle__track {
  background: #16a34a;
}

.pill-toggle__input:checked + .pill-toggle__track .pill-toggle__thumb {
  transform: translateX(1.25rem);
}

.pill-toggle__input:focus-visible + .pill-toggle__track {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}

.pill-toggle__input:disabled + .pill-toggle__track {
  opacity: 0.55;
}

:root[data-theme="dark"] .pill-toggle__track {
  background: #4b5563;
}

:root[data-theme="dark"] .pill-toggle__input:checked + .pill-toggle__track {
  background: #22c55e;
}

:root[data-theme="dark"] .pill-toggle__thumb {
  background: #f9fafb;
}

@media (prefers-reduced-motion: reduce) {
  .pill-toggle__track,
  .pill-toggle__thumb {
    transition: none;
  }
}

.form__hint {
  color: #6b7280;
  font-size: 0.85rem;
}

.form__error {
  margin: 0.5rem 0 0;
  color: #b42318;
  font-size: 0.85rem;
}

.btn--sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
}

.avatar-upload__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.avatar-upload__zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.avatar-upload__zone--drag {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.avatar-upload__zone--has-preview {
  padding-top: 1rem;
}

.avatar-upload__placeholder {
  display: flex;
  color: #9ca3af;
}

.avatar-upload__hint {
  margin: 0;
  font-size: 0.9rem;
  color: #6b7280;
  text-align: center;
}

.avatar-upload__preview-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.avatar-upload__preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 4px rgb(0 0 0 / 12%);
}

.avatar-upload__processing {
  font-size: 0.8rem;
  color: #6b7280;
}

.avatar-upload__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.avatar-upload__control {
  display: flex;
  flex: 1 1 12rem;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.avatar-upload__control-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
}

.avatar-upload__control input[type="range"] {
  width: 100%;
}

.avatar-upload__rotate,
.avatar-upload__remove {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.avatar-upload__ready {
  margin-top: 0.5rem;
}

.profile-avatar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

:root[data-theme="dark"] .avatar-upload__zone {
  background: #111827;
  border-color: #4b5563;
}

:root[data-theme="dark"] .avatar-upload__zone--drag {
  border-color: #3b82f6;
  background: #1e3a5f;
}

:root[data-theme="dark"] .avatar-upload__hint,
:root[data-theme="dark"] .avatar-upload__processing,
:root[data-theme="dark"] .avatar-upload__control-label {
  color: #9ca3af;
}

.form__footer {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.form__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.form--inline-actions {
  margin-top: 1rem;
}

.btn {
  font: inherit;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn--primary {
  background: #1d4ed8;
  color: #fff;
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  border-color: #d1d5db;
  color: #374151;
}

.alert {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.alert--error {
  color: #b42318;
  background: #fef3f2;
}

.alert--warn {
  color: #93370d;
  background: #fffaeb;
}

.profile-verify-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.profile-verify-banner > p {
  margin: 0;
  flex: 1 1 12rem;
}

.alert--ok {
  color: #027a48;
  background: #ecfdf3;
}

.alert__meta {
  font-size: 0.85rem;
  color: #667085;
}

.loading {
  color: #6b7280;
}

.section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-list__item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.session-list__meta {
  font-size: 0.85rem;
  color: #6b7280;
}

:root[data-theme="dark"] .session-list__meta,
:root[data-theme="dark"] .form__hint {
  color: #9ca3af;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgb(0 0 0 / 45%);
}

.modal {
  width: 100%;
  max-width: 24rem;
  margin: 0;
}

.modal h2 {
  margin: 0;
  font-size: 1.15rem;
}

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

.modal__close {
  flex-shrink: 0;
  padding: 0.35rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
}

.modal--avatar-editor {
  max-width: 26.5rem;
  padding: 1.25rem;
}

.profile-form .profile-avatar {
  margin-bottom: 1.25rem;
}

.profile-avatar {
  position: relative;
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
}

.profile-avatar:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.profile-avatar__img,
.profile-avatar__placeholder {
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-avatar__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 600;
  color: #4b5563;
  background: #e5e7eb;
}

.profile-avatar__edit {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgb(0 0 0 / 12%);
  color: #1f2937;
}

.avatar-editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.avatar-editor__preview-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar-editor__preview-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar-editor__trash {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
  flex-shrink: 0;
}

.avatar-editor__trash:hover:not(:disabled) {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.avatar-editor__trash:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.avatar-editor__preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f4f6;
}

.avatar-editor__preview--empty {
  border: 2px dashed #d1d5db;
}

.avatar-editor__processing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgb(255 255 255 / 75%);
  font-size: 0.85rem;
}

.avatar-editor__swatches {
  display: grid;
  grid-template-columns: repeat(5, 2.125rem);
  justify-content: center;
  gap: 0.625rem 0.75rem;
  width: 100%;
}

.avatar-editor__swatch {
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.avatar-editor__swatch--active {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 1px #fff;
}

.avatar-editor__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  width: 100%;
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #f9fafb;
}

.avatar-editor__cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  background: #fff;
}

.avatar-editor__cell--upload {
  background: #374151;
  color: #f9fafb;
}

.avatar-editor__cell--active {
  border-color: #1d4ed8;
}

.avatar-editor__emoji {
  font-size: 1.5rem;
  line-height: 1;
}

.avatar-editor__photo-tools {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.avatar-editor__save {
  width: 100%;
}

:root[data-theme="dark"] .profile-avatar__placeholder {
  background: #374151;
  color: #e5e7eb;
}

:root[data-theme="dark"] .profile-avatar__edit {
  background: #1f2937;
  border-color: #4b5563;
  color: #f3f4f6;
}

:root[data-theme="dark"] .avatar-editor__grid {
  background: #111827;
  border-color: #4b5563;
}

:root[data-theme="dark"] .avatar-editor__cell--upload {
  background: #4b5563;
}

:root[data-theme="dark"] .avatar-editor__trash {
  background: #1f2937;
  border-color: #4b5563;
  color: #9ca3af;
}

:root[data-theme="dark"] .avatar-editor__trash:hover:not(:disabled) {
  color: #fca5a5;
  border-color: #7f1d1d;
  background: #450a0a;
}

