:root {
    --bg: #f7f7f8;
    --panel: #ffffff;
    --panel-soft: #f3f4f6;
    --sidebar: #1f1f1f;
    --sidebar-soft: #262626;
    --sidebar-hover: #2f2f2f;
    --sidebar-active: #353535;
    --border: #e5e7eb;
    --ink: #111827;
    --ink-soft: #6b7280;
    --ink-faint: #9ca3af;
    --accent: #111827;
    --accent-strong: #0f172a;
    --brand: #10a37f;
    --brand-strong: #0d8b6c;
    --white: #ffffff;
    --shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    font-family: "Segoe UI Variable", "Pretendard", "Noto Sans KR", sans-serif;
    background: var(--bg);
}

button,
textarea {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
}

.sidebar {
    min-height: 0;
    padding: 12px 10px 10px;
    overflow: hidden;
    background: var(--sidebar);
    color: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-top {
    display: grid;
    gap: 8px;
}

.topbar h2,
.message-body p {
    margin: 0;
}

.topbar-label {
    margin: 0 0 4px;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.48);
}

.sidebar-search input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.9rem;
}

.sidebar-search input::placeholder {
    color: rgba(255, 255, 255, 0.38);
}

.sidebar-body {
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.sidebar-group {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-group-label {
    margin: 0;
    padding: 0 6px;
    color: rgba(255, 255, 255, 0.42);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.room-list {
    min-height: 0;
    overflow-y: auto;
    display: grid;
    gap: 2px;
    padding-right: 2px;
}

.room-list-item {
    position: relative;
}

.room-item {
    width: 100%;
    padding: 10px 12px 10px 42px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    text-align: left;
    display: grid;
    gap: 4px;
}

.room-item.active {
    background: var(--sidebar-active);
}

.room-item:hover {
    background: var(--sidebar-hover);
}

.room-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 26px;
    min-width: 0;
}

.room-item-leading {
    position: absolute;
    left: 7px;
    top: 50%;
    z-index: 1;
    width: 26px;
    height: 26px;
    margin-top: -13px;
    pointer-events: none;
}

.room-item-icon {
    position: absolute;
    inset: 0;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.46);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.14s ease, color 0.14s ease;
}

.room-item-icon-svg {
    display: block;
    width: 14px;
    height: 14px;
}

.room-item-title {
    display: block;
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-item-meta {
    flex: 0 0 auto;
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.46);
}

.room-item-preview {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.48);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-delete-button {
    position: absolute;
    left: 7px;
    top: 50%;
    z-index: 2;
    width: 26px;
    height: 26px;
    margin-top: -13px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.62);
    cursor: pointer;
    opacity: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: inset 0 0 0 1px transparent;
    transform: translateX(-2px) scale(0.96);
    transition:
        opacity 0.14s ease,
        transform 0.16s ease,
        background-color 0.16s ease,
        color 0.16s ease,
        box-shadow 0.16s ease;
}

.room-delete-button:hover,
.room-delete-button:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: translateX(0) scale(1);
    outline: none;
}

.room-delete-button:active {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(0) scale(0.97);
}

.room-delete-icon {
    display: block;
    width: 14px;
    height: 14px;
}

.room-list-item:hover .room-item-icon,
.room-list-item:focus-within .room-item-icon {
    opacity: 0;
}

.room-list-item:hover .room-delete-button,
.room-list-item:focus-within .room-delete-button {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.room-list-item.active .room-delete-button {
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-footer {
    display: grid;
    gap: 8px;
}

.sidebar-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-panel-head,
.sidebar-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(16, 163, 127, 0.18);
    color: #a7f3d0;
    font-size: 0.72rem;
    font-weight: 700;
}

.neutral-pill {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.68);
}

.sidebar-stat-list {
    display: grid;
    gap: 8px;
}

.sidebar-stat-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    color: rgba(255, 255, 255, 0.64);
    font-size: 0.84rem;
}

.sidebar-stat-row strong {
    color: var(--white);
    font-size: 0.84rem;
    font-weight: 700;
    text-align: right;
    overflow-wrap: anywhere;
}

.sidebar-note {
    margin: 0;
    color: rgba(255, 255, 255, 0.54);
    line-height: 1.45;
    font-size: 0.8rem;
}

.sidebar-nav-button,
.topbar-button,
.composer-link,
.send-button {
    border: none;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.sidebar-nav-button:hover,
.topbar-button:hover,
.composer-link:hover,
.send-button:hover {
    transform: translateY(-1px);
}

.sidebar-nav-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    background: transparent;
    color: var(--white);
    font-weight: 600;
    text-align: left;
}

