@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;450;500;550;600;650;700;750;800&display=swap');

:root {
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color: #242938;
  background: #f5f6fa;
  font-size: 16px;
  font-synthesis: none;
  --accent: #6656dd;
  --muted: #70788a;
  --line: #e9ebf1;
  --dark: #181b29
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  display: flex;
  min-height: 100vh
}

button,
textarea {
  font: inherit
}

button {
  cursor: pointer
}

button,
a,
textarea {
  touch-action: manipulation
}

button {
  transition: background .16s, border-color .16s, transform .16s
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid #a69af5;
  outline-offset: 4px
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0
}

h1,
h2,
h3,
p {
  margin: 0
}

button:disabled {
  cursor: default;
  opacity: .55
}

.sidebar {
  width: 270px;
  flex-shrink: 0;
  background: #0f1422;
  border-right: 1px solid #1e263c;
  color: #c0c3d3;
  height: 100vh;
  max-height: 100vh;
  position: sticky;
  top: 0;
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}

.sidebar[hidden],
main[hidden] {
  display: none !important;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  margin-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 4px 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -1px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.brand-caption {
  display: block;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: #818cf8;
  font-weight: 700;
  margin-top: 2px;
}

.sidebar-user-welcome {
  padding: 0 6px 10px;
}

.sidebar-user-welcome .eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #64748b;
}

/* Nút Cuộc trò chuyện mới cực kỳ nổi bật ở trên cùng */
.sidebar-new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.2px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-new-chat-btn:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}

.sidebar-new-chat-btn svg {
  width: 17px;
  height: 17px;
  stroke: #ffffff;
  stroke-width: 2.3;
}

/* Khung cuộn nội dung giữa (History + Navigation) */
.sidebar-scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
  margin-right: -4px;
}

.sidebar-scroll-area::-webkit-scrollbar {
  width: 4px;
}
.sidebar-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
.sidebar-scroll-area::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #64748b;
  padding: 0 6px;
  margin-bottom: 4px;
}

.sidebar-section-link {
  background: none;
  border: none;
  color: #818cf8;
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
  transition: color 0.15s;
}

.sidebar-section-link:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

/* Lịch sử trò chuyện dạng danh sách trong sidebar */
.sidebar-chat-history {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 220px;
  overflow-y: auto;
}

.sidebar-history-empty {
  font-size: 12px;
  color: #475569;
  padding: 10px 8px;
  text-align: center;
  font-style: italic;
}

.sidebar-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}

.sidebar-history-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
}

.sidebar-history-item.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.35);
  color: #ffffff;
  font-weight: 550;
}

.sidebar-history-item svg {
  width: 14px;
  height: 14px;
  color: #64748b;
  flex-shrink: 0;
}

.sidebar-history-item.active svg {
  color: #818cf8;
}

.sidebar-history-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
}

.sidebar-history-badge {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 999px;
  color: #94a3b8;
}

.sidebar-history-item.active .sidebar-history-badge {
  background: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
}

.nav-current,
.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  border-radius: 8px;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}

.nav-current {
  background: #232043;
  color: #c7d2fe;
  border: 1px solid #3b3569;
  font-weight: 500;
}

.nav-button {
  color: #94a3b8;
  border: 0;
  background: none;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
}

/* Footer cố định phía dưới */
.sidebar-footer {
  flex-shrink: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-about-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 11.5px;
  padding: 5px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-about-btn:hover {
  color: #c7d2fe;
  background: rgba(255, 255, 255, 0.04);
}

.profile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.avatar {
  background: #312e52;
  color: #c7d2fe;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.profile strong {
  font-size: 12.5px;
  color: #f8fafc;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-info span {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.btn-logout {
  background: transparent;
  border: none;
  color: #64748b;
  padding: 6px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.btn-logout svg {
  width: 16px;
  height: 16px;
}

main {
  min-width: 0;
  flex: 1;
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 38px
}

.topbar {
  height: 83px;
  border-bottom: 1px solid #e5e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px
}

.breadcrumb {
  font-size: 13px;
  color: #8890a1
}

.breadcrumb span {
  margin: 0 13px;
  color: #c3c6d2
}

.breadcrumb strong {
  color: #4f5667;
  font-weight: 450
}

.demo-badge {
  font-size: 10px;
  letter-spacing: .7px;
  padding: 7px 10px;
  border: 1px solid #dedaf6;
  background: #efecfc;
  color: #695bae;
  border-radius: 5px;
  font-weight: 600;
  white-space: nowrap
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 25px;
  align-items: center;
  padding: 35px 0 29px
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 1.6px;
  font-weight: 600;
  color: #8273bf;
  margin-bottom: 11px
}

h1 {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -1.2px;
  line-height: 1.45
}

.page-heading p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 7px;
  line-height: 1.7
}

.mobile-break {
  display: none
}

.model-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0
}

.status-indicator {
  width: 8px;
  height: 8px;
  border: 2px solid #a0a7b6;
  border-radius: 50%
}

.model-status strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #51596c
}

.model-status span:not(.status-indicator) {
  display: block;
  font-size: 11px;
  color: #8790a2;
  margin-top: 5px
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 1.65fr) minmax(290px, 1fr);
  gap: 22px;
  align-items: start
}

.chat-panel {
  min-width: 0;
  background: white;
  border: 1px solid #e2e5ee;
  border-radius: 15px;
  box-shadow: 0 5px 20px #292f4804;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 650px;
  max-height: calc(100vh - 277px);
  min-height: 530px
}

