/* Pharanoid — one mobile-first visual system. No remote fonts or UI dependencies. */
:root {
  color-scheme: dark;
  --bg:#111419; --surface:#1a1e25; --surface-raised:#232832; --field:#15191f;
  --text:#f2f1ed; --muted:#a4aab4; --line:#333943; --accent:#dcc397; --accent-ink:#292219;
  --success:#99cbb0; --danger:#ffa9a9; --shadow:0 24px 70px #0006;
  --safe-top:max(env(safe-area-inset-top,0px),var(--tg-content-safe-area-inset-top,0px));
  --safe-bottom:max(env(safe-area-inset-bottom,0px),var(--tg-content-safe-area-inset-bottom,0px));
  --visual-height:100dvh;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  font-synthesis:none; -webkit-font-smoothing:antialiased;
}
:root[data-theme=light] {
  color-scheme:light; --bg:#f6f5f1; --surface:#fff; --surface-raised:#efeee9; --field:#f7f7f4;
  --text:#22282e; --muted:#626b74; --line:#dcdfdd; --accent:#785d30; --accent-ink:#fff;
  --success:#286346; --danger:#ae303e; --shadow:0 24px 70px #20282722;
}
*,*::before,*::after {box-sizing:border-box}
body {margin:0;background:var(--bg);color:var(--text);font-size:16px;line-height:1.55;min-width:280px;height:var(--visual-height);display:flex;flex-direction:column;overflow:hidden}
button,input,select,textarea {font:inherit;color:inherit}
button,a,input,select,textarea,summary {-webkit-tap-highlight-color:transparent}
button,a {touch-action:manipulation}
button {cursor:pointer}
button:disabled {cursor:not-allowed;opacity:.45}
a {color:var(--accent);text-decoration:none}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible {outline:2px solid var(--accent);outline-offset:4px}
[hidden],.hidden {display:none!important}
.field-group.hidden[style*="display: block"] {display:block!important}
.visually-hidden {position:absolute!important;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.skip-link {position:fixed;left:16px;top:-100px;z-index:200;background:var(--surface);padding:12px}.skip-link:focus {top:12px}
.icon,[data-icon] {display:inline-flex;width:22px;height:22px;flex-shrink:0;align-items:center;justify-content:center}
.icon {fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.app-header {width:min(100%,760px);flex-shrink:0;margin:0 auto;padding:calc(12px + var(--safe-top)) 24px 12px;display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid var(--line)}
.header-actions {display:flex;gap:8px;flex-shrink:0}
.section-heading {min-width:0}.section-heading .eyebrow {font-size:9px;margin:0 0 4px}.section-heading h1 {font-size:23px;margin:0}
.brand {display:flex;align-items:center;gap:12px;color:var(--text);font-size:12px;font-weight:650;letter-spacing:.18em;min-height:48px}
.brand small {display:block;font-size:10px;font-weight:400;letter-spacing:.055em;color:var(--muted);margin-top:2px}
.brand-mark {color:var(--accent);width:36px;height:40px}.brand-mark .icon {width:32px;height:32px}
.container {width:min(100%,760px);margin:0 auto;flex:1;min-height:0;overflow-y:auto;overscroll-behavior-y:contain;padding:16px 20px;scroll-padding:16px;scrollbar-width:thin;scrollbar-color:var(--line) transparent}
.page-heading {display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:30px}
.eyebrow {font-size:10px;letter-spacing:.16em;text-transform:uppercase;color:var(--accent);margin:0 0 8px;font-weight:650}
h1 {font-size:32px;line-height:1.15;letter-spacing:-.035em;font-weight:600;margin:0 0 10px}
h2 {font-size:18px;line-height:1.35;font-weight:600;letter-spacing:-.015em;margin:0}
h3 {font-size:16px;margin:0 0 8px}
p {margin:0 0 16px}.page-caption {font-size:14px;color:var(--muted);margin:0;max-width:32em}
.page-symbol {width:52px;height:52px;border:1px solid var(--line);border-radius:18px;color:var(--accent);background:var(--surface);transform:rotate(-5deg)}
.page-symbol .icon {width:25px;height:25px;transform:rotate(5deg)}
.muted,.small,.char-counter {color:var(--muted)}.small {font-size:12px}.char-counter {font-size:11px;font-variant-numeric:tabular-nums}
.button,.btn,.btn-open,.btn-secondary,.btn-copy,.btn-copy-inline,button[type=submit] {display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:11px 18px;background:var(--surface-raised);border:1px solid var(--line);border-radius:13px;color:var(--text);font-size:14px;font-weight:550;line-height:1.4;text-align:center;transition:background .16s,transform .16s}
.primary,button[type=submit] {background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.button:active,.btn:active,.icon-button:active {transform:translateY(1px)}
.danger {color:var(--danger)}.full-width {width:100%}
.icon-button {width:48px;height:48px;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:14px;background:var(--surface);color:var(--muted)}
.icon-button.primary {background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.text-button {min-height:44px;padding:8px 10px;border:0;background:none;color:var(--accent);font-size:13px;border-radius:10px}
.text-button.danger {color:var(--danger)}
.panel {background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:20px;margin-bottom:16px}
.section-toolbar,.label-row,.field-footer {display:flex;align-items:center;justify-content:space-between;gap:12px}.section-toolbar {margin-bottom:16px}.section-toolbar>.muted {font-size:12px}
.field-group {margin-bottom:16px}label {display:block;font-size:13px;font-weight:550;margin-bottom:9px}
input:not([type=radio]):not([type=checkbox]):not([type=file]),select,textarea {display:block;width:100%;min-width:0;min-height:50px;padding:13px 14px;border:1px solid var(--line);border-radius:12px;background:var(--field);font-size:16px;line-height:1.45;transition:border-color .15s;box-shadow:none}
input::placeholder,textarea::placeholder {color:var(--muted);opacity:.8}
textarea {resize:vertical;min-height:150px}select {text-overflow:ellipsis;padding-right:28px}
input[type=file] {width:100%;min-width:0;font-size:13px;margin-top:8px}input::file-selector-button {background:var(--surface-raised);color:var(--text);padding:12px;border:1px solid var(--line);border-radius:10px;margin-right:10px;cursor:pointer}
input[type=checkbox],input[type=radio] {accent-color:var(--accent);width:20px;height:20px;flex-shrink:0}
.required {color:var(--accent)}.label-row label {margin:0}.label-row {margin-bottom:9px}.field-footer {margin-top:5px}
.tabs {display:flex;background:var(--surface);border:1px solid var(--line);padding:5px;border-radius:16px;gap:5px;margin-bottom:14px}
.tab-button {flex:1;min-width:0;display:flex;align-items:center;justify-content:center;gap:8px;min-height:46px;border:0;border-radius:11px;background:none;color:var(--muted);font-size:14px;font-weight:550;padding:10px}
.tab-button.active {background:var(--surface-raised);color:var(--text);box-shadow:0 2px 7px #0001}
.tab-button [data-icon] {width:17px;height:17px}.count-badge {border-radius:8px;background:var(--accent);color:var(--accent-ink);font-size:10px;padding:0 6px}
.tab-content {display:none}.tab-content.active {display:block}
.empty-state {text-align:center;padding:38px 18px 42px;background:var(--surface);border:1px solid var(--line);border-radius:22px}
.empty-emblem {display:flex;width:72px;height:72px;border:1px solid var(--line);border-radius:24px;margin:0 auto 23px;align-items:center;justify-content:center;color:var(--accent);background:var(--surface-raised)}
.empty-emblem .icon {width:30px;height:30px}.empty-state h2 {margin-bottom:10px}.empty-state p {font-size:14px;max-width:290px;margin:0 auto 24px;color:var(--muted)}
.empty-state .button {min-width:180px}.empty-state .text-button {display:block;margin:12px auto 0}
.privacy-footnote {display:flex;justify-content:center;align-items:flex-start;gap:8px;text-align:left;font-size:11px;line-height:1.65;color:var(--muted);margin:20px 4px 0}
.privacy-footnote [data-icon] {width:15px;height:15px;margin-top:2px}.privacy-footnote .icon {width:15px;height:15px}
.loading {padding:44px 20px;text-align:center;color:var(--muted);font-size:14px}
.loading::before {content:"";display:block;margin:0 auto 16px;width:24px;height:24px;border:2px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:spin 1s linear infinite}
@keyframes spin {to{transform:rotate(360deg)}}
body[data-section=notes] .container {display:flex;flex-direction:column;overflow:hidden;padding-top:0;padding-bottom:8px;gap:6px}
.notes-toolbar {display:flex;align-items:center;justify-content:space-between;flex-shrink:0;min-height:44px;font-size:12px;color:var(--muted)}.notes-toolbar .icon-button {width:44px;height:44px;background:none;border:0}
.notes-viewport {flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scroll-padding:8px;border-radius:18px}
.notes-toolbar .notes-tabs {flex:1;min-width:0;margin:0;border:0;padding:3px;gap:2px}.notes-tabs .tab-button {font-size:12px;min-height:44px;padding:7px 6px;gap:4px}.notes-toolbar>.icon-button {flex-shrink:0}
.sent-note-editor .dialog-body {display:flex;flex-direction:column;gap:14px}.sent-note-preview {max-height:28vh;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--muted);font-size:13px}.sent-note-editor select {width:100%}.sent-note-editor [data-edit-filename] {min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sent-note-editor .note-attachment-summary {display:flex}.sent-note-editor [data-edit-status] {font-size:12px;color:var(--danger);overflow-wrap:anywhere}
.sent-note-editor .sent-edit-fields {display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;overflow:auto;padding:2px}
.sent-note-editor .sent-edit-fields textarea {flex:1;min-height:110px;resize:none}
.sent-note-editor .note-compose-actions,.sent-note-editor .note-attachment-summary,.sent-note-editor [data-edit-status] {flex-shrink:0}
#notes-status {margin:0;flex-shrink:0;font-size:12px}#notes-status[data-state=error] {color:var(--danger)}
.notes-rows {list-style:none;margin:0;padding:0}.note-row {display:flex;align-items:center;gap:4px;min-height:68px;border-bottom:1px solid var(--line)}
.note-open {display:flex;align-items:center;gap:12px;flex:1;min-width:0;min-height:64px;padding:8px 4px;border:0;border-radius:12px;background:none;text-align:left}
.note-open>[data-icon] {color:var(--accent);width:36px;height:40px;background:var(--surface);border-radius:10px}
.note-label {min-width:0;flex:1}.note-sender {display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500}.note-date {display:block;font-size:11px;color:var(--muted);margin-top:2px}
.note-menu-trigger {border:0;background:none;width:48px;height:48px}.note-menu-trigger .icon {stroke-width:3}.note-open:hover,.note-menu-trigger:hover {background:var(--surface-raised)}
.notes-viewport .empty-state {border:0;background:none;padding:28px 8px}.notes-viewport .empty-state p {margin-bottom:16px}.notes-viewport .empty-emblem {width:48px;height:48px;border-radius:16px;margin-bottom:14px}.notes-viewport .empty-state h2 {font-size:18px}
#create-note {position:relative}.draft-dot {position:absolute;right:7px;top:7px;width:7px;height:7px;border-radius:50%;background:var(--accent-ink)}
.app-dialog.note-compose-dialog {--note-top-gap:calc(20px / 3);--note-bottom-gap:20px;top:calc(var(--safe-top) + var(--note-top-gap));bottom:auto;margin:0 auto;height:calc(var(--visual-height) - var(--safe-top) - var(--safe-bottom) - var(--note-top-gap) - var(--note-bottom-gap));max-height:calc(var(--visual-height) - var(--safe-top) - var(--safe-bottom) - var(--note-top-gap) - var(--note-bottom-gap))}
.note-recipient {display:flex;align-items:center;gap:10px;flex:1;min-width:0}
.note-recipient label {flex-shrink:0;margin:0;font-size:16px;font-weight:600}
.note-recipient select {flex:1;min-width:0;width:0;min-height:44px;padding:10px 28px 10px 12px}
.note-compose-dialog [data-compose-close] {flex-shrink:0;margin-left:auto}
.note-compose-dialog .dialog-body {display:flex;flex:1;min-height:0;overflow:hidden;padding-bottom:12px}
.compose-note {display:flex;flex-direction:column;flex:1;min-height:0;min-width:0;margin:0}
.note-compose-fields {display:flex;flex-direction:column;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:4px}
.note-compose-fields .field-group {flex-shrink:0;margin-bottom:10px}.note-compose-fields label {font-size:12px;margin-bottom:4px}.note-compose-fields .label-row {margin-bottom:0}
.note-compose-fields input,.note-compose-fields select {min-height:44px;padding:10px 12px}
.note-compose-fields .note-message-field {display:flex;flex-direction:column;flex:1;min-height:126px;margin-bottom:0}.note-message-field textarea {flex:1;min-height:96px;resize:none;padding:10px 12px}
.note-compose-footer {flex-shrink:0;padding-top:6px}
.note-compose-actions {display:flex;align-items:center;gap:8px}.note-compose-actions #submit-btn {flex:1;min-width:0}
.attach-picker {margin:0;cursor:pointer;position:relative;color:var(--accent)}.attach-picker:focus-within {outline:2px solid var(--accent);outline-offset:2px}.attach-picker:has(input:disabled) {opacity:.45;cursor:not-allowed}
.note-attachment-summary {display:flex;align-items:center;gap:8px;min-width:0;margin-bottom:6px}.note-attachment-summary #attach-info {flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--muted)}
.note-attachment-summary .icon-button {width:44px;height:44px;background:none;border:0}
.note-compose-footer #status-message:not(:empty) {font-size:12px;padding:0 0 8px;max-height:4.8em;overflow:auto}
.inline-status {font-size:12px;color:var(--muted);margin:0 0 10px;overflow-wrap:anywhere}
.success,.ok {color:var(--success)}.error {color:var(--danger)}#status-message:not(:empty) {padding:14px 0;font-size:14px}
.bottom-nav {position:relative;z-index:50;flex-shrink:0;margin:6px auto calc(12px + var(--safe-bottom));width:min(calc(100% - 32px),510px);display:grid;grid-template-columns:repeat(4,1fr);padding:7px;background:var(--surface);border:1px solid var(--line);border-radius:23px;box-shadow:0 10px 40px #0003}
.bottom-nav a,.bottom-nav button {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-height:58px;min-width:0;padding:6px 2px;color:var(--muted);background:none;border:0;border-radius:16px;font-size:10px;font-weight:500;letter-spacing:.01em}
.bottom-nav [aria-current=page] {color:var(--accent);background:var(--surface-raised)}
.keyboard-open .bottom-nav {display:none}
.app-toast {position:fixed;left:50%;bottom:calc(102px + var(--safe-bottom));transform:translate(-50%,12px);background:var(--surface-raised);border:1px solid var(--line);border-radius:14px;padding:13px 18px;max-width:calc(100% - 32px);width:max-content;color:var(--text);font-size:13px;box-shadow:var(--shadow);opacity:0;pointer-events:none;z-index:150;transition:.2s;overflow-wrap:anywhere}
.app-toast.show {opacity:1;transform:translate(-50%,0)}
.app-dialog {position:fixed;inset:0;width:min(calc(100% - 32px),520px);max-width:none;max-height:calc(var(--visual-height) - 40px - var(--safe-top) - var(--safe-bottom));margin:auto;padding:0;border:1px solid var(--line);border-radius:26px;background:var(--surface);color:var(--text);box-shadow:var(--shadow);overflow:hidden}
.app-dialog[open] {display:flex;flex-direction:column}.app-dialog::backdrop {background:#05090dbd;backdrop-filter:blur(7px)}
.dialog-head {padding:16px 20px 12px;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-shrink:0}.dialog-head h2 {font-size:22px}.dialog-head .icon-button {width:44px;height:44px}
.dialog-body {overflow:auto;overscroll-behavior:contain;padding:0 24px 24px;min-height:0;overflow-wrap:anywhere}.dialog-body>p {font-size:14px;color:var(--muted)}
.dialog-actions {display:flex;gap:10px;margin-top:24px}.dialog-actions>* {flex:1}.dialog-actions.stacked {flex-direction:column}
.dialog-status {font-size:13px;line-height:1.6;margin-top:18px;color:var(--muted)}.dialog-status:empty {display:none}
.dialog-status[data-state=error] {color:var(--danger)}.dialog-status[data-state=success] {color:var(--success)}
.menu-list {display:grid;gap:8px}.menu-item {display:flex;align-items:center;gap:14px;padding:16px;border:1px solid var(--line);border-radius:15px;background:var(--field);text-align:left;color:var(--text);min-height:76px;width:100%}
.menu-item>[data-icon] {color:var(--accent)}.menu-item strong {display:block;font-size:14px;font-weight:550}.menu-item small {display:block;color:var(--muted);font-size:12px;line-height:1.5;margin-top:3px}
.menu-item>span:nth-child(2) {flex:1}.menu-item .icon:last-child {color:var(--muted)}
.key-summary {border:1px solid var(--line);border-radius:16px;padding:18px;margin-bottom:20px;background:var(--field)}
.key-summary-top {display:flex;align-items:center;gap:12px}.key-summary-top>[data-icon] {color:var(--accent)}.key-summary strong {font-size:14px}.key-summary small {display:block;color:var(--muted);font-size:12px}
.key-fingerprint summary {display:flex;align-items:center;min-height:44px;font-size:11px;color:var(--muted);cursor:pointer;margin-bottom:-10px}.key-fingerprint summary::after {content:"＋";margin-left:auto}.key-fingerprint[open] summary::after {content:"−"}
.fingerprint {font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px;line-height:1.8;overflow-wrap:anywhere;word-break:break-all;color:var(--muted);margin:8px 0 0;user-select:all}
.key-tabs {margin-bottom:20px}.key-tabs .tab-button {font-size:12px;min-height:44px;padding:8px 5px}
.key-page>p,.key-page li {font-size:13px;color:var(--muted)}.key-page ol {padding-left:20px}.key-page li {margin-bottom:12px}
.key-page .button+.button {margin-top:12px}.info-box {background:var(--field);border-left:2px solid var(--accent);padding:14px;border-radius:0 12px 12px 0;font-size:13px;color:var(--muted);margin:18px 0}
.status-pill {display:inline-flex;align-items:center;gap:5px;color:var(--success);font-size:10px}.status-pill [data-icon],.status-pill .icon {width:13px;height:13px}
.upload-btn {margin:0;cursor:pointer;position:relative}.upload-btn:focus-within {outline:2px solid var(--accent);outline-offset:3px}.upload-btn:has(input:disabled) {opacity:.45;cursor:not-allowed}
body[data-section=files] .container {display:flex;flex-direction:column;overflow:hidden;padding-top:8px;padding-bottom:8px;gap:8px}
body[data-section=files] .inline-status {flex-shrink:0;margin:0;font-size:12px;max-height:3.2em;overflow:auto}
body[data-section=files] .inline-status.status-ok {display:none}
.files-viewport {flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scroll-padding:8px;border-radius:18px}
.files-list {list-style:none;margin:0;padding:0}.file-row {display:flex;align-items:center;gap:4px;min-height:68px;border-bottom:1px solid var(--line)}
.file-open {display:flex;align-items:center;gap:12px;flex:1;min-width:0;min-height:64px;padding:8px 4px;border:0;border-radius:12px;background:none;text-align:left}
.file-open>[data-icon] {color:var(--accent);width:36px;height:40px;background:var(--surface);border-radius:10px}
.file-label {min-width:0;flex:1}.file-name {display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500}.file-detail {display:block;font-size:11px;color:var(--muted);margin-top:2px}
.file-menu-trigger {border:0;background:none;width:48px;height:48px}.file-menu-trigger .icon {stroke-width:3}
.file-open:hover,.file-menu-trigger:hover {background:var(--surface-raised)}
.file-dialog-name {display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:13px;color:var(--muted);margin:0 0 12px}
.file-menu-actions {display:grid;gap:4px}.file-menu-action {display:flex;align-items:center;gap:12px;width:100%;min-height:48px;padding:10px 12px;border:0;border-radius:12px;background:none;text-align:left;font-size:15px}.file-menu-action:hover {background:var(--surface-raised)}
.file-preview-dialog {width:min(calc(100% - 24px),760px);height:calc(var(--visual-height) - 40px - var(--safe-top) - var(--safe-bottom))}
.file-preview-dialog .dialog-body {display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden;padding-bottom:16px}
.file-preview-dialog .preview-area {display:flex;align-items:center;justify-content:center;flex:1;min-height:0;margin:0;background:var(--field);border-radius:14px;overflow:hidden}
.file-preview-dialog .preview-area img {display:block;width:100%;height:100%;min-height:0;object-fit:contain}
.file-preview-dialog .dialog-actions {flex-shrink:0;margin-top:12px}.file-preview-dialog .dialog-status {margin:8px 0 0;flex-shrink:0}
.file-share-dialog .dialog-body {display:flex;flex-direction:column;overflow:hidden}.file-share-scroll {min-height:0;overflow:auto;overscroll-behavior:contain}.file-share-dialog .share-list {max-height:none;overflow:visible}.file-share-dialog .dialog-actions {margin-top:12px;flex-shrink:0}.file-share-dialog .dialog-status {margin:8px 0 0;flex-shrink:0}
.filename-field {display:flex;align-items:center;gap:8px}.filename-field input {flex:1}.filename-extension {flex-shrink:0;max-width:35%;overflow-wrap:anywhere;color:var(--muted);font-size:14px;padding:12px 8px;background:var(--field);border:1px solid var(--line);border-radius:12px}
.invited-list {color:var(--muted);font-size:13px}.invited-item {padding:10px 0;border-top:1px solid var(--line);overflow-wrap:anywhere}
.contacts {margin-top:20px}.contacts summary {display:flex;align-items:center;gap:8px;cursor:pointer;min-height:48px;list-style:none;font-size:13px;color:var(--accent)}.contacts summary::-webkit-details-marker {display:none}.contacts summary [data-icon]:last-child {margin-left:auto}
.contacts-toolbar {display:flex;gap:10px;margin-top:12px}.contacts-toolbar select {flex:1}.contacts-toolbar button {flex-shrink:0}
.people-panel {padding:8px 18px}.people-panel>summary {min-height:48px;display:flex;align-items:center;gap:10px;font-size:14px;color:var(--muted);cursor:pointer;list-style:none}.people-panel>summary::-webkit-details-marker {display:none}.people-panel>summary>[data-icon]:last-child {margin-left:auto}.people-panel[open]>summary {margin-bottom:14px}
body[data-section=chat] .app-header {width:min(100%,760px);padding:calc(12px + var(--safe-top)) 20px 12px;gap:12px}
.chat-heading {min-width:0}.chat-heading h1 {font-size:23px;margin:0 0 4px}.chat-heading [role=status] {font-size:11px;line-height:1.4;color:var(--muted);overflow-wrap:anywhere}
body[data-section=chat] .container {display:flex;flex-direction:column;padding:10px 16px 8px;overflow:hidden}
body[data-section=chat] .chat-panel {display:flex;flex-direction:column;flex:1;min-height:0;margin-bottom:0;padding:0 14px 12px}
body[data-section=chat] .messages {flex:1;min-height:0;max-height:none;scrollbar-width:thin}
body[data-section=chat] .composer {flex-shrink:0;padding-top:10px}
body[data-section=chat].keyboard-open .container {padding-bottom:calc(8px + var(--safe-bottom))}
.messages {min-height:180px;max-height:45vh;overflow:auto;padding:12px 0;display:flex;flex-direction:column;gap:12px;overscroll-behavior:contain}
.messages:empty::before {content:"Здесь начнётся ваш разговор";display:block;margin:auto;color:var(--muted);font-size:13px;text-align:center;padding:20px}
.msg {align-self:flex-start;max-width:90%;padding:12px 15px;background:var(--surface-raised);border-radius:16px 16px 16px 4px;font-size:14px;overflow-wrap:anywhere;white-space:pre-wrap}.msg.mine {align-self:flex-end;background:var(--accent);color:var(--accent-ink);border-radius:16px 16px 4px 16px}
.messages button.msg {border:0;min-width:44px;min-height:44px;text-align:left;flex-shrink:0;line-height:1.5;cursor:pointer;color:var(--text)}
.messages button.msg.mine {color:var(--accent-ink)}.msg-author {display:block;font-size:11px;font-weight:600;opacity:.75;margin-bottom:3px}.msg-text {display:block}
.chat-participant {display:flex;align-items:center;gap:10px;min-height:56px}.chat-participant-label {flex:1;min-width:0}.chat-participant-label strong,.chat-participant-label small {display:block;overflow-wrap:anywhere}.chat-participant-label small {font-size:11px;margin-top:3px}
.chat-management {margin-top:20px;padding-top:10px;border-top:1px solid var(--line)}
.composer {display:flex;gap:10px;padding-top:18px;border-top:1px solid var(--line)}.composer input {flex:1}.composer .icon-button {width:50px;height:50px}
.ip-panel {text-align:center}.ip-panel h2 {margin-bottom:14px}.ip-panel>p {font-size:14px;color:var(--muted)}.ip-panel>.button {margin-top:12px}
.ip-panel .empty-emblem {width:48px;height:48px;margin-bottom:16px;border-radius:16px}
.contact-choice {display:flex;align-items:center;gap:12px;padding:12px 8px;min-height:48px;border-bottom:1px solid var(--line);font-size:14px;overflow-wrap:anywhere}.contact-choice span {min-width:0}
.share-list {max-height:240px;overflow:auto}.share-granted {font-size:12px;color:var(--muted);overflow-wrap:anywhere}
.note-popup {display:none}.note-popup.show {display:flex;position:fixed;inset:0;z-index:100;align-items:center;justify-content:center;padding:20px;background:#05090dbd;backdrop-filter:blur(7px)}
.note-popup-content {position:relative;background:var(--surface);border:1px solid var(--line);border-radius:24px;padding:28px;max-width:540px;width:100%;max-height:calc(var(--visual-height) - 40px);overflow:auto;box-shadow:var(--shadow);overflow-wrap:anywhere}
.note-popup-close {position:absolute;right:14px;top:12px;width:44px;height:44px;background:var(--surface-raised);color:var(--text);border:0;border-radius:12px;font-size:26px}
.note-popup-header {font-size:21px;font-weight:600;padding-right:40px;margin-bottom:22px}.note-popup-text {white-space:pre-wrap;font-size:16px;margin-bottom:24px}.note-popup-meta {font-size:11px;color:var(--muted);margin:14px 0}.note-popup-meta.ok {color:var(--success)}.note-popup-actions {margin-top:20px}
.note-reader {height:calc(var(--visual-height) - 40px - var(--safe-top) - var(--safe-bottom));width:min(calc(100% - 24px),680px)}
.note-reader .dialog-body {display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden;padding-bottom:14px}
.note-reader-scroll {flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:4px 0}
.note-reader .note-popup-header {padding:0;font-size:19px;margin:0 0 12px}.note-reader .note-popup-text {margin:0 0 16px;font-size:15px;white-space:pre-wrap}
.note-reader .note-popup-meta {margin:4px 0 0;color:var(--muted);font-size:11px}.note-reader .note-popup-meta.ok {color:var(--success)}
.note-reader .note-popup-actions {flex-shrink:0;display:flex;gap:8px;margin:12px 0 0}.note-reader .note-popup-actions>* {flex:1;min-width:0}
.note-reader .note-popup-close {position:static;font-size:inherit;background:var(--surface);border:1px solid var(--line)}
.note-transfer-status {flex-shrink:0;font-size:12px;line-height:1.4;margin-top:8px;max-height:4.2em;overflow:auto;color:var(--muted)}.note-transfer-status[data-state=error] {color:var(--danger)}
.note-attachment {margin-top:20px;padding:16px;background:var(--field);border:1px solid var(--line);border-radius:16px;display:grid;gap:12px}
.note-attachment-name {font-size:14px;font-weight:550;overflow-wrap:anywhere}.note-attachment .dialog-status {margin:0}.note-attachment a {text-align:center}
body[data-section=attachment-save] {height:auto;min-height:100dvh;overflow:auto}.handoff-shell {width:min(100%,500px);padding:calc(36px + var(--safe-top)) 22px calc(36px + var(--safe-bottom));margin:auto}
@media (max-width:520px) {
  .app-dialog.note-compose-dialog {--note-top-gap:10px;--note-bottom-gap:10px}
  .app-header {padding:calc(12px + var(--safe-top)) 20px 12px}.container {padding:14px 16px}
  h1 {font-size:29px}.page-heading {margin-bottom:25px}.page-symbol {width:46px;height:46px}.panel {padding:20px;border-radius:20px}
  .app-dialog {inset:auto 0 calc(10px + var(--safe-bottom));max-height:calc(var(--visual-height) - 30px - var(--safe-top) - var(--safe-bottom));border-radius:24px;margin:0 auto}
  .dialog-head {padding:14px 18px 10px}.dialog-body {padding:0 18px 18px}.dialog-head h2 {font-size:21px}
  .contacts-toolbar {flex-direction:column}.contacts-toolbar button {width:100%}.empty-state {padding:24px 15px}.empty-emblem {width:64px;height:64px;margin-bottom:18px}
}
@media (max-width:350px) {.app-header {padding-left:14px;padding-right:14px}.container {padding-left:14px;padding-right:14px}h1 {font-size:26px}.page-symbol {display:none}.panel {padding:16px}.dialog-body {padding-left:16px;padding-right:16px}.dialog-head {padding-left:16px;padding-right:16px}.bottom-nav {width:calc(100% - 20px)}.tabs {gap:2px}.button {padding-left:12px;padding-right:12px}}
@media (prefers-reduced-motion:reduce) {*,*::before,*::after {animation:none!important;transition:none!important;scroll-behavior:auto!important}}
