/*
 * Кабинет покупателя — в стиле админки (тема Unfold): тот же шрифт Inter, фиолетовый акцент, серые,
 * метки и поля. Claude, 15.11.2026. Цвета заданы hex-значениями той же палитры и без color-mix / :has /
 * контейнерных запросов: страницу открывают и на старых телефонах. Тёмная тема — по настройке устройства.
 */
:root {
  --bg: #f9fafb; --surface: #fff; --soft: #f3f4f6; --line: #e5e7eb; --line-soft: #f3f4f6;
  --text: #4b5563; --strong: #111827; --muted: #6b7280; --faint: #9ca3af;
  --accent: #9333ea; --accent-hover: #7e22ce; --accent-pill: #f3e8ff; --accent-soft: #faf5ff; --accent-line: #e9d5ff; --accent-text: #7e22ce;
  --ok-bg: #dcfce7; --ok-text: #15803d; --warn-bg: #ffedd5; --warn-text: #c2410c; --bad-bg: #fee2e2; --bad-text: #b91c1c;
  --info-bg: #dbeafe; --info-text: #1d4ed8; --note-bg: #eff6ff; --note-text: #1e40af;
  --radius: 6px; --shadow: 0 1px 2px 0 rgba(0, 0, 0, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827; --surface: #111827; --soft: rgba(255, 255, 255, .05); --line: #1f2937; --line-soft: rgba(55, 65, 81, .5);
    --text: #d1d5db; --strong: #f3f4f6; --muted: #9ca3af; --faint: #6b7280;
    --accent: #9333ea; --accent-hover: #a855f7; --accent-pill: rgba(168, 85, 247, .2); --accent-soft: rgba(168, 85, 247, .12); --accent-line: rgba(168, 85, 247, .35); --accent-text: #c084fc;
    --ok-bg: rgba(34, 197, 94, .2); --ok-text: #4ade80; --warn-bg: rgba(249, 115, 22, .2); --warn-text: #fb923c; --bad-bg: rgba(239, 68, 68, .2); --bad-text: #f87171;
    --info-bg: rgba(59, 130, 246, .2); --info-text: #60a5fa; --note-bg: rgba(59, 130, 246, .12); --note-text: #93c5fd;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.hypnoz-portal { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { color: var(--strong); letter-spacing: -.015em; }
h1 { font-size: 22px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
h2 { font-size: 16px; font-weight: 600; line-height: 1.35; }
h3 { font-size: 14px; font-weight: 600; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.preserve-lines { white-space: pre-line; overflow-wrap: anywhere; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.compact { gap: 10px; }

/* шапка */
.portal-header { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; min-height: 64px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--strong); font-weight: 600; line-height: 1.2; letter-spacing: .02em; }
.brand small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.brand-mark { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--radius); background: var(--accent); color: #fff; font-size: 20px; font-weight: 600; line-height: 1; padding-bottom: 2px; }
.portal-navigation { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--soft); font-weight: 500; color: var(--strong); }
.portal-navigation a { padding: 5px 10px; border-radius: var(--radius); white-space: nowrap; }
.portal-navigation a:hover { background: rgba(55, 65, 81, .06); }
.portal-navigation a[aria-current] { background: var(--surface); box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .portal-navigation a[aria-current] { background: #374151; } }
.portal-navigation span { color: var(--faint); }
.account-nav { display: flex; align-items: center; gap: 12px; margin-left: auto; min-width: 0; }
.account-email { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-caption { margin-left: auto; color: var(--muted); font-size: 13px; }
.portal-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px; }
.portal-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; max-width: 1120px; width: 100%; margin: 0 auto; padding: 16px 24px 28px; color: var(--faint); font-size: 12px; }

/* кнопки и ссылки */
.button, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--strong); box-shadow: var(--shadow); font-weight: 500; line-height: 1.25; cursor: pointer; text-align: center; }
.button:hover, .text-button:hover { background: var(--soft); }
.button.primary { background: var(--accent); border-color: transparent; color: #fff; }
.button.primary:hover { background: var(--accent-hover); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.text-button { min-height: 34px; padding: 6px 12px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--muted); font-weight: 500; }
.back-link:hover, .subtle-link:hover, .open-link, .document-link:hover { color: var(--accent-text); }
.subtle-link { display: inline-block; margin-top: 14px; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.document-link { display: flex; gap: 6px; padding: 8px 0; color: var(--strong); font-weight: 500; overflow-wrap: anywhere; }

/* карточки, заголовки, метки */
.card, .p-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.eyebrow, .section-kicker { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.section-kicker { display: none; }
.page-heading, .case-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 20px; }
.page-heading p, .case-heading p { margin-top: 6px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.count { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: var(--radius); background: var(--soft); color: var(--text); font-size: 11px; font-weight: 600; line-height: 24px; text-transform: uppercase; white-space: nowrap; flex-shrink: 0; }
.pill.status-new, .pill.status-fulfillment { background: var(--accent-pill); color: var(--accent-text); }
.pill.status-in_progress, .pill.requirement-received { background: var(--info-bg); color: var(--info-text); }
.pill.status-waiting_customer, .pill.requirement-missing, .pill.requirement-unavailable { background: var(--warn-bg); color: var(--warn-text); }
.pill.status-resolved, .pill.requirement-verified, .pill.is-ok { background: var(--ok-bg); color: var(--ok-text); }
.pill.requirement-correction { background: var(--bad-bg); color: var(--bad-text); }
.notices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.notice, .soft-note { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--note-bg); color: var(--note-text); font-size: 13px; line-height: 1.5; }
.soft-note { background: var(--soft); color: var(--muted); }
.form-error { margin: 0; padding: 8px 12px; border-radius: var(--radius); background: var(--bad-bg); color: var(--bad-text); font-size: 13px; font-weight: 500; }
span.form-error { display: block; padding: 4px 0 0; background: none; }

/* формы */
.form-field { display: flex; flex-direction: column; gap: 6px; color: var(--strong); font-size: 13px; font-weight: 600; }
input:not([type=checkbox]):not([type=file]):not([type=hidden]), select, textarea { width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 16px; font-weight: 400; line-height: 1.4; }
@media (min-width: 768px) { input:not([type=checkbox]):not([type=file]):not([type=hidden]), select, textarea { font-size: 14px; } }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
::placeholder { color: var(--faint); }
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
input[type=checkbox] { width: 16px; height: 16px; margin: 2px 8px 0 0; accent-color: var(--accent); flex-shrink: 0; }
label.check, form > label:not(.form-field):not(.upload-zone) { display: flex; align-items: flex-start; color: var(--text); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.form-section-heading { display: flex; align-items: center; gap: 10px; }
.form-section-heading span { display: none; }
.code-input { max-width: 220px; font-size: 24px !important; font-weight: 600 !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
details > summary { cursor: pointer; color: var(--muted); font-weight: 500; }
details > summary:hover { color: var(--accent-text); }
details[open] > summary { margin-bottom: 12px; }

/* вход */
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 48px; align-items: center; max-width: 920px; margin: 32px auto; }
.auth-intro h1 { font-size: 28px; margin-bottom: 12px; }
.auth-intro > p { max-width: 420px; }
.intro-line { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.intro-line span { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-pill); color: var(--accent-text); font-size: 12px; font-weight: 600; flex-shrink: 0; }
.auth-card { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.auth-card.is-single { max-width: 480px; margin: 32px auto; }
.auth-card .button { align-self: flex-start; }
.auth-card form .button.primary { align-self: stretch; }

/* список обращений */
.case-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.case-list-item { display: flex; flex-direction: column; gap: 8px; }
.case-list-item:hover { border-color: #d1d5db; }
.case-list-top, .case-list-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.case-number { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.case-list-bottom { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 13px; }
.open-link { font-weight: 500; white-space: nowrap; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 520px; margin: 32px auto; padding: 40px 24px; text-align: center; }
.empty-symbol { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border: 1px dashed #d1d5db; border-radius: 50%; color: var(--faint); font-size: 26px; }

/* карточка обращения */
.case-progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0 0 16px; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.case-progress li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-right: 1px solid var(--line-soft); color: var(--faint); font-size: 13px; font-weight: 500; line-height: 1.3; }
.case-progress li:last-child { border-right: 0; }
.case-progress li > span { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--soft); font-size: 11px; font-weight: 600; flex-shrink: 0; }
.case-progress li.is-done { color: var(--strong); }
.case-progress li.is-done > span { background: var(--accent); color: #fff; }
.case-shortcuts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 16px; font-weight: 500; color: var(--muted); }
.case-shortcuts a:hover { color: var(--accent-text); }
.case-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.new-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.main-column, .side-column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.main-column > .card, .side-column > .card, .new-layout > .card { display: flex; flex-direction: column; gap: 12px; }
.status-card { border-color: var(--accent-line); background: var(--accent-soft); box-shadow: none; }
.status-card::before { content: "Сейчас"; color: var(--accent-text); font-size: 12px; font-weight: 600; }
.next-update { color: var(--muted); font-size: 13px; }
.requirement, .offer { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.requirement-heading, .offer-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.offer-amount { color: var(--strong); font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.recipient-panel { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.instruction-text { padding: 10px 12px; border-radius: var(--radius); background: var(--soft); font-size: 13px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--strong); font-size: 13px; overflow-wrap: anywhere; }
a.file-row:hover { border-color: #d1d5db; color: var(--accent-text); }
.file-icon { color: var(--faint); font-size: 16px; }
.file-name { display: flex; flex-direction: column; min-width: 0; font-weight: 500; }
.file-name small { color: var(--muted); font-size: 12px; font-weight: 400; }
#access-received, .all-files[open] { display: flex; flex-direction: column; gap: 6px; }
.general-upload { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.help-details, .all-files { font-size: 13px; }

/* загрузка файлов */
.upload-form { display: flex; flex-direction: column; gap: 10px; }
.upload-zone { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 76px; padding: 14px 16px; border: 1px dashed #d1d5db; border-radius: var(--radius); background: var(--bg); cursor: pointer; text-align: left; }
.upload-zone:hover, .upload-zone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-zone strong { display: block; color: var(--strong); font-weight: 500; }
.upload-zone small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.upload-plus { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--accent-text); font-size: 20px; line-height: 1; flex-shrink: 0; }
.upload-form > .button { align-self: flex-start; }
.js .upload-submit { display: none; }
.upload-results { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.upload-results:empty { display: none; }
.upload-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.upload-item img { width: 44px; height: 44px; border-radius: var(--radius); object-fit: cover; }
.upload-item-info { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--strong); }
.upload-item small { display: block; color: var(--muted); }
.upload-item progress { display: block; width: 100%; height: 4px; margin-top: 6px; accent-color: var(--accent); }
.upload-item .button { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.upload-item.failed { border-color: var(--bad-text); }
.upload-refresh { color: var(--accent-text); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
[data-local-preview] img { display: block; margin-top: 6px; border: 1px solid var(--line); }

/* переписка и покупка */
.conversation { display: flex; flex-direction: column; gap: 10px; }
.message { max-width: 88%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.message.from-support { align-self: flex-start; background: var(--bg); }
.message.from-customer { align-self: flex-end; border-color: var(--accent-line); background: var(--accent-soft); }
.message-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; font-size: 13px; }
.message-meta strong { color: var(--strong); font-weight: 600; }
.message-meta time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
details.quote { margin-top: 6px; font-size: 13px; }
details.quote > summary { display: inline-block; padding: 1px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
details.quote[open] > summary { margin-bottom: 8px; }
details.quote > p { padding-left: 10px; border-left: 2px solid var(--line); color: var(--muted); }
.reply-form { padding-top: 14px; border-top: 1px solid var(--line-soft); }
.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.facts > div:first-child { border-top: 0; }
.facts dt { color: var(--muted); }
.facts dd { color: var(--strong); text-align: right; overflow-wrap: anywhere; min-width: 0; }
.sidebar-note { display: flex; gap: 8px; padding: 0 4px; color: var(--faint); font-size: 12px; }

/* телефон */
@media (max-width: 860px) {
  .case-layout, .new-layout, .auth-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .auth-layout { margin: 8px auto; }
  .auth-intro h1 { font-size: 22px; }
  .intro-line, .sidebar-note { display: none; }
}
@media (max-width: 640px) {
  .portal-header { padding: 10px 16px; }
  .portal-navigation { order: 3; width: 100%; }
  .portal-navigation a { flex: 1; text-align: center; }
  .account-email { display: none; }
  .portal-main { padding: 16px; }
  .portal-footer { padding: 12px 16px 24px; }
  h1 { font-size: 20px; }
  .card, .p-card { padding: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .case-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-progress li { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
  .case-progress li:nth-child(2n) { border-right: 0; }
  .case-progress li:nth-last-child(-n+2) { border-bottom: 0; }
  .message { max-width: 100%; }
  .page-heading .button { width: 100%; }
}