.panel-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0
}

.agent-avatar {
  display: grid;
  place-items: center;
  background: #f0edff;
  color: var(--accent);
  width: 39px;
  height: 39px;
  border: 1px solid #e9e3ff;
  border-radius: 12px;
  font-weight: 700;
  font-size: 20px
}

.panel-heading h2 {
  font-size: 15px;
  font-weight: 600
}

.panel-heading div>span {
  font-size: 11px;
  color: #9096a5;
  display: block;
  margin-top: 5px
}

.session-pill {
  margin-left: auto;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 5px;
  background: #f4f5f9;
  color: #7d8598
}

.messages {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 22px 24px 16px;
  overscroll-behavior: contain;
  min-height: 0
}

.time-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 10px;
  color: #9ba1b0;
  margin-bottom: 24px
}

.time-divider:before,
.time-divider:after {
  content: '';
  height: 1px;
  background: #eef0f5;
  width: 40px
}

.message {
  margin: 0 0 21px;
  max-width: 94%;
  animation: appear .22s ease-out
}

.message-label {
  font-size: 10px;
  color: #7d8699;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px
}

.message-label .mini-r {
  color: var(--accent);
  font-weight: 700;
  font-size: 11px
}

.bubble {
  font-size: 14px;
  line-height: 1.85;
  padding: 15px 18px;
  border-radius: 0 13px 13px;
  background: #f5f6fa;
  color: #495165;
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

.message.user {
  margin-left: auto;
  max-width: 88%
}

.user .message-label {
  justify-content: flex-end
}

.user .bubble {
  background: #6b5add;
  color: white;
  border-radius: 13px 0 13px 13px
}

.message.system .bubble {
  font-size: 12px;
  background: #faf8ee;
  color: #776732;
  border: 1px solid #eee8cf
}

.welcome-order {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #e5e4f0;
  padding: 12px 14px;
  border-radius: 8px;
  margin-top: 11px;
  text-align: left;
  background: white;
  color: #414956;
  width: 100%
}

.welcome-order:hover {
  border-color: #b9acef;
  background: #fbfaff
}

.welcome-order strong {
  font-size: 13px;
  font-weight: 550
}

.welcome-order small {
  font-size: 11px;
  color: #9196a7;
  display: block;
  margin-top: 5px
}

.welcome-order span:last-child {
  color: #8176c4
}

.composer-area {
  border-top: 1px solid var(--line);
  padding: 15px 19px 13px;
  background: #fff;
  flex-shrink: 0
}

.suggestions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 13px
}

.suggestions button {
  background: #fff;
  border: 1px solid #e5e6ef;
  border-radius: 6px;
  color: #73798b;
  padding: 7px 8px;
  font-size: 10px
}

.suggestions button:hover {
  color: var(--accent);
  border-color: #bfb4ef
}

.suggestions span {
  margin-left: 7px
}

form {
  display: flex;
  align-items: flex-end;
  border: 1px solid #dfe1ea;
  background: #fcfcfe;
  padding: 10px;
  border-radius: 10px;
  gap: 10px
}

form:focus-within {
  border-color: #9586e9;
  box-shadow: 0 0 0 3px #7661d70b
}

textarea {
  width: 100%;
  border: 0;
  background: none;
  resize: none;
  min-height: 35px;
  max-height: 110px;
  font-size: 13px;
  line-height: 1.8;
  padding: 6px 3px;
  color: #353c51
}

textarea:focus-visible {
  outline: none
}

textarea::placeholder {
  color: #9aa0b1
}

.send {
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  color: #fff;
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  display: grid;
  place-items: center
}

.send:hover {
  background: #5141c3
}

.composer-note {
  font-size: 9px;
  color: #949cab;
  margin-top: 10px;
  text-align: center;
  line-height: 1.8
}

.context-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0
}

.order-panel,
.activity-panel {
  background: white;
  border: 1px solid #e2e5ee;
  border-radius: 13px;
  padding: 20px
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px
}

.section-header h2 {
  font-size: 13px;
  font-weight: 600
}

.section-header>span {
  font-size: 10px;
  color: #9098aa
}

.order-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #f3f4f8;
  border-radius: 8px;
  margin-bottom: 20px
}

.order-tabs button {
  flex: 1;
  border: 0;
  background: none;
  font-size: 11px;
  font-weight: 500;
  color: #8b92a4;
  padding: 8px;
  border-radius: 5px
}

.order-tabs button.selected {
  background: #fff;
  color: #5f50bb;
  box-shadow: 0 1px 4px #1c274a0d
}

.order-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px
}

.order-line h3 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.5px
}

.order-date {
  color: #979fae;
  font-size: 10px;
  margin-top: 6px
}

.badge {
  font-size: 10px;
  font-weight: 500;
  padding: 5px 8px;
  border-radius: 5px;
  white-space: nowrap
}

.badge.pending {
  background: #fdf3de;
  color: #977125
}

.badge.delivered {
  background: #eaf5f0;
  color: #41866e
}

.badge.cancelled {
  background: #f2edf8;
  color: #8c68a6
}

.item {
  display: flex;
  gap: 11px;
  align-items: center;
  margin: 23px 0 19px;
  padding-bottom: 20px;
  border-bottom: 1px dashed #e8eaf0
}

