/* ─────────────────────────────────────────────
   Nexora — Design System
   ───────────────────────────────────────────── */

/* ─── Tokens ─── */
:root {
  --bg: #0a0c13;
  --surface: #111520;
  --surface-2: #191e2d;
  --surface-3: #1f2538;
  --border: #252b3b;
  --border-hover: #3a4258;
  --text: #e6e8f0;
  --text-2: #7b8295;
  --text-3: #555d72;
  --accent: #4a8af4;
  --accent-hover: #3b7ae5;
  --accent-soft: rgba(74, 138, 244, 0.10);
  --accent-text: #a2c5fc;
  --success: #4cd98a;
  --success-soft: rgba(76, 217, 138, 0.12);
  --danger: #f47070;
  --warning: #f5b342;
  --radius: 10px;
  --radius-lg: 14px;
  --transition: 0.18s ease;
}

/* ─── Reset ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body, #app {
  height: 100%;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1000;
  max-width: 400px;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Auth ─── */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(ellipse 600px 400px at 50% 40%, #151a2c, var(--bg));
}

.auth-box {
  width: min(420px, 100%);
  padding: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.auth-box h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 20px 0 6px;
  letter-spacing: -0.3px;
}

.auth-box > p {
  color: var(--text-2);
  margin-bottom: 20px;
  font-size: 14px;
}

.auth-box input {
  width: 100%;
  padding: 11px 14px;
  margin: 5px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.auth-box input:focus {
  border-color: var(--accent);
}

.auth-box input::placeholder {
  color: var(--text-3);
}

.auth-switch {
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  margin-top: 16px;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  transition: background var(--transition), opacity var(--transition);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.link {
  color: var(--accent-text);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
}

.link:hover {
  text-decoration: underline;
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin: 6px 0;
}

/* ─── Brand ─── */
.brand {
  font-weight: 850;
  font-size: 20px;
  letter-spacing: -0.8px;
  user-select: none;
}

.brand em {
  font-style: normal;
  color: var(--accent);
}

/* ─── Shell ─── */
.shell {
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 19, 0.92);
  backdrop-filter: blur(16px);
  z-index: 10;
}

.sidebar-toggle {
  display: none;
  color: var(--text-2);
  padding: 6px;
  border-radius: 6px;
  transition: color var(--transition);
}

.sidebar-toggle:hover {
  color: var(--text);
}

.nav {
  display: flex;
  gap: 4px;
}

.nav button {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 13px;
  transition: all var(--transition);
}

.nav button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav button.active {
  background: var(--surface-2);
  color: #fff;
  font-weight: 600;
}

.spacer {
  flex: 1;
}

.balance {
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid rgba(74, 138, 244, 0.18);
  padding: 7px 12px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
}

.profile-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  transition: all var(--transition);
  white-space: nowrap;
}

.profile-btn:hover {
  border-color: var(--border-hover);
  background: var(--surface-3);
}

/* ─── Content / Layout ─── */
#content {
  display: flex;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 0;
}

/* ─── Sidebar ─── */
.sidebar-overlay {
  display: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow: hidden;
  background: rgba(13, 16, 24, 0.85);
}

.side-header {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0 8px 14px;
  text-transform: uppercase;
}

.side-orb {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--accent-text);
  background: var(--accent-soft);
}

.btn-new {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, rgba(74, 138, 244, 0.15), rgba(74, 138, 244, 0.06));
  color: var(--accent-text);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-weight: 650;
  font-size: 13px;
  transition: all var(--transition);
}

.btn-new:hover {
  background: linear-gradient(135deg, rgba(74, 138, 244, 0.22), rgba(74, 138, 244, 0.10));
  border-color: var(--accent-hover);
}

.btn-new:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-new .plus {
  font-size: 18px;
  line-height: 1;
}

.btn-new kbd {
  margin-left: auto;
  opacity: 0.5;
  font-size: 11px;
}

.side-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-3);
  font-weight: 700;
  margin: 22px 8px 8px;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--text-2);
  margin-bottom: 2px;
  cursor: pointer;
  transition: all var(--transition);
}

.chat-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.chat-item.active {
  background: var(--surface-2);
  color: #fff;
}

.chat-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: all var(--transition);
}

.chat-item:hover .chat-actions {
  opacity: 1;
}

