:root {
  --ink: #172033;
  --muted: #718097;
  --line: #e8ecf2;
  --surface: #ffffff;
  --canvas: #f7f8fb;
  --navy: #0b1220;
  --navy-soft: #152238;
  --purple: #7c5cff;
  --purple-dark: #6847ed;
  --purple-soft: #f0edff;
  --green: #1ca67a;
  --green-soft: #e8f8f1;
  --amber: #d38b28;
  --amber-soft: #fff5e3;
  --red: #d35d68;
  --red-soft: #ffedf0;
  --shadow: 0 12px 32px rgba(24, 37, 60, 0.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
/* O layout principal usa display flex; preserve o comportamento do atributo hidden. */
.app-shell[hidden], .login-screen[hidden] { display: none !important; }
button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(124, 92, 255, .35); outline-offset: 2px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 254px; flex: 0 0 254px; display: flex; flex-direction: column; padding: 27px 16px 18px; color: #cad4e7; background: var(--navy); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 30px; color: white; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: white; font-size: 18px; font-weight: 800; background: linear-gradient(145deg, #967eff, #6648ec); box-shadow: 0 7px 15px rgba(124, 92, 255, .35); }
.brand strong { display: block; font-size: 17px; letter-spacing: .5px; }
.brand span { display: block; margin-top: 2px; color: #7e8da8; font-size: 10px; letter-spacing: .1px; }
.eyebrow { color: #8a98af; font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.workspace-switcher { padding: 0 8px 25px; border-bottom: 1px solid rgba(255,255,255,.08); }
.workspace-switcher .eyebrow { display: block; margin-bottom: 9px; }
.workspace-button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 7px; border: 1px solid rgba(255,255,255,.1); border-radius: 9px; color: #e5eaff; text-align: left; background: rgba(255,255,255,.05); cursor: pointer; }
.workspace-avatar { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; color: #d6ceff; font-size: 9px; font-weight: 800; background: rgba(124,92,255,.28); }
.workspace-name { overflow: hidden; flex: 1; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: #8c98ad; font-size: 14px; }
.nav-list { display: grid; gap: 4px; padding: 24px 0; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 11px; border: 0; border-radius: 8px; color: #92a0b9; font-size: 12px; text-align: left; background: transparent; cursor: pointer; transition: background .18s, color .18s; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.is-active { color: #fff; background: linear-gradient(90deg, rgba(124,92,255,.24), rgba(124,92,255,.08)); box-shadow: inset 3px 0 0 var(--purple); }
.nav-icon { display: grid; place-items: center; width: 18px; color: #9eace4; font-size: 17px; }
.nav-count { margin-left: auto; padding: 2px 7px; border-radius: 9px; color: #d6ceff; font-size: 10px; background: rgba(124,92,255,.25); }
.status-dot { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: #35d29b; box-shadow: 0 0 0 3px rgba(53,210,155,.12); }
.sidebar-footer { margin-top: auto; }
.user-card { display: flex; align-items: center; gap: 9px; margin: 15px 5px 0; padding: 14px 7px 0; border-top: 1px solid rgba(255,255,255,.08); }
.user-avatar { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; border-radius: 50%; color: #fff; font-size: 9px; font-weight: 800; background: linear-gradient(145deg, #e49b63, #9f5d4f); }
.user-avatar.small { width: 27px; height: 27px; flex-basis: 27px; }
.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { color: #e6ebf7; font-size: 11px; }
.user-meta span { margin-top: 2px; color: #74829a; font-size: 10px; }
.more-button { border: 0; color: #8896ad; background: transparent; cursor: pointer; }

.main-content { min-width: 0; flex: 1; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 76px; padding: 0 46px; border-bottom: 1px solid var(--line); background: var(--surface); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: #9aa6b7; font-size: 12px; }
.breadcrumbs strong { color: var(--ink); font-weight: 700; }
.breadcrumb-separator { color: #cad0db; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.menu-button { display: none; padding: 5px; border: 0; color: #66748a; font-size: 20px; background: transparent; cursor: pointer; }
.icon-button, .profile-chip { border: 0; color: #6e7b90; background: transparent; cursor: pointer; }
.icon-button { position: relative; padding: 5px; font-size: 22px; line-height: 1; }
.notification-button span { position: absolute; top: 1px; right: 1px; width: 6px; height: 6px; border: 1px solid white; border-radius: 50%; background: var(--red); }
.topbar-divider { width: 1px; height: 22px; background: var(--line); }
.profile-chip { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.mobile-brand { display: none; align-items: center; gap: 7px; color: var(--ink); }
.mobile-brand .brand-mark { width: 27px; height: 27px; border-radius: 8px; font-size: 14px; }
.content-wrap { max-width: 1380px; margin: 0 auto; padding: 38px 46px 60px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.page-heading .eyebrow { display: block; margin-bottom: 8px; color: #9aa6b7; letter-spacing: .05em; }
h1 { margin: 0; color: var(--ink); font-size: 27px; letter-spacing: -.045em; }
.wave { display: inline-block; margin-left: 3px; color: #f5b74c; font-size: 20px; transform: rotate(-10deg); }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.primary-button { display: inline-flex; align-items: center; gap: 8px; padding: 10px 15px; border: 0; border-radius: 8px; color: white; font-size: 12px; font-weight: 700; background: var(--purple); box-shadow: 0 8px 16px rgba(124,92,255,.18); cursor: pointer; transition: transform .18s, background .18s; }
.primary-button:hover { background: var(--purple-dark); transform: translateY(-1px); }
.primary-button span { font-size: 17px; line-height: 0; }

.dashboard-grid { display: grid; gap: 19px; }
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.metric-card { position: relative; min-height: 124px; padding: 18px 18px 15px; overflow: hidden; }
.metric-card::after { position: absolute; right: -15px; bottom: -28px; width: 92px; height: 92px; border-radius: 50%; background: var(--purple-soft); content: ""; }
.metric-card.green::after { background: var(--green-soft); }
.metric-card.amber::after { background: var(--amber-soft); }
.metric-card.red::after { background: var(--red-soft); }
.metric-top { display: flex; align-items: center; justify-content: space-between; }
.metric-label { color: #8490a3; font-size: 11px; font-weight: 700; }
.metric-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--purple); font-size: 15px; background: var(--purple-soft); }
.metric-card.green .metric-icon { color: var(--green); background: var(--green-soft); }
.metric-card.amber .metric-icon { color: var(--amber); background: var(--amber-soft); }
.metric-card.red .metric-icon { color: var(--red); background: var(--red-soft); }
.metric-value { position: relative; z-index: 1; margin-top: 11px; color: var(--ink); font-size: 27px; font-weight: 800; letter-spacing: -.06em; }
.metric-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 5px; margin-top: 3px; color: #8995a7; font-size: 10px; }
.trend-up { color: var(--green); font-weight: 800; }
.trend-down { color: var(--red); font-weight: 800; }

.two-column { grid-template-columns: minmax(0, 1.28fr) minmax(340px, .72fr); margin-top: 20px; }
.panel { min-width: 0; padding: 20px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-title { margin: 0; color: var(--ink); font-size: 14px; letter-spacing: -.02em; }
.panel-subtitle { margin: 5px 0 0; color: #95a0b0; font-size: 10px; }
.text-button { border: 0; color: var(--purple); font-size: 11px; font-weight: 800; background: transparent; cursor: pointer; }
.activity-list { display: grid; gap: 0; }
.activity-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid #f0f2f6; }
.activity-row:first-child { padding-top: 0; border-top: 0; }
.activity-avatar { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: var(--purple); font-size: 13px; background: var(--purple-soft); }
.activity-avatar.green { color: var(--green); background: var(--green-soft); }
.activity-avatar.amber { color: var(--amber); background: var(--amber-soft); }
.activity-text strong, .activity-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-text strong { color: #33405a; font-size: 11px; }
.activity-text span { margin-top: 3px; color: #8c98a9; font-size: 10px; }
.activity-time { color: #9ba6b6; font-size: 10px; white-space: nowrap; }

.health-list { display: grid; gap: 12px; }
.health-row { display: flex; align-items: center; gap: 10px; }
.health-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--green); background: var(--green-soft); }
.health-copy { flex: 1; }
.health-copy strong { display: block; color: #354159; font-size: 11px; }
.health-copy span { display: block; margin-top: 3px; color: #919cab; font-size: 10px; }
.health-status { display: flex; align-items: center; gap: 5px; color: var(--green); font-size: 10px; font-weight: 800; }
.health-status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.health-status.warning { color: var(--amber); }
.health-status.error { color: var(--red); }
.health-summary { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid #f0f2f6; color: #7d899c; font-size: 10px; }
.health-summary strong { color: var(--green); }

.table-panel { margin-top: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 0 12px 12px; color: #9aa5b6; font-size: 10px; font-weight: 800; text-align: left; text-transform: uppercase; letter-spacing: .06em; }
td { padding: 13px 12px; border-top: 1px solid #f0f2f6; color: #59667b; font-size: 11px; white-space: nowrap; }
td:first-child, th:first-child { padding-left: 0; }
.customer-cell { display: flex; align-items: center; gap: 9px; color: #33405a; font-weight: 700; }
.customer-mini { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: #6251c9; font-size: 9px; background: #eeeaff; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 6px; font-size: 9px; font-weight: 800; }
.badge.green { color: var(--green); background: var(--green-soft); }
.badge.amber { color: var(--amber); background: var(--amber-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.purple { color: var(--purple); background: var(--purple-soft); }

.view-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.view-grid .panel { min-height: 180px; }
.empty-state { padding: 40px 20px; color: #8d99aa; font-size: 12px; text-align: center; }
.view-intro { margin-bottom: 20px; }
.view-intro h2 { margin: 0; font-size: 20px; letter-spacing: -.04em; }
.view-intro p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.simple-list { display: grid; gap: 10px; }
.simple-list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid #eff1f5; border-radius: 8px; }
.simple-list-item strong { display: block; color: #354159; font-size: 11px; }
.simple-list-item span { display: block; margin-top: 3px; color: #919cab; font-size: 10px; }

.toast { position: fixed; right: 25px; bottom: 25px; z-index: 10; max-width: 320px; padding: 12px 15px; border-radius: 9px; color: white; font-size: 11px; background: var(--navy); box-shadow: 0 12px 30px rgba(11,18,32,.25); opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

.support-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.support-toolbar > div { display: flex; align-items: center; gap: 10px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 7px; color: var(--green); font-size: 10px; font-weight: 800; background: var(--green-soft); }
.live-pill span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(28,166,122,.12); }
.support-caption { color: #8995a7; font-size: 11px; }
.secondary-button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: #6e7b90; font-size: 11px; font-weight: 700; background: var(--surface); cursor: pointer; }
.secondary-button:hover { border-color: #cbc5ff; color: var(--purple); }
.support-layout { display: grid; grid-template-columns: minmax(230px, .74fr) minmax(360px, 1.2fr) minmax(250px, .82fr); gap: 16px; min-width: 0; }
.support-layout > .panel { min-height: 620px; padding: 17px; }
.queue-header { margin-bottom: 14px; }
.queue-count { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; color: var(--purple); font-size: 10px; font-weight: 800; background: var(--purple-soft); }
.search-field { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; color: #99a4b3; background: #fbfcfe; }
.search-field input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); font-size: 11px; background: transparent; }
.search-field input::placeholder { color: #aab3c0; }
.conversation-list { display: grid; gap: 4px; margin-top: 12px; }
.conversation-item { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 9px; width: 100%; padding: 11px 8px; border: 0; border-radius: 8px; text-align: left; background: transparent; cursor: pointer; }
.conversation-item:hover { background: #f7f8fc; }
.conversation-item.is-selected { background: var(--purple-soft); box-shadow: inset 3px 0 0 var(--purple); }
.customer-avatar { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: #6251c9; font-size: 9px; font-weight: 800; background: #eeeaff; }
.customer-avatar.large { width: 36px; height: 36px; border-radius: 11px; font-size: 11px; }
.conversation-copy { min-width: 0; }
.conversation-copy strong, .conversation-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy strong { color: #354159; font-size: 11px; }
.conversation-copy span { margin-top: 4px; color: #8e9aaa; font-size: 9px; }
.conversation-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.conversation-meta small { color: #9da7b5; font-size: 9px; white-space: nowrap; }
.mini-status { width: 6px; height: 6px; border-radius: 50%; background: var(--purple); }
.mini-status.green { background: var(--green); }
.mini-status.amber { background: var(--amber); }
.thread-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid #f0f2f6; }
.thread-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.thread-person h2 { overflow: hidden; margin: 0; color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.thread-person p { margin: 4px 0 0; color: #95a0af; font-size: 10px; }
.thread-actions { display: flex; align-items: center; gap: 8px; }
.thread-actions .icon-button { padding: 0 2px; color: #97a2b1; font-size: 16px; }
.thread-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { padding: 4px 7px; border-radius: 5px; color: #7c5cff; font-size: 9px; font-weight: 700; background: #f1efff; }
.messages { display: flex; flex-direction: column; gap: 10px; min-height: 385px; padding: 22px 2px 15px; }
.message-row { display: flex; }
.message-row.from-customer { justify-content: flex-start; }
.message-row.from-eve { justify-content: flex-end; }
.message-bubble { display: flex; align-items: flex-end; gap: 12px; max-width: 80%; padding: 9px 11px; border-radius: 10px; color: #526078; font-size: 11px; line-height: 1.45; background: #f5f6fa; }
.from-eve .message-bubble { color: #fff; background: var(--purple); }
.message-bubble small { color: #a6afbd; font-size: 8px; white-space: nowrap; }
.from-eve .message-bubble small { color: #d8d1ff; }
.thread-context { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid #ece9ff; border-radius: 8px; background: #fbfaff; }
.context-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: var(--purple); background: var(--purple-soft); }
.thread-context > div { min-width: 0; flex: 1; }
.thread-context strong, .thread-context span { display: block; }
.thread-context strong { color: #4b3ea1; font-size: 10px; }
.thread-context span { margin-top: 3px; overflow: hidden; color: #918aa9; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.thread-context .text-button { padding: 0; font-size: 10px; white-space: nowrap; }
.command-lock { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: var(--purple); background: var(--purple-soft); }
.command-contract { display: flex; align-items: center; gap: 6px; margin: -3px 0 10px; color: #8c97a7; font-size: 8px; font-weight: 700; }
.contract-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(28,166,122,.1); }
.quick-command-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.quick-command { display: grid; grid-template-columns: 24px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 6px; min-height: 49px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; color: #5f6d81; text-align: left; background: #fff; cursor: pointer; }
.quick-command:hover, .quick-command.is-selected { border-color: #c9c1ff; color: var(--purple); background: #fbfaff; }
.quick-command span { grid-row: 1 / 3; display: grid; place-items: center; width: 21px; height: 21px; border-radius: 6px; color: var(--purple); background: var(--purple-soft); }
.quick-command strong { overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.quick-command small { overflow: hidden; margin-top: 2px; color: #9aa4b2; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.selected-command { display: grid; grid-template-columns: auto auto; gap: 3px 7px; margin-top: 13px; padding: 9px 10px; border: 1px solid #ece9ff; border-radius: 8px; background: #fbfaff; }
.selected-command span, .selected-command small { color: #918aa9; font-size: 8px; }
.selected-command strong { color: #4b3ea1; font-size: 10px; }
.selected-command small { grid-column: 1 / -1; line-height: 1.35; }
.command-label { display: block; margin: 21px 0 7px; color: #657287; font-size: 10px; font-weight: 800; }
.command-input { display: block; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: #48566c; font: inherit; font-size: 11px; background: #fbfcfe; }
.command-input:focus { border-color: #bcb2ff; box-shadow: 0 0 0 3px rgba(124,92,255,.1); }
.command-panel textarea { display: block; width: 100%; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: #48566c; font: inherit; font-size: 11px; line-height: 1.45; background: #fbfcfe; }
.command-panel textarea:focus { border-color: #bcb2ff; box-shadow: 0 0 0 3px rgba(124,92,255,.1); }
.command-hint { display: flex; gap: 6px; margin: 8px 0 12px; color: #9aa4b2; font-size: 9px; line-height: 1.35; }
.command-hint span:first-child { color: var(--amber); }
.send-command { justify-content: center; width: 100%; }
.command-history { display: grid; gap: 8px; margin-top: 18px; padding-top: 15px; border-top: 1px solid #f0f2f6; }
.history-empty { margin: 0; color: #a0a9b7; font-size: 9px; line-height: 1.4; }
.history-item { display: flex; align-items: flex-start; gap: 7px; }
.history-icon { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; color: var(--green); font-size: 10px; background: var(--green-soft); }
.history-item strong, .history-item span { display: block; }
.history-item strong { overflow: hidden; max-width: 190px; color: #5d6a7d; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.history-item span { margin-top: 2px; color: #9da6b4; font-size: 8px; }

@media (max-width: 1080px) {
  .sidebar { width: 220px; flex-basis: 220px; }
  .topbar, .content-wrap { padding-left: 28px; padding-right: 28px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .support-layout { grid-template-columns: minmax(220px, .75fr) minmax(0, 1.25fr); }
  .command-panel { grid-column: 1 / -1; min-height: auto !important; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 5; top: 0; bottom: 0; left: -260px; width: 254px; transition: left .2s; }
  .sidebar.open { left: 0; }
  .topbar { height: 64px; padding: 0 18px; }
  .menu-button { display: block; }
  .mobile-brand { display: flex; }
  .breadcrumbs { display: none; }
  .profile-chip span:not(.user-avatar):not(.chevron) { display: none; }
  .content-wrap { padding: 27px 18px 45px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .primary-button { width: 100%; justify-content: center; }
  .metric-grid, .view-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  h1 { font-size: 24px; }
  .activity-time { display: none; }
  .support-toolbar { align-items: flex-start; flex-direction: column; }
  .support-toolbar > div { align-items: flex-start; flex-direction: column; gap: 7px; }
  .support-toolbar .secondary-button { width: 100%; }
  .support-layout { display: flex; flex-direction: column; }
  .support-layout > .panel { min-height: auto; }
  .conversation-queue { order: 1; }
  .support-thread { order: 2; }
  .command-panel { order: 3; }
  .conversation-list { max-height: 265px; overflow-y: auto; }
  .messages { min-height: 245px; }
  .message-bubble { max-width: 90%; }
  .thread-context .text-button { display: none; }
}

body:has(#login-screen:not([hidden])) { background: #f7f8fc; }
.login-screen { display: grid; min-height: 100svh; place-items: center; padding: 32px; overflow: auto; background: radial-gradient(circle at 8% 10%, rgba(124,92,255,.22) 0, transparent 27%), radial-gradient(circle at 94% 92%, rgba(93,214,194,.13) 0, transparent 28%), #f7f8fc; }
.login-shell { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(390px, .72fr); width: min(100%, 1020px); min-height: 610px; overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 26px; background: #fff; box-shadow: 0 28px 80px rgba(27, 40, 70, .14); }
.login-showcase { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; padding: 42px 46px 30px; overflow: hidden; color: #fff; background: linear-gradient(145deg, #0d1930 0%, #101b35 55%, #192b4b 100%); }
.login-showcase::before, .login-showcase::after { position: absolute; border: 1px solid rgba(126,231,255,.13); border-radius: 50%; content: ""; pointer-events: none; }
.login-showcase::before { width: 430px; height: 430px; right: -190px; top: -150px; box-shadow: 0 0 0 34px rgba(126,231,255,.025), 0 0 0 68px rgba(126,231,255,.025); }
.login-showcase::after { width: 250px; height: 250px; left: -150px; bottom: -120px; }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; }
.login-brand .brand-mark { width: 39px; height: 39px; border-radius: 13px; }
.login-brand strong { display: block; font-size: 18px; letter-spacing: .5px; }
.login-brand span { display: block; margin-top: 3px; color: #91a1c0; font-size: 10px; }
.login-hero { position: relative; z-index: 1; max-width: 470px; }
.login-robot { display: grid; place-items: center; width: 76px; height: 76px; margin-bottom: 30px; padding: 9px; border: 1px solid rgba(126,231,255,.2); border-radius: 23px; background: rgba(255,255,255,.08); box-shadow: 0 15px 35px rgba(0,0,0,.2); }
.login-robot img { width: 100%; height: 100%; border-radius: 17px; }
.login-kicker { margin: 0 0 12px; color: #79e4f4; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.login-hero h1 { max-width: 460px; margin: 0; color: #fff; font-size: clamp(32px, 4vw, 48px); line-height: 1.06; letter-spacing: -.065em; }
.login-hero-copy { max-width: 390px; margin: 20px 0 0; color: #a9b5ca; font-size: 13px; line-height: 1.7; }
.login-highlights { display: grid; gap: 11px; margin-top: 30px; color: #d7dfed; font-size: 11px; }
.login-highlights span { display: flex; align-items: center; gap: 9px; }
.login-highlights b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #7aedd0; background: rgba(122,237,208,.12); }
.login-showcase-footer { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; color: #8e9db8; font-size: 10px; }
.login-showcase-footer .status-dot { margin-left: 0; }
.login-version { margin-left: auto; color: #61728f; }
.login-card { display: flex; flex-direction: column; justify-content: center; width: 100%; padding: 58px 56px; background: #fff; }
.login-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.login-card-head .eyebrow { color: #9aa6b8; }
.secure-badge { padding: 6px 9px; border-radius: 7px; color: var(--green); font-size: 9px; font-weight: 800; background: var(--green-soft); }
.login-card h2 { margin: 0; color: var(--ink); font-size: 29px; letter-spacing: -.055em; }
.login-copy { margin: 9px 0 29px; color: #8995a7; font-size: 12px; line-height: 1.55; }
.login-form { display: grid; gap: 8px; }
.login-form label, .form-grid label { color: #657287; font-size: 10px; font-weight: 800; }
.login-input-wrap { display: flex; align-items: center; gap: 9px; width: 100%; margin: 0 0 9px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: #9aa6b8; background: #fbfcfe; transition: border-color .18s, box-shadow .18s, background .18s; }
.login-input-wrap:focus-within { border-color: #bcb2ff; background: #fff; box-shadow: 0 0 0 4px rgba(124,92,255,.1); }
.login-input-wrap > span { font-size: 16px; }
.login-form input { min-width: 0; width: 100%; margin: 0; padding: 13px 0; border: 0; outline: 0; color: var(--ink); font: inherit; font-size: 12px; background: transparent; }
.form-grid input, .form-grid textarea { width: 100%; margin: 0 0 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--ink); font: inherit; font-size: 12px; background: #fbfcfe; }
.form-grid input:focus, .form-grid textarea:focus { border-color: #bcb2ff; box-shadow: 0 0 0 3px rgba(124,92,255,.1); }
.login-form input::placeholder { color: #b0b8c5; }
.login-form .primary-button { justify-content: center; width: 100%; margin-top: 14px; padding: 13px 15px; border-radius: 10px; }
.login-help { margin: 27px 0 0; padding-top: 18px; border-top: 1px solid #f0f2f6; color: #a0a9b7; font-size: 10px; line-height: 1.55; }
.form-error { min-height: 17px; margin: 4px 0 0; color: var(--red); font-size: 10px; }
.loading-panel { min-height: 180px; display: grid; place-items: center; color: #8d99aa; font-size: 12px; }
.empty-state { display: grid; justify-items: center; gap: 9px; min-height: 260px; align-content: center; color: #8d99aa; font-size: 12px; text-align: center; }
.empty-state strong { color: #455269; font-size: 14px; }
.empty-state span { max-width: 540px; line-height: 1.55; }
.empty-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--purple); font-size: 20px; background: var(--purple-soft); }
.role-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #eff1f5; border-radius: 9px; }
.role-card strong, .role-card span { display: block; }
.role-card strong { color: #354159; font-size: 12px; }
.role-card span:not(.user-avatar) { margin-top: 3px; color: #919cab; font-size: 10px; }
.panel-note { color: #8d99aa; font-size: 10px; line-height: 1.55; }
.command-page { min-height: 500px; }
.command-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.form-grid { display: grid; grid-template-columns: minmax(180px, .55fr) minmax(260px, 1.45fr); gap: 14px; margin-top: 18px; }
.form-grid textarea { min-height: 110px; resize: vertical; }
.protocol-card { min-height: 300px; }
.protocol-rule { display: grid; gap: 4px; margin: 10px 0; padding: 13px; border: 1px solid #ece9ff; border-radius: 9px; background: #fbfaff; }
.protocol-rule strong { color: #4b3ea1; font-size: 11px; }
.protocol-rule span { color: #8f8aa5; font-size: 10px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-grid > div { padding: 18px; border: 1px solid #eff1f5; border-radius: 10px; }
.settings-card { min-width: 0; }
.settings-card .secondary-button { margin-top: 17px; }
.settings-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.password-settings { grid-column: 1 / -1; }
.settings-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; margin-top: 20px; }
.settings-form label { display: grid; gap: 7px; color: #657287; font-size: 10px; font-weight: 800; }
.settings-form input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--ink); font: inherit; font-size: 12px; background: #fbfcfe; }
.settings-form input:focus { border-color: #bcb2ff; box-shadow: 0 0 0 3px rgba(124,92,255,.1); }
.settings-form small { margin-top: -2px; color: #a0a9b7; font-size: 9px; font-weight: 500; }
.settings-form .primary-button { justify-content: center; min-height: 40px; }
.form-message { grid-column: 1 / -1; min-height: 15px; margin: 0; color: #9aa4b2; font-size: 10px; }
.form-message.success { color: var(--green); }
.form-message.error { color: var(--red); }
.settings-form button:disabled { cursor: wait; opacity: .65; }
.sidebar { transition: width .2s, flex-basis .2s; }
.sidebar.is-collapsed { width: 82px; flex-basis: 82px; }
.sidebar.is-collapsed .brand > div:last-child, .sidebar.is-collapsed .workspace-switcher, .sidebar.is-collapsed .nav-label, .sidebar.is-collapsed .user-meta { display: none; }
.sidebar.is-collapsed .brand, .sidebar.is-collapsed .nav-item, .sidebar.is-collapsed .user-card { justify-content: center; }
.sidebar.is-collapsed .nav-item { padding-left: 0; padding-right: 0; }
.sidebar.is-collapsed .more-button { display: none; }

@media (max-width: 1080px) { .command-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .login-screen { align-items: start; padding: 16px; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; border-radius: 20px; }
  .login-showcase { min-height: 340px; padding: 27px 25px 23px; }
  .login-hero { margin-top: 38px; }
  .login-robot { width: 58px; height: 58px; margin-bottom: 18px; border-radius: 18px; }
  .login-hero h1 { max-width: 400px; font-size: 31px; }
  .login-hero-copy { margin-top: 13px; font-size: 12px; }
  .login-highlights { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; font-size: 9px; }
  .login-highlights span:last-child { grid-column: 1 / -1; }
  .login-showcase-footer { margin-top: 35px; }
  .login-card { padding: 31px 25px 34px; }
  .login-card h2 { font-size: 26px; }
  .command-grid, .form-grid, .settings-grid, .settings-form { grid-template-columns: 1fr; }
  .sidebar.is-collapsed { width: 254px; flex-basis: 254px; }
  .sidebar.is-collapsed .brand > div:last-child, .sidebar.is-collapsed .workspace-switcher, .sidebar.is-collapsed .nav-label, .sidebar.is-collapsed .user-meta { display: block; }
}