.sidebar-nav-icon {
    width: 16px;
    color: rgba(255, 255, 255, 0.68);
}

.primary-sidebar-button {
    background: rgba(255, 255, 255, 0.08);
}

.subtle-sidebar-button {
    justify-content: center;
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.84rem;
}

.primary-sidebar-button .sidebar-nav-icon,
.subtle-sidebar-button .sidebar-nav-icon {
    color: rgba(255, 255, 255, 0.84);
}

.main-panel {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: var(--bg);
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 28px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(247, 247, 248, 0.9);
}

.topbar-label {
    color: var(--ink-faint);
}

.topbar h2 {
    font-size: 1.1rem;
    line-height: 1.3;
}

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

.topbar-button {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--border);
    font-weight: 700;
}

.primary-topbar-button {
    background: var(--accent);
    color: var(--white);
    border-color: transparent;
}

.messages {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 24px 8px;
    display: grid;
    align-content: start;
    gap: 20px;
}

.message-row {
    width: min(860px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 14px;
}

.message-row.is-entering {
    animation: message-rise 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.message-row.user {
    grid-template-columns: minmax(0, 1fr);
    width: min(860px, 100%);
}

.message-row.user .avatar {
    display: none;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand), #14b88f);
    display: grid;
    place-items: center;
    color: var(--white);
    font-size: 0.78rem;
    font-weight: 700;
}

.avatar::before {
    content: "AI";
}

.message-row.user .message-card {
    margin-left: auto;
    max-width: min(720px, 100%);
    padding: 16px 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, #1f2937, #111827);
    color: var(--white);
    border: none;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.message-card {
    min-width: 0;
}

.message-row:not(.user) .message-card {
    padding: 4px 0;
}

.message-row.is-resolved .message-card {
    animation: message-settle 0.28s ease;
}

.message-header {
    margin-bottom: 10px;
}

.message-role {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    font-size: 0.76rem;
    font-weight: 700;
}

.message-row.user .message-role {
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.92);
}

.message-row.user .message-body {
    color: rgba(255, 255, 255, 0.96);
}

.message-body {
    line-height: 1.72;
    color: var(--ink);
    white-space: normal;
    word-break: break-word;
}

.message-body h2,
.message-body h3,
.message-body h4,
.message-body ul,
.message-body ol,
.message-body pre {
    margin-top: 14px;
    margin-bottom: 14px;
}

.message-body code {
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.16);
    font-family: "Cascadia Code", "D2Coding", Consolas, monospace;
    font-size: 0.92em;
}

.message-body del {
    color: var(--ink-faint);
    text-decoration-thickness: 1.5px;
}

.message-body a,
.source-item-detail a {
    color: #2563eb;
    text-decoration: none;
}

.message-body a:hover,
.source-item-detail a:hover {
    text-decoration: underline;
}

.message-image {
    display: block;
    max-width: min(100%, 720px);
    height: auto;
    margin: 14px 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.message-table-wrap {
    width: 100%;
    margin: 14px 0;
    overflow-x: auto;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #fff;
}

.message-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.message-table th,
.message-table td {
    padding: 11px 13px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    text-align: left;
    vertical-align: top;
    line-height: 1.55;
}

.message-table th {
    background: rgba(15, 23, 42, 0.04);
    color: var(--ink);
    font-weight: 700;
}

.message-table tbody tr:last-child td {
    border-bottom: none;
}

.message-row:not(.user) .message-body {
    font-size: 0.98rem;
}

.message-body.is-streaming {
    position: relative;
}

.typing-caret {
    display: inline-block;
    width: 0.62ch;
    height: 1.15em;
    margin-left: 2px;
    vertical-align: -0.18em;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.88;
    animation: typing-caret-blink 0.95s steps(1) infinite;
}

.loading-state {
    display: grid;
    gap: 10px;
    padding: 4px 0;
    transform-origin: left center;
    transition:
        opacity 0.18s ease,
        transform 0.22s ease,
        filter 0.22s ease;
}

.loading-state.is-state-swapping {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
    filter: blur(2px);
}

.loading-state.is-state-entering {
    animation: loading-state-enter 0.26s ease;
}

.loading-glass {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.58);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.28)),
        rgba(255, 255, 255, 0.38);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 12px 24px rgba(148, 163, 184, 0.18);
    backdrop-filter: blur(18px);
    color: #0f172a;
}

.loading-glass::before {
    content: "";
    position: absolute;
    inset: -2px;
    transform: translateX(-135%) skewX(-18deg);
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.18) 25%, rgba(255, 255, 255, 0.88) 48%, rgba(255, 255, 255, 0.18) 72%, transparent 100%);
    animation: glass-sheen 2.15s ease-in-out infinite;
}

