/* Standalone Nightwall messaging surface. */
body.nwc-page {
    margin: 0;
    background: #100e10;
    color: #faf7f8;
    color-scheme: dark;
    font: 400 1rem/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;
}
.nwc-app, .nwc-app *, .nwc-app *::before, .nwc-app *::after { box-sizing: border-box; }
.nwc-app [hidden] { display: none !important; }
.nwc-app {
    --panel: #171416;
    --surface: #241d21;
    --hover: #30262b;
    --muted: #c6b9be;
    --line: #382d32;
    --wine: #88163e;
    --rose: #ffd0df;
    display: flex; flex-direction: column;
    width: min(100%,74rem); margin: 0 auto;
    height: 100vh; height: 100dvh; min-height: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.nwc-app h1, .nwc-app h2, .nwc-app p, .nwc-app ul, .nwc-app ol { margin: 0; }
.nwc-app ul, .nwc-app ol { padding: 0; list-style: none; }
.nwc-app h1 { font-size: clamp(1.18rem,2.5vw,1.5rem); line-height: 1.2; font-weight: 700; }
.nwc-app h2 { font-size: 1.08rem; line-height: 1.25; font-weight: 650; }
.nwc-app button, .nwc-app textarea, .nwc-app input, .nwc-app select, .nwc-app summary { font: inherit; color: inherit; }
.nwc-app button, .nwc-app select, .nwc-app summary { cursor: pointer; }
.nwc-app button { min-height: 44px; touch-action: manipulation; }
.nwc-app :is(button,input,select,textarea,summary,a):focus-visible { outline: 2px solid #ffb4ce; outline-offset: 2px; }
.nwc-app a { color: var(--rose); text-underline-offset: .16em; }
.nwc-app :is(button,textarea,input,select):disabled { opacity: .55; cursor: default; }
.nwc-app :is(input[type=search],input[type=text],textarea,select) {
    max-width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 9px;
    padding: .55rem .72rem; background: #211b1e; color: #fff;
}
.nwc-app :is(input,textarea)::placeholder { color: #bbaeb4; opacity: 1; }
.nwc-top, .nwc-inboxbar, .nwc-threadbar { display: flex; align-items: center; gap: .65rem; flex: none; }
.nwc-top { min-height: 62px; padding: .48rem clamp(.8rem,2.6vw,1.7rem); border-bottom: 1px solid var(--line); }
.nwc-top h1 { flex: 1; }
.nwc-brand { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; color: #fff !important; font-weight: 700; text-decoration: none; }
.nwc-brand span:first-child:not(:last-child) { display: grid; place-items: center; min-width: 1.8rem; height: 1.8rem; border-radius: .45rem; background: var(--wine); color: #fff; }
.nwc-workspace { flex: 1; display: grid; grid-template-columns: minmax(16rem,32%) minmax(0,1fr); min-height: 0; background: var(--panel); }
.nwc-inbox, .nwc-chat, .nwc-thread, .nwc-picker { min-width: 0; min-height: 0; }
.nwc-inbox { padding: .65rem .7rem max(.75rem,env(safe-area-inset-bottom)); border-right: 1px solid var(--line); overflow: auto; }
.nwc-inboxbar { align-items: center; flex-wrap: wrap; padding: 0 .12rem .65rem; }
.nwc-inboxbar select { width: 100%; }
.nwc-inboxbar > :first-child { min-width: 0; flex: 1 1 8rem; }
.nwc-primary, .nwc-plain, .nwc-back, .nwc-inline, .nwc-menu summary, .nwc-settings summary {
    display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
    border: 0; border-radius: 9px; padding: .48rem .8rem; font-weight: 600; line-height: 1.25;
}
.nwc-primary { background: var(--wine); color: #fff; }
.nwc-primary:hover { background: #9e244d; }
.nwc-plain, .nwc-back, .nwc-inline, .nwc-menu summary, .nwc-settings summary { background: var(--surface); }
.nwc-plain:hover, .nwc-back:hover, .nwc-inline:hover, .nwc-menu summary:hover, .nwc-settings summary:hover { background: var(--hover); }
.nwc-filters {
    display: flex; flex-wrap: wrap; gap: .28rem;
    padding: 0 .12rem .55rem;
}
.nwc-filters [data-nwchat-filter] {
    min-height: 44px; padding: .42rem .85rem; border: 0; border-radius: 9px;
    background: transparent; color: var(--muted); font-size: .9rem; font-weight: 550;
}
.nwc-filters [data-nwchat-filter]:hover { background: var(--surface); color: #fff; }
.nwc-filters [data-nwchat-filter][aria-pressed="true"] { background: #562137; color: #fff; font-weight: 700; }
.nwc-threads, .nwc-results { display: grid; grid-template-columns: minmax(0,1fr); gap: 2px; }
.nwc-row {
    width: 100%; display: flex; align-items: center; gap: .72rem; min-width: 0; text-align: start;
    padding: .57rem .52rem; border: 0; border-radius: 10px; color: #fff; background: transparent;
}
.nwc-row:hover, .nwc-row[aria-current=true], .nwc-row[aria-selected=true] { background: var(--surface); }
.nwc-threads a.nwc-row { min-height: 54px; color: #f3eaef; text-decoration: none; touch-action: manipulation; }
.nwc-threads .nwc-rowcopy strong { font-weight: 550; }
.nwc-threads .nwc-row[data-unread="true"] .nwc-rowcopy strong { color: #fff; font-weight: 750; }
.nwc-threads .nwc-row[data-unread="true"] .nwc-rowcopy small { color: #f1e0e8; }
.nwc-avatar { width: 2.4rem; height: 2.4rem; flex: 0 0 2.4rem; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: #552338; color: #fff; font-size: .98rem; font-weight: 700; }
.nwc-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nwc-rowcopy { flex: 1; min-width: 0; display: grid; gap: .12rem; }
.nwc-rowcopy strong, .nwc-rowcopy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nwc-rowcopy small, .nwc-muted { color: var(--muted); }
.nwc-rowmeta { flex: none; display: grid; justify-items: end; gap: .2rem; }
.nwc-rowtime { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; line-height: 1.3; white-space: nowrap; }
.nwc-row[data-unread="true"] .nwc-rowtime { color: var(--rose); }
.nwc-badge { min-width: 1.5rem; padding: .08rem .36rem; border-radius: 999px; background: var(--wine); color: #fff; font-size: .78rem; text-align: center; }
.nwc-chat { display: flex; flex-direction: column; overflow: hidden; }
.nwc-placeholder { display: grid; place-content: center; align-self: stretch; flex: 1; padding: 2rem; text-align: center; color: var(--muted); }
.nwc-thread { display: flex; flex-direction: column; flex: 1; }
.nwc-threadbar { padding: .5rem clamp(.7rem,2vw,1.3rem); border-bottom: 1px solid var(--line); }
.nwc-threadbar h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nwc-threadbar .nwc-back { display: none; }
.nwc-menu { position: relative; flex: none; }
.nwc-menu summary, .nwc-settings summary { list-style: none; }
.nwc-menu summary::-webkit-details-marker, .nwc-settings summary::-webkit-details-marker { display: none; }
.nwc-menu[open] > :not(summary) { position: relative; z-index: 3; }
.nwc-menu > div, .nwc-menu > ul, .nwc-menu > nav {
    display: grid; gap: .25rem; padding: .35rem; min-width: min(15rem,75vw); background: #2a2326; border-radius: 8px;
}
.nwc-menu[open] > div, .nwc-menu[open] > ul, .nwc-menu[open] > nav { position: absolute; right: 0; top: 100%; }
.nwc-menu :is(button,a) { display: flex; align-items: center; text-align: start; width: 100%; min-height: 44px; padding: .45rem .65rem; border: 0; border-radius: 6px; background: transparent; text-decoration: none; color: #fff; }
.nwc-menu :is(button,a):hover { background: var(--hover); }
.nwc-top .nwc-main-menu {
    width: min(18rem, calc(100vw - 2rem));
    min-width: 0;
    max-height: calc(var(--nwc-visual-height, 100vh) - 4.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: max(.4rem, env(safe-area-inset-bottom));
}
@supports (height: 100dvh) {
    .nwc-top .nwc-main-menu {
        max-height: calc(var(--nwc-visual-height, 100dvh) - 4.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
}
.nwc-main-menu [data-nwe-legal-navigation] { width: 100%; margin: .15rem 0 0; padding: .25rem 0 0; }
.nwc-main-menu [data-nwe-legal-navigation] ul { display: grid; grid-template-columns: minmax(0, 1fr); gap: .15rem; }
.nwc-historywrap { flex: 1; min-height: 0; overflow: auto; overscroll-behavior-y: contain; padding: .75rem clamp(.7rem,2vw,1.35rem); }
.nwc-historywrap > button { display: flex; margin: 0 auto .5rem; }
.nwc-history { display: flow-root; }
.nwc-bubble { width: fit-content; max-width: min(80%,38rem); margin: .35rem 0; padding: .47rem .7rem; border-radius: 12px 12px 12px 3px; background: #30282d; color: #fff; }
.nwc-bubble p { white-space: pre-wrap; overflow-wrap: anywhere; }
.nwc-bubble.is-mine { margin-left: auto; background: #641b36; border-radius: 12px 12px 3px 12px; }
.nwc-bubble time { display: block; margin-top: .18rem; color: #e3ced7; font-size: .72rem; }
.nwc-bubble img { max-width: 100%; height: auto; border-radius: 6px; }
.nwc-composer { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: .5rem; padding: .65rem clamp(.65rem,2vw,1.3rem) max(.65rem,env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.nwc-composer textarea { min-width: 0; min-height: 44px; max-height: 8rem; resize: vertical; }
.nwc-picker { flex: 1; overflow: auto; padding: 1rem clamp(.75rem,2vw,1.4rem); }
.nwc-picker label, .nwc-settings label { display: grid; gap: .25rem; }
.nwc-picker input { width: 100%; }
.nwc-picker .nwc-results { margin-top: .8rem; }
.nwc-settings { padding: .55rem 0; color: var(--muted); }
.nwc-settings > summary { width: fit-content; color: #fff; }
.nwc-settings[open] > div { display: grid; justify-items: start; gap: .25rem; margin-top: .5rem; }
.nwc-settings label.nwc-inline { display: inline-flex; justify-content: flex-start; gap: .6rem; background: transparent; color: #f4eaf0; font-weight: 400; }
.nwc-settings input[type=checkbox] { width: 1.1rem; height: 1.1rem; flex-shrink: 0; accent-color: #922149; }
.nwc-settings [data-nwchat-alias-form] { display: grid; gap: .35rem; width: 100%; }
.nwc-settings [data-nwchat-alias-form] .nwc-link { justify-self: start; }
.nwc-settings input[type=url] { width: 100%; }
.nwc-picker .nwc-threadbar { margin: -.4rem 0 1rem; padding-left: 0; padding-right: 0; }
.nwc-gate > a.nwc-primary { margin-top: 1rem; color: #fff; text-decoration: none; }
.nwc-status, .nwc-note { padding: .42rem .8rem; color: #eed4de; font-size: .92rem; }
.nwc-status:empty, .nwc-note:empty { display: none; }
.nwc-gate { margin: auto; max-width: 34rem; padding: 1.5rem; text-align: center; }
.nwc-link { background: transparent; border: 0; color: var(--rose); text-decoration: underline; }
.nwc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width:700px) {
    .nwc-top { min-height: 51px; padding: .2rem .6rem; }
    .nwc-workspace { display: flex; flex-direction: column; }
    .nwc-inbox, .nwc-chat { flex: 1; width: 100%; border-right: 0; }
    .nwc-app[data-view="inbox"] .nwc-chat,
    .nwc-app[data-view="thread"] .nwc-inbox,
    .nwc-app[data-view="picker"] .nwc-inbox { display: none; }
    .nwc-threadbar .nwc-back { display: inline-flex; }
    .nwc-bubble { max-width: 87%; }
    .nwc-composer textarea { resize: none; }
}

/* The main viewport remains fixed while the inbox and history scroll independently. */
body.nwc-page { overflow: hidden; overscroll-behavior: none; }
.nwc-app {
    position: relative;
    top: var(--nwc-visual-offset, 0px);
    height: var(--nwc-visual-height, 100vh);
}
@supports (height: 100dvh) {
    .nwc-app { height: var(--nwc-visual-height, 100dvh); }
}
.nwc-app .nwc-circle-back,
.nwc-app .nwc-circle-shortcut {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 44px;
    width: fit-content;
    text-decoration: none;
    font-weight: 650;
}
.nwc-app .nwc-circle-back { padding-right: .35rem; font-size: .94rem; }
.nwc-circle-back > span { font-size: 1.9rem; line-height: .9; }
.nwc-app .nwc-circle-shortcut { margin-inline: .25rem; padding-inline: .25rem; }
.nwc-inbox-empty { max-width: 29ch; padding: .65rem .5rem .15rem; }
.nwc-app .nwc-settings-note { margin: 0 0 .55rem 2.4rem; font-size: .87rem; color: var(--muted); }
.nwc-app .nwc-history-empty {
    margin: clamp(1.5rem, 9vh, 5rem) auto 0;
    width: fit-content;
    max-width: 25rem;
    padding: .6rem 1rem;
    color: var(--muted);
    text-align: center;
}
.nwc-bubble {
    margin-block: .48rem;
    padding: .55rem .76rem .4rem;
    border-radius: 15px 15px 15px 5px;
}
.nwc-bubble.is-mine { border-radius: 15px 15px 5px 15px; }
.nwc-bubble time { text-align: end; }
.nwc-composer {
    flex: none;
    background: var(--panel);
    padding-bottom: max(.55rem, env(safe-area-inset-bottom));
}
.nwc-app .nwc-composer textarea {
    font-size: 1rem;
    line-height: 1.4;
    background: #211b1e;
    color: #fff;
    border: 1px solid var(--line);
    max-height: min(8rem, 25vh);
    padding-block: .65rem;
    resize: none;
    border-radius: .85rem;
}
.nwc-composer .nwc-primary { gap: .35rem; }
.nwc-send-icon {
    display: inline-block;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}
.nwc-status[data-error="true"] { background: #332029; color: #ffe2eb; }

.nwc-circle-picker {
    margin-top: 1.05rem;
    padding-top: .9rem;
    border-top: 1px solid var(--line);
}
.nwc-circle-picker h3 { margin: 0 0 .45rem; font-size: .98rem; line-height: 1.25; }
.nwc-circle-picker p { font-size: .9rem; }
.nwc-circle-picker p:not(:empty) { padding: .25rem 0; }
.nwc-circle-picker ul { display: grid; gap: 2px; }
.nwc-circle-picker li > a {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 48px;
    min-width: 0;
    padding: .45rem .55rem;
    border-radius: 10px;
    color: #f3eaef;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.nwc-circle-picker li > a:hover { background: var(--surface); }
.nwc-circle-picker li > a::after {
    content: '›' / '';
    flex: none;
    margin-inline-start: auto;
    color: var(--rose);
    font-size: 1.35rem;
    line-height: 1;
}
.nwc-share-preview {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    padding: .3rem .35rem .3rem .65rem;
    border: 1px solid var(--line);
    border-inline-start: 3px solid #b24f78;
    border-radius: 10px;
    background: var(--surface);
}
.nwc-picker-event { margin-bottom: .95rem; padding: .55rem .65rem; }
.nwc-share-copy { display: grid; gap: .15rem; min-width: 0; flex: 1; }
.nwc-share-copy :is(strong,small) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nwc-share-copy strong { color: #fff; font-size: .9rem; line-height: 1.25; }
.nwc-share-copy small { color: var(--muted); font-size: .78rem; line-height: 1.25; }
.nwc-share-copy small:empty { display: none; }
.nwc-share-remove {
    flex: none;
    min-width: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    line-height: 1;
}
.nwc-share-remove:hover { background: var(--hover); }
.nwc-share-remove span { font-size: 1.4rem; }
.nwc-app .nwc-event-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    min-height: 44px;
    min-width: 0;
    margin-top: .25rem;
    padding: .42rem .58rem;
    border: 1px solid #ffffff32;
    border-radius: 8px;
    background: #140f1480;
    color: #ffe7f0;
    font-size: .88rem;
    font-weight: 650;
    line-height: 1.3;
    overflow-wrap: anywhere;
    text-decoration: none;
}
.nwc-app .nwc-event-link:hover { text-decoration: underline; }
.nwc-event-link::after { content: '↗' / ''; flex: none; }

@media (max-width: 700px) {
    .nwc-app[data-view="thread"] .nwc-top h1 { font-size: 1rem; }
    .nwc-threadbar { min-height: 54px; padding-block: .25rem; }
    .nwc-threadbar .nwc-back {
        min-width: 44px;
        padding: 0;
        font-size: 1.75rem;
        background: transparent;
    }
    .nwc-threadbar h2 {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }
    .nwc-composer .nwc-primary { width: 44px; padding: .45rem; border-radius: .85rem; }
    .nwc-composer .nwc-send-label {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
    }
}
