/* Sapphire Chorus — chat application skin for chat.sapphire-project.me */

:root {
    --chorus-bg: #070b16;
    --chorus-panel: #0c1324;
    --chorus-sidebar: #091021;
    --chorus-raised: #121b31;
    --chorus-hover: rgba(122, 162, 255, 0.08);
    --chorus-active: rgba(92, 140, 255, 0.18);
    --chorus-border: rgba(151, 184, 255, 0.13);
    --chorus-text: #e6edf8;
    --chorus-muted: #8e9cb8;
    --chorus-faint: #5f6d89;
    --chorus-accent: #5b8cff;
    --chorus-accent-strong: #7aa2ff;
    --chorus-mention: #f2b553;
    --chorus-danger: #ff6b7d;
    --chorus-ok: #3ccf91;
    --chorus-radius: 10px;
    --chorus-font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --chorus-display: "Space Grotesk", var(--chorus-font);
}

html,
body.sapphire-chorus {
    height: 100%;
}

body.sapphire-chorus {
    margin: 0;
    background: var(--chorus-bg);
    color: var(--chorus-text);
    font-family: var(--chorus-font);
    font-size: 15px;
    line-height: 1.45;
    overflow: hidden;
}

.chorus-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ---------- top bar ---------- */

.chorus-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 48px;
    padding: 4px 14px;
    padding-top: max(4px, env(safe-area-inset-top));
    background: linear-gradient(180deg, #0b1222, #080d1a);
    border-bottom: 1px solid var(--chorus-border);
    position: relative;
    z-index: 30;
}

.chorus-topbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--chorus-text);
    text-decoration: none;
    font-family: var(--chorus-display);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.chorus-topbar__logo {
    width: 28px;
    height: 28px;
}

.chorus-topbar__name {
    font-size: 18px;
}

.chorus-topbar__zone {
    display: flex;
    align-items: center;
    min-width: 0;
}

.chorus-topbar__zone--settings {
    margin-left: auto;
    gap: 6px;
}

.chorus-topbar__zone--settings .header-settings__cluster {
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
}

.chorus-topbar__zone--settings .setting-card label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.chorus-topbar__zone--settings .setting-card {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
}

.chorus-topbar__zone--settings .setting-card--currency {
    display: none;
}

.chorus-topbar__zone--settings select {
    background: var(--chorus-raised);
    color: var(--chorus-text);
    border: 1px solid var(--chorus-border);
    border-radius: 8px;
    padding: 4px 8px;
    font: inherit;
    font-size: 13px;
}

.chorus-topbar__zone--menu {
    gap: 8px;
}

.chorus-topbar__zone--menu a {
    color: var(--chorus-text);
}

.chorus-host {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}

.chorus-block {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    display: flex;
}

.chorus-credits {
    flex: 0 0 auto;
    padding: 2px 12px calc(2px + env(safe-area-inset-bottom));
    font-size: 11px;
    color: var(--chorus-faint);
    text-align: center;
    border-top: 1px solid var(--chorus-border);
}

.chorus-credits a {
    color: inherit;
}

/* ---------- landing ---------- */

.chorus-landing,
.chorus-empty {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    overflow-y: auto;
    background: radial-gradient(1200px 600px at 20% -10%, rgba(91, 140, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(140, 92, 255, 0.12), transparent 60%);
}

.chorus-empty {
    position: absolute;
    inset: 0;
    z-index: 5;
    background-color: var(--chorus-bg);
}

.chorus-landing__card {
    width: min(460px, 100%);
    padding: 34px 30px;
    text-align: center;
    background: rgba(12, 19, 36, 0.86);
    border: 1px solid var(--chorus-border);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(2, 6, 17, 0.55);
}

.chorus-landing__card .chorus-form {
    text-align: left;
    margin-top: 12px;
}

.chorus-landing__mark {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--chorus-accent), #8a6bff);
    font-size: 26px;
    color: #fff;
    margin-bottom: 14px;
}

.chorus-landing h1 {
    margin: 0 0 10px;
    font-family: var(--chorus-display);
    font-size: 28px;
}

.chorus-landing__lead {
    margin: 0 0 22px;
    color: var(--chorus-muted);
}