.chat-actions button {
  color: var(--text-3);
  font-size: 13px;
  padding: 4px;
  line-height: 1;
  background: transparent;
  border-radius: 4px;
}

.chat-actions button:hover {
  background: var(--surface);
  color: var(--text);
}

.chat-actions button[data-delete]:hover {
  color: var(--danger);
}

/* Credits layout */
.credits-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.credits-left {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.credits-right {
  flex: 1;
  min-width: 0;
}

.buy-section {
  background: var(--surface);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: 12px;
}

.buy-section input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.buy-section input:focus {
  border-color: var(--primary);
}

.promo-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.promo-form input {
  flex: 1;
  min-width: 0;
}

.promo-form .btn-primary {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
  padding: 11px 20px;
  flex-shrink: 0;
}

.pricing-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.price-row span {
  color: var(--text-2);
}

/* Custom Dropdown */
.custom-select {
  position: relative;
  display: inline-block;
}

.custom-select-trigger {
  background: var(--surface);
  border: 1px solid var(--border-color);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.custom-select-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  background: #111116;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  min-width: 240px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  flex-direction: column;
}

.custom-select-dropdown.show {
  display: flex;
}

.dropdown-group {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.dropdown-group:last-child {
  border-bottom: none;
}

.dropdown-group-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  font-weight: 600;
}

.dropdown-item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dropdown-item:hover, .dropdown-item.active {
  background: var(--surface);
  color: var(--text);
}

.model-stars {
  color: var(--primary);
  font-size: 11px;
  letter-spacing: -1px;
}

.side-footer {
  margin-top: auto;
  padding-top: 16px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.7;
}

.side-footer small {
  color: var(--text-3);
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 4px;
  box-shadow: 0 0 8px rgba(76, 217, 138, 0.4);
}

/* ─── Chat area ─── */
.chat-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px;
}

/* ─── Empty / Welcome state ─── */
.empty {
  display: grid;
  place-content: center;
  height: 100%;
  text-align: center;
  padding-bottom: 40px;
}

.welcome-mark {
  display: flex;
  justify-content: center;
  gap: 6px;
  height: 28px;
  margin-bottom: 20px;
}

.welcome-mark i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
  animation: pulse 2s ease-in-out infinite;
}

.welcome-mark i:nth-child(2) {
  align-self: flex-end;
  background: var(--success);
  animation-delay: 0.3s;
}

.welcome-mark i:nth-child(3) {
  align-self: center;
  background: var(--accent-text);
  animation-delay: 0.6s;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 700;
}

.empty h1 {
  font-size: 36px;
  letter-spacing: -1.8px;
  margin: 12px 0 8px;
  line-height: 1.1;
  font-weight: 800;
}

.empty > p {
  color: var(--text-2);
  font-size: 15px;
}

.suggestions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
}

.suggestions button {
  display: flex;
  text-align: left;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  width: 190px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all var(--transition);
  font-size: 13px;
}

.suggestions button:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.suggestions small {
  font-size: 11px;
  color: var(--text-2);
}

/* ─── Messages ─── */
.message {
  margin: 0 0 24px;
}

.msg-label {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.msg-cost {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  display: inline-block;
}

.message.user .msg-content {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.assistant .msg-content {
  padding: 2px 0;
  line-height: 1.7;
  word-break: break-word;
}

/* ─── Markdown styles inside assistant messages ─── */
.msg-content h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 20px 0 8px;
  letter-spacing: -0.3px;
}

.msg-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 16px 0 6px;
}

.msg-content h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 14px 0 4px;
}

.msg-content p {
  margin: 0 0 10px;
}

.msg-content p:last-child {
  margin-bottom: 0;
}

.msg-content strong {
  font-weight: 700;
  color: #fff;
}

.msg-content em {
  font-style: italic;
}

.msg-content ul,
.msg-content ol {
  margin: 8px 0;
  padding-left: 22px;
}

.msg-content li {
  margin: 4px 0;
}

.msg-content blockquote {
  border-left: 3px solid var(--border-hover);
  padding: 8px 14px;
  margin: 10px 0;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 6px 6px 0;
}

.msg-content pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 10px 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
}

.msg-content pre code {
  background: none;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: inherit;
}

.msg-content code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  border: 1px solid var(--border);
}

/* Thinking / generating indicator */
.msg-content .thinking-indicator {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: var(--text-2);
}

.msg-content .thinking-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.2s ease-in-out infinite;
}

