@font-face {
  font-family: "PortStart SF";
  src: url("/fonts/SF-Pro-Display-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f5f7fb;
  --surface: #fff;
  --soft: #edf2ff;
  --ink: #18243c;
  --secondary: #606e85;
  --line: #dfe5ef;
  --input-line: #7c8ca6;
  --accent: #0942f5;
  --accent-hover: #0031c6;
  --navy: #082775;
  --lime: #b1ff0a;
  --error: #a62929;
  --error-bg: #fff0f0;
  --good: #28613e;
  --good-bg: #e8f5ea;
  --nav-width: 232px;
}

:root[data-theme=dark] {
  color-scheme: dark;
  --paper: #101827;
  --surface: #192338;
  --soft: #223351;
  --ink: #edf2ff;
  --secondary: #b3bfd4;
  --line: #354560;
  --input-line: #7b8aa6;
  --accent: #91b2ff;
  --accent-hover: #b6cbff;
  --error: #ffaaaa;
  --error-bg: #41252c;
  --good: #a1dfb1;
  --good-bg: #203d31;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 Arial, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p {
  margin: 0;
}

h1, h2, h3 {
  letter-spacing: -.035em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 25px;
}

h3 {
  font-size: 21px;
}

p + p {
  margin-top: 12px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
}

button:hover, .button:hover {
  border-color: var(--input-line);
  text-decoration: none;
}

button:disabled {
  opacity: .6;
  cursor: wait;
}

.primary {
  background: #0942f5;
  color: #fff;
  border-color: #0942f5;
}

.primary:hover {
  background: #0031c6;
  border-color: #0031c6;
}

.danger {
  color: var(--error);
  background: var(--error-bg);
}

.lime {
  background: var(--lime);
  color: var(--navy);
  border-color: var(--lime);
}

.wide {
  width: 100%;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.small, small {
  font-size: 14px;
}

.muted, small {
  color: var(--secondary);
}

.prose, .description, .field small {
  font-family: "PortStart SF", Arial, sans-serif;
}

.prose {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.between {
  justify-content: space-between;
}

.stack {
  display: grid;
  gap: 20px;
  align-content: start;
}

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

.section-title {
  margin-bottom: 20px;
}

.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  padding: 12px;
  background: var(--surface);
  z-index: 100;
  transform: translateY(-160%);
}

.skip:focus {
  transform: none;
}

.brand {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -1px;
  color: #fff;
  white-space: nowrap;
}

.brand span {
  color: var(--lime);
}

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
}

.boot .brand {
  color: var(--accent);
}

/* Вход и регистрация */

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.auth-story {
  background: var(--navy);
  color: white;
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 64px;
}

.auth-story h1 {
  font-size: clamp(32px, 3.5vw, 52px);
  font-weight: 800;
  line-height: 1.08;
  margin: 18px 0 24px;
}

.auth-story h1 span {
  color: var(--lime);
}

.auth-story p {
  max-width: 440px;
  color: #dbe5ff;
}

.auth-story .eyebrow {
  font-size: 14px;
  letter-spacing: 2px;
}

.auth-side {
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.auth-theme {
  align-self: flex-end;
  margin-bottom: 40px;
}

.auth-theme label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  margin: auto;
}

.auth-card > p {
  margin-top: 12px;
}

.segments {
  display: flex;
  background: var(--soft);
  padding: 4px;
  border-radius: 9px;
  margin: 24px 0;
  gap: 4px;
}

.segments button {
  flex: 1;
  background: transparent;
  border-color: transparent;
}

.segments button[aria-pressed=true] {
  background: var(--surface);
  border-color: var(--line);
  color: var(--accent);
}

.mail-note {
  margin-top: 22px !important;
}

/* Формы и сообщения */

.field {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 18px;
}

.field small {
  font-weight: 400;
}

.field input,
.field textarea,
.field select,
select.theme-select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
}

.field textarea {
  resize: vertical;
  min-height: 110px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--secondary);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.error {
  background: var(--error-bg);
  color: var(--error);
  padding: 14px 16px;
  border-radius: 8px;
  border-left: 3px solid var(--error);
  margin: 16px 0;
  overflow-wrap: anywhere;
}

.note {
  background: var(--soft);
  border-radius: 8px;
  padding: 16px;
  color: var(--secondary);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--accent);
  font-size: 14px;
}

.badge.good {
  color: var(--good);
  background: var(--good-bg);
}

