:root {
    color-scheme: dark;
    --background: #070b14;
    --surface: #0d1320;
    --surface-elevated: #121a2a;
    --surface-soft: #182235;
    --border: #263247;
    --text: #f6f8fc;
    --muted: #95a3ba;
    --primary: #1288ff;
    --primary-hover: #2b98ff;
    --danger: #ffb7bd;
    --danger-bg: rgba(212, 55, 72, 0.18);
    --success: #a5e5bd;
    --success-bg: rgba(44, 151, 88, 0.18);
    --overlay: rgba(2, 6, 13, 0.62);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    --sidebar-width: 272px;
    --sidebar-collapsed: 84px;
}

:root[data-theme="light"] {
    color-scheme: light;
    --background: #f7f9fc;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --surface-soft: #edf2f8;
    --border: #dce3ed;
    --text: #10213f;
    --muted: #607089;
    --primary: #087df0;
    --primary-hover: #006fdc;
    --danger: #a91e2c;
    --danger-bg: #fff0f1;
    --success: #176f3b;
    --success-bg: #eaf8ef;
    --overlay: rgba(28, 42, 64, 0.38);
    --shadow: 0 24px 70px rgba(20, 37, 63, 0.2);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.app-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    transition: grid-template-columns 180ms ease;
}

.sidebar-is-collapsed .app-shell {
    grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
}

.sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 22px 18px;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.sidebar-header {
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.brand-image {
    display: block;
    object-fit: contain;
    object-position: left center;
}

.brand-image-full {
    width: 168px;
    max-height: 52px;
}

.brand-image-symbol {
    display: none !important;
    width: 48px;
    height: 48px;
}

.brand-light,
:root[data-theme="light"] .brand-dark {
    display: none;
}

:root[data-theme="light"] .brand-light {
    display: block;
}

.icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--border);
    background: var(--surface-soft);
}

.navigation {
    margin-top: 34px;
    min-height: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
}

