:root {
  --ink: #17343a;
  --ink-deep: #0e252a;
  --paper: #f3f6f6;
  --panel: #ffffff;
  --line: #dbe4e5;
  --muted: #6f8387;
  --soft: #e9eff0;
  --teal: #14796f;
  --teal-dark: #0f615a;
  --telegram: #269ed7;
  --max: #d7604f;
  --max-soft: #fff0ed;
  --success: #238462;
  --danger: #b7463c;
  --shadow: 0 24px 64px rgba(15, 43, 48, 0.14);
  --display: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", sans-serif;
  --utility: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--body); font-size: 15px; }
button, input, textarea, select { font: inherit; }
button, select, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(38, 158, 215, .32); outline-offset: 2px;
}
[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.eyebrow, .utility-label { margin: 0 0 10px; color: inherit; font-family: var(--utility); font-size: 11px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
.utility-label { color: var(--muted); }
.brand-lockup { display: inline-flex; align-items: center; gap: 12px; font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.brand-lockup--light { color: white; }
.brand-mark { display: inline-flex; width: 28px; height: 32px; align-items: stretch; gap: 4px; padding: 4px; border: 1px solid rgba(255,255,255,.22); border-radius: 9px; }
.brand-mark i { width: 50%; border-radius: 4px; background: var(--telegram); }
.brand-mark i:last-child { background: var(--max); }
.brand-mark--compact { width: 38px; height: 42px; padding: 6px; border-color: rgba(255,255,255,.18); }

/* Login */
.login-view { min-height: 100%; display: grid; grid-template-columns: minmax(380px, .92fr) minmax(480px, 1.08fr); background: var(--panel); }
.login-story { position: relative; overflow: hidden; min-height: 650px; padding: 48px clamp(40px, 6vw, 90px); display: flex; flex-direction: column; justify-content: space-between; color: white; background: var(--ink-deep); }
.login-story::after { content: ""; position: absolute; right: -130px; bottom: -150px; width: 420px; height: 420px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; box-shadow: 0 0 0 55px rgba(255,255,255,.025), 0 0 0 110px rgba(255,255,255,.018); }
.login-story__copy { position: relative; z-index: 1; max-width: 580px; padding-bottom: 8vh; }
.login-story__copy .eyebrow { color: #bad0d3; }
.login-story__copy .eyebrow span { color: var(--max); padding: 0 6px; }
.login-story h1 { margin: 0; font-family: var(--display); font-size: clamp(52px, 6vw, 92px); font-weight: 620; line-height: .95; letter-spacing: -.06em; }
.login-story__copy > p:last-child { max-width: 470px; margin: 30px 0 0; color: #c5d4d6; font-size: 18px; line-height: 1.55; }
.channel-tracks { position: absolute; top: 0; right: 9%; display: flex; gap: 8px; height: 36%; }
.channel-tracks i { width: 5px; background: var(--telegram); border-radius: 0 0 8px 8px; }
.channel-tracks i:last-child { height: 72%; background: var(--max); }
.login-panel { display: grid; place-items: center; padding: 54px; }
.login-form { width: min(420px, 100%); display: grid; gap: 22px; }
.login-form h2 { margin: 0; font-family: var(--display); font-size: 38px; letter-spacing: -.045em; }
.form-intro { margin: 9px 0 4px; color: var(--muted); line-height: 1.55; }
.field-label { display: grid; gap: 8px; font-weight: 650; font-size: 13px; }
.field-label input { width: 100%; height: 52px; padding: 0 15px; color: var(--ink); background: #fbfcfc; border: 1px solid var(--line); border-radius: 10px; transition: border .15s, box-shadow .15s; }
.field-label input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(20,121,111,.09); outline: none; }
.primary-button, .secondary-button { min-height: 46px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 700; transition: transform .15s, background .15s, opacity .15s; }
.primary-button { color: white; background: var(--teal); box-shadow: 0 8px 20px rgba(20,121,111,.19); }
.primary-button:hover { background: var(--teal-dark); transform: translateY(-1px); }
.primary-button--wide { width: 100%; margin-top: 4px; }
.form-error { margin: -8px 0; padding: 10px 12px; color: var(--danger); background: #fff2f1; border-radius: 8px; font-size: 13px; }

/* Application frame */
.app-shell { height: 100%; min-height: 620px; display: grid; grid-template-columns: 78px 354px minmax(420px, 1fr) 274px; overflow: hidden; }
.app-rail { z-index: 4; padding: 21px 0 16px; display: flex; flex-direction: column; align-items: center; color: #d7e3e5; background: var(--ink-deep); }
.rail-nav { width: 100%; margin-top: 46px; display: grid; gap: 12px; justify-items: center; }
.rail-button { position: relative; width: 48px; height: 48px; display: grid; place-items: center; color: #9bb0b4; background: transparent; border: 0; border-radius: 13px; cursor: pointer; }
.rail-button:hover { color: white; background: rgba(255,255,255,.06); }
.rail-button.is-active { color: white; background: rgba(255,255,255,.1); }
.rail-dot { position: absolute; right: -3px; top: -3px; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; color: white; background: var(--max); border: 2px solid var(--ink-deep); border-radius: 10px; font-family: var(--utility); font-size: 8px; font-weight: 700; }
.rail-profile { margin-top: auto; display: grid; justify-items: center; gap: 7px; }
.mini-avatar { width: 34px; height: 34px; display: grid; place-items: center; color: var(--ink-deep); background: #dbe8e9; border-radius: 10px; font-weight: 750; }
.rail-logout { padding: 4px; color: #8ea5a9; background: none; border: 0; cursor: pointer; font-size: 10px; }
.rail-logout:hover { color: white; }

.inbox-panel, .contact-panel { min-width: 0; background: var(--panel); }
.inbox-panel { z-index: 2; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.panel-heading { padding: 24px 22px 15px; display: flex; align-items: end; justify-content: space-between; }
.panel-heading h1 { margin: 0; font-family: var(--display); font-size: 30px; letter-spacing: -.045em; }
.panel-heading h1 span { display: inline-grid; min-width: 25px; height: 25px; margin-left: 4px; place-items: center; vertical-align: 4px; color: var(--muted); background: var(--soft); border-radius: 8px; font-family: var(--utility); font-size: 10px; letter-spacing: 0; }
.live-indicator { display: inline-flex; align-items: center; gap: 7px; padding-bottom: 5px; color: var(--muted); font-size: 11px; }
.live-indicator i { width: 7px; height: 7px; background: var(--success); border-radius: 50%; box-shadow: 0 0 0 4px rgba(35,132,98,.1); }
.live-indicator.is-offline i { background: var(--danger); box-shadow: 0 0 0 4px rgba(183,70,60,.1); }
.notification-prompt { margin: 0 22px 13px; padding: 10px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; color: #e9f4f4; background: var(--ink-deep); border-radius: 11px; box-shadow: 0 8px 20px rgba(14,37,42,.1); }
.notification-prompt__icon { width: 34px; height: 34px; display: grid; place-items: center; color: white; background: rgba(255,255,255,.1); border-radius: 9px; }
.notification-prompt__icon svg { width: 18px; height: 18px; }
.notification-prompt__copy { min-width: 0; display: grid; gap: 2px; }
.notification-prompt__copy strong { font-size: 11px; }
.notification-prompt__copy small { overflow: hidden; color: #aec1c4; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.notification-prompt button { height: 32px; padding: 0 10px; color: var(--ink-deep); background: white; border: 0; border-radius: 8px; cursor: pointer; font-size: 10px; font-weight: 750; }
.notification-prompt button:disabled { opacity: .6; cursor: default; }
.search-box { height: 42px; margin: 0 22px; padding: 0 12px; display: flex; align-items: center; gap: 9px; color: #879a9d; background: var(--paper); border: 1px solid transparent; border-radius: 10px; }
.search-box:focus-within { border-color: #abc4c7; background: white; }
.search-box svg { width: 18px; height: 18px; }
.search-box input { min-width: 0; flex: 1; color: var(--ink); background: transparent; border: 0; outline: 0; }
.filter-row { padding: 14px 22px 12px; display: flex; gap: 7px; border-bottom: 1px solid var(--line); }
.filter-chip { height: 31px; padding: 0 11px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 650; }
.filter-chip:hover { color: var(--ink); }
.filter-chip.is-active { color: var(--ink); background: var(--soft); border-color: var(--soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot--telegram { background: var(--telegram); }
.dot--max { background: var(--max); }

.conversation-list { min-height: 0; flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #c8d5d7 transparent; }
.conversation-card { position: relative; width: 100%; min-height: 88px; padding: 15px 16px 14px 22px; display: grid; grid-template-columns: 46px minmax(0,1fr) auto; gap: 12px; text-align: left; background: white; border: 0; border-bottom: 1px solid #edf1f2; cursor: pointer; }
.conversation-card::before { content: ""; position: absolute; left: 0; top: 15px; bottom: 15px; width: 3px; background: var(--telegram); border-radius: 0 3px 3px 0; opacity: .82; }
.conversation-card[data-channel="max"]::before { background: var(--max); }
.conversation-card:hover { background: #f8fafb; }
.conversation-card.is-active { background: #eef4f4; }
.conversation-card.is-active::before { width: 5px; }
.person-avatar, .conversation-avatar { display: grid; place-items: center; flex: 0 0 auto; color: #31565d; background: #dce8e9; border-radius: 14px; font-family: var(--display); font-weight: 750; }
.conversation-avatar { width: 46px; height: 46px; font-size: 16px; }
.conversation-main { min-width: 0; padding-top: 1px; }
.conversation-title { display: flex; align-items: center; gap: 7px; }
.conversation-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.source-mini { flex: 0 0 auto; padding: 2px 5px; color: var(--telegram); background: #eaf7fc; border-radius: 5px; font-family: var(--utility); font-size: 8px; font-weight: 700; letter-spacing: .04em; }
.conversation-card[data-channel="max"] .source-mini { color: #b34d40; background: var(--max-soft); }
.conversation-preview { margin: 6px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-meta { min-width: 36px; display: grid; align-content: start; justify-items: end; gap: 11px; color: #91a1a4; font-size: 10px; }
.unread-badge { min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; color: white; background: var(--teal); border-radius: 10px; font-family: var(--utility); font-size: 9px; }
.list-empty { padding: 50px 30px; color: var(--muted); text-align: center; line-height: 1.55; }

/* Chat */
.chat-panel { position: relative; min-width: 0; overflow: hidden; background: var(--paper); }
.chat-empty { height: 100%; padding: 40px; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-emblem { position: relative; width: 98px; height: 90px; margin-bottom: 22px; display: flex; justify-content: center; gap: 7px; }
.empty-emblem > i { width: 7px; height: 100%; background: var(--telegram); border-radius: 6px; }
.empty-emblem > i:nth-child(2) { height: 68%; background: var(--max); }
.empty-emblem span { position: absolute; left: 25px; top: 18px; width: 60px; height: 54px; display: grid; place-items: center; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 24px rgba(16,45,50,.1); }
.chat-empty h2 { margin: 0; font-family: var(--display); font-size: 26px; letter-spacing: -.04em; }
.chat-empty p { max-width: 380px; margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.chat-active { width: 100%; max-width: 100%; height: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 72px minmax(0,1fr) auto; overflow: hidden; }
.chat-header { padding: 0 22px; display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); }
.person-avatar { width: 42px; height: 42px; border-radius: 13px; }
.chat-person { min-width: 0; flex: 1; }
.chat-person h2 { margin: 0; overflow: hidden; font-family: var(--display); font-size: 17px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.chat-person p { margin: 4px 0 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.channel-badge { padding: 2px 6px; color: #147cae; background: #e3f3fa; border-radius: 5px; font-family: var(--utility); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.channel-badge.is-max { color: #a9483c; background: var(--max-soft); }
.status-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.status-control select { height: 34px; padding: 0 30px 0 10px; color: var(--ink); background: #f7f9f9; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; font-weight: 650; }
.mobile-back { display: none !important; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.icon-button:hover { background: var(--soft); }

.message-list { min-height: 0; padding: 22px clamp(18px, 3vw, 42px); overflow-y: auto; scroll-behavior: smooth; }
.day-separator { margin: 6px 0 20px; display: flex; align-items: center; gap: 12px; color: #899a9d; font-family: var(--utility); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.day-separator::before, .day-separator::after { content: ""; height: 1px; flex: 1; background: #dbe4e5; }
.message-row { margin: 0 0 13px; display: flex; align-items: flex-end; gap: 8px; }
.message-row.is-outgoing { justify-content: flex-end; }
.message-bubble { max-width: min(610px, 78%); padding: 10px 12px 7px; color: var(--ink); background: white; border: 1px solid #e1e8e9; border-radius: 5px 16px 16px 16px; box-shadow: 0 3px 10px rgba(20,50,56,.04); }
.message-row.is-outgoing .message-bubble { color: white; background: var(--teal); border-color: var(--teal); border-radius: 16px 5px 16px 16px; }
.message-text { margin: 0; line-height: 1.48; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-foot { margin-top: 5px; display: flex; align-items: center; justify-content: flex-end; gap: 5px; color: #86999c; font-family: var(--utility); font-size: 8px; }
.message-row.is-outgoing .message-foot { color: rgba(255,255,255,.68); }
.delivery-icon svg { width: 12px; height: 12px; }
.delivery-icon.is-failed { color: #ffd2cd; }
.attachment-grid { margin: -4px -6px 7px; display: grid; gap: 7px; }
.attachment-image { display: block; max-width: 420px; max-height: 340px; object-fit: cover; border-radius: 11px; }
.attachment-file { min-width: 210px; padding: 10px; display: flex; align-items: center; gap: 10px; color: inherit; background: rgba(19,52,58,.05); border-radius: 10px; text-decoration: none; }
.message-row.is-outgoing .attachment-file { background: rgba(255,255,255,.12); }
.attachment-file svg { flex: 0 0 auto; }
.attachment-file span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-grid audio, .attachment-grid video { max-width: 100%; }
.message-error { margin: 7px 0 0; color: #ffd9d5; font-size: 10px; }

.composer { width: 100%; max-width: 100%; min-width: 0; padding: 12px clamp(16px, 2.5vw, 34px) 14px; overflow: hidden; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); }
.composer-row { width: 100%; min-width: 0; display: flex; align-items: flex-end; gap: 8px; }
.attach-button, .send-button { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 12px; cursor: pointer; }
.attach-button { color: var(--muted); background: var(--soft); }
.attach-button:hover { color: var(--ink); }
.send-button { color: white; background: var(--teal); }
.send-button:hover { background: var(--teal-dark); }
.send-button:disabled { opacity: .5; cursor: wait; }
.composer textarea { width: 0; min-width: 0; min-height: 42px; max-height: 140px; flex: 1 1 0; resize: none; padding: 10px 13px; color: var(--ink); background: var(--paper); border: 1px solid transparent; border-radius: 12px; outline: 0; line-height: 1.45; }
.composer textarea:focus { background: white; border-color: #b7cacc; }
.composer-hint { margin: 7px 50px 0; color: #94a4a6; font-size: 9px; }
.file-preview { width: fit-content; max-width: calc(100% - 50px); margin: 0 0 8px 50px; padding: 7px 8px 7px 10px; display: flex; align-items: center; gap: 7px; overflow: hidden; background: var(--soft); border-radius: 9px; font-size: 11px; }
.file-preview > svg { width: 16px; }
.file-preview span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview button { width: 24px; height: 24px; display: grid; place-items: center; background: transparent; border: 0; border-radius: 6px; cursor: pointer; }
.file-preview button:hover { background: white; }
.file-preview button svg { width: 13px; }

/* Contact card */
.contact-panel { padding: 25px 22px; overflow-y: auto; border-left: 1px solid var(--line); }
.contact-empty { padding-top: 80px; color: var(--muted); text-align: center; line-height: 1.55; }
.contact-avatar { width: 70px; height: 70px; margin: 28px auto 14px; display: grid; place-items: center; color: #2d555d; background: #dce8e9; border-radius: 22px; font-family: var(--display); font-size: 24px; font-weight: 750; }
.contact-panel h2 { margin: 0; overflow-wrap: anywhere; font-family: var(--display); font-size: 21px; text-align: center; letter-spacing: -.035em; }
.contact-handle { margin: 5px 0 28px; color: var(--muted); text-align: center; font-size: 12px; }
.contact-facts { margin: 0; border-top: 1px solid var(--line); }
.contact-facts div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.contact-facts dt { margin-bottom: 5px; color: var(--muted); font-family: var(--utility); font-size: 9px; text-transform: uppercase; }
.contact-facts dd { margin: 0; font-size: 12px; font-weight: 650; }
.contact-note { margin-top: 25px; padding: 14px; background: #edf4f3; border-left: 3px solid var(--teal); border-radius: 0 10px 10px 0; }
.contact-note span { color: var(--teal); font-family: var(--utility); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.contact-note p { margin: 7px 0 0; color: #536d72; font-size: 11px; line-height: 1.5; }

/* Settings */
.settings-dialog { width: min(620px, calc(100vw - 32px)); padding: 0; color: var(--ink); background: white; border: 0; border-radius: 18px; box-shadow: var(--shadow); }
.settings-dialog::backdrop { background: rgba(9,31,35,.55); backdrop-filter: blur(4px); }
.dialog-heading { padding: 24px 25px 12px; display: flex; align-items: start; justify-content: space-between; }
.dialog-heading h2 { margin: 0; font-family: var(--display); font-size: 29px; letter-spacing: -.04em; }
.dialog-intro { margin: 0; padding: 0 25px 20px; color: var(--muted); }
.notification-settings { margin: 0 25px 16px; padding: 14px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 12px; background: #edf4f3; border: 1px solid #d8e6e4; border-radius: 13px; }
.notification-settings__icon { width: 38px; height: 38px; display: grid; place-items: center; color: white; background: var(--teal); border-radius: 11px; }
.notification-settings__icon svg { width: 19px; height: 19px; }
.notification-settings strong { font-size: 13px; }
.notification-settings p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.notification-settings__actions { display: flex; align-items: center; gap: 7px; }
.sound-test-button { min-height: 38px; padding: 0 11px; color: var(--teal-dark); background: white; border: 1px solid #bfd4d2; border-radius: 9px; cursor: pointer; font-size: 11px; font-weight: 700; }
.sound-test-button:hover { background: #f7fbfa; border-color: var(--teal); }
.install-button { width: calc(100% - 50px); min-height: 42px; margin: 0 25px 16px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--ink); background: white; border: 1px dashed #a9bfc2; border-radius: 11px; cursor: pointer; font-weight: 700; }
.install-button:hover { background: var(--paper); border-style: solid; }
.install-button svg { width: 18px; height: 18px; }
.integration-cards { padding: 0 25px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.integration-card { position: relative; padding: 16px; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.integration-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--telegram); }
.integration-card.is-max::before { background: var(--max); }
.integration-card__top { display: flex; align-items: center; justify-content: space-between; }
.integration-card h3 { margin: 0; font-size: 15px; }
.connection-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.connection-state i { width: 7px; height: 7px; background: var(--danger); border-radius: 50%; }
.connection-state.is-connected i { background: var(--success); }
.integration-card p { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.webhook-box { margin: 18px 25px 8px; padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--paper); border-radius: 12px; }
.webhook-box span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.webhook-box code { font-family: var(--utility); font-size: 10px; overflow-wrap: anywhere; }
.secondary-button { flex: 0 0 auto; padding: 0 14px; color: white; background: var(--ink); }
.secondary-button:hover { background: var(--ink-deep); }
.secondary-button:disabled { opacity: .5; cursor: wait; }
.dialog-result { min-height: 20px; margin: 0; padding: 2px 25px 24px; color: var(--muted); font-size: 11px; }

.toast-region { position: fixed; z-index: 20; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 360px; padding: 12px 15px; color: white; background: var(--ink-deep); border-radius: 10px; box-shadow: var(--shadow); animation: toast-in .2s ease-out; font-size: 12px; }
.toast.is-error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 72px 340px minmax(420px,1fr); }
  .contact-panel { display: none; }
}

@media (max-width: 820px) {
  .login-view { grid-template-columns: 1fr; }
  .login-story { min-height: 320px; padding: 30px; }
  .login-story__copy { padding: 50px 0 15px; }
  .login-story h1 { font-size: clamp(46px, 13vw, 70px); }
  .login-story__copy > p:last-child { margin-top: 18px; font-size: 15px; }
  .login-panel { padding: 40px 24px 60px; }
  .app-shell { position: relative; display: block; }
  .app-rail { position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; height: 60px; padding: 0 14px; flex-direction: row; justify-content: space-between; }
  .app-rail > .brand-mark { display: none; }
  .rail-nav { width: auto; margin: 0; display: flex; gap: 6px; }
  .rail-button { width: 44px; height: 44px; }
  .rail-profile { margin: 0; display: flex; gap: 8px; }
  .inbox-panel { height: calc(100% - 60px); border: 0; }
  .chat-panel { position: fixed; z-index: 6; inset: 0 0 60px 0; display: none; }
  .app-shell.chat-open .chat-panel { display: block; }
  .app-shell.chat-open .inbox-panel { display: none; }
  .mobile-back { display: grid !important; }
  .chat-header { padding: 0 12px; }
  .status-control { margin-left: auto; }
  .status-control { font-size: 0; }
  .status-control select { max-width: 112px; }
  .message-list { padding: 18px 13px; }
  .message-bubble { max-width: 87%; }
  .composer { padding-inline: 10px; }
  .composer-hint { display: none; }
  .file-preview { max-width: 100%; margin-left: 0; }
}

@media (max-width: 520px) {
  .login-story { min-height: 290px; }
  .login-story__copy > p:last-child { display: none; }
  .panel-heading { padding-top: 18px; }
  .integration-cards { grid-template-columns: 1fr; }
  .webhook-box { align-items: stretch; flex-direction: column; }
  .secondary-button { width: 100%; }
  .notification-prompt { margin-inline: 14px; }
  .notification-prompt__copy small { max-width: 145px; }
  .notification-settings { grid-template-columns: 38px 1fr; }
  .notification-settings__actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .notification-settings .secondary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