.item-id {
  display: grid;
  place-items: center;
  width: 43px;
  height: 48px;
  border: 1px solid #e8e5ef;
  border-radius: 8px;
  background: #f7f5fc;
  color: #9b90bd;
  font-size: 12px;
  font-weight: 500
}

.item strong {
  font-size: 13px;
  font-weight: 500
}

.item p {
  font-size: 10px;
  color: #9198a9;
  margin-top: 6px
}

.order-rows {
  display: grid;
  gap: 12px
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 11px;
  line-height: 1.6
}

.detail-row span {
  color: #8e96a6
}

.detail-row strong {
  color: #575e70;
  font-weight: 450;
  text-align: right
}

.detail-row.total {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px
}

.detail-row.total strong {
  font-weight: 650;
  color: #31384c
}

.order-policy {
  background: #f7f8fb;
  padding: 12px;
  border-radius: 7px;
  font-size: 10px;
  color: #8790a1;
  line-height: 1.8;
  margin-top: 17px
}

.order-action {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid #dfdaf3;
  background: #fbfaff;
  color: #7968c3;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 13px
}

.order-action:hover {
  background: #f2edff
}

.activity-panel {
  padding-bottom: 16px
}

.activity-empty {
  font-size: 11px;
  line-height: 1.8;
  color: #969ead;
  padding: 2px 0 5px
}

.activity-item {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  font-size: 11px;
  line-height: 1.7
}

.activity-icon {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: #f2effa;
  color: #8b7ac5;
  border-radius: 50%;
  font-size: 10px;
  margin-top: 1px
}

.activity-item p {
  color: #626b7f
}

.activity-item small {
  font-size: 9px;
  color: #a0a7b4;
  display: block;
  margin-top: 2px
}

.scope-note {
  display: flex;
  gap: 9px;
  padding: 0 8px;
  color: #9aa2b0
}

.scope-note svg {
  width: 17px;
  height: 17px;
  margin-top: 2px
}

.scope-note p {
  font-size: 10px;
  line-height: 1.9
}

footer {
  padding: 21px 0;
  font-size: 10px;
  color: #b0b6c2;
  display: flex;
  justify-content: space-between
}

.proposal {
  padding: 16px;
  margin-top: 12px;
  border: 1px solid #e4dff5;
  border-radius: 9px;
  background: white;
  font-size: 12px;
  line-height: 1.7;
  color: #576071
}

.proposal h3 {
  font-size: 13px;
  color: #4b425f;
  margin-bottom: 9px
}

.proposal label {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin: 10px 0;
  font-size: 12px
}

.proposal input {
  accent-color: var(--accent);
  margin-top: 4px
}

.proposal small {
  display: block;
  font-size: 10px;
  color: #9993aa;
  margin-top: 9px
}

.primary,
.secondary {
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6
}

.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white
}

.primary:hover {
  background: #5340bf
}

.secondary {
  border: 1px solid #e2e3ec;
  background: white;
  color: #70768a
}

.proposal .primary {
  margin-top: 8px;
  width: 100%
}

.proposal-resolved {
  font-size: 12px;
  color: #7c728d;
  margin-top: 10px
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0
}

dialog {
  border: 1px solid #e5e3f0;
  border-radius: 17px;
  padding: 0;
  max-width: 450px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 100px #1c173638;
  color: #42495b
}

dialog::backdrop {
  background: #171b2e66;
  backdrop-filter: blur(3px)
}

.dialog-inner {
  padding: 30px
}

.dialog-inner h2 {
  font-size: 22px;
  letter-spacing: -.6px;
  margin: 13px 0 14px
}

.dialog-inner p {
  font-size: 13px;
  line-height: 1.9;
  color: #7a8191;
  margin: 13px 0
}

.dialog-inner .dialog-note {
  font-size: 11px;
  line-height: 1.8;
  color: #9890a8
}

.confirm-detail {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #ece8f6;
  border-radius: 7px;
  padding: 14px;
  font-size: 12px
}

.confirm-detail span {
  color: #9490a4
}

.confirm-detail strong {
  font-weight: 500
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
  flex-wrap: wrap
}

