﻿:root {
    --bg: #0f1115;
    --panel: #1b1d22;
    --panel-soft: #1f2229;
    --line: rgba(255, 255, 255, 0.08);
    --text: #e8eaed;
    --text-soft: #a8adb6;
    --accent: #8ab4f8;
    --accent-strong: #8ab4f8;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'IBM Plex Sans', sans-serif;
}

.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
    font-size: 19px;
    line-height: 1;
}

button,
input,
textarea,
select {
    font: inherit;
}

select {
    appearance: none;
    background-color: rgba(0, 0, 0, 0.22);
    color: var(--text);
    color-scheme: dark;
}

select option,
select optgroup {
    background: #171a20;
    color: var(--text);
}

select:focus {
    outline: none;
    border-color: rgba(138, 180, 248, 0.45);
    box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.14);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    width: 100%;
    margin: 0;
    position: relative;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 70;
}

.compact-layout {
    display: grid;
    grid-template-columns: 288px minmax(0, 1fr);
    gap: 0;
    min-height: 100vh;
}

.app-shell.is-sidebar-collapsed {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 0;
}

.left-sidebar {
    background: var(--panel);
    border: none;
    border-radius: 0;
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease, padding 0.2s ease;
}

.sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.sidebar-search-wrap {
    position: relative;
    flex: 1;
}

.sidebar-search-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-soft);
    font-size: 18px;
    pointer-events: none;
}

.sidebar-search {
    width: 100%;
    min-height: 36px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 0 10px 0 34px;
}

.sidebar-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #e8ebf0;
    letter-spacing: 0.01em;
}

.sidebar-section {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-section {
    flex: 1;
    min-height: 0;
}

.sidebar-section input,
.sidebar-section textarea,
.sidebar-section select,
.composer-form textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: 8px 10px;
}

.inline-actions {
    display: flex;
    gap: 6px;
}

.history-list {
    min-height: 160px;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    gap: 4px;
    padding-right: 2px;
}

.history-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    position: relative;
}

.history-item,
.history-empty {
    border: 1px solid transparent;
    border-radius: 18px;
    min-height: 38px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    color: var(--text-soft);
    background: transparent;
}

.history-item {
    flex: 1;
    cursor: pointer;
    text-align: left;
    min-width: 0;
}

.history-item:hover,
.history-item.is-active {
    color: var(--text);
    border-color: transparent;
    background: rgba(138, 180, 248, 0.26);
}

.history-empty {
    justify-content: center;
    font-size: 0.82rem;
}

.history-label {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.98rem;
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease;
}

.history-row:hover .history-actions,
.history-row.is-menu-open .history-actions {
    opacity: 1;
    pointer-events: auto;
}

.history-menu-button {
    display: inline-flex;
    pointer-events: auto;
}

.history-row:hover .history-menu-button,
.history-row.is-menu-open .history-menu-button,
.history-row:focus-within .history-menu-button {
    opacity: 1;
    pointer-events: auto;
}

