:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-muted: #f7f9fc;
  --text: #202733;
  --muted: #6c7888;
  --border: #e3e8f0;
  --primary: #2f7df6;
  --primary-strong: #1d63d8;
  --danger: #b42318;
  --warning: #8a5a00;
  --active: #eef5ff;
  --shadow: 0 18px 50px rgba(43, 61, 88, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.12;
  margin-bottom: 8px;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  margin-bottom: 14px;
}

h3 {
  font-size: 17px;
  margin-bottom: 10px;
}

.hidden {
  display: none !important;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-logo {
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 8px;
  object-fit: contain;
}

.eyebrow {
  color: var(--primary-strong);
  font-weight: 800;
  font-size: 13px;
  margin: 0 0 5px;
}

button,
.button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font: inherit;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
  min-height: 42px;
}

button:hover,
.button:hover {
  background: var(--primary-strong);
}

button.secondary,
.button.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

button.secondary:hover,
.button.secondary:hover {
  background: var(--panel-muted);
}

button.danger {
  background: #fff;
  border-color: #f1c2bd;
  color: var(--danger);
}

button.danger:hover {
  background: #fff4f2;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(47, 125, 246, 0.16);
  border-color: var(--primary);
}

label {
  font-size: 14px;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.status {
  min-height: 24px;
  color: var(--muted);
  font-size: 14px;
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--primary-strong);
}

.chat-app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: linear-gradient(135deg, #f4f8ff 0%, #fbfcff 48%, #f7f4ff 100%);
}

.chat-sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  background: #fff;
  border-right: 1px solid var(--border);
}

.mobile-drawer-backdrop,
.mobile-topbar {
  display: none;
}

.chat-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-search-wrap {
  margin-top: 2px;
}

.chat-search-input {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff;
}

.icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.new-chat-button {
  width: 100%;
  background: var(--primary);
}

.new-chat-button:hover {
  background: var(--primary-strong);
}

.sidebar-section-title {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chat-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.chat-list-item {
  min-height: 38px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-item:hover,
.chat-list-item.active {
  color: var(--primary-strong);
  background: var(--active);
  border-color: #d6e7ff;
}

.chat-sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.chat-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 100vh;
  overflow: visible;
  padding: 24px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.mobile-icon-button,
.mobile-title-pill {
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.92);
  color: #16181d;
  box-shadow: 0 18px 40px rgba(29, 40, 64, 0.08);
  backdrop-filter: blur(18px);
}

.mobile-icon-button {
  width: 52px;
  min-width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 20px;
}

.mobile-icon-button span {
  display: block;
  width: 22px;
  height: 2.5px;
  border-radius: 999px;
  background: #16181d;
}

.mobile-icon-button svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: #16181d;
}

.mobile-title-pill {
  min-height: 52px;
  padding: 0 20px;
  border-radius: 24px;
  font-size: 17px;
  font-weight: 800;
  color: #111318;
}

.chat-workspace {
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 18px;
  min-height: auto;
  flex: none;
  overflow: visible;
  padding-bottom: 24px;
}

.empty-state {
  min-height: 260px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: 32px 16px;
}