.dialog-inner>.primary {
  margin-top: 10px
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(5px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

/* Readable text scale across Vietnamese labels and body copy. */
.brand-caption,
.sidebar-label,
.small-tag,
.demo-badge,
.eyebrow,
.time-divider,
.message-label,
.composer-note,
.item p,
.order-date,
.section-header>span,
.badge,
.order-tabs button,
.detail-row,
.order-policy,
.order-action,
.activity-empty,
.activity-item,
.scope-note p,
.session-pill,
.suggestions button,
.panel-heading div>span,
.profile strong,
.profile div>span,
.side-note button,
.model-status strong,
.model-status span:not(.status-indicator),
.order-rows,
.activity-item small,
footer,
.proposal small,
.dialog-inner .dialog-note {
  font-size: .75rem
}

.breadcrumb,
.nav-current,
.nav-button,
.page-heading p,
.side-note p,
.panel-heading h2,
.section-header h2,
.welcome-order strong,
.welcome-order small,
textarea,
.item strong,
.detail-row.total,
.proposal,
.proposal label,
.proposal h3,
.proposal-resolved,
.primary,
.secondary,
.confirm-detail,
.dialog-inner p {
  font-size: .875rem
}

.bubble {
  font-size: 1rem
}

.page-heading p {
  max-width: 510px
}

.chat-panel {
  min-height: 610px;
  height: 720px;
  max-height: calc(100vh - 265px)
}

.suggestions button {
  padding: 7px 9px
}

.composer-note {
  font-size: .75rem
}

.section-header>span {
  font-size: .75rem
}

.item-id {
  font-size: .875rem
}

.sidebar {
  width: 248px
}

.side-note p {
  font-size: .875rem
}

.model-status {
  max-width: 240px
}

.activity-item {
  font-size: .875rem
}

.scope-note p {
  font-size: .75rem
}

.profile strong {
  font-size: .875rem
}

.order-policy {
  font-size: .8125rem
}

.order-action {
  font-size: .875rem
}

.order-tabs button {
  font-size: .875rem
}

.detail-row {
  font-size: .875rem
}

.badge {
  font-size: .75rem
}

.dialog-inner p {
  font-size: 1rem
}

.brand-caption {
  font-size: .65rem
}

.chat-panel .panel-heading div>span {
  font-size: .75rem
}

@media(min-width:1550px) {
  main {
    padding: 0 55px
  }

  .workspace {
    grid-template-columns: minmax(450px, 1.8fr) minmax(340px, 1fr)
  }

  .chat-panel {
    min-height: 650px
  }

  .messages {
    padding: 25px 32px
  }

  .panel-heading {
    padding: 22px 30px
  }

  .composer-area {
    padding: 20px 27px
  }

  .page-heading {
    padding-top: 42px;
    padding-bottom: 33px
  }

  h1 {
    font-size: 32px
  }

  .order-panel,
  .activity-panel {
    padding: 24px
  }
}

@media(max-width:1180px) {
  .sidebar {
    width: 208px;
    padding: 28px 13px 20px
  }

  .brand {
    font-size: 21px;
    margin-left: 8px
  }

  .brand-mark {
    width: 36px;
    height: 38px
  }

  .brand-caption {
    font-size: 9px
  }

  .sidebar-label {
    font-size: 10px
  }

  .nav-current,
  .nav-button {
    font-size: 13px;
    padding: 14px 10px
  }

  .side-note {
    margin-top: 45px
  }

  main {
    padding: 0 24px
  }

  .page-heading {
    align-items: flex-start
  }

  .model-status {
    margin-top: 7px
  }

  .model-status strong {
    font-size: 12px
  }

  .model-status span:not(.status-indicator) {
    font-size: 11px
  }

  .workspace {
    grid-template-columns: minmax(330px, 1.45fr) minmax(275px, 1fr);
    gap: 16px
  }

  .order-panel,
  .activity-panel {
    padding: 17px
  }

  .panel-heading {
    padding: 18px
  }

  .messages {
    padding: 20px 18px
  }

  .composer-area {
    padding: 14px
  }

  .suggestions {
    gap: 5px
  }

  .suggestions button {
    font-size: 11px
  }

  h1 {
    font-size: 25px
  }

  .page-heading p {
    font-size: 13px
  }
}

@media(max-width:980px) {
  .sidebar {
    width: 78px;
    padding: 26px 12px
  }

  .brand {
    margin: 0 auto 32px
  }

  .brand>span:last-child,
  .sidebar-label,
  .side-note,
  .profile,
  .nav-current,
  .nav-button {
    display: none
  }

  .workspace {
    grid-template-columns: minmax(300px, 1fr) minmax(260px, .8fr)
  }

  .page-heading {
    flex-direction: column;
    gap: 15px
  }

  .model-status {
    display: flex;
    max-width: none
  }

  .model-status div {
    display: flex;
    gap: 10px;
    align-items: center
  }

  .model-status span:not(.status-indicator) {
    margin: 0
  }

  .page-heading p {
    max-width: none
  }

  .chat-panel {
    min-height: 660px;
    max-height: none
  }

  .topbar {
    height: 70px
  }

  .badge {
    font-size: 11px
  }

  .section-header h2 {
    font-size: 13px
  }

  .section-header>span {
    font-size: 11px
  }
}

@media(max-width:730px) {
  body {
    display: block
  }

  .sidebar {
    width: 100%;
    height: 65px;
    min-height: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px
  }

  .brand {
    margin: 0;
    gap: 9px
  }

  .brand-mark {
    width: 31px;
    height: 32px;
    font-size: 22px;
    border-radius: 9px
  }

  .brand>span:last-child {
    display: block;
    font-size: 20px
  }

  .brand-caption {
    display: none
  }

  .nav-button {
    display: flex;
    width: auto;
    margin: 0;
    font-size: 12px;
    padding: 10px;
    color: #dbd8ef
  }

  .nav-button svg {
    width: 15px
  }

  .sidebar .nav-current {
    display: none
  }

  main {
    padding: 0 18px
  }

  .topbar {
    height: 57px;
    gap: 5px
  }

  .breadcrumb {
    font-size: 11px
  }

  .breadcrumb span {
    margin: 0 6px
  }

  .demo-badge {
    font-size: 9px;
    padding: 6px
  }

  .page-heading {
    padding: 24px 0;
    gap: 12px
  }

  h1 {
    font-size: 27px;
    letter-spacing: -1px
  }

  .page-heading p {
    font-size: 13px
  }

  .eyebrow {
    font-size: 10px
  }

  .workspace {
    display: flex;
    flex-direction: column;
    gap: 20px
  }

  .chat-panel {
    width: 100%;
    height: 640px;
    min-height: 0;
    max-height: none
  }

  .context-panel {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px
  }

  .panel-heading {
    padding: 17px
  }

  .messages {
    padding: 18px 16px
  }

  .bubble {
    font-size: 15px
  }

  .suggestions button {
    font-size: 11px
  }

  .composer-note {
    font-size: 10px
  }

  .section-header h2 {
    font-size: 15px
  }

  .order-panel,
  .activity-panel {
    padding: 21px
  }

  .section-header>span,
  .badge {
    font-size: 12px
  }

  .order-date,
  .item p {
    font-size: 12px
  }

  .item strong {
    font-size: 15px
  }

  .detail-row {
    font-size: 14px
  }

  .order-policy {
    font-size: 13px
  }

  .order-action {
    font-size: 14px;
    padding: 12px
  }

  .order-tabs button {
    font-size: 14px
  }

  .item {
    margin-top: 20px
  }

  .model-status strong {
    font-size: 12px
  }

  .model-status span:not(.status-indicator) {
    font-size: 11px
  }

  .dialog-inner {
    padding: 23px
  }

  .dialog-inner h2 {
    font-size: 22px
  }

  .dialog-inner p {
    font-size: 14px
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important
  }
}

.login-shell {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #181b29;
  display: grid;
  place-items: center;
  padding: 24px
}

.login-shell[hidden] {
  display: none
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 36px;
  max-width: 440px;
  width: 100%;
  display: grid;
  gap: 18px
}

.login-card h1 {
  font-size: 30px;
  line-height: 1.2
}

.login-card p {
  line-height: 1.6
}

.login-card input {
  font: inherit;
  padding: 12px;
  border: 1px solid #aeb4c2;
  border-radius: 8px;
  min-width: 0
}

.login-card label {
  font-weight: 600
}

#login-error {
  color: #a32338;
  min-height: 24px
}

.proposal-error {
  color: #a32338;
  line-height: 1.5
}

button:disabled {
  cursor: wait;
  opacity: .6
}

.order-empty {
  padding: 24px;
  line-height: 1.7
}

.model-status strong {
  display: block
}

.messages:empty {
  min-height: 300px
}

.conversation-context {
  padding: 10px 20px;
  margin: 0;
  background: #f0f3ff;
  border-bottom: 1px solid #dce1f2;
  font-size: 14px;
  color: #374273;
  line-height: 1.5
}

.message-label {
  flex-wrap: wrap;
  line-height: 1.5
}

.agent-trace {
  font-size: 12px;
  color: #555c70;
  margin: 10px 0 0 34px;
  overflow-wrap: anywhere;
}

.agent-trace summary {
  cursor: pointer;
  padding: 5px 0;
}

.agent-trace p {
  margin: 6px 0;
}

.agent-trace small,
.replay-note {
  display: block;
  line-height: 1.5;
}

.messages[aria-busy="true"] {
  opacity: .85;
}

.provider-controls {
  padding: 12px 22px;
  border-bottom: 1px solid #e8eaf0;
  background: #f8f9fc;
}

.provider-controls label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #41465a;
}