.history-action-button {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.history-action-button .material-symbols-rounded {
    font-size: 18px;
    line-height: 1;
    display: block;
}

.history-action-button:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.history-action-button.is-pinned {
    color: #8ab4f8;
    border-color: transparent;
    background: transparent;
}

.history-menu-button {
    border-color: transparent;
    background: transparent;
    opacity: 0;
    transition: opacity 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.history-menu-button:hover {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
}

.history-menu-wrap {
    position: relative;
}

.history-menu {
    position: fixed;
    min-width: 236px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #1f232b;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.48);
    display: none;
    z-index: 120;
}

.history-menu.is-open {
    display: block;
}

.history-menu-item {
    width: 100%;
    min-height: 40px;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    border-radius: 9px;
    padding: 0 12px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-menu-item:hover {
    background: rgba(138, 180, 248, 0.2);
    color: var(--text);
}

.history-menu-item .material-symbols-rounded {
    font-size: 19px;
}

.history-menu-item.is-danger {
    color: #f28b82;
}

.history-menu-item.is-danger:hover {
    color: #ffd1cc;
    background: rgba(242, 139, 130, 0.14);
}

.wide {
    flex: 1 1 0;
}

.new-chat-button {
    width: 100%;
    border-radius: 18px;
    justify-content: flex-start;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.new-chat-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.new-chat-label {
    font-size: 0.95rem;
}

.icon-compact {
    min-height: 40px;
    border-radius: 50%;
    padding: 0;
    font-size: 0.78rem;
    width: 40px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle {
    border: none !important;
    background: transparent !important;
    border-radius: 50% !important;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12) !important;
}

.toolbar-button,
.ghost-button,
.icon-button,
.action-button,
#send-button {
    border: 1px solid var(--line);
    border-radius: 999px;
    min-height: 36px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    cursor: pointer;
}

.toolbar-button,
.action-button.primary,
#send-button {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.sidebar-foot {
    margin-top: auto;
    padding-top: 8px;
    position: relative;
}

.sidebar-settings-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    border-radius: 18px;
    border: none;
    background: transparent;
    color: #d2d6dd;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.sidebar-settings-btn:hover {
    background: rgba(138, 180, 248, 0.18);
    color: var(--text);
}

.sidebar-settings-label {
    font-size: 0.93rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-shell.is-sidebar-collapsed .sidebar-settings-label {
    display: none;
}

.app-shell.is-sidebar-collapsed .sidebar-settings-btn {
    justify-content: center;
    padding: 0;
    width: 38px;
    min-width: 38px;
    height: 38px;
    align-self: center;
}

.sidebar-settings-menu {
    display: none;
    margin-top: 6px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #20242c;
    overflow: hidden;
}

.sidebar-settings-menu.is-open {
    display: block;
}

.sidebar-settings-item {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 0 10px;
    color: var(--text-soft);
    font-size: 0.9rem;
}

.sidebar-settings-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

.main-shell {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    padding: 0 16px 10px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 2px 4px;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
}

.mobile-sidebar-toggle {
    display: none;
}

.topbar-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #e8eaed;
    font-size: 1.75rem;
}

.app-shell.is-sidebar-collapsed .left-sidebar {
    padding: 10px 8px;
    overflow: hidden;
}

.app-shell.is-sidebar-collapsed .sidebar-search-wrap,
.app-shell.is-sidebar-collapsed .history-section {
    display: none;
}

.app-shell.is-sidebar-collapsed .sidebar-brand-row {
    justify-content: center;
}

.app-shell.is-sidebar-collapsed .new-chat-button {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
    align-self: center;
}

.app-shell.is-sidebar-collapsed .new-chat-label {
    display: none;
}

.app-shell.is-sidebar-collapsed .sidebar-settings-menu {
    display: none !important;
}

.topbar .status-strip {
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.topbar-icon-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    color: #c6cad2;
}

.topbar-icon-btn .material-symbols-rounded {
    font-size: 20px;
    line-height: 1;
    display: block;
}

.topbar-icon-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--text);
}

#toggle-side-panel {
    display: none !important;
}

.compact-topbar {
    min-height: 44px;
}

.status-strip {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.status-pill {
    min-height: 24px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-soft);
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    font-size: 0.76rem;
}

.status-pill--hidden {
    display: none;
}

.user-menu-wrap,
.tool-menu-wrap {
    position: relative;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(122, 162, 255, 0.45);
    background: rgba(122, 162, 255, 0.2);
    color: var(--text);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.user-menu,
.tool-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: #2a2d35;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    padding: 10px;
    display: none;
    z-index: 50;
}

.tool-menu {
    left: 0;
    right: auto;
    min-width: 180px;
    top: auto;
    bottom: calc(100% + 10px);
}

.plus-toggle {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 8px;
    border-color: transparent;
    background: transparent;
    font-size: 1.1rem;
    line-height: 1;
}

.plus-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.tool-label-inline {
    font-size: 0.98rem;
    color: #d3d7de;
}

