:root {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: #202b3f;
    background: #f4f6fa;
    font-size: 16px;
    --blue: #2867e8;
    --line: #e3e8f0;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
a {
    color: var(--blue);
    text-decoration: none;
}
button,
input,
select,
textarea {
    font: inherit;
}
button,
.file-button {
    cursor: pointer;
    border: 1px solid var(--line);
    background: white;
    border-radius: 9px;
    padding: 10px 15px;
    color: inherit;
}
button:disabled {
    opacity: 0.5;
    cursor: default;
}
.primary {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}
.quiet {
    background: transparent;
}
.navigation {
    width: 220px;
    position: fixed;
    inset: 0 auto 0 0;
    background: #fff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 28px 18px;
}
.brand {
    font-size: 34px;
    font-weight: 800;
    color: var(--blue);
    padding: 0 12px;
}
.brand span {
    display: block;
    font-size: 13px;
    color: #7c879a;
    font-weight: 400;
    margin-top: 7px;
}
.navigation nav {
    display: grid;
    gap: 7px;
    margin-top: 42px;
}
.navigation nav a {
    padding: 13px;
    border-radius: 9px;
    color: #657087;
    font-size: 15px;
}
.navigation nav a.selected {
    background: #edf3ff;
    color: var(--blue);
    font-weight: 600;
}
.identity {
    margin-top: auto;
    padding: 15px 10px;
}
.identity small {
    display: block;
    color: #7c879a;
    margin: 6px 0 18px;
}
.workspace {
    margin-left: 220px;
    min-height: 100dvh;
    padding: 32px;
}
.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0 30px;
    gap: 20px;
}
.page-title h1 {
    margin: 5px 0 10px;
    font-size: 30px;
    font-weight: 650;
}
.eyebrow {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #7b8ba7;
    font-weight: 700;
}
.muted,
small {
    color: #778398;
    line-height: 1.6;
}
.counter,
.tag {
    background: #eaf0fa;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}
.tag {
    display: inline-block;
    margin-top: 8px;
}
.tag.active {
    background: #eaf7f0;
    color: #287d51;
}
.tag.disabled {
    background: #fceeed;
    color: #a35050;
}
.admin-grid {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(350px, 1fr);
    gap: 24px;
}
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 26px;
    height: fit-content;
}
.panel h2 {
    font-size: 19px;
    margin: 0 0 24px;
}
label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin: 16px 0;
}
input,
select,
textarea {
    display: block;
    width: 100%;
    border: 1px solid #d7dfeb;
    border-radius: 8px;
    background: #fff;
    padding: 11px;
    margin-top: 7px;
    outline-offset: 2px;
    color: inherit;
}
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #bfd2fd;
}
form .primary {
    margin-top: 8px;
}
.user-row {
    border-bottom: 1px solid var(--line);
    padding: 20px 0;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.user-row > div {
    flex: 1;
}
.user-row small {
    display: block;
}
.user-row details {
    flex-basis: 100%;
    font-size: 14px;
}
.user-row:first-child {
    padding-top: 0;
}
.user-row:last-child {
    border: 0;
}
.error,
.notice {
    padding: 12px 16px;
    border-radius: 9px;
    font-size: 14px;
    line-height: 1.5;
}
.error {
    background: #fff0ef;
    color: #a13c3c;
}
.notice {
    background: #eaf7f0;
    color: #237648;
}
.error p {
    margin: 4px 0;
}
.narrow {
    max-width: 460px;
}
.login-wrapper {
    min-height: 100dvh;
    display: grid;
    place-content: center;
    padding: 24px;
    background: radial-gradient(ellipse at 50% 10%, #e5edff, transparent 65%);
}
.login-card {
    width: min(420px, 90vw);
    background: white;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 38px;
    box-shadow: 0 18px 80px #12346b0b;
}
.login-card h1 {
    font-size: 29px;
    line-height: 1.25;
    margin-top: 28px;
}
.login-card .primary {
    width: 100%;
}
.badge {
    background: var(--blue);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 13px;
    display: grid;
    place-content: center;
    font-size: 28px;
    font-weight: 700;
}
.pagination {
    margin-top: 20px;
}
.pagination svg {
    width: 20px;
}
.workspace:has(.inbox) {
    padding: 0;
}
.inbox {
    height: 100dvh;
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    background: #fff;
}
.chat-list {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--line);
}
.chat-list header {
    padding: 25px 20px 16px;
}
.chat-list h1 {
    font-size: 24px;
    margin: 0 0 8px;
}
.small-link {
    font-size: 13px;
}
.chat-scroll {
    overflow: auto;
    flex: 1;
    min-height: 0;
}
.chat-item {
    display: flex;
    gap: 12px;
    text-align: left;
    width: 100%;
    border: 0;
    border-radius: 0;
    padding: 17px 20px;
    align-items: center;
}
.chat-item:hover {
    background: #f7f9fd;
}
.chat-item.selected {
    background: #edf3ff;
}
.avatar {
    width: 43px;
    height: 43px;
    border-radius: 50%;
    background: #e6edfb;
    color: #45679e;
    display: grid;
    place-content: center;
    flex-shrink: 0;
    font-size: 14px;
    object-fit: cover;
}
.chat-info {
    min-width: 0;
    flex: 1;
}
.chat-info > .muted {
    display: block;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-button { border: 0; padding: 0; background: transparent; max-width: 100%; }
.sender { display: block; }
.chat-info strong {
    display: block;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-info small {
    font-size: 12px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.unread {
    font-size: 11px;
    background: var(--blue);
    color: white;
    border-radius: 20px;
    min-width: 21px;
    padding: 3px;
    text-align: center;
}
.conversation {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.conversation-head {
    padding: 22px 25px;
    display: flex;
    gap: 15px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
}
.conversation-head h2 {
    margin: 0;
    font-size: 18px;
}
.conversation-head small {
    font-size: 12px;
}
.message-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: #f6f8fc;
    padding: 22px 30px;
}
.bubble {
    max-width: min(80%, 620px);
    margin: 10px 0;
    background: white;
    padding: 13px 16px;
    border-radius: 13px;
    box-shadow: 0 1px 3px #233c6310;
    overflow-wrap: anywhere;
}
.bubble.outgoing {
    margin-left: auto;
    background: #e8f0ff;
}
.bubble .sender {
    font-size: 12px;
    font-weight: 600;
    color: #5577b0;
    margin-bottom: 6px;
}
.bubble .body {
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 15px;
}
.bubble .time {
    font-size: 11px;
    color: #8995a8;
    display: block;
    text-align: right;
    margin-top: 6px;
}
.bubble .actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}
.bubble .actions button {
    font-size: 11px;
    padding: 3px 0;
    border: 0;
    background: transparent;
    color: #6880a9;
}
.bubble blockquote {
    margin: 0 0 8px;
    padding: 6px 10px;
    border-left: 3px solid #83a5e6;
    background: #ffffff70;
    font-size: 12px;
}
.media-thumb {
    max-width: 100%;
    max-height: 270px;
    border-radius: 8px;
    object-fit: contain;
    cursor: zoom-in;
}
.bubble audio {
    max-width: 100%;
    width: 300px;
}
.composer {
    border-top: 1px solid var(--line);
    padding: 15px 22px;
}
.composer textarea {
    resize: vertical;
    max-height: 130px;
    min-height: 60px;
    margin: 0;
}
.composer-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}
.composer-actions .primary {
    margin: 0 0 0 auto;
}
.file-button {
    margin: 0;
    font-size: 13px;
}
.file-button input {
    display: none;
}
.empty {
    text-align: center;
    color: #8893a6;
    padding: 50px 20px;
    font-size: 14px;
    line-height: 1.7;
}
.reply-preview {
    padding: 8px 24px;
    background: #edf3ff;
    font-size: 13px;
}
.reply-preview button {
    padding: 4px 8px;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}
[hidden] {
    display: none !important;
}
dialog {
    border: 1px solid var(--line);
    border-radius: 16px;
    max-width: min(95vw, 1100px);
    padding: 24px;
    box-shadow: 0 15px 80px #0003;
}
dialog::backdrop {
    background: #13233e99;
}
#media-preview img,
#media-preview video {
    max-width: 85vw;
    max-height: 80dvh;
}
#media-dialog .close-dialog {
    position: absolute;
    right: 10px;
    top: 10px;
}
#connection-qr {
    display: block;
    margin: auto;
    max-width: 100%;
}
#forward-dialog {
    min-width: 320px;
}
.conversation > .error {
    margin: 0;
    border-radius: 0;
}
@media (max-width: 1000px) {
    .navigation {
        width: 170px;
        padding: 20px 10px;
    }
    .workspace {
        margin-left: 170px;
        padding: 20px;
    }
    .inbox {
        grid-template-columns: 270px minmax(0, 1fr);
    }
    .admin-grid {
        grid-template-columns: 1fr;
    }
    .conversation-head {
        padding: 15px;
    }
    .message-scroll {
        padding: 15px;
    }
}
@media (max-width: 700px) {
    .navigation {
        position: static;
        width: auto;
        height: auto;
        padding: 12px;
        display: block;
    }
    .brand {
        font-size: 22px;
    }
    .brand span,
    .identity {
        display: none;
    }
    .navigation nav {
        display: flex;
        flex-wrap: wrap;
        margin: 8px 0 0;
        gap: 0;
    }
    .navigation nav a {
        padding: 8px;
        font-size: 12px;
    }
    .workspace {
        margin: 0;
        padding: 15px;
    }
    .inbox {
        height: calc(100dvh - 104px);
        grid-template-columns: 130px minmax(0, 1fr);
    }
    .chat-list header {
        padding: 10px;
    }
    .chat-list h1 {
        font-size: 18px;
    }
    .chat-item {
        padding: 12px 8px;
    }
    .chat-item .avatar {
        display: none;
    }
    .conversation-head {
        flex-wrap: wrap;
        padding: 12px;
    }
    .conversation-head h2 {
        font-size: 15px;
    }
    .conversation-head button {
        font-size: 11px;
        padding: 6px;
    }
    .message-scroll {
        padding: 8px;
    }
    .bubble {
        max-width: 95%;
        padding: 10px;
    }
    .composer {
        padding: 8px;
    }
    .composer-actions {
        gap: 5px;
    }
    .composer-actions button {
        padding: 8px;
        font-size: 12px;
    }
    .panel {
        padding: 20px;
    }
    .page-title {
        align-items: start;
        flex-wrap: wrap;
    }
}
