:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: #172033;
  background: #eef1f6;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { border: 0; border-radius: 10px; padding: 11px 18px; background: #3157d5; color: white; font-weight: 700; cursor: pointer; }
button.secondary { background: #edf0f7; color: #27324a; }
.eyebrow { margin: 0 0 4px; color: #71809e; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 390px); display: grid; gap: 14px; padding: 34px; background: white; border-radius: 18px; box-shadow: 0 18px 55px #24304a1f; }
.login-card h1 { margin: 0 0 8px; }
.login-card input, .composer textarea { width: 100%; border: 1px solid #ccd3e0; border-radius: 10px; padding: 12px; color: #172033; background: white; }
.form-error { margin: 0; color: #b42332; }
.inbox-shell { height: 100vh; display: grid; grid-template-columns: minmax(280px, 360px) 1fr; background: white; }
.conversation-panel { min-width: 0; border-right: 1px solid #dfe4ed; background: #f8f9fc; overflow: auto; }
.panel-header, .conversation-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; border-bottom: 1px solid #dfe4ed; background: white; }
.panel-header h1, .conversation-header h2 { margin: 0; font-size: 22px; }
.conversation-header p { margin: 4px 0 0; color: #65718a; font-size: 14px; }
.conversation-actions { display: flex; align-items: center; gap: 8px; }
.conversation-actions form { margin: 0; }
.hide-disabled { max-width: 150px; color: #765300; font-size: 12px; text-align: right; }
.total-count { display: grid; place-items: center; min-width: 30px; height: 30px; border-radius: 15px; background: #e5e9f3; font-weight: 700; }
.panel-counts { display: flex; align-items: center; gap: 8px; }
.inbox-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 10px 0; }
.inbox-navigation a { padding: 9px 12px; border-radius: 9px; color: #65718a; text-align: center; text-decoration: none; font-weight: 700; }
.inbox-navigation a.active { background: #e5e9f3; color: #27324a; }
.unread-total { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px; background: #a51f2a; color: white; font-weight: 800; }
.awaiting-total { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; background: #fff0c2; color: #765300; border: 1px solid #e4bd4f; font-weight: 800; }
.conversation-list { display: grid; padding: 10px; gap: 6px; }
.push-settings { display: grid; gap: 7px; margin: 8px 10px 14px; padding: 12px; border: 1px solid #dfe4ed; border-radius: 12px; background: white; }
.push-toggle { width: 100%; padding: 9px 12px; }
.push-toggle:disabled { cursor: default; opacity: .62; }
.push-status { margin: 0; color: #65718a; font-size: 12px; line-height: 1.4; }
.conversation-item { display: grid; grid-template-columns: 1fr auto; gap: 7px 10px; padding: 14px; border-radius: 12px; color: inherit; text-decoration: none; background: white; border: 1px solid transparent; }
.conversation-item:hover, .conversation-item.active { border-color: #aebce7; background: #f0f4ff; }
.conversation-item.has-unread { border-color: #e6a2a9; background: #fff4f5; box-shadow: inset 4px 0 #a51f2a; }
.conversation-item.has-unread strong { font-weight: 850; }
.conversation-item.has-unread.active { border-color: #aebce7; background: #f0f4ff; box-shadow: inset 4px 0 #3157d5; }
.channel { font-size: 12px; font-weight: 800; }
.channel-website { color: #3157d5; }
.channel-vk { color: #087bd8; }
.channel-telegram { color: #168dcc; }
.conversation-item strong { grid-column: 1; overflow: hidden; text-overflow: ellipsis; }
.conversation-meta { grid-column: 2; grid-row: 1 / 3; display: grid; justify-items: end; align-content: space-between; gap: 8px; }
.awaiting-reply { display: inline-block; padding: 4px 7px; border: 1px solid #d6a72d; border-radius: 6px; background: #fff0c2; color: #765300; font-size: 11px; font-weight: 800; line-height: 1.15; }
.header-awaiting { margin-top: 7px; }
.state { color: #6a7487; font-size: 12px; }
.state-closed { color: #9a5360; }
.unread { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: #3157d5; color: white; font-size: 12px; font-weight: 800; }
.message-panel { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; background: #f2f4f8; }
.messages { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 24px; }
.message { max-width: min(72%, 650px); padding: 12px 15px; border-radius: 14px; background: white; box-shadow: 0 2px 8px #22304b0f; }
.message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.outbound { align-self: flex-end; background: #dfe7ff; }
.new-messages-separator { display: flex; align-items: center; gap: 10px; color: #a51f2a; font-size: 12px; font-weight: 800; }
.new-messages-separator::before, .new-messages-separator::after { content: ""; flex: 1; height: 1px; background: #e3a3aa; }
.delivery { display: block; margin-top: 6px; font-size: 11px; color: #60708f; text-align: right; }
.delivery-failed { color: #b42332; }
.composer { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; padding: 16px 20px; border-top: 1px solid #dfe4ed; background: white; }
.composer textarea { resize: vertical; max-height: 160px; }
.empty-state { place-self: center; color: #738098; text-align: center; }
.empty-state h2 { color: #354159; }
.back-link { display: none; color: #3157d5; font-size: 26px; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
  .inbox-shell { display: block; min-height: 100vh; height: auto; }
  .conversation-panel { min-height: 100vh; border: 0; }
  .message-panel { display: none; min-height: 100vh; grid-template-rows: auto minmax(50vh, 1fr) auto; }
  .inbox-shell.has-active .conversation-panel { display: none; }
  .inbox-shell.has-active .message-panel { display: grid; }
  .back-link { display: block; }
  .conversation-header { padding: 14px; }
  .conversation-header h2 { font-size: 18px; }
  .messages { padding: 14px; }
  .message { max-width: 88%; }
  .composer { grid-template-columns: 1fr; padding: 12px; }
  .composer button { width: 100%; }
}