.tool-menu-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.user-meta {
    display: grid;
    gap: 6px;
    padding: 4px 4px 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
}

.user-meta label {
    font-size: 0.74rem;
    color: var(--text-soft);
}

.user-meta input {
    width: 100%;
    min-height: 30px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 0 8px;
}

.user-meta input[readonly] {
    color: #dbe4ff;
    background: rgba(122, 162, 255, 0.14);
}

.user-menu.is-open,
.tool-menu.is-open {
    display: block;
}

.user-menu-item,
.tool-menu-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    border-radius: 10px;
    min-height: 36px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    text-align: left;
    cursor: pointer;
    font-size: 0.92rem;
}

.tool-menu-item .material-symbols-rounded {
    font-size: 20px;
    margin-right: 10px;
    color: #d0d3da;
}

.user-menu-item.active,
.user-menu-item:hover,
.tool-menu-item:hover {
    background: rgba(138, 180, 248, 0.18);
    color: var(--text);
}

.chat-stage {
    min-height: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: hidden;
}

.hero-block {
    max-width: 760px;
    margin: 24px auto 10px;
    padding: 0 6px;
}

.hero-greeting {
    margin: 0;
    color: #c4c7c5;
    font-size: 1.95rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
}

.hero-title {
    margin: 2px 0 0;
    font-size: clamp(2.2rem, 4.5vw, 3.4rem);
    line-height: 1.08;
    font-weight: 500;
    color: #e8eaed;
}

.terms-card {
    position: relative;
    max-width: 760px;
    margin: 12px auto 18px;
    padding: 20px 24px 18px;
    background: #1d2025;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 26px;
}

.terms-card h2 {
    margin: 0 34px 6px 0;
    font-size: 2rem;
    line-height: 1.15;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    color: #e8eaed;
}

.terms-card h2 span {
    color: #b699ff;
}

.terms-subtitle {
    margin: 0 0 8px;
    color: #c4c7c5;
    font-weight: 500;
}

.terms-card p {
    margin: 0;
    color: #d1d4da;
    font-size: 0.95rem;
    line-height: 1.45;
}

.terms-card a {
    color: #a8c7fa;
    text-decoration: underline;
}

.terms-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #d0d4da;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}

.terms-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.main-shell.is-empty .chat-stage {
    display: grid;
    align-content: center;
}