.sidebar-section {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lines-section {
    flex: 0 1 34%;
    max-height: 34%;
    margin-top: 20px;
}

.tickets-section {
    flex: 0 1 25%;
    max-height: 25%;
    margin-top: 22px;
}

.history-section {
    min-height: 120px;
    display: flex;
    flex: 1;
    flex-direction: column;
    margin-top: 22px;
}

.sidebar-section-title {
    margin: 0 10px 9px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.available-lines,
.active-tickets,
.conversation-history {
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    overscroll-behavior: contain;
}

.line-item {
    width: 100%;
    display: block;
    margin-bottom: 5px;
    padding: 10px 11px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.line-item:hover,
.line-item.is-active {
    border-color: var(--border);
    background: var(--surface-soft);
}

.line-item-code {
    min-width: 0;
    display: block;
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-item-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
}

.line-status-badge {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: 19px;
    padding: 2px 7px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.line-status-01 {
    border-color: rgba(39, 174, 96, 0.3);
    background: rgba(39, 174, 96, 0.14);
    color: #66d493;
}

.line-status-02 {
    border-color: rgba(18, 136, 255, 0.3);
    background: rgba(18, 136, 255, 0.14);
    color: #6bb7ff;
}

.line-status-03 {
    border-color: rgba(241, 153, 55, 0.34);
    background: rgba(241, 153, 55, 0.15);
    color: #ffc273;
}

.line-status-04,
.line-status-unknown {
    border-color: var(--border);
    background: var(--surface-soft);
    color: var(--muted);
}

.line-status-05 {
    border-color: rgba(212, 55, 72, 0.34);
    background: rgba(212, 55, 72, 0.15);
    color: #ff9da7;
}

:root[data-theme="light"] .line-status-01 {
    color: #176f3b;
}

:root[data-theme="light"] .line-status-02 {
    color: #006ac9;
}

:root[data-theme="light"] .line-status-03 {
    color: #9a5700;
}

:root[data-theme="light"] .line-status-05 {
    color: #a91e2c;
}

.line-item-address {
    display: -webkit-box;
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.sidebar-empty {
    margin: 8px 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.ticket-item {
    width: 100%;
    display: block;
    margin-bottom: 5px;
    padding: 10px 11px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.ticket-item:hover,
.ticket-item.is-active {
    border-color: var(--border);
    background: var(--surface-soft);
}

.ticket-item-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
}

.ticket-item-id {
    color: var(--primary);
    font-size: 12px;
    font-weight: 750;
}

.ticket-state-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.ticket-state-0 {
    border-color: rgba(18, 136, 255, 0.3);
    background: rgba(18, 136, 255, 0.14);
    color: #6bb7ff;
}

.ticket-state-2 {
    border-color: rgba(241, 153, 55, 0.34);
    background: rgba(241, 153, 55, 0.15);
    color: #ffc273;
}

.ticket-state-unknown {
    border-color: var(--border);
    background: var(--surface-soft);
    color: var(--muted);
}

:root[data-theme="light"] .ticket-state-0 {
    color: #006ac9;
}

:root[data-theme="light"] .ticket-state-2 {
    color: #9a5700;
}

.ticket-item-subject,
.ticket-item-line {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-item-subject {
    margin-top: 5px;
    font-size: 12px;
}

.ticket-item-line {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 48px;
    padding: 11px 14px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--muted);
    font-size: 15px;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.nav-item.active {
    background: var(--surface-soft);
    color: var(--text);
}

.nav-item svg {
    flex: 0 0 auto;
}

.new-conversation {
    margin-bottom: 8px;
    border: 1px solid var(--border);
    color: var(--text);
}

.new-conversation:hover,
.history-item:hover {
    background: var(--surface-soft);
}

.conversation-history {
    min-height: 0;
    flex: 1;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 3px;
    border-radius: 10px;
}

.history-item.is-active {
    background: var(--surface-soft);
}

.history-open {
    min-width: 0;
    flex: 1;
    padding: 8px 7px 8px 11px;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.history-line-code,
.history-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-line-code {
    margin-bottom: 1px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
}

.history-item.is-active .history-open {
    color: var(--text);
}

.history-delete {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    opacity: 0;
    cursor: pointer;
}

.history-delete svg {
    width: 17px;
    height: 17px;
}

.history-item:hover .history-delete,
.history-item:focus-within .history-delete {
    opacity: 1;
}

.history-delete:hover {
    background: var(--background);
    color: var(--danger);
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px;
    color: var(--muted);
    font-size: 12px;
}

.portal-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    text-decoration: none;
}

.portal-link:hover {
    color: var(--primary);
}

.portal-link svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.sidebar-meta {
    color: var(--muted);
}

.sidebar-version {
    margin: 7px 0 0 28px;
    font-size: 10px;
    line-height: 1.3;
}

.sidebar-is-collapsed .sidebar {
    padding-inline: 17px;
}

.sidebar-is-collapsed .brand {
    justify-content: center;
}

.sidebar-is-collapsed .brand-image-full,
.sidebar-is-collapsed .nav-item span,
.sidebar-is-collapsed .sidebar-caption,
.sidebar-is-collapsed .sidebar-meta,
.sidebar-is-collapsed .sidebar-section {
    display: none;
}

.sidebar-is-collapsed .brand-image-symbol.brand-dark {
    display: block !important;
}

:root[data-theme="light"].sidebar-is-collapsed .brand-image-symbol.brand-dark {
    display: none !important;
}

:root[data-theme="light"].sidebar-is-collapsed .brand-image-symbol.brand-light {
    display: block !important;
}

.sidebar-is-collapsed .sidebar-header {
    flex-direction: column;
}

.sidebar-is-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar-is-collapsed .nav-item {
    justify-content: center;
    padding-inline: 0;
}

.main-content {
    min-width: 0;
    min-height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 8%, rgba(15, 129, 255, 0.09), transparent 34%),
        var(--background);
}

.page-copyright {
    flex: 0 0 auto;
    margin: 0;
    padding: 0 12px 7px;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.2;
    text-align: center;
}

.topbar {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 16px 28px;
}

.mobile-menu-toggle {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

.mobile-brand {
    display: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.install-button,
.auth-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.auth-button {
    min-width: 82px;
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
    font-weight: 650;
}

.auth-button:hover,
.login-submit:hover {
    background: var(--primary-hover);
}

.sun-icon {
    display: none;
}

:root[data-theme="light"] .moon-icon {
    display: none;
}

:root[data-theme="light"] .sun-icon {
    display: block;
}

.conversation {
    width: min(860px, calc(100% - 42px));
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-self: center;
    padding: 24px 0 34px;
}

.line-context {
    max-width: min(100%, 620px);
    display: grid;
    grid-template-columns: auto minmax(0, auto) auto;
    align-items: baseline;
    align-self: center;
    gap: 2px 10px;
    margin: 0 auto 18px;
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.line-context:hover {
    background: var(--surface-soft);
}

.line-context-label {
    grid-row: 1 / 3;
    align-self: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.line-context .line-status-badge {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
}

.line-context strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#lineContextAddress {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation.has-messages {
    justify-content: flex-start;
    width: min(920px, calc(100% - 42px));
    padding-top: 0;
}

.empty-conversation {
    margin: auto 0 36px;
    text-align: center;
}

.empty-conversation h1 {
    max-width: 760px;
    margin: 0 auto 14px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.empty-conversation p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.ticket-detail {
    width: min(720px, 100%);
    margin: auto auto 24px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface-elevated);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
}

.ticket-detail[hidden] {
    display: none;
}

.ticket-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.ticket-detail-kicker {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ticket-detail h1 {
    margin: 3px 0 0;
    font-size: 28px;
}

.ticket-detail-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0 0;
}

.ticket-detail-meta div {
    min-width: 0;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-soft);
}

.ticket-detail-meta dt {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.ticket-detail-meta dd {
    margin: 5px 0 0;
    overflow: hidden;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-detail-subject {
    margin: 22px 0 8px;
    font-size: 17px;
    font-weight: 750;
}

.ticket-detail-summary {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.ticket-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.ticket-chat-button,
.ticket-portal-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.ticket-chat-button {
    border: 0;
    background: var(--primary);
    color: #ffffff;
}

.ticket-portal-button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.conversation.viewing-ticket {
    justify-content: flex-start;
}

.message-list {
    min-height: 0;
    flex: 1;
    padding: 18px 10px 30px;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
}

.message-list[hidden] {
    display: none;
}

.message-row {
    display: flex;
    margin: 0 0 22px;
}

.message-user {
    justify-content: flex-end;
}

.message-assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: min(78%, 720px);
    color: var(--text);
    font-size: 15px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.message-user .message-bubble {
    padding: 11px 15px;
    border: 1px solid var(--border);
    border-radius: 18px 18px 5px 18px;
    background: var(--surface-soft);
}

.message-assistant .message-bubble {
    padding: 5px 2px;
}

.message-bubble.is-pending {
    color: var(--muted);
}

.message-bubble.is-pending::after {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-left: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: dalila-pulse 900ms infinite alternate;
}

.message-bubble.is-error {
    color: var(--danger);
}

@keyframes dalila-pulse {
    from {
        opacity: 0.25;
        transform: translateY(0);
    }

    to {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.composer {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 12px 12px 18px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface-elevated);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.14);
}

.attachment-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 5px;
    padding-bottom: 2px;
}

.attachment-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.attachment-button:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.attachment-button:disabled {
    opacity: .4;
    cursor: default;
}

.attachment-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.camera-button {
    display: none;
}

.selected-images {
    width: min(760px, 100%);
    display: flex;
    gap: 10px;
    margin: 0 auto 10px;
    overflow-x: auto;
}

.selected-images[hidden] {
    display: none;
}

.selected-image {
    position: relative;
    width: 76px;
    height: 76px;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-elevated);
}

.selected-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selected-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(7, 11, 20, .82);
    color: #fff;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}

.conversation.has-messages .composer {
    flex: 0 0 auto;
}

.composer:focus-within {
    border-color: rgba(18, 136, 255, 0.65);
}

.composer textarea {
    width: 100%;
    min-height: 42px;
    max-height: 160px;
    resize: none;
    padding: 10px 0 7px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
}

.composer textarea::placeholder {
    color: var(--muted);
}

.send-button {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: var(--primary);
    color: #ffffff;
}

.send-button:disabled {
    opacity: 0.45;
}

.composer-caption {
    margin: 11px 0 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.is-guest .app-shell {
    pointer-events: none;
    user-select: none;
    filter: blur(5px);
    transform: scale(1.004);
}

.login-overlay,
.install-overlay {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: none;
    place-items: center;
    padding: 24px;
    overflow-y: auto;
    background: var(--overlay);
    backdrop-filter: blur(3px);
}

.login-overlay.is-visible,
.install-overlay.is-visible {
    display: grid;
}

.install-overlay {
    z-index: 70;
}

.login-card,
.install-card {
    position: relative;
    width: min(450px, 100%);
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface-elevated);
    box-shadow: var(--shadow);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.login-logo img {
    width: 188px;
    max-height: 70px;
    object-fit: contain;
}

.login-card h2,
.install-card h2 {
    margin: 0 0 8px;
    font-size: 26px;
    text-align: center;
}

.login-intro {
    margin: 0 0 24px;
    color: var(--muted);
    text-align: center;
}

.login-card label {
    display: block;
    margin: 15px 0 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.login-card input {
    width: 100%;
    height: 49px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--background);
    color: var(--text);
}

.login-card input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18, 136, 255, 0.13);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    transform: translateY(-50%);
    cursor: pointer;
}

.login-submit {
    width: 100%;
    min-height: 49px;
    margin-top: 22px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.password-recovery-link {
    display: block;
    width: fit-content;
    margin: 14px auto 0;
    color: var(--primary);
    font-size: 13px;
    font-weight: 650;
    text-align: center;
    text-decoration: none;
}

.password-recovery-link:hover,
.password-recovery-link:focus-visible {
    text-decoration: underline;
}

.login-help {
    margin: 21px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    text-align: center;
}

.login-help a {
    color: var(--primary);
}

.login-error,
.login-success {
    margin-bottom: 18px;
    padding: 11px 13px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
}

.login-error {
    background: var(--danger-bg);
    color: var(--danger);
}

.login-success {
    background: var(--success-bg);
    color: var(--success);
}

.secondary-install {
    width: 100%;
    margin-top: 16px;
    padding: 8px;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
}

.install-card {
    width: min(480px, 100%);
}

.install-card h2 {
    margin-bottom: 22px;
}

#installInstructions {
    color: var(--muted);
    line-height: 1.6;
}

#installInstructions p {
    margin: 0 0 12px;
}

#installInstructions ol {
    margin: 8px 0 0;
    padding-left: 22px;
}

@media (max-width: 760px) {
    .camera-button {
        display: grid;
    }

    .composer {
        gap: 7px;
        padding-left: 10px;
    }

    .attachment-actions {
        gap: 1px;
    }

    .attachment-button {
        width: 34px;
        height: 38px;
    }

    body {
        overflow: auto;
    }

    .app-shell,
    .sidebar-is-collapsed .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        z-index: 45;
        inset: 0 auto 0 0;
        width: min(86vw, 320px);
        display: flex;
        padding-top: max(18px, env(safe-area-inset-top));
        transform: translateX(-105%);
        transition: transform 180ms ease;
        box-shadow: var(--shadow);
    }

    .lines-section {
        flex-basis: 38%;
        max-height: 38%;
    }

    .tickets-section {
        flex-basis: 25%;
        max-height: 25%;
    }

    .mobile-sidebar-open .sidebar {
        transform: translateX(0);
    }

    .mobile-sidebar-open .sidebar-backdrop {
        position: fixed;
        z-index: 44;
        inset: 0;
        display: block;
        padding: 0;
        border: 0;
        background: var(--overlay);
    }

    .sidebar-toggle {
        display: none;
    }

    .sidebar-is-collapsed .sidebar-section {
        display: block;
    }

    .sidebar-is-collapsed .brand-image-full {
        display: block;
    }

    .sidebar-is-collapsed .brand-image-full.brand-light {
        display: none;
    }

    :root[data-theme="light"] .sidebar-is-collapsed .brand-image-full.brand-dark {
        display: none;
    }

    :root[data-theme="light"] .sidebar-is-collapsed .brand-image-full.brand-light {
        display: block;
    }

    .sidebar-is-collapsed .brand-image-symbol {
        display: none !important;
    }

    .sidebar-is-collapsed .nav-item span,
    .sidebar-is-collapsed .sidebar-caption {
        display: inline;
    }

    .sidebar-version,
    .sidebar-is-collapsed .sidebar-version {
        display: block;
    }

    .page-copyright {
        display: none;
    }

    .sidebar-is-collapsed .sidebar-header {
        flex-direction: row;
    }

    .mobile-menu-toggle {
        display: grid;
    }

    .main-content {
        min-height: 100dvh;
        max-height: 100dvh;
    }

    .topbar {
        min-height: 72px;
        justify-content: space-between;
        padding: max(12px, env(safe-area-inset-top)) 12px 10px;
    }

    .mobile-brand {
        display: block;
        margin-right: auto;
        margin-left: 8px;
    }

    .mobile-brand img {
        width: 96px;
        max-height: 45px;
        object-fit: contain;
        object-position: left center;
    }

    .install-button span {
        display: none;
    }

    .install-button {
        width: 38px;
        min-height: 38px;
        padding: 0;
    }

    .topbar-actions {
        gap: 6px;
    }

    .topbar .icon-button {
        width: 38px;
        height: 38px;
    }

    .topbar .auth-button {
        min-width: 58px;
        min-height: 38px;
        padding-inline: 10px;
    }

    .conversation {
        width: min(100% - 28px, 700px);
        min-height: calc(100dvh - 72px);
        padding-bottom: max(22px, env(safe-area-inset-bottom));
    }

    .line-context {
        max-width: 100%;
        margin-bottom: 13px;
    }

    .conversation.has-messages {
        width: min(100% - 28px, 700px);
        min-height: 0;
        height: calc(100dvh - 72px);
    }

    .ticket-detail {
        margin-top: 10px;
        padding: 20px;
    }

    .ticket-detail-meta {
        grid-template-columns: 1fr;
    }

    .ticket-detail-actions {
        flex-direction: column;
    }

    .message-list {
        padding-inline: 2px;
    }

    .message-bubble {
        max-width: 88%;
    }

    .empty-conversation {
        margin-bottom: 28px;
    }

    .empty-conversation h1 {
        font-size: clamp(27px, 8vw, 36px);
    }

    .login-overlay,
    .install-overlay {
        align-items: center;
        padding: 14px;
    }

    .login-card,
    .install-card {
        padding: 30px 22px 24px;
        border-radius: 20px;
    }
}

@media (max-height: 680px) {
    .login-overlay,
    .install-overlay {
        align-items: start;
    }
}

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