/* SUHAREX layout + redwine chrome — uses theme CSS variables */
:root {
  --sx-sidebar-w: var(--sidebar-width, 240px);
  --sx-topbar-h: var(--topbar-height, 48px);
  --sx-status-h: var(--statusbar-height, 26px);
  --sx-safe-bottom: env(safe-area-inset-bottom, 0px);
  --sx-safe-top: env(safe-area-inset-top, 0px);
  --sx-wine: #600010;
  --sx-wine-muted: #f3e6e8;
  --sx-gold: #c9a227;
  --font-ui: "Roboto Condensed", "Segoe UI", sans-serif;
  --font-heading: "Syne", "Segoe UI", sans-serif;
}

html, body, #app, #content, button, input, select, textarea, .nav-link, .tb-btn {
  font-family: var(--font-ui);
}

h1, h2, h3, h4, .page-header h2, .splash-title, .splash-wordmark,
.brand-text-logo, .gpt-main-head h2, .gpt-welcome h3, .docs-card h3,
#sidebar .sidebar-header h1, #modal-title {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-text-logo {
  display: inline-block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--sx-wine, #600010);
  line-height: 1;
  white-space: nowrap;
}
[data-theme="dark"] .brand-text-logo { color: #f2e6ea; }

.splash-wordmark {
  font-size: clamp(42px, 12vw, 64px);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--sx-gold, #c9a227);
  line-height: 1;
  margin: 0 0 10px;
  text-align: center;
}

#topbar .brand-logo { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--content-bg);
  color: var(--text-primary);
}

body.sidebar-open {
  overflow: hidden;
}

#app {
  display: flex !important;
  flex-direction: column !important;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

#topbar {
  position: relative;
  z-index: 1200;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: calc(var(--sx-topbar-h) + var(--sx-safe-top));
  min-height: calc(var(--sx-topbar-h) + var(--sx-safe-top));
  padding: var(--sx-safe-top) 10px 0 10px;
  background: linear-gradient(180deg, #faf6f7 0%, var(--toolbar-bg) 100%);
  color: var(--text-primary);
  border-bottom: 1px solid var(--toolbar-border);
  overflow: hidden;
}

#topbar .topbar-brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  background: #0b0b0b;
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 0;
}

#topbar .brand-logo {
  height: 28px;
  width: auto;
  max-width: min(160px, 42vw);
  object-fit: contain;
  display: block;
}

#topbar .tb-btn {
  min-height: 36px;
  min-width: 36px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
}

#topbar .tb-btn:hover,
#topbar .tb-btn:focus {
  background: rgba(96, 0, 16, 0.06);
  border-color: var(--toolbar-border);
  color: var(--sx-wine, #600010);
}

#topbar .tb-btn-primary {
  background: var(--sx-wine, #600010);
  border-color: var(--sx-wine, #600010);
  color: #fff;
}

#topbar .tb-search {
  min-width: 0;
  flex: 1;
  max-width: 280px;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--input-border);
  background: var(--panel-bg);
  color: var(--text-primary);
  padding: 0 10px;
}

#menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--toolbar-border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--sx-wine, #600010);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

#theme-toggle {
  color: var(--sx-wine, #600010);
}

#sidebar-backdrop {
  display: none;
  position: fixed;
  top: calc(var(--sx-topbar-h) + var(--sx-safe-top));
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(40, 0, 8, 0.4);
  z-index: 1090;
}

#sidebar {
  background: linear-gradient(180deg, var(--sx-wine, #600010) 0%, var(--sx-wine-dark, #3d000a) 100%);
  color: var(--text-on-dark);
  border-right: 1px solid var(--sx-wine-dark, #3d000a);
  width: var(--sx-sidebar-w);
  flex: 0 0 var(--sx-sidebar-w);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}

#sidebar .sidebar-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

#sidebar .brand-logo-sidebar {
  display: none !important;
}

#sidebar .sidebar-header h1 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

#sidebar .sidebar-edition {
  display: none;
}

#sidebar .nav-section {
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 14px 4px;
}

#sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  border-left: 3px solid transparent;
  font-size: 13px;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-left-color: var(--qb-gold, #c9a227);
}

#sidebar .sidebar-footer {
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  padding: 14px;
}

#main-area {
  display: flex !important;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: var(--content-bg);
  color: var(--text-primary);
  padding: 12px;
  padding-bottom: calc(12px + var(--sx-safe-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

#statusbar {
  flex: 0 0 auto;
  background: var(--toolbar-bg);
  color: var(--text-secondary);
  border-top: 1px solid var(--toolbar-border);
  min-height: var(--sx-status-h);
  padding-bottom: var(--sx-safe-bottom);
  font-size: 11px;
}

.page-header h2,
.sx-kpi .value {
  color: var(--heading-color, var(--sx-wine, #600010));
}

.sx-kpi .label,
.mapcn-panel h3 {
  color: var(--text-muted);
}

.splash-logo {
  width: auto !important;
  max-width: min(280px, 82vw);
  height: auto !important;
  margin: 0 auto 12px;
  display: block;
  object-fit: contain;
  background: #0b0b0b;
  border-radius: 8px;
  padding: 12px 16px;
}

.splash-overlay {
  background: rgba(245, 242, 243, 0.96);
}

.splash-box {
  background: var(--panel-bg);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  max-width: 420px;
  width: calc(100% - 32px);
  padding: 24px;
}

.splash-title {
  color: var(--sx-wine, #600010);
  font-weight: 700;
}

.splash-subtitle {
  color: var(--text-muted);
}

.splash-btn {
  background: var(--sx-wine, #600010);
  color: #fff;
  border: 0;
  min-height: 42px;
  border-radius: 6px;
  width: 100%;
  margin-top: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary,
.sx-btn-primary {
  background: var(--sx-wine, #600010);
  border-color: var(--sx-wine, #600010);
  color: #fff;
}

.card,
.sx-card,
.sx-kpi {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: 8px;
}

/* Map — always visible canvas (with or without customers) */
.mapcn-page { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.mapcn-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.mapcn-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-height: min(72vh, 680px);
  flex: 1;
}
.mapcn-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 10px;
  max-height: 220px;
  overflow: auto;
}
.mapcn-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: var(--gray-50);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 6px;
  min-height: 44px;
}
.mapcn-list-item:hover,
.mapcn-list-item.active {
  border-color: var(--sx-wine, #600010);
  background: var(--sx-wine-muted, #f3e6e8);
}
.mapcn-list-item.unmapped { border-style: dashed; }
.mapcn-empty-hint {
  color: var(--text-muted);
  font-size: 13px;
  padding: 10px 4px;
  line-height: 1.45;
}
.mapcn-empty-hint .sx-btn { margin-top: 10px; display: inline-flex; }
.mapcn-frame {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: #d7d2ce;
  min-height: 360px;
  height: min(68vh, 640px);
}
#sx-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 360px;
}
.mapcn-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--panel-bg);
  color: var(--text-primary);
}
.mapcn-empty-banner {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--panel-border);
  color: var(--sx-wine, #600010);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(40, 0, 8, 0.12);
}
[data-theme="dark"] .mapcn-empty-banner {
  background: rgba(24, 14, 16, 0.92);
  color: #f2d7dc;
}
.mapcn-hint {
  margin: 0;
  font-size: 12px;
  color: var(--sx-wine, #600010);
  font-weight: 600;
}
.mapcn-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mapcn-ctrl {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--sx-wine, #600010);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mapcn-toolbar {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 64px);
}
.mapcn-toolbar select,
.mapcn-toolbar button {
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text-primary);
  padding: 0 10px;
  font-size: 12px;
}
.mapcn-marker {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--sx-wine, #600010);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(96, 0, 16, 0.25);
  cursor: pointer;
}
.mapcn-marker.distributor {
  background: var(--qb-gold, #c9a227);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.28);
}

.pos-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
.pos-products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pos-product,
.pos-cart {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 12px;
}
.pos-product { min-height: 80px; cursor: pointer; text-align: left; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-group.full-width { grid-column: 1 / -1; }
}

@media (min-width: 768px) {
  .pos-layout { grid-template-columns: 1.4fr 1fr; }
  .pos-products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sx-grid-2 { grid-template-columns: 1fr 1fr; }
  .sx-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 960px) {
  .mapcn-shell { grid-template-columns: 280px 1fr; }
  .mapcn-panel { max-height: min(64vh, 600px); }
}

@media (min-width: 1024px) {
  .pos-products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sx-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  #menu-toggle { display: inline-flex; }
  .sidebar-close { display: inline-flex; }
  #main-area { display: block !important; }

  #sidebar {
    position: fixed;
    top: calc(var(--sx-topbar-h) + var(--sx-safe-top));
    left: 0;
    bottom: 0;
    z-index: 1100;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    width: min(88vw, 300px);
    flex: none;
    box-shadow: 8px 0 28px rgba(40, 0, 8, 0.28);
  }
  body.sidebar-open #sidebar { transform: translateX(0); }
  body.sidebar-open #sidebar-backdrop { display: block; }

  #topbar .tb-search { max-width: none; flex: 1; }
  #topbar #topbar-clock { display: none !important; }
  #topbar #install-app-btn { font-size: 11px; padding: 0 8px; }
  /* Keep theme toggle + logout + create visible on mobile */

  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tr {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px;
  }
  .data-table td { border: 0; padding: 4px 0; color: var(--text-primary); }
  .data-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
  }

  .modal {
    width: calc(100vw - 16px) !important;
    max-width: 100% !important;
    margin: 8px;
  }
}

@media (max-width: 480px) {
  #topbar .tb-search { display: none; }
  #content { padding: 8px; }
  #topbar .brand-logo { max-width: 120px; height: 24px; }
  .pos-products { grid-template-columns: 1fr 1fr; }

  /* Minimal mobile footer / status bar */
  #statusbar {
    min-height: 22px;
    height: auto;
    padding: 2px 8px calc(2px + var(--sx-safe-bottom));
    font-size: 10px;
    gap: 6px;
  }
  #statusbar .status-desktop-only,
  #statusbar .status-sep { display: none !important; }
  #statusbar #status-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #statusbar #status-date { font-variant-numeric: tabular-nums; opacity: 0.85; }
}

/* POS */
.pos-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pos-shift-pill { padding: 6px 10px; font-size: 12px; }
.pos-shift-pill.muted { opacity: 0.7; }
.pos-search-row { margin-bottom: 10px; }
.pos-search-row input { width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--panel-border); background: var(--panel-bg); color: var(--text-primary); }
.pos-cart-line { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--panel-border); }
.pos-qty { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pos-last-sale { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Documents */
.docs-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.docs-filter {
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 36px;
  cursor: pointer;
}
.docs-filter.active { background: var(--sx-wine, #600010); color: #fff; border-color: transparent; }
.docs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .docs-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .docs-grid { grid-template-columns: repeat(3, 1fr); }
}
.docs-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text-primary);
}
.docs-card h3 { margin: 6px 0; font-size: 15px; color: var(--heading-color, var(--sx-wine)); }
.docs-card-type {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sx-wine, #600010);
  font-weight: 700;
}
.docs-card-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-muted); margin: 8px 0; }
.docs-empty { text-align: center; padding: 28px 16px; }