/* Левая навигация */

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--nav-width);
  padding: 30px 18px 20px;
  background: var(--navy);
  color: white;
  overflow: auto;
  z-index: 20;
}

.app-sidebar .brand {
  display: block;
  padding: 0 8px;
}

.app-sidebar :focus-visible {
  outline-color: var(--lime);
}

#navigation {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 100px);
}

.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 36px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #d0dbf5;
  font-size: 16px;
}

.side-nav a span {
  font-size: 14px;
}

.side-nav a:hover {
  background: #ffffff12;
  text-decoration: none;
}

.side-nav a[aria-current=page] {
  background: var(--lime);
  color: var(--navy);
  font-weight: 700;
}

.side-bottom {
  margin-top: auto;
  padding-top: 30px;
  display: grid;
  gap: 12px;
}

.side-bottom .field {
  margin-bottom: 0;
  color: #d0dbf5;
}

.side-bottom .theme-select {
  background: #0c338b;
  color: #fff;
  border-color: #6e8bbf;
  font-size: 14px;
}

.account-chip {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: #ffffff0b;
  border-radius: 8px;
  color: white;
  overflow-wrap: anywhere;
}

.account-chip small {
  color: #ced9f2;
}

.side-bottom button {
  background: transparent;
  color: #fff;
  border-color: #ffffff40;
}

.menu-toggle {
  display: none;
}

/* Основная область */

.app-body {
  margin-left: var(--nav-width);
  min-height: 100vh;
}

.topbar {
  min-height: 88px;
  padding: 20px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  font-size: 24px;
}

.topbar p {
  font-size: 14px;
  color: var(--secondary);
  margin-top: 4px;
}

main {
  max-width: 1350px;
  margin: auto;
  padding: 28px 32px 48px;
  outline: none;
}

main:focus {
  outline: none;
}

.hero {
  position: relative;
  background: #0942f5;
  color: white;
  padding: 32px;
  border-radius: 12px;
  margin-bottom: 26px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
}

.hero h2 {
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 800;
  line-height: 1.1;
}

.hero h2 span {
  color: var(--lime);
}

.hero p {
  margin-top: 18px;
  color: #e2e9ff;
  font-size: 15px;
}

.hero-arrow {
  font-size: 120px;
  line-height: 1;
  color: var(--lime);
  align-self: center;
  flex-shrink: 0;
}

/* Поиск и карточки */

.filters {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 170px 180px auto;
  gap: 12px;
  margin-bottom: 20px;
  align-items: end;
}

.filters .field {
  margin: 0;
}

.filters button {
  min-height: 48px;
}

.orders-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card h3 a {
  color: var(--ink);
}

.card h3 a:hover {
  color: var(--accent);
}