.chorus-landing__note {
    margin: 18px 0 0;
    font-size: 12px;
    color: var(--chorus-faint);
}

/* ---------- buttons and inputs ---------- */

.chorus-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 9px;
    border: 1px solid var(--chorus-border);
    background: var(--chorus-raised);
    color: var(--chorus-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.chorus-button:hover {
    background: #18233d;
}

.chorus-button:active {
    transform: translateY(1px);
}

.chorus-button:disabled {
    opacity: 0.55;
    cursor: default;
}

.chorus-button--primary {
    background: var(--chorus-accent);
    border-color: transparent;
    color: #fff;
}

.chorus-button--primary:hover {
    background: var(--chorus-accent-strong);
}

.chorus-button--quiet {
    background: transparent;
}

.chorus-button--small {
    padding: 5px 10px;
    font-size: 13px;
}

.chorus-icon-button {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--chorus-muted);
    cursor: pointer;
    font-size: 15px;
}

.chorus-icon-button:hover {
    background: var(--chorus-hover);
    color: var(--chorus-text);
}

.chorus-icon-button--danger:hover {
    color: var(--chorus-danger);
}

.chorus-button:focus-visible,
.chorus-icon-button:focus-visible,
.chorus-nav__item:focus-visible,
.chorus-input:focus-visible {
    outline: 2px solid var(--chorus-accent-strong);
    outline-offset: 1px;
}

.chorus-input,
.chorus-edit__input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    border-radius: 9px;
    border: 1px solid var(--chorus-border);
    background: #0a1120;
    color: var(--chorus-text);
    font: inherit;
}

.chorus-input--select {
    width: auto;
}

/* ---------- application grid ---------- */

.chorus-app {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    position: relative;
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    background: var(--chorus-panel);
}

.chorus-app.has-thread {
    grid-template-columns: 272px minmax(0, 1fr) minmax(320px, 400px);
}

.chorus-i18n,
.chorus-app [hidden] {
    display: none !important;
}

/* ---------- sidebar ---------- */

.chorus-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--chorus-sidebar);
    border-right: 1px solid var(--chorus-border);
}

.chorus-sidebar-backdrop {
    display: none;
}

.chorus-org {
    position: relative;
    padding: 10px 10px 6px;
    border-bottom: 1px solid var(--chorus-border);
}

.chorus-org__button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--chorus-text);
    font-family: var(--chorus-display);
    font-size: 17px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.chorus-org__button:not(:disabled):hover {
    background: var(--chorus-hover);
}

.chorus-org__button:disabled {
    cursor: default;
}

.chorus-org__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chorus-menu {
    position: absolute;
    left: 10px;
    right: 10px;
    top: calc(100% - 2px);
    z-index: 20;
    padding: 6px;
    background: var(--chorus-raised);
    border: 1px solid var(--chorus-border);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.chorus-menu__item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--chorus-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.chorus-menu__item:hover,
.chorus-menu__item.is-active {
    background: var(--chorus-active);
}

.chorus-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 8px 14px;
}

.chorus-nav__section {
    margin-top: 14px;
}

.chorus-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px 4px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--chorus-faint);
}

.chorus-nav__tools {
    display: inline-flex;
    gap: 2px;
}

.chorus-nav__tools .chorus-icon-button {
    width: 26px;
    height: 26px;
    font-size: 13px;
}

.chorus-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chorus-nav__item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--chorus-muted);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.chorus-nav__item:hover {
    background: var(--chorus-hover);
    color: var(--chorus-text);
}

.chorus-nav__item.is-active {
    background: var(--chorus-active);
    color: #fff;
}

.chorus-nav__item.is-unread {
    color: var(--chorus-text);
    font-weight: 800;
}

.chorus-nav__item > .bi {
    width: 18px;
    text-align: center;
    color: var(--chorus-faint);
}

.chorus-nav__item.is-active > .bi {
    color: var(--chorus-accent-strong);
}

.chorus-nav__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chorus-nav__empty {
    padding: 4px 12px;
    color: var(--chorus-faint);
}

.chorus-badge {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--chorus-mention);
    color: #1b1300;
    font-size: 12px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
}

.chorus-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chorus-accent-strong);
}