/* Gamification */
.game-bar {
  height: 10px;
  background: rgba(96, 0, 16, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.game-bar-fill {
  height: 100%;
  background: var(--sx-wine, #600010);
  border-radius: 999px;
  transition: width 0.35s ease;
}
.customer-game-strip {
  margin-bottom: 14px;
  padding: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  font-size: 13px;
}

/* Notification center */
#notif-center-btn { position: relative; }
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--sx-wine, #600010);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}
.notif-center {
  position: absolute;
  top: calc(100% + 6px);
  right: 8px;
  width: min(380px, calc(100vw - 16px));
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(40, 0, 8, 0.18);
  z-index: 1400;
  overflow: hidden;
}
#topbar { position: relative; }
.notif-center-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
}
.notif-tabs { display: flex; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--panel-border); }
.notif-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
.notif-tab.active { background: rgba(96, 0, 16, 0.1); color: var(--sx-wine, #600010); font-weight: 600; }
.notif-center-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 8px;
  max-height: min(55vh, 420px);
}
.notif-item {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--content-bg, transparent);
}
.notif-item-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.notif-channel {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.notif-item p { margin: 6px 0; font-size: 13px; color: var(--text-secondary); }
.notif-item time { font-size: 11px; color: var(--text-muted); }
.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); }
.notif-item.level-success { border-left: 3px solid #1f7a36; }
.notif-item.level-warn { border-left: 3px solid #a8761f; }

#install-app-btn { white-space: nowrap; font-size: 12px; }

/* ChatGPT-style AI shell */
.gpt-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100vh - var(--sx-topbar-h, 52px) - var(--sx-status-h, 26px) - 24px);
  background: var(--content-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.gpt-sidebar {
  display: none;
  flex-direction: column;
  background: #111;
  color: #ececec;
  width: min(280px, 88vw);
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 5;
  transform: translateX(-105%);
  transition: transform 0.22s ease;
}
.gpt-sidebar.open { display: flex; transform: translateX(0); }
.gpt-sidebar-top {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.gpt-new { flex: 1; }
.gpt-history {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}
.gpt-hist-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: #ececec;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gpt-hist-item:hover, .gpt-hist-item.active { background: rgba(255,255,255,0.08); }
.gpt-hist-item small { color: #9a9a9a; }
.gpt-kb {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 10px 12px 14px;
  font-size: 12px;
}
.gpt-kb-list { margin: 6px 0 10px; padding-left: 16px; max-height: 90px; overflow: auto; }
.gpt-ingest { display: grid; gap: 6px; }
.gpt-ingest input {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #fff;
  border-radius: 6px;
  padding: 6px 8px;
}
.gpt-main {
  display: flex;
  flex-direction: column;
  min-height: inherit;
  background: var(--panel-bg);
}
.gpt-main-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-border);
}
.gpt-main-head h2 { margin: 0; font-size: 16px; color: var(--heading-color, var(--sx-wine)); }
.gpt-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.gpt-welcome { max-width: 560px; margin: 8vh auto 0; text-align: center; }
.gpt-welcome h3 { color: var(--heading-color, var(--sx-wine)); }
.gpt-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.gpt-msg {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  margin-bottom: 16px;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}
.gpt-msg.user { direction: ltr; }
.gpt-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: rgba(96,0,16,0.12);
  color: var(--sx-wine, #600010);
}
.gpt-msg.user .gpt-avatar { background: #111; color: #fff; }
.gpt-bubble {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--content-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  line-height: 1.5;
  white-space: normal;
}
.gpt-msg.user .gpt-bubble { background: rgba(96, 0, 16, 0.08); }
.gpt-composer {
  border-top: 1px solid var(--panel-border);
  padding: 10px 12px calc(10px + var(--sx-safe-bottom));
  display: grid;
  gap: 8px;
  background: var(--panel-bg);
}
.gpt-composer textarea {
  width: 100%;
  resize: none;
  min-height: 44px;
  max-height: 140px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--content-bg);
  color: var(--text-primary);
  padding: 10px 12px;
  font: inherit;
}
.gpt-composer-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (min-width: 900px) {
  .gpt-shell { grid-template-columns: 280px 1fr; }
  .gpt-sidebar {
    display: flex;
    position: relative;
    transform: none;
    width: auto;
  }
  .gpt-sidebar-close, .gpt-menu { display: none !important; }
}

@media (max-width: 899px) {
  .gpt-sidebar.open { display: flex; }
  .gpt-sidebar:not(.open) { display: none; }
}

[data-theme="dark"] .gpt-main { background: #171111; }
[data-theme="dark"] .gpt-bubble { background: #1f1719; }
[data-theme="dark"] .notif-center { background: #1a1214; }