.empty-state h2 {
  font-size: clamp(28px, 5vw, 48px);
  margin-bottom: 0;
  background: linear-gradient(90deg, #2f7df6, #c762d7);
  -webkit-background-clip: text;
  color: transparent;
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 8px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(720px, 100%);
}

.prompt-grid button {
  min-height: 76px;
  background: #fff;
  color: var(--text);
  border-color: var(--border);
  text-align: left;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(43, 61, 88, 0.06);
}

.prompt-grid button:hover {
  background: var(--active);
  color: var(--primary-strong);
}

.ask-panel {
  padding: 18px;
}

.ask-dock {
  position: static;
  z-index: 1;
  width: 100%;
  margin: 0 auto;
  padding: 0 0 24px;
  background: none;
}

.ask-dock .ask-panel {
  box-shadow: 0 -10px 40px rgba(43, 61, 88, 0.08);
  border-radius: 16px;
}

.ask-dock textarea {
  min-height: 78px;
}

.chat-messages {
  display: grid;
  gap: 18px;
  align-content: start;
}

.chat-message {
  display: grid;
  gap: 6px;
}

.thinking-status {
  font-size: 13px;
  color: var(--muted);
}

.chat-message.user {
  justify-items: end;
}

.chat-message.assistant {
  justify-items: start;
}

.chat-role {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.chat-bubble {
  max-width: min(820px, 100%);
  padding: 16px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.user .chat-bubble {
  background: #e8f2ff;
  border-color: #c9defb;
}

.chat-message.assistant .chat-bubble {
  background: var(--panel-muted);
}

.chat-bubble.loading {
  width: 78px;
  min-height: 54px;
  display: grid;
  place-items: center;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(47, 125, 246, 0.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.assistant-reference {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

@media (min-width: 861px) {
  .chat-app-shell {
    display: block;
    padding-left: 260px;
  }

  .chat-header {
    position: fixed;
    top: 0;
    left: calc(260px + 24px);
    right: 24px;
    z-index: 4;
    justify-content: flex-end;
    padding: 6px 0 14px;
    background: linear-gradient(180deg, #f7faff 0%, rgba(247, 250, 255, 0.94) 70%, rgba(247, 250, 255, 0) 100%);
    pointer-events: none;
  }

  .chat-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    overflow: hidden;
    z-index: 5;
  }

  .chat-header > div {
    display: none;
  }

  .chat-header button {
    pointer-events: auto;
  }

  .chat-workspace,
  .ask-dock {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
  }

  .chat-workspace {
    width: min(980px, 100%);
    padding-top: 54px;
    padding-bottom: 210px;
  }

  .chat-messages,
  .empty-state {
    width: 100%;
  }

  .ask-dock {
    position: fixed;
    bottom: 0;
    left: calc(260px + 24px);
    right: 24px;
    z-index: 3;
    width: auto;
    max-width: none;
    padding: 14px 0 18px;
    background: linear-gradient(180deg, rgba(247, 250, 255, 0), #f7faff 22%, #f7faff 100%);
    display: flex;
    justify-content: center;
  }

  .ask-dock .ask-panel {
    width: min(980px, 100%);
  }

  .ask-dock label,
  #askStatus {
    display: none;
  }

  .ask-dock .field {
    margin-bottom: 10px;
  }

  .ask-dock textarea {
    min-height: 86px;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.topbar-inner,
.main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.main {
  flex: 1;
  padding: 24px 0 48px;
}

#adminView {
  background: #f6f8fb;
}

#adminView .main {
  width: 100%;
  padding: 0;
}

#adminView .topbar {
  display: none;
}

.login-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f5f8ff 0%, #ffffff 52%, #f7f4ff 100%);
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 0;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  align-self: start;
  box-shadow: none;
  border-radius: 0;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: #fff;
}

.sidebar-menu {
  display: grid;
  gap: 8px;
}

.sidebar-bottom {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}

.sidebar-link {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.tab-button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: var(--text);
  border-color: transparent;
}

.tab-button:hover,
.tab-button.active {
  background: var(--active);
  color: var(--primary-strong);
  border-color: #d6e7ff;
}

.admin-section {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 26px 28px 48px;
}

.form-panel {
  padding: 18px;
  box-shadow: none;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.manual-list,
.provider-list {
  display: grid;
  gap: 12px;
}

.admin-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-page-head h1 {
  margin-bottom: 6px;
}

.list-panel {
  box-shadow: none;
  overflow: auto;
}

.empty-list {
  padding: 34px;
  text-align: center;
}

.data-table {
  min-width: 860px;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) 120px 180px minmax(180px, 1fr) 150px;
  gap: 16px;
  align-items: center;
  min-height: 58px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.user-table .data-row {
  grid-template-columns: minmax(150px, 1fr) 100px 150px 180px 150px;
}

.role-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  color: #236049;
  background: #eaf8f1;
  font-size: 13px;
  font-weight: 800;
}

.role-admin {
  color: #1d63d8;
  background: #eef5ff;
}

.data-row:last-child {
  border-bottom: 0;
}

.data-head {
  min-height: 46px;
  color: var(--muted);
  background: #fbfcfe;
  font-size: 13px;
  font-weight: 800;
}

.table-sub {
  margin-top: 3px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-attachments {
  max-height: 68px;
  overflow: hidden;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions button {
  min-height: 34px;
  padding: 6px 10px;
}

.source-item,
.manual-item,
.provider-item {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 16px;
}

.source-title,
.manual-title {
  font-weight: 800;
}

.manual-head,
.provider-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.attachment-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 13px;
  background: var(--panel-muted);
}

.attachment button {
  width: auto;
  min-height: 26px;
  padding: 2px 7px;
  font-size: 12px;
}

.inline-form {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.notice {
  border-left: 4px solid var(--warning);
  background: #fff8e6;
  color: #453000;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(16, 24, 40, 0.32);
  opacity: 0;
  transition: opacity 180ms ease;
}

.drawer-backdrop.open {
  opacity: 1;
}

.drawer-panel {
  margin-left: auto;
  width: min(480px, 92vw);
  height: 100%;
  padding: 22px;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 50px rgba(43, 61, 88, 0.18);
  transform: translateX(100%);
  transition: transform 220ms ease;
  overflow: auto;
}

.drawer-backdrop.open .drawer-panel {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.drawer-close {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 20px;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.product-landing {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 28px clamp(18px, 5vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 18% 20%, rgba(67, 186, 255, 0.5), transparent 28%),
    radial-gradient(circle at 78% 28%, rgba(95, 125, 255, 0.48), transparent 30%),
    linear-gradient(135deg, #071a4a 0%, #0b47bb 46%, #25a5ff 100%);
}

.product-landing::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 82%);
}

.landing-nav,
.landing-content {
  position: relative;
  z-index: 1;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.landing-content {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  max-width: 980px;
  margin: 0 auto;
  padding: 64px 0;
}

.landing-kicker {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
  letter-spacing: 0;
}

.landing-content h1 {
  max-width: 900px;
  font-size: clamp(42px, 7vw, 88px);
  color: #fff;
  margin-bottom: 20px;
  text-align: center;
}

.landing-headline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0;
  white-space: nowrap;
  width: 100%;
}

.landing-headline-main,
.landing-headline-comma,
.landing-headline-break {
  display: inline;
}

.landing-content p {
  max-width: 720px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
}

.pill-cta {
  margin-top: 24px;
  min-height: 52px;
  padding: 0 34px;
  border-radius: 999px;
  background: #0b0f18;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
}

.pill-cta:hover {
  background: #151b27;
}

.tech-orbit {
  position: absolute;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  pointer-events: none;
}

.orbit-one {
  left: -120px;
  bottom: -130px;
}

.orbit-two {
  right: -140px;
  top: 120px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 18, 42, 0.48);
  backdrop-filter: blur(10px);
}

.login-modal {
  width: min(420px, 100%);
  padding: 24px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.user-chip {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-muted);
  font-size: 13px;
  font-weight: 800;
  word-break: break-word;
}

.inline-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

@media (max-width: 860px) {
  .landing-headline {
    display: block;
    white-space: normal;
  }

  .landing-headline-main,
  .landing-headline-comma,
  .landing-headline-break {
    display: block;
  }

  .landing-headline-comma {
    display: none;
  }

  .chat-app-shell {
    grid-template-columns: 1fr;
    background:
      radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.78) 32%, transparent 54%),
      linear-gradient(180deg, #f9fafc 0%, #ffffff 100%);
  }

  .chat-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 12;
    width: min(84vw, 360px);
    min-height: 100vh;
    padding: 28px 26px 32px;
    border-right: none;
    transform: translateX(-102%);
    transition: transform 220ms ease;
    box-shadow: 28px 0 70px rgba(32, 39, 51, 0.12);
  }

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

  .mobile-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 11;
    background: rgba(24, 29, 39, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  .mobile-drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    position: fixed;
    top: 0;
    left: 16px;
    right: 16px;
    z-index: 4;
    padding: max(8px, env(safe-area-inset-top)) 0 12px;
    margin-bottom: 8px;
    background: linear-gradient(180deg, rgba(249, 250, 252, 0.98) 0%, rgba(255, 255, 255, 0.94) 72%, rgba(255, 255, 255, 0) 100%);
  }

  .mobile-title-pill {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    justify-content: flex-start;
    text-align: left;
    min-width: 0;
    max-width: calc(100vw - 108px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-main {
    min-height: 100vh;
    padding: 16px;
    background: transparent;
  }

  .chat-header {
    display: none;
  }

  .chat-header h1,
  .desktop-only {
    display: none;
  }

  .chat-workspace {
    width: 100%;
    padding-bottom: 164px;
    padding-top: calc(64px + env(safe-area-inset-top));
    gap: 20px;
  }

  .ask-dock {
    position: fixed;
    bottom: 0;
    left: 16px;
    right: 16px;
    z-index: 3;
    width: auto;
    padding: 8px 0 calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff 18%, #ffffff 100%);
  }

  .ask-dock .ask-panel {
    border-radius: 28px;
    padding: 14px 14px 16px;
    box-shadow: 0 10px 36px rgba(17, 22, 32, 0.08);
  }

  .ask-dock .field {
    margin-bottom: 10px;
  }

  .ask-dock label,
  #clearButton,
  #askStatus {
    display: none;
  }

  .ask-dock textarea {
    min-height: 54px;
    max-height: 140px;
    padding: 14px 16px;
    border: none;
    background: transparent;
    resize: none;
  }

  .ask-dock .button-row {
    justify-content: flex-end;
  }

  #askButton {
    min-width: 108px;
    min-height: 48px;
    border-radius: 999px;
    background: var(--primary);
  }

  #askButton:hover {
    background: var(--primary-strong);
  }

  .empty-state {
    min-height: calc(100vh - 260px);
    align-content: end;
    justify-items: stretch;
    text-align: left;
    padding: 0 4px 10px;
  }

  .empty-state h2,
  .empty-state p {
    display: none;
  }

  .prompt-grid {
    width: 100%;
    display: grid;
    gap: 8px;
  }

  .prompt-grid button {
    min-height: 56px;
    border: none;
    box-shadow: none;
    padding: 0 4px;
    background: transparent;
    font-size: 16px;
    font-weight: 700;
  }

  .chat-list {
    gap: 2px;
    padding-top: 14px;
  }

  .chat-sidebar-head {
    align-items: center;
    justify-content: flex-start;
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .chat-sidebar-head .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.1;
  }

  .chat-sidebar-head .brand img {
    display: block;
    width: 36px;
    height: 36px;
  }

  .sidebar-section-title {
    margin-top: 18px;
    color: #16181d;
    font-size: 14px;
    font-weight: 800;
  }

  .chat-search-wrap {
    margin-top: 8px;
  }

  .chat-search-input {
    min-height: 48px;
    border-radius: 18px;
    background: #fff;
  }

  .chat-list-item {
    min-height: 58px;
    padding: 12px 4px;
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 700;
  }

  .new-chat-button {
    position: sticky;
    top: 0;
    bottom: auto;
    width: 100%;
    margin-top: 0;
    margin-left: 0;
    padding: 0 22px;
    min-height: 56px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 14px 32px rgba(47, 125, 246, 0.18);
  }

  .new-chat-button:hover {
    background: var(--primary-strong);
  }

  .chat-sidebar-foot {
    display: grid;
    gap: 8px;
    padding-top: 12px;
    margin-top: auto;
  }

  .chat-sidebar-foot .user-chip {
    display: none;
  }

  .chat-sidebar-foot button {
    border-radius: 18px;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .prompt-grid,
  .admin-layout,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .inline-controls {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 1px solid var(--border);
  }

  .sidebar-bottom {
    margin-top: 12px;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .main {
    padding-top: 18px;
  }
}

@media (max-width: 520px) {
  .topbar-inner,
  .main {
    width: min(100% - 20px, 1180px);
  }

  .ask-panel,
  .form-panel,
  .login-card {
    padding: 16px;
  }

  button,
  .button {
    width: 100%;
  }

  .landing-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .icon-button {
    width: 34px;
  }

  .manual-head,
  .provider-head {
    display: grid;
  }

  .drawer-actions,
  .admin-page-head {
    align-items: stretch;
    flex-direction: column;
  }
}