.provider-controls select {
  width: 100%;
  max-width: 400px;
  border: 1px solid #cbd0de;
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-size: 13px;
  background: white;
  color: #25293b;
}

.provider-controls select:focus-visible {
  outline: 2px solid #675fe8;
  outline-offset: 2px;
}

.provider-controls select:disabled {
  opacity: .65;
}

.provider-controls p {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: #555c70;
  overflow-wrap: anywhere;
}

.provider-controls small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #555c70;
}

/* Retail Production UI Enhancements */
.shipment-card {
  margin: 12px 0 6px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-left: 4px solid #3b82f6;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

.shipment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.shipment-header strong {
  font-size: 14px;
  color: #1e3a8a;
}

.tracking-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: #dbeafe;
  color: #1d4ed8;
}

.tracking-pill.delivered {
  background: #d1fae5;
  color: #047857;
}

.shipment-body p {
  margin: 4px 0;
  font-size: 12.5px;
  color: #334155;
}

.delivery-eta {
  font-weight: 600;
  color: #2563eb !important;
  margin-top: 6px !important;
}

.shipment-timeline {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timeline-item {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
}

.timeline-time {
  font-weight: 550;
  color: #475569;
  min-width: 95px;
}

.human-support-card {
  margin: 12px 0 6px;
  padding: 14px 18px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
}

.human-header {
  font-size: 13.5px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 4px;
}

.human-support-card p {
  font-size: 12.5px;
  color: #78350f;
  margin: 4px 0;
}

.badge-handoff {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #d97706;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Tool Inspector Modal */
.inspector-modal {
  max-width: 600px;
}

.inspector-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.inspector-form label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-top: 6px;
}

.inspector-form select {
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  background: #f8fafc;
  color: #0f172a;
  outline: none;
}

.inspector-form textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: monospace;
  font-size: 12px;
  padding: 8px;
  background: #f8fafc;
  color: #0f172a;
  resize: vertical;
}

.inspector-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
}

#inspector-latency-badge {
  font-size: 12px;
  font-weight: 600;
  color: #10b981;
}

#inspector-output {
  background: #0f172a;
  color: #38bdf8;
  font-family: monospace;
  font-size: 11.5px;
  padding: 12px;
  border-radius: 8px;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* In-Chat Header Action Buttons & Status */
