* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070711;
  color: #f8fafc;
}

.hidden {
  display: none !important;
}

/* LOGIN */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.35), transparent 35%),
    radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.25), transparent 35%),
    linear-gradient(135deg, #070711, #111122);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 36px;
  border-radius: 28px;
  background: rgba(16, 16, 32, 0.82);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 30px 90px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px);
}

.brand-orb,
.empty-orb,
.mini-orb,
.logo-img,
.login-logo {
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.55);
}

.brand-orb {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  font-weight: 800;
  font-size: 28px;
  margin-bottom: 24px;
}

.login-card h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.subtitle {
  color: #a1a1aa;
  margin: 10px 0 28px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  color: #c4b5fd;
  font-size: 13px;
  margin-bottom: 8px;
}

input,
textarea,
select {
  width: 100%;
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  font-size: 15px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #a78bfa;
  box-shadow: 0 0 0 4px rgba(167,139,250,0.12);
}

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  box-shadow: 0 14px 34px rgba(124,58,237,0.35);
}

.primary-btn:hover {
  transform: translateY(-1px);
}

.otp-block {
  display: none;
  margin-top: 18px;
}

.status-msg {
  margin-top: 14px;
  color: #c4b5fd;
  font-size: 14px;
}

/* APP */

.app-shell {
  height: 100vh;
  display: flex;
  background: #09090f;
}

.sidebar {
  width: 315px;
  background: rgba(10,10,18,0.96);
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.app-logo {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  flex: 0 0 auto;
}

.login-logo {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  display: block;
  margin-bottom: 24px;
}

.mini-orb {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.app-logo strong {
  display: block;
  font-size: 15px;
}

.app-logo span {
  color: #8b8ba3;
  font-size: 12px;
}

.new-chat {
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid rgba(167,139,250,0.3);
  background: rgba(139,92,246,0.14);
  color: #ede9fe;
  cursor: pointer;
  font-weight: 700;
}

.new-chat:hover {
  background: rgba(139,92,246,0.24);
}

.session-label {
  color: #71717a;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.12em;
  margin: 24px 0 10px;
}

.sessions-list {
  flex: 1;
  overflow-y: auto;
}

.empty-sessions {
  color: #71717a;
  font-size: 13px;
  padding: 12px;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px 11px 14px;
  border-radius: 14px;
  color: #d4d4d8;
  cursor: pointer;
  margin-bottom: 6px;
  font-size: 14px;
  position: relative;
}

.session-item:hover {
  background: rgba(255,255,255,0.06);
}

.session-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(192,38,211,0.22));
  color: #fff;
}

.session-content {
  min-width: 0;
  flex: 1;
}

.session-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.session-time {
  margin-top: 4px;
  color: #8b8ba3;
  font-size: 11px;
}

.session-delete {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  border: none;
  color: #a1a1aa;
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  opacity: 0;
  transition: 0.15s ease;
  font-size: 18px;
  line-height: 1;
}

.session-item:hover .session-delete {
  opacity: 1;
}

.session-delete:hover {
  background: rgba(239,68,68,0.22);
  color: #fecaca;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
}

.sidebar-footer button {
  width: 100%;
  background: transparent;
  color: #a1a1aa;
  border: none;
  padding: 10px;
  cursor: pointer;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(circle at 70% 10%, rgba(124,58,237,0.12), transparent 28%),
    #0d0d16;
}

.chat-header {
  height: 82px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.chat-header h2 {
  margin: 0;
  font-size: 18px;
}

.chat-header p {
  margin: 5px 0 0;
  color: #8b8ba3;
  font-size: 13px;
}

.model-select {
  width: 230px;
  background: #171728;
}

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: #a1a1aa;
}

.empty-state > div {
  max-width: 560px;
}

.empty-orb {
  width: 70px;
  height: 70px;
  margin: 0 auto 22px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 30px;
}

.empty-state h3 {
  color: #fff;
  font-size: 30px;
  margin: 0 0 10px;
  letter-spacing: -0.04em;
}

.message-row {
  display: flex;
  margin-bottom: 22px;
}

.message-row.user {
  justify-content: flex-end;
}

.message {
  max-width: 780px;
  padding: 16px 18px;
  border-radius: 20px;
  line-height: 1.6;
  font-size: 15px;
}

.message.user {
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  color: white;
  border-bottom-right-radius: 6px;
}