.msg-content .thinking-indicator span:nth-child(2) { animation-delay: 0.2s; }
.msg-content .thinking-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ─── Composer ─── */
.composer-wrap {
  padding: 12px 28px 22px;
  background: linear-gradient(transparent, var(--bg) 30%);
}

.composer {
  max-width: 840px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--accent);
}

.composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 200px;
  resize: none;
  color: var(--text);
  border: none;
  outline: none;
  background: transparent;
  line-height: 1.5;
  font-size: 14px;
}

.composer textarea::placeholder {
  color: var(--text-3);
}

.tools {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

.model-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-label {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: 700;
}

.tools select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-weight: 600;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.tools select:focus {
  border-color: var(--accent);
}

.chip {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.chip b {
  font-size: 10px;
  margin-left: 2px;
}

.chip:hover {
  border-color: var(--border-hover);
}

.chip.on {
  color: #c0f5d9;
  border-color: rgba(76, 217, 138, 0.3);
  background: var(--success-soft);
}

.chip.on b {
  color: var(--success);
}

.chip-icon {
  color: var(--accent);
}

.tool-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}

.estimate {
  margin-left: auto;
  color: var(--text-3);
  font-size: 11px;
  cursor: default;
  border: none;
  background: none;
  padding: 0;
}

.send-btn {
  border-radius: 8px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  transition: all var(--transition);
  white-space: nowrap;
}

.send-btn span {
  font-size: 14px;
  margin-left: 3px;
}

.send-btn:hover {
  background: var(--accent-hover);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.notice {
  max-width: 840px;
  margin: 6px auto 0;
  color: var(--warning);
  font-size: 11px;
  min-height: 16px;
}

/* ─── Credits page ─── */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 28px;
  width: 100%;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 260px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform var(--transition);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .composer-wrap {
    padding: 16px;
  }

  .tools {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .credits-layout {
    flex-direction: column;
  }
  
  .credits-left {
    flex: none;
    width: 100%;
  }
}
.page h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 6px;
}

.page-desc {
  margin-bottom: 28px;
}

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

.credit-card {
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.credit-card small {
  color: var(--text-2);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.credit-card strong {
  font-size: 36px;
  display: block;
  margin-top: 8px;
  letter-spacing: -1.5px;
  font-weight: 800;
}

.ledger {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.8fr 1fr;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 13px;
}

.row:last-child {
  border-bottom: none;
}

.positive {
  color: var(--success);
}

.negative {
  color: var(--danger);
}

/* ─── Coder ─── */
.coder {
  display: grid;
  grid-template-columns: 220px 1fr 240px;
  min-height: calc(100dvh - 56px);
  width: 100%;
}

.coder aside {
  padding: 20px;
  border-right: 1px solid var(--border);
}

.coder aside:last-child {
  border-right: none;
  border-left: 1px solid var(--border);
}

.coder .blank {
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--text-2);
}

.coder .blank h1 {
  font-size: 24px;
  letter-spacing: -0.8px;
  margin-bottom: 8px;
  color: var(--text);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .sidebar-toggle {
    display: block;
  }

  .nav {
    gap: 0;
  }

  .nav button {
    padding: 6px 8px;
    font-size: 12px;
  }

  .balance {
    font-size: 11px;
    padding: 5px 8px;
  }

  .profile-btn {
    padding: 5px 8px;
    font-size: 12px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 25;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    background: var(--bg);
    border-right: 1px solid var(--border);
  }

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

  .messages {
    padding: 20px 16px;
  }

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

  .tools {
    gap: 4px;
    flex-wrap: wrap;
  }

  .tool-divider,
  .tool-label {
    display: none;
  }

  .estimate {
    margin-left: 0;
    flex-basis: 100%;
    text-align: right;
  }

  .suggestions {
    flex-direction: column;
  }

  .suggestions button {
    width: 100%;
  }

  .empty h1 {
    font-size: 28px;
    letter-spacing: -1.2px;
  }

  .coder {
    grid-template-columns: 1fr;
  }

  .coder aside:last-child {
    display: none;
  }

  .row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 12px 14px;
  }

  .topbar .brand {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .balance {
    display: none;
  }

  .topbar .brand {
    font-size: 16px;
  }

  .page {
    padding: 28px 16px;
  }

  .credit-card strong {
    font-size: 28px;
  }
}