.chorus-sidebar__footer {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px 10px;
    border-top: 1px solid var(--chorus-border);
}

.chorus-connection {
    margin-left: auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--chorus-faint);
    box-shadow: 0 0 0 3px rgba(95, 109, 137, 0.2);
}

.chorus-connection.is-live {
    background: var(--chorus-ok);
    box-shadow: 0 0 0 3px rgba(60, 207, 145, 0.18);
}

/* ---------- avatar ---------- */

.chorus-avatar {
    --chorus-avatar-hue: 220;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: hsl(var(--chorus-avatar-hue) 55% 32%);
    color: hsl(var(--chorus-avatar-hue) 90% 90%);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.chorus-avatar--small {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 9px;
}

/* ---------- main column ---------- */

.chorus-main {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.chorus-main__header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 6px 14px;
    border-bottom: 1px solid var(--chorus-border);
}

.chorus-main__menu {
    display: none;
}

.chorus-main__titles {
    flex: 1;
    min-width: 0;
}

.chorus-main__title {
    margin: 0;
    font-family: var(--chorus-display);
    font-size: 17px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chorus-main__title .bi {
    color: var(--chorus-faint);
}

.chorus-main__topic {
    margin: 0;
    font-size: 12px;
    color: var(--chorus-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chorus-main__topic:empty {
    display: none;
}

.chorus-main__actions {
    display: flex;
    gap: 2px;
}

.chorus-timeline {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 0 8px;
}

.chorus-loading,
.chorus-timeline-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--chorus-muted);
}

.chorus-load-older {
    display: flex;
    margin: 4px auto 12px;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--chorus-border);
    border-radius: 999px;
    background: transparent;
    color: var(--chorus-muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.chorus-day,
.chorus-new-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 16px 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--chorus-faint);
}

.chorus-day::before,
.chorus-day::after,
.chorus-new-line::before,
.chorus-new-line::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--chorus-border);
}

.chorus-new-line {
    color: var(--chorus-danger);
}

.chorus-new-line::before,
.chorus-new-line::after {
    background: rgba(255, 107, 125, 0.4);
}

/* ---------- message ---------- */

.chorus-message {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 6px 18px 4px;
}

.chorus-message--grouped {
    padding-top: 1px;
}

.chorus-message:hover {
    background: rgba(122, 162, 255, 0.04);
}

.chorus-message__gutter {
    flex: 0 0 36px;
    display: flex;
    justify-content: center;
}

.chorus-message__hover-time {
    visibility: hidden;
    padding-top: 3px;
    font-size: 11px;
    color: var(--chorus-faint);
}

.chorus-message:hover .chorus-message__hover-time {
    visibility: visible;
}

.chorus-message__content {
    flex: 1;
    min-width: 0;
}

.chorus-message__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.chorus-message__author {
    font-weight: 800;
}

.chorus-message__agent {
    font-weight: 700;
    color: var(--chorus-muted, inherit);
}

.chorus-message__time {
    font-size: 12px;
    color: var(--chorus-faint);
}

.chorus-message__body {
    overflow-wrap: anywhere;
    white-space: normal;
}

.chorus-message__body--deleted {
    font-style: italic;
    color: var(--chorus-faint);
}

.chorus-message__edited {
    font-size: 12px;
    color: var(--chorus-faint);
}

.chorus-message__replies {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--chorus-accent-strong);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.chorus-message__replies:hover {
    border-color: var(--chorus-border);
    background: var(--chorus-raised);
}