.message.assistant {
  background: rgba(255,255,255,0.065);
  border: 1px solid rgba(255,255,255,0.08);
  color: #f4f4f5;
  border-bottom-left-radius: 6px;
}

.message.streaming {
  white-space: pre-wrap;
}

.message table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
}

.message th,
.message td {
  border: 1px solid rgba(255,255,255,0.14);
  padding: 10px;
}

.message th {
  background: rgba(255,255,255,0.08);
}

.message pre {
  background: #050508;
  padding: 14px;
  border-radius: 14px;
  overflow-x: auto;
}

.composer-wrap {
  position: relative;
  padding: 14px 28px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.drop-zone {
  position: absolute;
  inset: 12px 28px 92px;
  z-index: 12;
  display: grid;
  place-items: center;
  border-radius: 24px;
  border: 1.5px dashed rgba(196,181,253,0.72);
  background: rgba(12, 12, 24, 0.82);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 22px 70px rgba(0,0,0,0.38);
}

.drop-zone-card {
  text-align: center;
  padding: 26px;
  border-radius: 24px;
  background: rgba(139,92,246,0.14);
  border: 1px solid rgba(167,139,250,0.24);
  max-width: 420px;
}

.drop-zone-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  box-shadow: 0 18px 45px rgba(124,58,237,0.36);
  font-size: 26px;
}

.drop-zone-card strong {
  display: block;
  color: #fff;
  font-size: 18px;
  margin-bottom: 6px;
}

.drop-zone-card span {
  color: #c4b5fd;
  font-size: 13px;
  line-height: 1.5;
}

body.drag-active .composer {
  border-color: rgba(196,181,253,0.75);
  box-shadow: 0 0 0 4px rgba(167,139,250,0.12);
}


.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 280px;
  padding: 8px 9px;
  border-radius: 14px;
  background: rgba(139,92,246,0.16);
  border: 1px solid rgba(167,139,250,0.22);
  color: #ede9fe;
}

.attachment-chip strong {
  display: block;
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 190px;
}

.attachment-chip small {
  display: block;
  color: #a1a1aa;
  font-size: 11px;
}

.attachment-chip button {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.09);
  color: #fff;
  cursor: pointer;
}

.composer {
  display: flex;
  gap: 10px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 10px;
  border-radius: 22px;
}

.attach-btn {
  width: 48px !important;
  min-width: 48px;
  border: none;
  border-radius: 16px;
  color: #fff;
  background: rgba(255,255,255,0.08) !important;
  cursor: pointer;
  font-size: 18px;
}

.attach-btn:hover {
  background: rgba(139,92,246,0.28) !important;
}

.composer textarea {
  resize: none;
  border: none;
  background: transparent;
  min-height: 48px;
  max-height: 160px;
}

.composer textarea:focus {
  box-shadow: none;
}

.composer button#sendBtn {
  width: 92px;
  border: none;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  cursor: pointer;
}

.composer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  color: #71717a;
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
}

.loading {
  color: #c4b5fd;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  50% { opacity: 0.5; }
}

@media (max-width: 800px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 210px;
  }

  .sessions-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
  }

  .session-item {
    min-width: 180px;
  }

  .session-delete {
    opacity: 1;
  }

  .chat-header {
    padding: 16px;
    height: auto;
    gap: 12px;
    flex-direction: column;
    align-items: flex-start;
  }

  .model-select {
    width: 100%;
  }

  .messages-area {
    padding: 18px;
  }

  .composer-wrap {
    padding: 14px;
  }
}

/* In-app toast + confirm modal. No browser alert/confirm. */
.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  padding: 13px 15px;
  border-radius: 16px;
  background: rgba(24, 24, 38, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  color: #f8fafc;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  backdrop-filter: blur(18px);
  font-size: 14px;
  line-height: 1.4;
}

.toast-success {
  border-color: rgba(34,197,94,0.32);
}

.toast-error {
  border-color: rgba(239,68,68,0.35);
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 3, 10, 0.66);
  backdrop-filter: blur(10px);
}

.confirm-card {
  width: min(430px, 100%);
  border-radius: 26px;
  padding: 26px;
  background: rgba(18, 18, 32, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 28px 90px rgba(0,0,0,0.58);
  color: #f8fafc;
}

.confirm-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  margin-bottom: 14px;
  background: rgba(239,68,68,0.15);
  color: #fecaca;
  font-weight: 900;
}

