:root {
  color-scheme: dark;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #f4edf4;
  background: #141117;
  --surface: #1d1820;
  --surface-2: #28212d;
  --line: #3b3040;
  --dim: #bcafc1;
  --pink: #ff8fb7;
  --pink-soft: #452838;
  --mint: #a3dfc6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
button, input, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 4px; }
h1, h2, p { margin: 0; }
h1 { font-family: Georgia, serif; font-size: 1.95rem; font-weight: 600; letter-spacing: -.05em; line-height: 1; }
h2 { font-size: 1.05rem; line-height: 1.3; }
p { color: var(--dim); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.logo { display: grid; place-content: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 14px; color: var(--pink); background: var(--pink-soft); font-size: 1.35rem; }
.primary, .small-button, .plain, .filter { min-height: 38px; border: 1px solid transparent; border-radius: 9px; padding: 8px 13px; white-space: nowrap; }
.primary { border-color: #ffabd0; background: var(--pink); color: #24121e; font-weight: 700; }
.primary:hover { background: #ffb1ce; }
.small-button { display: inline-grid; place-items: center; background: var(--surface-2); border-color: var(--line); color: #f5eaf4; }
.small-button:hover, .plain:hover, .filter:hover { background: #34283a; }
.plain, .filter { color: var(--dim); background: transparent; }
.danger { color: #ffafbc; font-size: .78rem; }
input { min-height: 43px; min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: #19151b; color: #fcf6fc; }
input::placeholder { color: #ad9daf; }
.public-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 5%, #302035 0, #141117 58%); }
.chat-shell { display: flex; flex-direction: column; width: min(100%, 560px); min-height: 540px; height: min(730px, calc(100dvh - 48px)); border: 1px solid #49384c; border-radius: 22px; background: var(--surface); box-shadow: 0 28px 80px #0b080d88; overflow: hidden; }
.chat-head, .app-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.chat-head p, .app-head p { margin-top: 5px; font-size: .78rem; }
.chat-head .small-button { margin-left: auto; font-size: .78rem; }
.gate { margin: auto 22px; padding: 25px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); }
.gate h2 { font-family: Georgia, serif; font-size: 1.55rem; }
.gate p { line-height: 1.55; margin: 9px 0 19px; }
.gate:not([hidden]) ~ .messages, .gate:not([hidden]) ~ .chat-footer { display: none; }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 19px 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 11px; scrollbar-width: thin; }
.bubble { max-width: min(88%, 550px); padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); color: #f5edf5; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .93rem; line-height: 1.42; }
.bubble.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: var(--pink-soft); }
.bubble.operator { border: 1px solid #4b7065; }
.bubble.offer { border: 1px solid #70415a; }
.bubble small { display: block; color: var(--dim); margin: 0 0 3px; font-size: .7rem; }
.bubble img { display: block; width: auto; max-width: 100%; max-height: 340px; border-radius: 8px; object-fit: contain; }
.status { min-height: 1em; padding: 0 20px 7px; color: var(--dim); font-size: .78rem; }
.composer { display: flex; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--line); }
.chat-footer { min-height: 14px; padding: 0 11px 4px; }
.chat-footer .plain { min-height: 26px; font-size: .72rem; padding: 3px 7px; }
.operator-page { padding: 32px; background: radial-gradient(ellipse at 30% -20%, #332039, #141117 58%); }
.app-shell { max-width: 1180px; margin: 0 auto; min-height: min(730px, calc(100dvh - 64px)); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; }
.head-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; font-size: .84rem; }
.login { max-width: 410px; margin: 85px auto 30px; padding: 25px; }
.login h2 { font-family: Georgia, serif; font-size: 1.7rem; margin-bottom: 20px; }
.login label { display: block; margin-bottom: 8px; font-size: .9rem; }
.login .status { padding: 10px 0; }
.navigation { display: flex; gap: 6px; padding: 8px 15px; border-bottom: 1px solid var(--line); }
.workspace { min-height: 540px; height: min(740px, calc(100dvh - 192px)); display: grid; grid-template-columns: 310px minmax(0, 1fr); }
.inbox { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); padding: 16px 15px; }
.inbox-head, .detail-head { display: flex; align-items: center; gap: 7px; }
.inbox-head { justify-content: space-between; margin-bottom: 10px; }
.inbox-head p, .detail-head p { font-size: .74rem; margin-top: 4px; }
.filters { display: flex; gap: 3px; margin-bottom: 10px; }
.filter { padding: 6px 9px; min-height: 31px; font-size: .75rem; }
.filter[aria-pressed="true"] { background: var(--pink-soft); color: #ffc4db; }
.inbox input { min-height: 37px; margin-bottom: 8px; }
.threads { overflow: auto; scrollbar-width: thin; }
.thread { width: 100%; display: block; padding: 11px 9px; border: 1px solid transparent; border-bottom-color: var(--line); background: transparent; color: inherit; text-align: left; }
.thread:hover, .thread[aria-current="true"] { background: var(--surface-2); border-color: var(--line); border-radius: 9px; }
.thread strong, .thread span { display: block; }
.thread strong { font-size: .85rem; }
.thread span { color: var(--dim); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 5px; }
.thread .manual { color: var(--mint); }
.thread .unread { color: var(--pink); }
.thread span.empty-list, .empty-list { padding: 16px 8px; font-size: .83rem; }
.more { align-self: center; margin-top: 7px; font-size: .77rem; }
.empty-pane { display: grid; place-content: center; text-align: center; gap: 8px; padding: 20px; }
.detail { display: flex; flex-direction: column; min-height: 0; }
.detail-head { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.detail-label { flex: 1; }
.detail-head .small-button { font-size: .78rem; }
.detail .back { display: none; }
.profile-panel { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 545px; }
.profile-nav { padding: 17px; border-right: 1px solid var(--line); }
.profile-nav > button { width: 100%; margin-bottom: 10px; }
.profile-detail { padding: 20px; }
.profile-detail h2 { margin-bottom: 14px; }
.profile-form, .photo-library { max-width: 720px; }
.profile-form label { display: block; margin-bottom: 12px; font-size: .84rem; color: var(--dim); }
.profile-form label input, .profile-form label textarea { display: block; margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid input { width: 100%; }
fieldset.form-grid { margin: 0 0 12px; min-width: 0; padding: 9px 12px 0; border: 1px solid var(--line); border-radius: 9px; }
legend { padding: 0 5px; font-size: .83rem; }
textarea, select { width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #19151b; color: #fcf6fc; font: inherit; }
textarea { resize: vertical; }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-actions input[type=file] { flex: 1 1 200px; }
.profile-form .status, .photo-library .status { padding: 9px 0; }
.photo-library { border-top: 1px solid var(--line); padding-top: 18px; }
.photo-library > p { font-size: .83rem; margin-bottom: 9px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.photo-grid figure { margin: 0; padding: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.photo-grid img { display: block; width: 100%; height: 95px; object-fit: cover; border-radius: 6px; }
.photo-grid figcaption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 6px 0; font-size: .72rem; }
.photo-grid button { font-size: .72rem; width: 100%; }
@media (max-width: 700px) {
  .public-page, .operator-page { padding: 0; }
  .chat-shell, .app-shell { min-height: 0; width: 100%; border: 0; border-radius: 0; }
  .chat-shell { height: 100dvh; }
  .app-head { padding: 12px; }
  .app-head p { font-size: .68rem; }
  .app-head a, .app-head button { font-size: .72rem; padding: 7px; }
  .workspace { display: flex; flex-direction: column; min-height: 0; height: calc(100dvh - 117px); }
  .inbox, .detail { flex: 1; border-right: 0; }
  .empty-pane, .workspace.show-detail .inbox { display: none; }
  .detail .back { display: inline-grid; }
  .detail-head { padding: 10px 8px; }
  .detail-head .small-button, .detail-head .plain { padding: 5px 7px; }
  .profile-panel { grid-template-columns: 1fr; }
  .profile-nav { border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-detail { padding: 16px; }
}