.chat-log {
    height: 100%;
    overflow-y: auto;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 18px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-bubble {
    display: flex;
}

.chat-bubble.user {
    justify-content: flex-end;
}

.chat-bubble.ai {
    justify-content: flex-start;
}

.chat-bubble p,
.chat-bubble .bubble-content {
    margin: 0;
    max-width: 78%;
    padding: 12px 14px;
    border-radius: 16px;
    line-height: 1.45;
    word-break: break-word;
}

.chat-bubble .bubble-content {
    overflow-x: auto;
}

.chat-bubble.user p,
.chat-bubble.user .bubble-content {
    background: #2d313d;
    border: 1px solid rgba(255, 255, 255, 0.15);
    white-space: pre-wrap;
}

.chat-bubble.ai p,
.chat-bubble.ai .bubble-content {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.chat-bubble .bubble-content > :first-child {
    margin-top: 0;
}

.chat-bubble .bubble-content > :last-child {
    margin-bottom: 0;
}

.chat-bubble .bubble-content p,
.chat-bubble .bubble-content ul,
.chat-bubble .bubble-content ol,
.chat-bubble .bubble-content blockquote,
.chat-bubble .bubble-content pre,
.chat-bubble .bubble-content h1,
.chat-bubble .bubble-content h2,
.chat-bubble .bubble-content h3 {
    margin: 0 0 10px;
}

.chat-bubble .bubble-content ul,
.chat-bubble .bubble-content ol {
    padding-left: 20px;
}

.chat-bubble .bubble-content .bubble-list {
    margin: 0 0 10px;
    padding-left: 24px;
}

.chat-bubble .bubble-content .bubble-list li {
    padding-left: 4px;
}

.chat-bubble .bubble-content li + li {
    margin-top: 4px;
}

.chat-bubble .bubble-content .bubble-list li + li {
    margin-top: 8px;
}

.chat-bubble .bubble-content .bubble-list li::marker {
    color: #8ec9ff;
    font-weight: 600;
}

.chat-bubble.user .bubble-content .bubble-list li::marker {
    color: rgba(255, 255, 255, 0.92);
}

.chat-bubble .bubble-content .bubble-list li p {
    margin: 0;
}

.chat-bubble .bubble-content .bubble-list li p + p {
    margin-top: 6px;
}

.chat-bubble .bubble-content .bubble-list-detail {
    color: #c9d5e7;
    font-size: 0.93rem;
    line-height: 1.45;
}

.chat-bubble .bubble-content blockquote {
    padding-left: 12px;
    border-left: 3px solid rgba(138, 198, 255, 0.45);
    color: rgba(255, 255, 255, 0.82);
}

.chat-bubble .bubble-content pre {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(7, 10, 15, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
}

.chat-bubble .bubble-content code {
    padding: 0.1em 0.35em;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    font-family: Consolas, 'SFMono-Regular', 'Courier New', monospace;
    font-size: 0.92em;
}

.chat-bubble .bubble-content pre code {
    padding: 0;
    background: transparent;
}

.chat-bubble .bubble-content a {
    color: #8ec9ff;
    text-decoration: underline;
}

.chat-bubble.user .bubble-content a {
    color: #ffffff;
}

.chat-bubble .bubble-content h1,
.chat-bubble .bubble-content h2,
.chat-bubble .bubble-content h3 {
    line-height: 1.3;
}

.chat-bubble .bubble-content h1 {
    font-size: 1.08rem;
}

.chat-bubble .bubble-content h2 {
    font-size: 1rem;
}

.chat-bubble .bubble-content h3 {
    font-size: 0.96rem;
}

.chat-bubble .bubble-table-wrap {
    overflow-x: auto;
    margin-bottom: 10px;
}

.chat-bubble .bubble-content table {
    width: 100%;
    min-width: 360px;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.chat-bubble .bubble-content th,
.chat-bubble .bubble-content td {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
    vertical-align: top;
}

.chat-bubble .bubble-content th {
    background: rgba(138, 198, 255, 0.12);
    font-weight: 600;
}

.orchestration-brief-card {
    position: relative;
    width: 100%;
    padding: 16px 18px;
    border-radius: 24px;
    border: 1px solid rgba(168, 199, 250, 0.18);
    background:
        radial-gradient(circle at top right, rgba(168, 199, 250, 0.16), transparent 36%),
        linear-gradient(145deg, rgba(30, 35, 45, 0.98), rgba(17, 21, 28, 0.96));
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.orchestration-brief-card::after {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0));
    opacity: 0.6;
}

.orchestration-brief-card[data-state="success"] {
    border-color: rgba(101, 214, 173, 0.24);
}

.orchestration-brief-card[data-state="warning"] {
    border-color: rgba(245, 197, 66, 0.28);
}

.orchestration-brief-card[data-state="error"] {
    border-color: rgba(255, 109, 109, 0.28);
}

.orchestration-brief-card.is-compact {
    padding: 14px;
    border-radius: 18px;
    box-shadow: none;
}

.orchestration-brief-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.orchestration-kicker {
    margin: 0 0 4px;
    font-size: 0.68rem;
    line-height: 1.2;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #8fa7cf;
}

.orchestration-brief-title {
    margin: 0;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: #eff2fa;
}

.orchestration-status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.08);
    color: #eef2fa;
    font-size: 0.78rem;
    white-space: nowrap;
}

.orchestration-status-chip.is-thinking {
    background: rgba(138, 180, 248, 0.16);
    border-color: rgba(138, 180, 248, 0.26);
    color: #bfd3ff;
}

.orchestration-status-chip.is-active {
    background: rgba(117, 137, 255, 0.18);
    border-color: rgba(117, 137, 255, 0.3);
    color: #d3dbff;
}

.orchestration-status-chip.is-success {
    background: rgba(101, 214, 173, 0.16);
    border-color: rgba(101, 214, 173, 0.28);
    color: #d4fbe9;
}

.orchestration-status-chip.is-warning {
    background: rgba(245, 197, 66, 0.18);
    border-color: rgba(245, 197, 66, 0.3);
    color: #ffe9a8;
}

.orchestration-status-chip.is-error {
    background: rgba(255, 109, 109, 0.16);
    border-color: rgba(255, 109, 109, 0.28);
    color: #ffd5d5;
}

.orchestration-request {
    margin: 12px 0 0;
    color: #eef2fa;
    font-size: 0.94rem;
    line-height: 1.45;
}

.orchestration-meta-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.orchestration-detail {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    display: grid;
    gap: 4px;
}

.orchestration-detail-label {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #98a0ad;
}

.orchestration-detail-value {
    color: #f3f6fc;
    font-size: 0.86rem;
    font-weight: 600;
}

.orchestration-section {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.orchestration-section-label {
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8fa7cf;
}

.orchestration-step-list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 6px;
    color: #d6dce8;
    font-size: 0.88rem;
}

.orchestration-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.orchestration-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.06);
    color: #eff2fa;
    font-size: 0.78rem;
}