.confirm-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.confirm-card p {
  margin: 0;
  color: #a1a1aa;
  line-height: 1.5;
  font-size: 14px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.confirm-actions button {
  border: none;
  border-radius: 14px;
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 800;
}

.confirm-cancel {
  background: rgba(255,255,255,0.08);
  color: #e4e4e7;
}

.confirm-ok {
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  color: #fff;
}

.confirm-ok.danger {
  background: linear-gradient(135deg, #dc2626, #f97316);
}

@media (max-width: 560px) {
  .login-card {
    padding: 26px;
    border-radius: 24px;
  }

  .login-card h1 {
    font-size: 29px;
  }

  .app-shell {
    height: 100dvh;
  }

  .sidebar {
    height: 180px;
    padding: 14px;
  }

  .app-logo {
    margin-bottom: 12px;
  }

  .new-chat {
    padding: 11px;
  }

  .session-label {
    margin: 14px 0 8px;
  }

  .session-item {
    min-width: 165px;
    padding: 10px;
  }

  .session-delete {
    opacity: 1;
  }

  .chat-header h2 {
    font-size: 16px;
  }

  .chat-header p {
    display: none;
  }

  .empty-state h3 {
    font-size: 24px;
  }

  .message {
    max-width: 94vw;
    font-size: 14px;
    padding: 14px 15px;
  }

  .composer {
    gap: 8px;
    padding: 8px;
    border-radius: 18px;
  }

  .attach-btn {
    width: 42px !important;
    min-width: 42px;
  }

  .composer button#sendBtn {
    width: 74px;
  }

  .hint {
    font-size: 11px;
  }

  .attachment-chip {
    max-width: 100%;
  }

  .toast-container {
    left: 14px;
    right: 14px;
    top: 14px;
  }

  .confirm-card {
    border-radius: 22px;
    padding: 22px;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .confirm-actions button {
    width: 100%;
  }
}

@media (max-width: 920px) {
  .sidebar {
    width: 275px;
  }

  .message {
    max-width: min(760px, 86vw);
  }
}

@media (max-width: 720px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
  }

  .sidebar {
    height: 178px;
    min-height: 178px;
  }

  .chat-main {
    min-height: 0;
  }

  .messages-area {
    min-height: 0;
  }

  .drop-zone {
    inset: 8px 14px 86px;
    border-radius: 20px;
  }

  .drop-zone-card {
    padding: 20px;
    max-width: calc(100vw - 52px);
  }
}

@media (max-width: 420px) {
  .login-page {
    padding: 14px;
  }

  .login-card {
    padding: 22px;
  }

  .login-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 18px;
  }

  .sidebar {
    height: 168px;
    min-height: 168px;
  }

  .app-logo span {
    max-width: 220px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .attachment-tray {
    max-height: 94px;
    overflow-y: auto;
  }

  .composer textarea {
    font-size: 16px;
  }
}
.code-wrap {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  overflow: hidden;
  margin-top: 12px;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.06);
  padding: 6px 10px;
  font-size: 12px;
  color: #a1a1aa;
}

.code-label {
  text-transform: lowercase;
}

.copy-btn {
  background: transparent;
  border: none;
  color: #a1a1aa;
  cursor: pointer;
  font-size: 14px;
}

.copy-btn:hover {
  color: #fff;
}

.code-wrap pre {
  margin: 0;
  padding: 14px;
  background: #050508;
}

/* Streaming should stay solid, no fading/pulse */
.message.streaming {
  white-space: pre-wrap;
  animation: none !important;
  opacity: 1 !important;
  color: #f4f4f5 !important;
}

/* Send button becomes Stop while streaming */
.composer button#sendBtn.stop-mode {
  background: linear-gradient(135deg, #dc2626, #f97316);
  box-shadow: 0 12px 28px rgba(220,38,38,0.25);
}

.composer button#sendBtn.stop-mode:hover {
  filter: brightness(1.08);
}

.message.assistant {
  max-width: min(980px, calc(100vw - 360px));
  overflow-x: auto;
}

.message.assistant table {
  min-width: 720px;
  width: max-content;
  max-width: none;
}

.message.assistant th,
.message.assistant td {
  white-space: nowrap;
}