.loading-glass strong,
.loading-copy,
.loading-dot {
    position: relative;
    z-index: 1;
}

.loading-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #10a37f, #7dd3fc);
    box-shadow: 0 0 0 6px rgba(16, 163, 127, 0.12);
    animation: loading-pulse 1.2s ease-in-out infinite;
}

.loading-copy {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
    line-height: 1.55;
}

.sources {
    margin-top: 16px;
    display: grid;
    gap: 8px;
}

.sources-title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink-soft);
}

.source-item {
    display: grid;
    gap: 10px;
    padding: 2px 0;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    outline: none;
    transition: color 0.16s ease;
}

.source-item:hover .source-item-trigger,
.source-item:focus-visible .source-item-trigger {
    color: var(--accent-strong);
}

.source-item-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 28px;
    color: var(--ink-soft);
    transition: color 0.16s ease;
}

.source-item-copy {
    min-width: 0;
}

.source-item-copy strong,
.source-item-copy span {
    display: block;
}

.source-item strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
}

.source-item strong a {
    color: inherit;
    text-decoration: none;
}

.source-item strong a:hover {
    text-decoration: underline;
}

.source-item-copy span {
    margin-top: 4px;
    color: var(--ink-soft);
    font-size: 0.8rem;
    line-height: 1.4;
}

.source-item.is-commerce {
    padding: 6px 0 4px;
}

.commerce-source-trigger {
    align-items: flex-start;
    gap: 14px;
}

.commerce-source-thumb-link {
    display: block;
    flex: 0 0 88px;
    border-radius: 18px;
    overflow: hidden;
}

.commerce-source-thumb {
    width: 88px;
    height: 88px;
    flex: 0 0 88px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.commerce-source-thumb-placeholder,
.commerce-related-thumb-placeholder {
    display: grid;
    place-items: center;
    color: var(--ink-soft);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background:
        radial-gradient(circle at top left, rgba(16, 163, 127, 0.16), transparent 55%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.06), rgba(15, 23, 42, 0.02));
}

.commerce-source-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.commerce-source-kicker {
    color: var(--accent-strong);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.commerce-source-subtitle {
    color: var(--ink-soft);
    font-size: 0.84rem;
    line-height: 1.5;
}

.commerce-source-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.commerce-source-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--ink-soft);
    font-size: 0.74rem;
    font-weight: 600;
}

.commerce-source-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.commerce-source-meta-item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    color: var(--ink-soft);
    font-size: 0.8rem;
}

.commerce-source-meta-label {
    color: var(--ink-faint);
}

.commerce-source-meta-item strong {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink);
}

.source-item-toggle {
    flex: 0 0 auto;
    color: var(--ink-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.16s ease, color 0.16s ease;
}

.source-item-chevron {
    display: block;
    width: 14px;
    height: 14px;
}

.source-item-detail {
    min-height: 0;
    overflow: hidden;
    line-height: 1.68;
}

.source-item-detail-wrap {
    display: grid;
    grid-template-rows: 0fr;
    margin-left: 2px;
    padding-left: 12px;
    border-left: 2px solid rgba(17, 24, 39, 0.08);
    opacity: 0;
    transition:
        grid-template-rows 0.24s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.18s ease,
        border-color 0.18s ease;
}

.source-item.expanded .source-item-detail-wrap {
    grid-template-rows: 1fr;
    opacity: 1;
    border-left-color: rgba(17, 24, 39, 0.16);
}

.source-item.is-commerce .source-item-detail-wrap {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
}

.source-item-detail > :first-child {
    margin-top: 0;
}

.source-item-detail > :last-child {
    margin-bottom: 0;
}

.source-item-detail .message-image {
    max-width: min(100%, 640px);
}

.commerce-related-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.commerce-related-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
}

.commerce-related-link {
    display: flex;
    width: 100%;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.commerce-related-link:hover strong {
    text-decoration: underline;
}

.commerce-related-thumb {
    width: 76px;
    height: 76px;
    flex: 0 0 76px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}

.commerce-related-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.commerce-related-copy strong {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.commerce-related-copy p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.82rem;
    line-height: 1.45;
}

.commerce-related-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 2px;
}

.commerce-related-meta span {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    color: var(--ink-soft);
    font-size: 0.76rem;
}

.commerce-related-meta em {
    font-style: normal;
    color: var(--ink-faint);
}

.commerce-related-meta strong {
    font-size: 0.78rem;
    color: var(--ink);
}

.source-item.expanded .source-item-trigger {
    color: var(--ink);
}

.source-item.expanded {
    color: var(--ink);
}