.orchestration-chip.is-skill {
    background: rgba(138, 180, 248, 0.14);
    border-color: rgba(138, 180, 248, 0.24);
    color: #d7e4ff;
}

.orchestration-chip.is-tool {
    background: rgba(181, 146, 255, 0.14);
    border-color: rgba(181, 146, 255, 0.24);
    color: #efe2ff;
}

.orchestration-chip.is-warning,
.orchestration-chip.is-risk-medium {
    background: rgba(245, 197, 66, 0.16);
    border-color: rgba(245, 197, 66, 0.26);
    color: #ffe7a4;
}

.orchestration-chip.is-risk-high,
.orchestration-chip.is-risk-critical {
    background: rgba(255, 109, 109, 0.15);
    border-color: rgba(255, 109, 109, 0.28);
    color: #ffd5d5;
}

.orchestration-chip.is-risk-low {
    background: rgba(101, 214, 173, 0.13);
    border-color: rgba(101, 214, 173, 0.24);
    color: #d3f5e8;
}

.orchestration-task-list {
    display: grid;
    gap: 8px;
}

.orchestration-task-card {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.orchestration-task-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.orchestration-task-title {
    color: #f3f6fc;
    font-size: 0.86rem;
    line-height: 1.35;
}

.orchestration-task-meta {
    margin-top: 6px;
    color: #aab1bd;
    font-size: 0.76rem;
}

.orchestration-note {
    margin: 12px 0 0;
    color: #b9c1cd;
    font-size: 0.84rem;
    line-height: 1.45;
}

.composer-shell {
    background: #1f2228;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    padding: 10px;
    width: min(920px, calc(100% - 16px));
    margin: 0 auto 8px;
    display: grid;
    gap: 6px;
}

.main-shell.is-empty .composer-shell {
    width: min(920px, calc(100% - 16px));
}

.plus-toggle .material-symbols-rounded,
.history-action-button .material-symbols-rounded,
.new-chat-icon.material-symbols-rounded,
.sidebar-toggle .material-symbols-rounded {
    font-size: 19px;
}

.compact-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.composer-wake-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border-color: transparent;
    background: transparent;
}

.lang-toggle-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border-color: transparent;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s;
    box-sizing: border-box;
}

.lang-toggle-btn:hover {
    background: rgba(255,255,255,0.08);
}

.voice-lang-picker {
    display: inline-flex;
    align-items: center;
}

.topbar-lang-picker {
    display: inline-flex;
    align-items: center;
}

.lang-select {
    height: 32px;
    min-width: 88px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(10, 13, 22, 0.9);
    color: var(--text);
    padding: 0 8px;
    font-size: 12px;
    font-family: 'IBM Plex Sans', sans-serif;
}