@media (max-width: 800px) {
  .message.assistant {
    max-width: 94vw;
  }

  .message.assistant table {
    min-width: 680px;
  }
}
/* Smooth dark scrollbar (Chrome, Edge, Safari) */
.message.assistant::-webkit-scrollbar {
  height: 8px;
}

.message.assistant::-webkit-scrollbar-track {
  background: transparent;
}

.message.assistant::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  transition: background 0.2s ease;
}

.message.assistant::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Firefox */
.message.assistant {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Mobile hamburger + drawer layout */
.mobile-menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  flex: 0 0 auto;
}

.mobile-menu-btn:hover {
  background: rgba(139,92,246,0.22);
}

.chat-heading {
  min-width: 0;
}

.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0,0,0,0.56);
  backdrop-filter: blur(5px);
}

@media (max-width: 800px) {
  .app-shell {
    flex-direction: row;
    height: 100dvh;
    overflow: hidden;
  }

  .mobile-menu-btn {
    display: grid;
    place-items: center;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 340px);
    height: 100dvh;
    min-height: 100dvh;
    z-index: 90;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 24px 0 80px rgba(0,0,0,0.55);
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sessions-list {
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 0;
  }

  .session-item {
    min-width: 0;
    width: 100%;
  }

  .chat-main {
    width: 100%;
    min-width: 0;
  }

  .chat-header {
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
  }

  .chat-header .chat-heading {
    flex: 1;
  }

  .model-select {
    width: min(42vw, 190px);
    padding: 11px 12px;
  }

  .messages-area {
    padding: 18px 14px;
  }

  .message.assistant {
    max-width: 94vw;
  }
}

@media (max-width: 560px) {
  .chat-header {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
  }

  .model-select {
    grid-column: 1 / -1;
    width: 100%;
  }

  .composer-wrap {
    padding: 12px 12px 16px;
  }

  .composer {
    border-radius: 20px;
  }

  .composer button#sendBtn {
    width: 78px;
  }

  .empty-state {
    padding: 0 18px;
  }

  .empty-state h3 {
    font-size: 27px;
  }

  .empty-state p {
    font-size: 16px;
    line-height: 1.45;
  }
}


/* Premium OTP modal */
.otp-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 20%, rgba(168,85,247,0.28), transparent 32%),
    rgba(3, 3, 10, 0.72);
  backdrop-filter: blur(16px);
}

.otp-modal-card {
  position: relative;
  width: min(430px, 100%);
  padding: 30px;
  border-radius: 30px;
  background: rgba(18, 18, 34, 0.96);
  border: 1px solid rgba(255,255,255,0.13);
  box-shadow: 0 34px 100px rgba(0,0,0,0.64);
  text-align: center;
  overflow: hidden;
}

.otp-modal-card::before {
  content: "";
  position: absolute;
  inset: -80px -80px auto auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(217,70,239,0.34), transparent 68%);
  pointer-events: none;
}

.otp-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: #c4b5fd;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.otp-close:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

.otp-glow-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, #7c3aed, #d946ef);
  box-shadow: 0 20px 58px rgba(168,85,247,0.42);
  font-size: 28px;
}

.otp-modal-card h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.04em;
}

.otp-subtext {
  margin: 10px 0 22px;
  color: #a1a1aa;
  line-height: 1.45;
}

.otp-subtext strong {
  color: #ddd6fe;
}

.otp-boxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  margin: 20px 0 16px;
}

.otp-digit {
  height: 54px;
  padding: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 900;
  border-radius: 16px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
}

.otp-digit:focus {
  border-color: #c084fc;
  box-shadow: 0 0 0 4px rgba(192,132,252,0.13);
}

.otp-timer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 18px;
  color: #a1a1aa;
  font-size: 13px;
}

.otp-resend {
  border: none;
  background: transparent;
  color: #c4b5fd;
  font-weight: 800;
  cursor: pointer;
}

.otp-resend:disabled {
  color: #71717a;
  cursor: not-allowed;
}

.otp-verify-btn {
  margin-top: 4px;
}

.otp-modal-msg {
  min-height: 20px;
  margin-top: 12px;
  font-size: 13px;
  color: #a1a1aa;
}

.otp-modal-msg.error {
  color: #fca5a5;
}

.otp-modal-msg.success {
  color: #86efac;
}

