/* UNISET-inspired chat shell (chat-mode only) */

#genScreen.chat-mode {
  background: #000;
  padding-bottom: calc(12px + var(--safe-b));
}

#genScreen.chat-mode #genBrand,
#genScreen.chat-mode #closeGen {
  display: none !important;
}

#genScreen.chat-mode #chatTopBar {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

#genScreen.chat-mode .top-bar.simple {
  background: #000;
  border-bottom: none;
  padding-inline: 8px;
}

.chat-model-chip {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 12px;
}

.chat-model-chip-caret {
  font-size: 11px;
  opacity: 0.7;
}

#genScreen.chat-mode .gen-config,
#genScreen.chat-mode .chat-reset-btn {
  display: none !important;
}

#genScreen.chat-mode .chat-thread {
  flex: 1;
  min-height: 0;
  max-height: none;
  background: transparent;
  border: none;
  padding: 8px 4px 16px;
}

#genScreen.chat-mode .chat-thread-empty {
  min-height: 55vh;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
  opacity: 1;
}

#genScreen.chat-mode .chat-bubble-user {
  background: #2a2a2e;
  color: #fff;
}

#genScreen.chat-mode .chat-bubble-ai {
  background: transparent;
  border: none;
  padding-left: 2px;
  max-width: 100%;
}

#genScreen.chat-mode .gen-composer {
  background: transparent;
  padding: 0 4px calc(6px + var(--safe-b));
}

#genScreen.chat-mode .chat-compose-box {
  background: #1c1c1e;
  border: none;
  border-radius: 28px;
  padding: 14px 14px 12px;
}

#genScreen.chat-mode .chat-compose-input {
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  min-height: 44px;
  max-height: 120px;
  padding: 0 4px 10px !important;
  font-size: 16px;
  resize: none;
}

#genScreen.chat-mode .chat-compose-input::placeholder {
  color: #8e8e93;
}

#genScreen.chat-mode .chat-compose-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

#genScreen.chat-mode .chat-send-btn {
  display: none !important;
}

#genScreen.chat-mode .chat-gear-btn,
#genScreen.chat-mode .chat-attach-btn,
#genScreen.chat-mode .chat-round-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #f2f2f7;
  font-size: 18px;
  border-radius: 50%;
  padding: 0;
}

#genScreen.chat-mode .chat-round-btn {
  width: 42px;
  height: 42px;
  background: #fff;
  color: #000;
  font-size: 18px;
  margin-left: 2px;
}

#genScreen.chat-mode .chat-round-btn.is-send {
  font-size: 20px;
}

#genScreen.chat-mode .chat-attach-btn.is-disabled {
  opacity: 0.35;
}

/* Model picker */
.chat-picker-sheet .chat-picker-panel {
  background: #000;
  max-height: 92vh;
}

.chat-cat-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chat-cat-tab {
  flex: 0 0 auto;
  border: none;
  background: #141416;
  color: #8e8e93;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
}

.chat-cat-tab.is-active {
  background: #2c2c2e;
  color: #fff;
}

.chat-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: calc(92vh - 140px);
  padding-bottom: 20px;
}

.chat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  border: none;
  background: #1c1c1e;
  color: #fff;
  border-radius: 18px;
  padding: 16px;
}

.chat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2c2c2e;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-card-body {
  flex: 1;
  min-width: 0;
}

.chat-card-body strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.chat-card-body small {
  display: block;
  color: #8e8e93;
  font-size: 13px;
  line-height: 1.35;
}

.chat-card-chevron {
  color: #8e8e93;
  font-size: 18px;
}

.chat-card.is-active {
  outline: 1px solid rgba(255, 255, 255, 0.18);
}

/* Drawer — full-height left sidebar */
.chat-drawer.sheet {
  align-items: stretch;
  justify-content: flex-start;
}

.chat-drawer .sheet-backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.chat-drawer .chat-drawer-panel,
.chat-drawer .sheet-panel {
  position: relative;
  align-self: stretch;
  height: 100%;
  max-height: 100%;
  min-height: 100%;
  width: min(84vw, 320px);
  max-width: 320px;
  margin: 0;
  background: #0a0a0c;
  border-radius: 0;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px calc(18px + var(--safe-b));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.chat-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding: 2px 2px 0;
}

.chat-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-drawer-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #000;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.chat-drawer-title {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chat-drawer-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #a1a1a6;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.chat-drawer-close:active {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.chat-drawer-cats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: #141416;
  border-radius: 16px;
  padding: 5px;
  margin: 0 0 18px;
}

.chat-drawer-cat {
  border: none;
  background: transparent;
  color: #8e8e93;
  border-radius: 12px;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-height: 58px;
}

.chat-drawer-cat svg {
  width: 20px;
  height: 20px;
  display: block;
}

.chat-drawer-cat small {
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

.chat-drawer-cat.is-active {
  background: #2a2a2e;
  color: #fff;
}

.chat-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 18px;
}

.chat-drawer .chat-drawer-link,
.chat-drawer .menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none !important;
  background: transparent !important;
  color: #f2f2f7 !important;
  border-radius: 12px;
  padding: 11px 10px !important;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  box-shadow: none !important;
}

.chat-drawer .chat-drawer-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #c7c7cc;
}

.chat-drawer .chat-drawer-link span,
.chat-drawer .menu-row span:last-child {
  margin-left: 0 !important;
  color: inherit !important;
}

.chat-drawer .chat-drawer-link:active,
.chat-drawer .menu-row:active {
  background: rgba(255, 255, 255, 0.06) !important;
}

.chat-drawer-section,
.chat-drawer .menu-section-label {
  margin: 0 10px 8px;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #636366;
  background: none;
  border: none;
}

.chat-session-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 0 0 8px;
  -webkit-overflow-scrolling: touch;
}

.chat-session-empty {
  padding: 8px 10px 16px;
  font-size: 13px;
  color: #636366;
}

.chat-session-row {
  border: none;
  background: transparent;
  color: #fff;
  text-align: left;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-session-row:active {
  background: rgba(255, 255, 255, 0.06);
}

.chat-session-row strong {
  font-size: 14px;
  font-weight: 600;
  color: #f5f5f7;
}

.chat-session-row small {
  color: #8e8e93;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Context sheet */
.chat-context-sheet .chat-context-panel {
  background: #1c1c1e;
  border-radius: 24px 24px 0 0;
  padding-bottom: calc(18px + var(--safe-b));
}

.chat-context-title {
  margin: 0;
  font-size: 20px;
}

.chat-context-sub {
  margin: 6px 0 0;
  font-size: 13px;
}

.chat-context-meter {
  margin: 18px 0 16px;
  background: #111113;
  border-radius: 18px;
  padding: 22px 18px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.chat-context-meter span {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.chat-context-meter small {
  color: #8e8e93;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.chat-context-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.chat-context-chip {
  border: none;
  background: #111113;
  color: #8e8e93;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
}

.chat-context-chip.is-active {
  background: #3a3a3c;
  color: #fff;
}

.chat-context-foot {
  font-size: 13px;
  margin: 0;
}