.lang-select:focus {
    outline: none;
    border-color: rgba(66, 133, 244, 0.8);
}

.composer-wake-btn:hover {
    background: rgba(255,255,255,0.08);
}

.composer-wake-btn.is-active {
    color: #ea4335;
    background: rgba(234,67,53,0.12);
}

.voice-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-soft);
    font-size: 0.82rem;
}

.voice-switch input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-strong);
}

.composer-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.composer-form textarea {
    flex: 1;
    min-height: 54px;
    max-height: 140px;
    resize: none;
    border-radius: 16px;
    font-size: 1.15rem;
    line-height: 1.35;
}

.composer-disclaimer {
    margin: 2px 0 0;
    text-align: center;
    color: #aab0b9;
    font-size: 0.76rem;
}

.composer-wake-btn::before {
    content: 'Nhanh';
    font-size: 0.95rem;
    color: #d5d9e1;
    margin-right: 6px;
}

.composer-action-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-soft);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.composer-action-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--text);
}

.composer-send-btn {
    background: var(--accent);
    color: #0f1115;
}

.composer-send-btn:hover {
    background: #a8c7fa;
    color: #0f1115;
}

.composer-action-btn.is-listening {
    background: rgba(234, 67, 53, 0.2);
    color: #ea4335;
    animation: pulse-mic 1.2s infinite;
}

@keyframes pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234,67,53,0.3); }
    50% { box-shadow: 0 0 0 6px rgba(234,67,53,0); }
}

.side-panel {
    position: fixed;
    top: 8px;
    right: 8px;
    bottom: 8px;
    width: min(390px, calc(100vw - 16px));
    background: #20242d;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    transform: translateX(calc(100% + 16px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.drawer-group {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    display: grid;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.side-panel.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.section-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.section-heading--sub {
    margin-top: 2px;
}

.agent-brief-dock {
    display: grid;
    gap: 8px;
}

.agent-brief-placeholder {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.agent-brief-placeholder-title {
    display: block;
    color: #eef2fa;
    font-size: 0.92rem;
}

.agent-brief-placeholder-copy {
    margin: 8px 0 0;
    color: #b3bbc8;
    font-size: 0.82rem;
    line-height: 1.45;
}

.file-list,
.image-results,
.debug-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.file-list {
    min-height: 60px;
    max-height: 180px;
    overflow-y: auto;
    padding: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 6px;
    font-size: 0.82rem;
}

.file-item input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent-strong);
}

.image-results {
    min-height: 80px;
    max-height: 260px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
}

.image-card {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.image-card img {
    width: 100%;
    height: 82px;
    object-fit: cover;
}

.image-card span {
    display: block;
    padding: 6px;
    font-size: 0.75rem;
    color: var(--text-soft);
}

.chat-image-gallery {
    width: min(760px, calc(100% - 8px));
    margin: 2px auto 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.chat-image-gallery .image-card {
    background: rgba(255, 255, 255, 0.03);
}

.chat-image-gallery .image-card img {
    height: 110px;
}

.settings-page-shell {
    min-height: 100vh;
    padding: 24px;
    max-width: 1320px;
    margin: 0 auto;
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 16px;
}

.settings-column {
    display: grid;
    gap: 14px;
    align-content: start;
}

.settings-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    padding: 14px;
    display: grid;
    gap: 10px;
}

.brand-block h1 {
    margin: 4px 0;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.5rem, 2.4vw, 2.2rem);
}

.brand-block p {
    margin: 0;
    color: var(--text-soft);
}

.top-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    color: var(--text-soft);
}

.nav-link.active,
.nav-link:hover {
    color: var(--text);
    border-color: rgba(138, 180, 248, 0.42);
    background: rgba(138, 180, 248, 0.16);
}

.form-group {
    display: grid;
    gap: 6px;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-soft);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: 9px 10px;
}

.voice-output-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    color: var(--text);
}

.voice-output-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-strong);
}