@media (max-width: 460px) {
  .otp-modal-card {
    padding: 26px 20px;
    border-radius: 26px;
  }

  .otp-boxes {
    gap: 7px;
  }

  .otp-digit {
    height: 48px;
    font-size: 21px;
    border-radius: 14px;
  }

  .otp-timer-row {
    flex-direction: column;
    gap: 8px;
  }
}

/* ===== GLOBAL DARK SCROLLBAR (FIX OUTER + SIDEBAR) ===== */

/* Apply to entire app */
html, body, .sidebar, .sessions-list, .messages-area {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}

/* Chrome / Edge / Safari */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.sessions-list::-webkit-scrollbar,
.messages-area::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.sessions-list::-webkit-scrollbar-track,
.messages-area::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.sessions-list::-webkit-scrollbar-thumb,
.messages-area::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.sessions-list::-webkit-scrollbar-thumb:hover,
.messages-area::-webkit-scrollbar-thumb:hover {
  background: rgba(196,181,253,0.35); /* subtle purple */
}
/* Prevent outer scroll — only internal panels scroll */
body:has(.app-shell:not(.hidden)) {
  overflow: hidden;
}
/* ===== PROJECTS V1 ===== */
.sidebar-actions {
  margin-top: 10px;
}

.new-project {
  width: 100%;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.055);
  color: #ddd6fe;
  cursor: pointer;
  font-weight: 800;
}

.new-project:hover {
  background: rgba(139,92,246,0.20);
  border-color: rgba(167,139,250,0.28);
}

.project-create-card {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(167,139,250,0.16);
}

.project-create-card input,
.project-create-card textarea {
  padding: 11px 12px;
  border-radius: 13px;
  font-size: 13px;
  margin-bottom: 8px;
}

.project-create-card textarea {
  resize: vertical;
  min-height: 74px;
  max-height: 130px;
}

.project-create-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.project-create-actions button {
  border: none;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  font-weight: 800;
}

#cancelProjectBtn {
  background: rgba(255,255,255,0.08);
  color: #d4d4d8;
}

#saveProjectBtn {
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  color: #fff;
}

#saveProjectBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.project-msg {
  min-height: 16px;
  margin-top: 8px;
  color: #a1a1aa;
  font-size: 12px;
}

.project-msg.error {
  color: #fca5a5;
}

.sidebar-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
}

.sidebar-section-row .session-label {
  margin: 0;
}

.project-more-btn {
  border: none;
  background: transparent;
  color: #c4b5fd;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 0;
}

.project-more-btn:hover {
  color: #fff;
}

.projects-list {
  margin-top: 10px;
  max-height: 246px;
  overflow-y: auto;
  padding-right: 2px;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 15px;
  color: #d4d4d8;
  cursor: pointer;
  margin-bottom: 6px;
  border: 1px solid transparent;
}

.project-item:hover {
  background: rgba(255,255,255,0.06);
}

.project-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.36), rgba(192,38,211,0.20));
  border-color: rgba(196,181,253,0.18);
  color: #fff;
}

.project-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(139,92,246,0.20);
  border: 1px solid rgba(167,139,250,0.20);
  color: #ede9fe;
  font-size: 13px;
  font-weight: 900;
}

.project-content {
  min-width: 0;
  flex: 1;
}

.project-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.25;
  font-size: 14px;
  font-weight: 800;
}

.project-meta {
  margin-top: 3px;
  color: #8b8ba3;
  font-size: 11px;
}

.project-delete {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border: none;
  border-radius: 9px;
  background: rgba(255,255,255,0.06);
  color: #a1a1aa;
  cursor: pointer;
  opacity: 0;
  transition: 0.15s ease;
  font-size: 18px;
  line-height: 1;
}

.project-item:hover .project-delete {
  opacity: 1;
}

.project-delete:hover {
  background: rgba(239,68,68,0.22);
  color: #fecaca;
}

@media (max-width: 800px) {
  .project-delete {
    opacity: 1;
  }
}

.projects-list::-webkit-scrollbar {
  width: 8px;
}

.projects-list::-webkit-scrollbar-track {
  background: transparent;
}

.projects-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.projects-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}

@media (max-width: 800px) {
  .projects-list {
    max-height: 220px;
  }
}

/* Project name in chat header */
.project-header-label {
  color: #ddd6fe;
}

.project-header-label strong {
  color: #ffffff;
  font-weight: 800;
}

.project-create-card.hidden {
  display: none !important;
}

.project-create-card {
  position: relative;
  z-index: 2;
}