.chat-header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 550;
  border-radius: 8px;
  border: 1px solid #e2e5ee;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.18s ease;
}

.header-action-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
  transform: translateY(-1px);
}

.header-action-btn.active {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #b45309;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

#btn-toggle-topbar.active {
  border-color: #6366f1;
  background: #eef2ff;
  color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.header-action-btn.danger {
  border-color: #fee2e2;
  background: #fff5f5;
  color: #dc2626;
}

.header-action-btn.danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.agent-avatar.human {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-color: #fde68a;
  font-size: 16px;
  letter-spacing: -0.5px;
}

.session-pill.human {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-weight: 600;
}

/* CSAT Rating Modal */
.csat-rating-group {
  margin: 18px 0 14px;
  text-align: center;
  background: #f8fafc;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.csat-rating-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.csat-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 32px;
  cursor: pointer;
  user-select: none;
  line-height: 1;
}

.csat-stars .star {
  color: #cbd5e1;
  transition: color 0.15s ease, transform 0.15s ease;
  display: inline-block;
}

.csat-stars .star:hover,
.csat-stars .star.selected {
  color: #f59e0b;
  transform: scale(1.15);
}

#csat-feedback-label {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.session-ended-card {
  margin: 14px 0 8px;
  padding: 16px 20px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #16a34a;
  border-radius: 10px;
}

.session-ended-card h4 {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: #15803d;
  font-weight: 700;
}

.session-ended-card p {
  margin: 4px 0;
  font-size: 12px;
  color: #166534;
}

.human-badge-mini {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-weight: 700;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 4px;
}

.message.human-message .bubble {
  border-left: 3px solid #f59e0b;
  background: #fffdf5;
  color: #451a03;
}

/* Message Feedback (Like / Dislike & Reasons) */
.message-feedback-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.feedback-btn {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.feedback-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

.feedback-btn.active.positive {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

.feedback-btn.active.negative {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.feedback-btn:disabled {
  cursor: default;
  opacity: 0.75;
}

.feedback-note {
  font-size: 11px;
  color: #16a34a;
  font-weight: 500;
}

.feedback-reason-popover {
  margin-top: 6px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 320px;
}

.feedback-reason-popover span {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}

.feedback-reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.reason-chip {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}

.reason-chip:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}

/* Staff Live Chat Console (Human-in-the-Loop Desk) */
#staff-desk-dialog {
  max-width: 1120px !important;
  width: 92vw !important;
  height: 84vh !important;
  max-height: 850px !important;
  border-radius: 16px !important;
  padding: 0 !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35) !important;
  overflow: hidden !important;
  background: #ffffff !important;
}

#staff-desk-dialog::backdrop {
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(4px) !important;
}

#staff-desk-dialog .dialog-inner {
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.staff-desk-container {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.staff-desk-header {
  padding: 16px 24px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  background: #f8fafc !important;
  flex-shrink: 0 !important;
}

.staff-header-info h2 {
  margin: 2px 0 4px !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
}

.staff-header-info p {
  margin: 0 !important;
  font-size: 12.5px !important;
  color: #64748b !important;
}

.staff-header-actions {
  display: flex !important;
  gap: 10px !important;
  align-items: center !important;
}

.staff-desk-workspace {
  display: flex !important;
  flex: 1 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.staff-queue-panel {
  width: 330px !important;
  min-width: 300px !important;
  max-width: 350px !important;
  flex-shrink: 0 !important;
  border-right: 1px solid #e2e8f0 !important;
  display: flex !important;
  flex-direction: column !important;
  background: #f8fafc !important;
}

.queue-panel-header {
  padding: 14px 18px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #334155 !important;
  background: #ffffff !important;
  flex-shrink: 0 !important;
}

.staff-queue-list {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.ticket-card {
  padding: 12px 14px !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  cursor: pointer !important;
  transition: all 0.18s ease !important;
  text-align: left !important;
}

.ticket-card:hover {
  border-color: #3b82f6 !important;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12) !important;
  transform: translateY(-1px) !important;
}

.ticket-card.active {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.18) !important;
}

.ticket-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 6px !important;
}

.ticket-user {
  font-weight: 650 !important;
  font-size: 13.5px !important;
  color: #0f172a !important;
}

.ticket-badge {
  font-size: 10.5px !important;
  padding: 3px 8px !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
}

.ticket-badge.pending {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

.ticket-badge.resolved {
  background: #dcfce7 !important;
  color: #16a34a !important;
}

.ticket-reason {
  font-size: 12px !important;
  color: #475569 !important;
  margin: 0 0 8px !important;
  line-height: 1.45 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

.ticket-meta {
  font-size: 11px !important;
  color: #94a3b8 !important;
  display: flex !important;
  justify-content: space-between !important;
}

.staff-active-chat-panel {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  background: #ffffff !important;
}

.staff-chat-header {
  padding: 14px 24px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  background: #ffffff !important;
  flex-shrink: 0 !important;
}

.chat-header-user strong {
  display: block !important;
  font-size: 15px !important;
  color: #0f172a !important;
  font-weight: 650 !important;
}

.chat-header-user span {
  font-size: 12px !important;
  color: #64748b !important;
}

.staff-chat-transcript {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 20px 24px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  background: #f8fafc !important;
}

.transcript-placeholder {
  margin: auto !important;
  color: #94a3b8 !important;
  font-size: 13.5px !important;
  text-align: center !important;
}

.staff-chat-composer {
  padding: 16px 24px !important;
  border-top: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  flex-shrink: 0 !important;
}

.staff-chat-composer textarea {
  width: 100% !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  font-size: 13.5px !important;
  font-family: inherit !important;
  resize: none !important;
  outline: none !important;
  box-sizing: border-box !important;
}

.staff-chat-composer textarea:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.composer-actions {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

.staff-rep-badge {
  font-size: 12px !important;
  color: #475569 !important;
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 12px !important;
  font-weight: 550 !important;
  border-radius: 7px !important;
}

.bubble-staff {
  background: #ede9fe !important;
  border: 1px solid #c4b5fd !important;
  color: #4c1d95 !important;
}

.bubble-user {
  background: #0284c7 !important;
  color: #ffffff !important;
  align-self: flex-end !important;
}

/* Google Sign-in Button & Divider */
.google-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 550;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
  transition: all 0.2s ease;
  cursor: pointer;
}

.google-login-btn:hover {
  background: #f8fafd;
  border-color: #c2c7d0;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.18);
  color: #202124;
}

.google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #70757a;
  font-size: 11px;
  font-weight: 600;
  margin: 4px 0;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e2e8f0;
}

.login-divider span {
  padding: 0 10px;
  letter-spacing: 0.5px;
}

/* Role-Based Access Control UI Isolation */
body[data-role="customer"] #toggle-staff-desk,
body[data-role="viewer"] #toggle-staff-desk,
body[data-role="customer"] #toggle-inspector,
body[data-role="viewer"] #toggle-inspector {
  display: none !important;
}

body[data-role="staff"] #toggle-staff-desk {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* ==========================================================================
   Store Manager Console & Right Sidebar Optimization (RetailOps 2026)
   ========================================================================== */

.manager-highlight-btn {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  color: #38bdf8 !important;
  border: 1px solid #38bdf8 !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 4px rgba(56, 189, 248, 0.15);
  transition: all 0.2s ease;
}

.manager-highlight-btn:hover {
  background: #1e293b !important;
  color: #7dd3fc !important;
  border-color: #7dd3fc !important;
  transform: translateY(-1px);
}

.manager-banner-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  border: 1px solid #38bdf8;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  transition: all 0.2s ease;
}