.output-box {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
    min-height: 120px;
    max-height: 260px;
    overflow: auto;
    padding: 10px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.82rem;
    line-height: 1.45;
}

.helper-copy {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.9rem;
    line-height: 1.45;
}

@media (max-width: 1024px) {
    .settings-page-shell {
        padding: 12px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.debug-box {
    flex: 0 0 auto;
    min-height: 140px;
    max-height: 220px;
    overflow-y: auto;
    padding: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #8ef19a;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.75rem;
}

@media (max-width: 980px) {
    .compact-layout {
        grid-template-columns: 1fr;
    }

    .mobile-sidebar-toggle {
        display: inline-flex;
    }

    .left-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 360px);
        z-index: 90;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        padding-top: 14px;
    }

    .app-shell:not(.is-sidebar-collapsed) .left-sidebar {
        transform: translateX(0);
    }

    .app-shell:not(.is-sidebar-collapsed) .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .app-shell.is-sidebar-collapsed .left-sidebar {
        transform: translateX(-100%);
    }

    .main-shell {
        min-height: 100vh;
        padding: 0 10px 12px;
    }

    .topbar {
        min-height: 56px;
        padding: 8px 0;
    }

    .topbar-logo {
        font-size: 2rem;
    }

    .topbar-actions {
        margin-left: auto;
    }

    .hero-block {
        margin-top: 16px;
    }

    .hero-greeting {
        font-size: 2.2rem;
    }

    .hero-title {
        font-size: clamp(2.2rem, 9vw, 3.2rem);
    }

    .terms-card {
        margin-inline: 0;
        border-radius: 24px;
    }

    .terms-card h2 {
        font-size: 1.7rem;
    }

    .chat-log {
        padding: 10px 2px;
    }

    .orchestration-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .orchestration-brief-head {
        flex-direction: column;
    }

    .composer-shell {
        margin-top: 6px;
        border-radius: 30px;
    }

    .tool-menu {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 92px;
        top: auto;
        min-width: 0;
        border-radius: 18px;
        padding: 8px;
        background: #1f2228;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
        z-index: 95;
    }

    .tool-menu-item {
        min-height: 44px;
        border-radius: 10px;
        font-size: 1rem;
    }

    .side-panel {
        width: min(96vw, 420px);
        top: auto;
        bottom: 8px;
        height: min(54vh, 420px);
        border-radius: 18px;
    }
}

@media (max-width: 640px) {
    .orchestration-brief-card {
        padding: 14px;
        border-radius: 20px;
    }

    .orchestration-meta-grid {
        grid-template-columns: 1fr;
    }

    .orchestration-status-chip {
        white-space: normal;
    }
}

/* Transcript Review Modal Styles */
.transcript-review-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1000;
}

.transcript-review-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.transcript-review-content {
    background: var(--panel);
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.transcript-review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.transcript-review-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.transcript-review-header .icon-button {
    margin-left: auto;
}

.transcript-review-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.transcript-review-label {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.transcript-review-display {
    padding: 12px 14px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
}

.transcript-review-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    max-height: 200px;
}

.transcript-review-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(138, 180, 248, 0.2);
}

.transcript-review-footer {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--line);
    justify-content: flex-end;
}

.transcript-review-footer button {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.transcript-review-footer .ghost-button {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text-soft);
}

.transcript-review-footer .ghost-button:hover {
    background: var(--panel-soft);
    color: var(--text);
}

.transcript-review-footer .primary-button {
    background: var(--accent);
    border: none;
    color: var(--bg);
    font-weight: 600;
}

.transcript-review-footer .primary-button:hover {
    background: #9bc4f8;
    transform: translateY(-1px);
}

.transcript-review-footer .primary-button:active {
    transform: translateY(0);
    opacity: 0.9;
}

@media (max-width: 640px) {
    .transcript-review-modal {
        width: 95%;
    }
    
    .transcript-review-footer {
        flex-direction: column-reverse;
    }
    
    .transcript-review-footer button {
        width: 100%;
    }
}