.project-delete {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: #a1a1aa;
  cursor: pointer;
  opacity: 0;
}

.project-item:hover .project-delete {
  opacity: 1;
}

.project-delete:hover {
  background: rgba(239,68,68,0.22);
  color: #fecaca;
}

@media (max-width: 800px) {
  .project-delete { opacity: 1; }
}


/* ===== RESTORED PREMIUM SIDEBAR COLLAPSE ===== */
.app-logo {
  position: relative;
  cursor: pointer;
  border-radius: 16px;
  padding: 6px 42px 6px 6px;
  margin-left: -6px;
  transition: background 0.18s ease;
}

.app-logo:hover {
  background: rgba(255,255,255,0.045);
}

.brand-text {
  min-width: 0;
}

.sidebar-collapse-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 31px;
  height: 31px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 11px;
  background: rgba(255,255,255,0.07);
  color: #ddd6fe;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-collapse-btn:hover {
  background: rgba(139,92,246,0.24);
  color: #fff;
}

@media (min-width: 801px) {
  .sidebar {
    transition: width 0.22s ease, padding 0.22s ease;
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: 78px;
    padding: 18px 12px;
    align-items: center;
  }

  .app-shell.sidebar-collapsed .app-logo {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
    margin-left: 0;
    margin-bottom: 18px;
  }

  .app-shell.sidebar-collapsed .logo-img {
    width: 42px;
    height: 42px;
  }

  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .new-chat,
  .app-shell.sidebar-collapsed .sidebar-actions,
  .app-shell.sidebar-collapsed .project-create-card,
  .app-shell.sidebar-collapsed .sidebar-section-row,
  .app-shell.sidebar-collapsed .projects-list,
  .app-shell.sidebar-collapsed .session-label,
  .app-shell.sidebar-collapsed .sessions-list,
  .app-shell.sidebar-collapsed .sidebar-footer {
    display: none !important;
  }

  .app-shell.sidebar-collapsed .sidebar-collapse-btn {
    right: -8px;
    top: 58px;
    background: rgba(24,24,38,0.98);
    box-shadow: 0 12px 34px rgba(0,0,0,0.42);
  }

  .app-shell.sidebar-collapsed .message.assistant {
    max-width: min(900px, calc(100vw - 145px));
  }
}

@media (max-width: 800px) {
  .sidebar-collapse-btn {
    display: none;
  }

  .app-logo {
    cursor: default;
    padding: 0;
    margin-left: 0;
  }

  .app-logo:hover {
    background: transparent;
  }

  .app-shell.sidebar-collapsed .sidebar {
    transform: translateX(-105%);
  }
}

/* ===== Active file context restored ===== */
.attachment-section-title {
  width: 100%;
  color: #a78bfa;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 2px 2px;
}

.active-attachment-tray {
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(139,92,246,0.09);
  border: 1px solid rgba(167,139,250,0.18);
}

.active-context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #ddd6fe;
  font-size: 12px;
  font-weight: 800;
}

.active-context-header button {
  border: none;
  border-radius: 10px;
  padding: 6px 9px;
  background: rgba(255,255,255,0.08);
  color: #c4b5fd;
  cursor: pointer;
  font-weight: 800;
  font-size: 11px;
}

.active-context-header button:hover {
  background: rgba(239,68,68,0.18);
  color: #fecaca;
}

.active-context-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip.active-file {
  background: rgba(34,197,94,0.10);
  border-color: rgba(74,222,128,0.24);
}

.attachment-chip.active-file small {
  color: #a7f3d0;
}

@media (max-width: 560px) {
  .active-context-header {
    align-items: flex-start;
  }

  .active-context-list .attachment-chip {
    width: 100%;
  }
}