.source-item.expanded .source-item-toggle {
    color: var(--ink);
    transform: rotate(90deg);
}

.source-item:hover .source-item-toggle,
.source-item:focus-visible .source-item-toggle {
    color: var(--ink);
    transform: translateX(2px);
}

.source-item.expanded:hover .source-item-toggle,
.source-item.expanded:focus-visible .source-item-toggle {
    transform: rotate(90deg) translateY(0);
}

@keyframes message-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes message-settle {
    from {
        opacity: 0.72;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing-caret-blink {
    0%,
    46% {
        opacity: 0.9;
    }
    50%,
    100% {
        opacity: 0;
    }
}

.message-code {
    margin: 14px 0;
    padding: 14px 16px;
    overflow-x: auto;
    border-radius: 16px;
    background: #0f172a;
    color: #e5eefc;
    font-family: "Cascadia Code", "D2Coding", Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.6;
}

.message-code code {
    white-space: pre-wrap;
    word-break: break-word;
}

.code-language {
    display: inline-block;
    margin-bottom: 10px;
    color: #93c5fd;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
}

.composer {
    padding: 14px 20px 20px;
    background: linear-gradient(180deg, rgba(247, 247, 248, 0), rgba(247, 247, 248, 0.96) 24%);
}

.composer-shell {
    width: min(860px, 100%);
    margin: 0 auto;
    padding: 14px 16px 12px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: var(--shadow);
}

textarea {
    width: 100%;
    resize: none;
    min-height: 28px;
    max-height: 220px;
    padding: 4px 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.6;
}

textarea::placeholder {
    color: var(--ink-faint);
}

.composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 8px;
}

.composer-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.composer-link {
    padding: 0;
    background: transparent;
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.helper-text {
    color: var(--ink-faint);
    font-size: 0.84rem;
}

.send-button {
    min-width: 78px;
    height: 40px;
    border-radius: 14px;
    padding: 0 16px;
    background: var(--accent);
    color: var(--white);
    font-weight: 700;
}

.send-button:disabled,
.sidebar-nav-button:disabled,
.topbar-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.sync-overlay[hidden] {
    display: none;
}

.sync-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.44);
    backdrop-filter: blur(10px);
}

.sync-modal {
    width: min(420px, 100%);
    padding: 28px 24px 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(229, 231, 235, 0.9);
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
    text-align: center;
}

.sync-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 999px;
    border: 4px solid rgba(16, 163, 127, 0.14);
    border-top-color: var(--brand);
    animation: sync-spin 0.85s linear infinite;
}

.sync-label,
.sync-stage,
.sync-progress-text,
.sync-detail {
    margin: 0;
}

.sync-label {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--ink);
}

.sync-stage {
    margin-top: 8px;
    color: var(--ink-soft);
    line-height: 1.5;
    font-size: 0.92rem;
}

.sync-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.sync-metric {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.9);
}

.sync-metric-label {
    display: block;
    font-size: 0.76rem;
    color: var(--ink-soft);
}

.sync-metric-value {
    display: block;
    margin-top: 6px;
    font-size: 1rem;
    color: var(--ink);
}

.sync-detail {
    margin-top: 10px;
    color: var(--ink-soft);
    font-size: 0.84rem;
    line-height: 1.45;
}

.sync-progress-track {
    width: 100%;
    height: 10px;
    margin-top: 18px;
    border-radius: 999px;
    overflow: hidden;
    background: #e5e7eb;
}

.sync-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), #34d399);
    transition: width 0.35s ease;
}

.sync-progress-text {
    margin-top: 12px;
    color: var(--ink-soft);
    font-size: 0.86rem;
    font-weight: 700;
}

@keyframes sync-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes glass-sheen {
    0% {
        transform: translateX(-135%) skewX(-18deg);
    }
    100% {
        transform: translateX(145%) skewX(-18deg);
    }
}

@keyframes loading-pulse {
    0%,
    100% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.12);
        opacity: 1;
    }
}

@keyframes loading-state-enter {
    0% {
        opacity: 0;
        transform: translateY(4px) scale(0.985);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@media (max-width: 980px) {
    body {
        overflow: auto;
    }

    .app-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100dvh;
    }

    .sidebar {
        overflow: visible;
    }

    .main-panel {
        min-height: 75dvh;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .sidebar,
    .topbar,
    .messages,
    .composer {
        padding-left: 14px;
        padding-right: 14px;
    }

    .sidebar {
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .message-row {
        grid-template-columns: 1fr;
    }

    .avatar {
        display: none;
    }

    .composer-bar,
    .composer-meta {
        flex-direction: column;
        align-items: stretch;
    }

    .send-button {
        width: 100%;
    }
}