.description {
  color: var(--secondary);
  font-size: 15px;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.price {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.035em;
}

.card .meta {
  font-size: 14px;
  color: var(--secondary);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 44px 24px;
  border: 1px dashed var(--input-line);
  border-radius: 12px;
  background: var(--surface);
}

.empty h3 {
  margin-bottom: 12px;
}

.empty p {
  color: var(--secondary);
  max-width: 520px;
  margin: auto;
}

.pagination {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.back {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-bottom: 16px;
}

/* Страница заказа */

.details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 24px;
}

.details h2 {
  font-size: 30px;
}

.details .panel {
  align-self: start;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  background: var(--soft);
  padding: 18px;
  border-radius: 8px;
  margin: 0;
}

.meta-grid dt {
  font-size: 14px;
  color: var(--secondary);
  margin-bottom: 6px;
}

.meta-grid dd {
  margin: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.responses {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.response {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.response .prose {
  margin: 14px 0;
}

/* Сделка и переписка */

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr);
  gap: 24px;
}

.chat-log {
  height: 360px;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.chat-message {
  max-width: 90%;
  align-self: flex-start;
}

.chat-message.own {
  align-self: flex-end;
}

.message-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.own .message-body {
  background: var(--soft);
}

.chat-message small {
  display: block;
  margin: 4px 0;
}

.chat-form {
  margin-top: 16px;
}

.chat-form textarea {
  min-height: 80px;
}

.chat-status {
  font-size: 14px;
  color: var(--secondary);
  margin: 12px 0;
}

.history {
  display: grid;
  gap: 12px;
}

.history article {
  padding: 14px;
  background: var(--soft);
  border-radius: 8px;
}

.history .prose {
  margin: 8px 0;
}

/* Профиль и тестовый баланс */

.settings {
  max-width: 760px;
}

.settings h2 {
  margin-bottom: 16px;
}

.money-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.money-row:last-child {
  border: 0;
}

.money-row strong {
  white-space: nowrap;
}

.rating {
  font-weight: 700;
  color: var(--accent);
}

/* Модальные окна и уведомления */

dialog {
  width: min(620px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 80px #06173555;
}

dialog::backdrop {
  background: #071b4780;
  backdrop-filter: blur(3px);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  font-size: 23px;
}

#modalBody {
  padding: 24px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.actions button {
  flex: 1;
}

#notice {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: min(520px, calc(100% - 40px));
  padding: 14px 16px;
  background: var(--navy);
  color: #fff;
  border: 1px solid #6987c0;
  border-radius: 10px;
  box-shadow: 0 8px 28px #08277525;
}

#noticeText {
  overflow-wrap: anywhere;
}

#notice button {
  color: #fff;
  background: transparent;
  border-color: #ffffff40;
  flex-shrink: 0;
}

/* Адаптивность */

@media (min-width: 1400px) {
  .auth-story {
    padding: 56px;
  }

  .auth-side {
    padding: 44px;
  }
}

@media (max-width: 1200px) {
  .orders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .chat-layout {
    grid-template-columns: 1fr;
  }

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

  .hero-arrow {
    font-size: 90px;
  }
}

@media (max-width: 820px) {
  :root {
    --nav-width: 0px;
  }

  .app-sidebar {
    position: static;
    width: auto;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
  }

  .app-sidebar .brand {
    padding: 0;
  }

  .menu-toggle {
    display: inline-flex;
    background: transparent;
    color: #fff;
    border-color: #ffffff50;
  }

  #navigation {
    display: none;
    min-height: 0;
    flex-basis: 100%;
    width: 100%;
  }

  .app-sidebar.menu-open #navigation {
    display: flex;
  }

  .side-nav {
    margin-top: 20px;
  }

  .side-bottom {
    padding-top: 20px;
  }

  .topbar {
    padding: 20px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  main {
    padding: 24px 20px 40px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-story {
    padding: 24px;
    gap: 24px;
  }

  .auth-story h1 {
    font-size: 32px;
    margin: 12px 0;
  }

  .auth-story > p.small,
  .auth-story .eyebrow {
    display: none;
  }

  .auth-story > div > p:last-child {
    font-size: 14px;
  }

  .auth-side {
    padding: 24px;
  }

  .auth-theme {
    margin-bottom: 24px;
  }

  .auth-card {
    max-width: 520px;
  }

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

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

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar p {
    font-size: 14px;
  }

  .topbar .primary {
    width: 100%;
  }

  main {
    padding: 20px 16px 36px;
  }

  .hero {
    padding: 24px;
  }

  .hero h2 {
    font-size: 28px;
  }

  .hero-arrow {
    display: none;
  }

  .hero p {
    font-size: 14px;
  }

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

  .card, .panel {
    padding: 20px;
  }

  .details h2 {
    font-size: 26px;
  }

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

  .auth-story h1 {
    font-size: 29px;
  }

  .auth-side {
    padding: 24px 20px;
  }

  .auth-theme {
    align-self: stretch;
  }

  .auth-theme select {
    flex: 1;
  }

  .chat-log {
    height: 330px;
    padding: 12px;
  }

  .chat-message {
    max-width: 95%;
  }

  .modal-head {
    padding: 18px 20px;
  }

  #modalBody {
    padding: 20px;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .money-row {
    align-items: flex-start;
  }

  .brand {
    font-size: 24px;
  }
}

/* Анимации и доступность */

@media (prefers-reduced-motion: no-preference) {
  .card, .primary, .side-nav a {
    transition:
      background-color .18s,
      border-color .18s,
      transform .18s;
  }

  .card:hover {
    border-color: var(--input-line);
    transform: translateY(-2px);
  }

  dialog[open] {
    animation: appear .18s ease-out;
  }

  .hero-arrow {
    animation: float 5s ease-in-out infinite;
  }

  @keyframes appear {
    from {
      opacity: 0;
      transform: translateY(8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes float {
    50% {
      transform: translateY(-5px);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  button, .button, .card, .panel, .badge {
    border: 1px solid ButtonText;
  }

  :focus-visible {
    outline-color: Highlight;
  }
}