.chorus-message__actions {
    position: absolute;
    top: -12px;
    right: 18px;
    display: none;
    gap: 2px;
    padding: 2px;
    background: var(--chorus-raised);
    border: 1px solid var(--chorus-border);
    border-radius: 9px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.chorus-message:hover .chorus-message__actions,
.chorus-message:focus-within .chorus-message__actions {
    display: flex;
}

.chorus-message.is-editing .chorus-message__actions {
    display: none;
}

.chorus-message--pending .chorus-message__body {
    opacity: 0.6;
}

.chorus-message__state {
    font-size: 12px;
    color: var(--chorus-faint);
}

.chorus-message__state.is-failed {
    color: var(--chorus-danger);
    cursor: pointer;
    text-decoration: underline;
}

.chorus-tag {
    padding: 0 6px;
    border-radius: 5px;
    background: rgba(140, 107, 255, 0.2);
    color: #c9b8ff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.chorus-link {
    color: var(--chorus-accent-strong);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chorus-mention {
    padding: 0 3px;
    border-radius: 4px;
    background: rgba(91, 140, 255, 0.16);
    color: var(--chorus-accent-strong);
    font-weight: 700;
}

.chorus-mention--me {
    background: rgba(242, 181, 83, 0.2);
    color: var(--chorus-mention);
}

.chorus-inline-code {
    padding: 1px 5px;
    border-radius: 5px;
    background: #0a1120;
    border: 1px solid var(--chorus-border);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.88em;
}

.chorus-code {
    margin: 6px 0;
    padding: 10px 12px;
    border-radius: 9px;
    background: #060a14;
    border: 1px solid var(--chorus-border);
    overflow-x: auto;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 13px;
    white-space: pre;
}

.chorus-edit {
    margin-top: 4px;
}

.chorus-edit__actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}

.chorus-jump {
    position: absolute;
    left: 50%;
    bottom: 84px;
    transform: translateX(-50%);
    display: inline-flex;
    gap: 6px;
    padding: 6px 14px;
    border: 0;
    border-radius: 999px;
    background: var(--chorus-accent);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    z-index: 4;
}

/* ---------- composer ---------- */

.chorus-composer {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    margin: 0 14px 12px;
    padding: 8px 8px 8px 12px;
    border: 1px solid var(--chorus-border);
    border-radius: 12px;
    background: #0a1120;
}

.chorus-composer:focus-within {
    border-color: rgba(122, 162, 255, 0.45);
}

.chorus-composer__input:focus,
.chorus-composer__input:focus-visible {
    outline: none;
}

.chorus-composer__input {
    flex: 1;
    min-height: 24px;
    max-height: 240px;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--chorus-text);
    font: inherit;
    line-height: 1.45;
    padding: 4px 0;
}

.chorus-composer__send {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    background: var(--chorus-accent);
    color: #fff;
    cursor: pointer;
}

.chorus-composer__send:hover {
    background: var(--chorus-accent-strong);
}

.chorus-composer__send:disabled {
    opacity: 0.5;
    cursor: progress;
}

.chorus-composer__send:disabled:hover {
    background: var(--chorus-accent);
}

.chorus-composer__send:focus-visible {
    outline: 2px solid var(--chorus-accent-strong);
    outline-offset: 2px;
}

.chorus-join {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 14px 12px;
    padding: 12px 14px;
    border: 1px dashed var(--chorus-border);
    border-radius: 12px;
    color: var(--chorus-muted);
}

.chorus-join p {
    margin: 0;
}

/* ---------- thread ---------- */

.chorus-thread {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #0a1122;
    border-left: 1px solid var(--chorus-border);
}

.chorus-thread[hidden] {
    display: none;
}

.chorus-thread__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 6px 12px 6px 16px;
    border-bottom: 1px solid var(--chorus-border);
}

.chorus-thread__header h2 {
    margin: 0;
    font-family: var(--chorus-display);
    font-size: 16px;
}

/* ---------- mentions view ---------- */

.chorus-mention-card {
    display: block;
    width: calc(100% - 28px);
    margin: 8px 14px;
    padding: 12px 14px;
    border: 1px solid var(--chorus-border);
    border-radius: 12px;
    background: var(--chorus-raised);
    color: var(--chorus-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.chorus-mention-card:hover {
    border-color: rgba(122, 162, 255, 0.4);
}

.chorus-mention-card__head {
    display: flex;
    gap: 4px;
    align-items: baseline;
    font-size: 13px;
    color: var(--chorus-muted);
}

.chorus-mention-card__head time {
    margin-left: auto;
}

.chorus-mention-card__head strong {
    color: var(--chorus-text);
}

.chorus-mention-card__excerpt {
    margin-top: 4px;
    overflow-wrap: anywhere;
}

/* ---------- modal ---------- */

.chorus-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(2, 6, 17, 0.72);
}

.chorus-modal[hidden] {
    display: none;
}

.chorus-modal__dialog {
    width: min(560px, 100%);
    max-height: min(84vh, 760px);
    display: flex;
    flex-direction: column;
    background: var(--chorus-panel);
    border: 1px solid var(--chorus-border);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.chorus-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 10px 20px;
    border-bottom: 1px solid var(--chorus-border);
}

.chorus-modal__header h2 {
    margin: 0;
    font-family: var(--chorus-display);
    font-size: 18px;
}

.chorus-modal__body {
    padding: 16px 20px 20px;
    overflow-y: auto;
}

.chorus-modal__section {
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--chorus-faint);
}