.manager-banner-btn:hover {
  background: #1e293b;
  border-color: #7dd3fc;
  color: #38bdf8;
  transform: translateY(-1px);
}

.banner-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
}

/* Sidebar Search & Filter Box */
.order-search-filter-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.order-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.order-search-wrapper input {
  width: 100%;
  padding: 8px 30px 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  transition: all 0.2s ease;
}

.order-search-wrapper input:focus {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
}

.search-clear-btn:hover {
  color: #475569;
}

.order-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 11.5px;
  color: #64748b;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  border-color: #94a3b8;
  color: #334155;
}

.filter-chip.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  font-weight: 600;
}

/* Vertical Order Card List */
.order-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 14px;
}

.order-card-list::-webkit-scrollbar {
  width: 5px;
}

.order-card-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.order-card-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.order-card-item:hover {
  border-color: #93c5fd;
  background: #f8fafc;
  transform: translateX(2px);
}

.order-card-item.selected {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 0 0 1.5px #0284c7;
}

.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-card-oid {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}

.order-card-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  letter-spacing: 0.2px;
}

.order-card-badge.pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.order-card-badge.delivered {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.order-card-badge.cancelled {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.order-card-title {
  font-size: 12px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

.order-card-price {
  font-weight: 700;
  color: #0284c7;
}

.order-card-cust {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
}

/* ==========================================================================
   Manager Console Fullscreen Dialog (#manager-console-dialog)
   ========================================================================== */

.manager-console-dialog {
  width: 95vw;
  max-width: 1280px;
  height: 90vh;
  max-height: 900px;
  padding: 0;
  border: 1px solid #334155;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.manager-console-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  box-sizing: border-box;
  overflow-y: auto;
}

.manager-console-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 16px;
}

.manager-header-info h2 {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  margin: 4px 0;
}

.manager-header-info p {
  color: #64748b;
  font-size: 13.5px;
  margin: 0;
}

.manager-header-actions {
  display: flex;
  gap: 8px;
}

/* Navigation Tabs */
.manager-nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
  overflow-x: auto;
}

.manager-nav-tab {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.manager-nav-tab:hover {
  color: #0f172a;
}

.manager-nav-tab.active {
  color: #0284c7;
  border-bottom-color: #0284c7;
}

.manager-tab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.manager-tab-content.active {
  display: flex;
}

/* Tab 1: KPIs */
.manager-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.kpi-icon {
  font-size: 32px;
  background: #ffffff;
  padding: 12px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.kpi-body {
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
}

.kpi-val {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin: 2px 0;
}

.kpi-sub {
  font-size: 11.5px;
  color: #16a34a;
  font-weight: 500;
}

.manager-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.stat-mini-pill {
  padding: 14px 16px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}

.stat-mini-pill.pending { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.stat-mini-pill.delivered { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.stat-mini-pill.cancelled { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.stat-mini-pill.products { background: #f1f5f9; color: #1e293b; border: 1px solid #cbd5e1; }

.stat-mini-pill strong {
  font-size: 18px;
}

/* Tab 2: Products CRUD & Data Tables */
.manager-products-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.manager-products-toolbar input {
  flex: 1;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
}

.manager-products-toolbar select {
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
}

.manager-table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.manager-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.manager-data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.manager-data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.manager-data-table tr:hover td {
  background: #f8fafc;
}

.btn-action-sm {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  margin-right: 4px;
  transition: all 0.15s ease;
}

.btn-action-sm:hover {
  background: #f1f5f9;
}

.btn-action-sm.danger {
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-action-sm.danger:hover {
  background: #fef2f2;
}

/* Tab 3: SOP Grid */
.sop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.sop-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.sop-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.sop-header h4 {
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

.sop-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.sop-1 { background: #fee2e2; color: #b91c1c; }
.sop-2 { background: #dcfce7; color: #15803d; }
.sop-3 { background: #dbeafe; color: #1d4ed8; }
.sop-4 { background: #fef3c7; color: #b45309; }
.sop-5 { background: #f3e8ff; color: #7e22ce; }
.sop-6 { background: #e0e7ff; color: #4338ca; }

.sop-card p {
  font-size: 12.5px;
  color: #64748b;
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.sop-case {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: #334155;
  margin-bottom: 14px;
}

.sop-action-btn {
  margin-top: auto;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: #0284c7;
  color: #ffffff;
  transition: all 0.15s ease;
}

.sop-action-btn:hover { background: #0369a1; }
.sop-action-btn.success { background: #16a34a; }
.sop-action-btn.success:hover { background: #15803d; }
.sop-action-btn.primary { background: #2563eb; }
.sop-action-btn.primary:hover { background: #1d4ed8; }
.sop-action-btn.warning { background: #d97706; }
.sop-action-btn.warning:hover { background: #b45309; }
.sop-action-btn.danger { background: #dc2626; }
.sop-action-btn.danger:hover { background: #b91c1c; }
.sop-action-btn.secondary { background: #475569; }
.sop-action-btn.secondary:hover { background: #334155; }

/* Product Modal */
.product-modal {
  width: 90vw;
  max-width: 580px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.product-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.product-form input,
.product-form textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  box-sizing: border-box;
}

.product-form label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}

.product-form small {
  font-size: 11px;
  color: #64748b;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* ==========================================================================
   Chat Attachments, Media & Lightbox (Multimodal CSKH)
   ========================================================================== */
.messages {
  overflow-x: hidden;
}

.bubble {
  max-width: 100%;
}

.bubble img {
  max-width: 100%;
  height: auto;
}

.chat-attachment-card {
  margin: 6px 0 8px;
  max-width: min(380px, 100%);
  width: fit-content;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.user .chat-attachment-card {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.22);
}

.chat-attachment-img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  background: rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-attachment-img:hover {
  opacity: 0.94;
  transform: scale(1.01);
}

.chat-attachment-caption {
  font-size: 11.5px;
  color: inherit;
  opacity: 0.9;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}

.chat-attachment-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 13.5px;
  color: inherit;
  background: rgba(255, 255, 255, 0.08);
}

.chat-attachment-doc strong {
  word-break: break-all;
  font-weight: 600;
}

/* Attachment Preview Bar above Composer */
.attachment-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: #f1f3f9;
  border: 1px solid #dbe0ea;
  border-radius: 10px;
  animation: appear 0.2s ease-out;
}

.attachment-preview-thumb {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  flex-shrink: 0;
}

.attachment-preview-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.attachment-preview-info {
  flex: 1;
  min-width: 0;
}

.attachment-preview-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-preview-size {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.attachment-preview-remove {
  background: transparent;
  border: none;
  font-size: 16px;
  font-weight: 700;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.attachment-preview-remove:hover {
  background: #e2e8f0;
  color: #ef4444;
}

/* Lightbox Dialog */
.image-lightbox-dialog {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  max-width: 95vw;
  max-height: 95vh;
  overflow: visible;
}

.image-lightbox-dialog::backdrop {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
}

.lightbox-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: -8px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(239, 68, 68, 0.85);
}

#lightbox-img {
  max-width: 88vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  margin-top: 10px;
  color: #f1f5f9;
  font-size: 13px;
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 14px;
  border-radius: 20px;
}

/* Multi-turn Conversation History Dialog */
#conversation-history-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 620px;
  width: 90vw;
  max-height: 85vh;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
  background: #ffffff;
  overflow: hidden;
}

#conversation-history-dialog::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.history-modal {
  display: flex;
  flex-direction: column;
  padding: 24px 28px !important;
  max-height: 85vh;
  overflow-y: auto;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.history-header h2 {
  font-size: 20px;
  margin: 4px 0 0 0;
  color: #1e293b;
}

.history-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 8px;
  transition: all 0.2s;
}

.history-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.history-desc {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.history-action-bar {
  margin-bottom: 16px;
}

.history-action-bar button {
  width: 100%;
  padding: 10px 16px;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
}

.history-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.history-item.active {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6, 0 4px 12px rgba(59, 130, 246, 0.1);
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.history-item-title {
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-item.active .history-item-title {
  color: #1d4ed8;
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
}

.history-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 11px;
  font-weight: 500;
  color: #475569;
}

.history-item.active .history-pill {
  background: #dbeafe;
  color: #1e40af;
}

.history-pill.human {
  background: #fee2e2;
  color: #b91c1c;
}

.history-empty-state {
  text-align: center;
  padding: 36px 16px;
  color: #94a3b8;
  font-size: 14px;
}