/* ===== GLOBAL SEARCH / COMMAND PALETTE ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.global-search-btn {
  height: 44px;
  min-width: 150px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 15px;
  padding: 0 11px 0 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(139,92,246,0.12));
  color: #f8fafc;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.global-search-btn:hover {
  border-color: rgba(196,181,253,0.32);
  background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(192,38,211,0.12));
}

.global-search-btn strong {
  font-size: 13px;
  font-weight: 800;
}

.global-search-btn kbd {
  font: inherit;
  font-size: 11px;
  color: #c4b5fd;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 9px;
  padding: 4px 7px;
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: start center;
  padding: min(9vh, 80px) 18px 18px;
  background: rgba(3, 3, 10, 0.68);
  backdrop-filter: blur(16px);
}

.search-modal {
  width: min(760px, 100%);
  max-height: min(760px, 84vh);
  overflow: hidden;
  border-radius: 30px;
  background:
    radial-gradient(circle at 85% 0%, rgba(217,70,239,0.20), transparent 30%),
    radial-gradient(circle at 10% 10%, rgba(124,58,237,0.22), transparent 28%),
    rgba(18, 18, 34, 0.97);
  border: 1px solid rgba(255,255,255,0.13);
  box-shadow: 0 34px 110px rgba(0,0,0,0.66);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
}

.search-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 14px;
}

.search-modal-head h3 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.search-modal-head p {
  margin: 6px 0 0;
  color: #a1a1aa;
  font-size: 13px;
}

.search-close-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  color: #c4b5fd;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.search-close-btn:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

.search-input-wrap {
  margin: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 58px;
  border-radius: 20px;
  background: rgba(255,255,255,0.075);
  border: 1px solid rgba(255,255,255,0.13);
}

.search-input-wrap:focus-within {
  border-color: rgba(196,181,253,0.55);
  box-shadow: 0 0 0 4px rgba(167,139,250,0.12);
}

.search-input-wrap input {
  padding: 0;
  border: none;
  box-shadow: none !important;
  background: transparent;
  min-height: 54px;
  font-size: 17px;
}

.search-scope-row {
  display: flex;
  gap: 9px;
  padding: 14px 24px 10px;
}

.search-scope {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.055);
  color: #a1a1aa;
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
}

.search-scope.active {
  color: #fff;
  border-color: rgba(167,139,250,0.35);
  background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(192,38,211,0.18));
}

.search-results {
  padding: 8px 14px 16px;
  overflow-y: auto;
}

.search-empty {
  margin: 12px 10px 16px;
  padding: 28px;
  text-align: center;
  color: #a1a1aa;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
}

.search-error {
  color: #fca5a5;
}

.search-result {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 14px 15px;
  margin: 8px 0;
  color: #f8fafc;
  background: rgba(255,255,255,0.055);
  cursor: pointer;
}

.search-result:hover {
  border-color: rgba(196,181,253,0.32);
  background: linear-gradient(135deg, rgba(124,58,237,0.20), rgba(255,255,255,0.06));
  transform: translateY(-1px);
}

.search-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.search-project-pill {
  max-width: 72%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #ddd6fe;
  background: rgba(139,92,246,0.18);
  border: 1px solid rgba(167,139,250,0.22);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
}

.search-role {
  color: #8b8ba3;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search-result-title {
  font-weight: 900;
  font-size: 15px;
  margin-bottom: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-result-preview {
  color: #a1a1aa;
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 800px) {
  .header-actions {
    width: 100%;
    grid-column: 1 / -1;
  }

  .global-search-btn {
    min-width: 0;
    flex: 1;
  }

  .global-search-btn kbd {
    display: none;
  }

  .header-actions .model-select {
    flex: 1;
    width: auto;
  }
}

@media (max-width: 560px) {
  .search-overlay {
    padding: 12px;
    place-items: stretch;
  }

  .search-modal {
    max-height: calc(100dvh - 24px);
    border-radius: 24px;
  }

  .search-modal-head {
    padding: 20px 18px 12px;
  }

  .search-input-wrap {
    margin: 0 18px;
  }

  .search-scope-row {
    padding-left: 18px;
    padding-right: 18px;
  }
}


/* Search jump highlight */
.message-highlight .message {
  box-shadow:
    0 0 0 2px rgba(196,181,253,.9),
    0 0 42px rgba(139,92,246,.42);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.message-highlight .message.assistant {
  transform: translateY(-1px);
}


@keyframes messagePulseHighlight {
  0% {
    box-shadow: 0 0 0 0 rgba(139,92,246,0);
  }
  30% {
    box-shadow:
      0 0 0 2px rgba(196,181,253,0.9),
      0 0 40px rgba(139,92,246,0.55);
  }
  60% {
    box-shadow:
      0 0 0 2px rgba(196,181,253,0.9),
      0 0 40px rgba(139,92,246,0.55);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(139,92,246,0);
  }
}

.message-highlight .message {
  animation: messagePulseHighlight 1.2s ease-in-out 6;
}