.chorus-modal__section:first-child {
    margin-top: 0;
}

.chorus-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chorus-form--inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

.chorus-form--inline .chorus-input:first-child {
    flex: 1 1 160px;
    width: auto;
}

.chorus-form--inline .chorus-form-error {
    flex-basis: 100%;
}

.chorus-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.chorus-field__label {
    font-size: 13px;
    font-weight: 700;
    color: var(--chorus-muted);
}

.chorus-field__hint {
    font-size: 12px;
    color: var(--chorus-faint);
}

.chorus-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--chorus-muted);
}

.chorus-form-error {
    color: var(--chorus-danger);
    font-size: 13px;
}

.chorus-form-error:empty {
    display: none;
}

.chorus-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chorus-list__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--chorus-border);
}

.chorus-list__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chorus-list__info small {
    color: var(--chorus-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chorus-audit {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 13px;
    color: var(--chorus-muted);
}

.chorus-audit li {
    padding: 5px 0;
    border-bottom: 1px solid var(--chorus-border);
    overflow-wrap: anywhere;
}

.chorus-audit time {
    color: var(--chorus-faint);
}

.chorus-muted {
    color: var(--chorus-muted);
}

.chorus-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 70;
    max-width: min(520px, calc(100% - 32px));
    padding: 10px 16px;
    border-radius: 10px;
    background: #1d2742;
    border: 1px solid var(--chorus-border);
    color: var(--chorus-text);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.chorus-toast[hidden] {
    display: none;
}

.chorus-empty-host {
    flex: 1;
    display: grid;
    place-items: center;
    color: var(--chorus-muted);
}

/* ---------- attachments ---------- */

.chorus-composer__attach {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    margin-left: -6px;
    font-size: 18px;
}

.chorus-composer__attachments {
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 6px;
    max-height: 136px;
    margin-left: -4px;
    padding: 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.chorus-chip {
    position: relative;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 3px 7px 5px;
    border: 1px solid var(--chorus-border);
    border-radius: 9px;
    background: var(--chorus-raised);
    overflow: hidden;
}

.chorus-chip.is-error {
    border-color: rgba(255, 107, 125, 0.45);
}

.chorus-chip__icon {
    flex: 0 0 32px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    background: #0a1120;
    color: var(--chorus-accent-strong);
    font-size: 16px;
    overflow: hidden;
}

.chorus-chip__icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chorus-chip.is-error .chorus-chip__icon {
    color: var(--chorus-danger);
}

.chorus-chip__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.chorus-chip__name {
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chorus-chip__meta {
    font-size: 12px;
    color: var(--chorus-faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chorus-chip.is-error .chorus-chip__meta {
    color: var(--chorus-danger);
    white-space: normal;
}

.chorus-chip__remove {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.chorus-chip__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(122, 162, 255, 0.12);
}

.chorus-chip:not(.is-uploading) .chorus-chip__progress {
    display: none;
}

.chorus-chip__bar {
    display: block;
    width: 0;
    height: 100%;
    background: var(--chorus-accent);
    transition: width 0.15s linear;
}

.chorus-main.has-attachments .chorus-jump {
    bottom: 150px;
}

.chorus-thread {
    position: relative;
}

.chorus-dropzone {
    position: absolute;
    inset: 8px;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px dashed var(--chorus-accent-strong);
    border-radius: 14px;
    background: rgba(12, 19, 36, 0.92);
    color: var(--chorus-text);
    font-family: var(--chorus-display);
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    pointer-events: none;
}

.chorus-dropzone .bi {
    font-size: 32px;
    color: var(--chorus-accent-strong);
}

.chorus-message__body--empty {
    display: none;
}

.chorus-attachments {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    max-width: 520px;
}

.chorus-message__body--empty + .chorus-attachments {
    margin-top: 2px;
}

.chorus-message--pending .chorus-attachments {
    opacity: 0.6;
}

.chorus-attachments__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    max-width: 420px;
}

.chorus-attachments__grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 360px;
}

.chorus-attachments__grid--single {
    display: block;
    max-width: 100%;
}

.chorus-attachment-image {
    position: relative;
    display: block;
    overflow: hidden;
    border: 1px solid var(--chorus-border);
    border-radius: 9px;
    background: #0a1120;
    line-height: 0;
}

.chorus-attachments__grid:not(.chorus-attachments__grid--single) .chorus-attachment-image {
    aspect-ratio: 1 / 1;
}

.chorus-attachments__grid:not(.chorus-attachments__grid--single) .chorus-attachment-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chorus-attachments__grid--single .chorus-attachment-image {
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
}

.chorus-attachments__grid--single .chorus-attachment-image img {
    display: block;
    max-width: 100%;
    max-height: 300px;
    height: auto;
    object-fit: contain;
}

.chorus-attachment-image:hover {
    border-color: rgba(122, 162, 255, 0.45);
}

.chorus-attachments__files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chorus-file {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    max-width: min(100%, 320px);
    box-sizing: border-box;
    padding: 7px 10px;
    border: 1px solid var(--chorus-border);
    border-radius: 9px;
    background: var(--chorus-raised);
    color: var(--chorus-text);
    text-decoration: none;
}

.chorus-file:hover {
    border-color: rgba(122, 162, 255, 0.45);
    background: #18233d;
}

.chorus-file > .bi:first-child {
    font-size: 22px;
    color: var(--chorus-accent-strong);
}

.chorus-file > .bi:last-child {
    margin-left: 2px;
    color: var(--chorus-muted);
}

.chorus-file__text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.chorus-file__name {
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chorus-file__size {
    font-size: 12px;
    color: var(--chorus-faint);
}

.chorus-attachment-image:focus-visible,
.chorus-file:focus-visible {
    outline: 2px solid var(--chorus-accent-strong);
    outline-offset: 2px;
}

/* ---------- mobile ---------- */

@media (max-width: 899px) {
    body.sapphire-chorus {
        font-size: 16px;
    }

    .chorus-topbar {
        gap: 8px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .chorus-topbar__name {
        display: none;
    }

    .chorus-topbar__zone--settings {
        display: none;
    }

    .chorus-topbar__zone--menu {
        margin-left: auto;
    }

    .chorus-credits {
        font-size: 9px;
        line-height: 1.25;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .chorus-app,
    .chorus-app.has-thread {
        grid-template-columns: minmax(0, 1fr);
    }

    .chorus-main__menu {
        display: inline-grid;
    }

    .chorus-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 40;
        width: min(300px, 86vw);
        transform: translateX(-102%);
        transition: transform 0.2s ease;
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.5);
    }

    .chorus-app.is-sidebar-open .chorus-sidebar {
        transform: none;
    }

    .chorus-app.is-sidebar-open .chorus-sidebar-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 35;
        background: rgba(2, 6, 17, 0.6);
    }

    .chorus-thread {
        position: absolute;
        inset: 0;
        z-index: 30;
        border-left: 0;
    }

    .chorus-message {
        padding-left: 12px;
        padding-right: 12px;
    }

    .chorus-message__actions {
        right: 10px;
    }

    .chorus-composer {
        margin: 0 8px 8px;
    }

    .chorus-join {
        flex-direction: column;
        align-items: stretch;
        margin: 0 8px 8px;
    }

    .chorus-modal {
        padding: 0;
        place-items: end stretch;
    }

    .chorus-modal__dialog {
        width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
    }

    .chorus-list__item {
        flex-wrap: wrap;
    }
}

@media (hover: none) {
    .chorus-message__actions {
        position: static;
        display: flex;
        margin-left: auto;
        align-self: flex-start;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .chorus-message__actions .chorus-icon-button {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
}
