:root {
  color-scheme: light;
  --bg: #f4f5f4;
  --canvas: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --surface-tint: #eef2f0;
  --text: #1f2421;
  --muted: #68736e;
  --muted-2: #909993;
  --line: #dfe7e2;
  --line-strong: #cbd9d1;
  --accent: #1f7a4d;
  --accent-strong: #155f3e;
  --accent-soft: #edf5f1;
  --danger: #a33a2f;
  --shadow: 0 24px 70px rgba(31, 36, 33, 0.08);
  --shadow-soft: 0 12px 34px rgba(31, 36, 33, 0.06);
  --radius: 8px;
  --radius-lg: 10px;
  --sidebar-width: 286px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 24% -8%, rgba(31, 122, 77, 0.08), transparent 31%),
    linear-gradient(180deg, #fbfcfb 0%, var(--bg) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
textarea:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

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

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.eyebrow {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.primary,
.ghost,
.dev-skip {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 10px 15px;
  font-size: 14px;
  font-weight: 780;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.primary {
  color: #ffffff;
  background: linear-gradient(180deg, #258356, #1d7149);
  box-shadow: 0 12px 24px rgba(31, 116, 76, 0.2);
}

.primary:hover {
  background: linear-gradient(180deg, #20764e, #17623f);
}

.danger-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  color: #ffffff;
  background: linear-gradient(180deg, #b34b3f, #943428);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 780;
  box-shadow: 0 12px 24px rgba(163, 58, 47, 0.18);
}

.danger-button:hover {
  background: linear-gradient(180deg, #a54136, #843126);
}

.ghost,
.dev-skip {
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
}

.ghost:hover,
.dev-skip:hover {
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: 0 8px 20px rgba(31, 36, 33, 0.05);
}

input,
textarea,
select {
  width: 100%;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 9px 12px;
}

textarea {
  min-height: 96px;
  padding: 13px 14px;
  line-height: 1.55;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(31, 122, 77, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 122, 77, 0.1);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}

.notice,
.error,
.toast {
  margin: 0;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 720;
}

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

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.toast.subtle {
  position: static;
  margin: 12px 0;
  box-shadow: none;
}

.busy-line {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 40;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #81b992, var(--accent));
  animation: busy 1s linear infinite;
}

@keyframes busy {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 180px 0;
  }
}

.landing-body {
  min-height: 100vh;
  background: #fbfcfb;
}

.landing-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 24px 56px;
}

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

.landing-brand,
.landing-nav-link,
.landing-primary {
  text-decoration: none;
}

.landing-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 820;
}

.landing-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #1f7a4d;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 900;
}

.landing-nav-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  color: #3e4742;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 760;
}

.landing-nav-link:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.landing-main {
  width: min(580px, 100%);
  align-self: center;
  display: grid;
  gap: 18px;
  padding: 72px 0 92px;
}

.landing-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0;
}

.landing-main h1 {
  color: #17211b;
  font-size: 56px;
  font-weight: 890;
  letter-spacing: 0;
  line-height: 0.98;
}

.landing-copy {
  max-width: 460px;
  color: #5f6a64;
  font-size: 18px;
  line-height: 1.55;
}

.landing-primary {
  width: fit-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 10px 16px;
  color: #ffffff;
  background: #1f7a4d;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 820;
}

.landing-primary:hover {
  background: #17623f;
}

.landing-footer {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.brand-row,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(180deg, #2d8d61, #1f744c);
  border-radius: 10px;
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.mark.small {
  width: 38px;
  height: 38px;
  font-size: 18px;
}

.brand-row h1,
.sidebar-brand h2 {
  font-size: 23px;
  line-height: 1.05;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px 14px 12px;
  background: rgba(247, 248, 247, 0.94);
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.sidebar-top {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
}

.sidebar-brand {
  padding: 2px 6px 14px;
  border-bottom: 1px solid var(--line);
}

.side-command-list {
  display: grid;
  gap: 4px;
}

.side-command {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  color: #444c48;
  background: transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 640;
  text-align: left;
}

.side-command:hover,
.side-command.active {
  color: #202622;
  background: #eceeed;
}

.side-command.active .icon {
  color: var(--accent-strong);
}

.sidebar-section {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.sidebar-projects {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.sidebar-chats-summary {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

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

.sidebar-section-head span {
  color: #a1a7a3;
  font-size: 13px;
  font-weight: 620;
}

.sidebar-mini-action {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: #f0f3f1;
  border: 1px solid #dfe6e1;
  border-radius: 8px;
}

.sidebar-mini-action .icon {
  width: 16px;
  height: 16px;
}

.sidebar-project-scroll,
.sidebar-history-scroll {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(104, 115, 110, 0.35) transparent;
}

.sidebar-project-scroll {
  min-height: 0;
}

.sidebar-project-node {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sidebar-project-line,
.sidebar-task-line,
.sidebar-recent-line {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  gap: 4px;
  align-items: center;
}

.sidebar-project-row,
.sidebar-chat-link {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 3px 8px;
  align-items: center;
  padding: 7px 8px;
  color: #39433d;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: left;
}

.sidebar-project-row {
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 2px 8px;
  padding: 8px;
}

.sidebar-project-row .icon {
  grid-row: 1 / span 2;
  align-self: center;
}

.sidebar-task-line .sidebar-task-row {
  width: 100%;
}

.sidebar-delete-action {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: #9aa39e;
  background: transparent;
  border-radius: 7px;
  opacity: 0.48;
  transition: color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.sidebar-project-line:hover .sidebar-delete-action,
.sidebar-task-line:hover .sidebar-delete-action,
.sidebar-recent-line:hover .sidebar-delete-action,
.sidebar-delete-action:focus-visible {
  opacity: 1;
}

.sidebar-delete-action:hover {
  color: var(--danger);
  background: #f7eeec;
}

.sidebar-delete-action .icon {
  width: 15px;
  height: 15px;
}

.sidebar-project-row:hover,
.sidebar-chat-link:hover,
.sidebar-project-node.active .sidebar-project-row,
.sidebar-chat-link.active {
  color: #202622;
  background: #e9ecea;
  border-color: #e2e6e3;
}

.sidebar-project-node.active .sidebar-project-row .icon,
.sidebar-chat-link.active .icon {
  color: var(--accent-strong);
}

.sidebar-project-row .icon,
.sidebar-chat-link .icon {
  width: 18px;
  height: 18px;
}

.sidebar-project-row span,
.sidebar-chat-link span {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 14px;
  font-weight: 640;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-project-row small,
.sidebar-chat-link small,
.sidebar-empty {
  min-width: 0;
  overflow: hidden;
  color: #8d9691;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-project-row small {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
}

.sidebar-project-chats,
.sidebar-recent-list {
  display: grid;
  gap: 1px;
}

.sidebar-project-chats {
  padding: 2px 0 7px 28px;
}

.sidebar-task-row {
  min-width: 0;
  min-height: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
  color: #4b514e;
  background: transparent;
  border-radius: 7px;
  text-align: left;
}

.sidebar-task-row:hover,
.sidebar-task-row.active {
  background: #eceeed;
  color: #202622;
}

.sidebar-task-row span {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-task-row time {
  color: #969d99;
  font-size: 12px;
}

.sidebar-empty.compact {
  padding: 5px 8px;
}

.sidebar-bottom {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.user-box {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.user-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
}

.user-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.user-meta strong,
.user-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta strong {
  font-size: 14px;
}

.user-meta span {
  color: var(--muted);
  font-size: 12px;
}

.logout-button {
  width: 100%;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  padding: 14px 16px 14px 18px;
}

.research-page,
.research-main {
  min-width: 0;
}

.research-main {
  min-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e3e8e5;
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 46px rgba(31, 36, 33, 0.055);
}

.research-header {
  min-height: 150px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(500px, 0.82fr);
  gap: 26px;
  align-items: center;
  padding: 30px 36px;
  background:
    linear-gradient(90deg, rgba(31, 122, 77, 0.045), rgba(64, 91, 112, 0.025), transparent),
    linear-gradient(180deg, #fbfcfb, #f9faf9);
  border-bottom: 1px solid var(--line);
}

.research-header h1,
.admin-hero h1 {
  font-size: 31px;
  font-weight: 880;
  line-height: 1.05;
}

.folder-chip-row {
  max-width: min(620px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.folder-chip {
  width: fit-content;
  max-width: min(440px, 100%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: #40504a;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.folder-chip span {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-delete-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  color: #9a7b76;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid #eadcda;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 720;
}

.context-delete-button:hover {
  color: var(--danger);
  background: #fbf4f3;
}

.context-delete-button .icon {
  width: 15px;
  height: 15px;
}

.research-controls {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 18px;
  align-items: end;
}

.model-switcher {
  min-width: 0;
  display: grid;
  gap: 9px;
}

.model-switcher > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.model-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 22px rgba(31, 36, 33, 0.045);
}

.model-option {
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-content: center;
  padding: 11px 14px;
  color: #3e4842;
  background: transparent;
  border-right: 1px solid var(--line);
  text-align: left;
}

.model-option:last-child {
  border-right: 0;
}

.model-option:hover,
.model-option.active {
  color: #202622;
  background: linear-gradient(180deg, #ffffff, #f3f6f4);
  box-shadow: inset 0 0 0 1px rgba(31, 122, 77, 0.1);
}

.model-option.active .icon {
  color: var(--accent-strong);
}

.model-option .icon {
  width: 19px;
  height: 19px;
}

.model-option strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-option strong {
  font-size: 14px;
  font-weight: 840;
}

#research-model {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.spark-button {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.research-content {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  padding: 28px 36px 30px;
}

.research-empty {
  min-height: 0;
  display: grid;
  align-content: center;
  justify-content: center;
  gap: 26px;
  padding: 26px 0 32px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at center, rgba(31, 122, 77, 0.035), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0), rgba(248,250,249,0.66));
}

.empty-copy {
  display: grid;
  justify-items: center;
  text-align: center;
}

.empty-copy h1 {
  font-size: clamp(36px, 4vw, 50px);
  font-weight: 880;
  line-height: 1.05;
}

.starter-grid {
  width: min(850px, calc(100vw - var(--sidebar-width) - 160px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.starter-card {
  min-height: 84px;
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 18px;
  gap: 6px 14px;
  align-items: center;
  padding: 18px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 10px 26px rgba(31, 36, 33, 0.045);
  text-align: left;
}

.starter-card:hover {
  border-color: rgba(31, 122, 77, 0.24);
  transform: translateY(-1px);
}

.starter-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(31, 122, 77, 0.16);
  border-radius: 50%;
}

.starter-card strong {
  grid-column: 2;
  font-size: 15px;
  font-weight: 850;
}

.starter-chevron {
  grid-column: 3;
  color: var(--muted);
}

.research-stream {
  min-height: 0;
  overflow: auto;
  padding: 4px 0 24px;
}

.message {
  display: grid;
  grid-template-columns: 38px minmax(0, 820px);
  gap: 12px;
  margin-bottom: 18px;
}

.message.user {
  grid-template-columns: minmax(0, 820px) 38px;
  justify-content: end;
}

.message.user .message-avatar {
  grid-column: 2;
}

.message.user .message-body {
  grid-column: 1;
  justify-self: end;
  background: #f3faf6;
}

.message.error .message-body {
  color: #6f2c23;
  background: #fff7f5;
  border-color: #efd7d2;
}

.message.error .message-body p,
.message.error .message-body li {
  color: #6f2c23;
}

.message-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
}

.message-body {
  min-width: 0;
  padding: 15px 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(31, 36, 33, 0.045);
}

.message-body p,
.message-body li {
  color: #303733;
  line-height: 1.65;
}

.message-body p + p,
.message-body ul + p,
.message-body ol + p {
  margin-top: 10px;
}

.message-body ul,
.message-body ol {
  margin: 8px 0 8px 20px;
  padding: 0;
}

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

.folder-context-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 36px;
  margin-bottom: 10px;
  color: var(--muted);
}

.folder-context-strip > span {
  font-size: 12px;
  font-weight: 850;
}

.folder-context-strip > div {
  min-width: 0;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.folder-context-strip small {
  flex: 0 0 auto;
  max-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  padding: 6px 9px;
  color: #40504a;
  background: #f3f6f4;
  border: 1px solid rgba(31, 122, 77, 0.16);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-composer {
  display: grid;
  gap: 10px;
  padding: 15px;
  background: #ffffff;
  border: 1px solid #d9e2dd;
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 32px rgba(31, 36, 33, 0.07);
}

.research-composer textarea {
  min-height: 88px;
  border: 0;
  box-shadow: none;
  padding: 0;
}

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

.research-send-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.research-send-row > span {
  min-width: 0;
  margin-right: auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-send-row kbd {
  color: var(--muted-2);
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
}

.file-upload-button {
  width: auto;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #31413a;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.file-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.send-button {
  min-width: 96px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 36, 33, 0.25);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 22px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-head span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 50%;
}

.modal-head h2 {
  font-size: 19px;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.danger-modal .modal-head span {
  color: var(--danger);
  background: #f8eeec;
}

.delete-copy {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  background: #fbf7f6;
  border: 1px solid #eed9d5;
  border-radius: var(--radius);
}

.delete-copy strong {
  font-size: 15px;
}

.delete-copy p {
  color: #7b5a55;
  font-size: 13px;
  line-height: 1.55;
}

.search-backdrop {
  place-items: start center;
  padding-top: 9vh;
  background: rgba(31, 36, 33, 0.18);
}

.search-dialog {
  width: min(620px, 100%);
  max-height: min(680px, 82vh);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-head h2 {
  font-size: 17px;
  line-height: 1.2;
}

.global-search-form {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 8px 8px 8px 12px;
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.global-search-form input {
  min-height: 34px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.global-search-form input:focus {
  box-shadow: none;
}

.search-results {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 3px;
  overflow: auto;
}

.search-result {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  color: #333b36;
  background: transparent;
  border-radius: 8px;
  text-align: left;
}

.search-result:hover {
  background: #eef1ef;
}

.search-result span {
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result small {
  color: var(--muted);
  font-size: 12px;
}

.admin-page {
  max-width: 1260px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 30px;
  background:
    linear-gradient(90deg, rgba(31, 122, 77, 0.045), transparent 42%),
    #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(31, 36, 33, 0.045);
}

.admin-hero p:not(.eyebrow) {
  margin-top: 8px;
  color: var(--muted);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.admin-tab {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: var(--muted);
  background: transparent;
  border-radius: var(--radius);
  font-weight: 680;
  white-space: nowrap;
}

.admin-tab.active,
.admin-tab:hover {
  color: #202622;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(31, 36, 33, 0.04);
}

.admin-dashboard,
.admin-grid,
.admin-panel {
  min-width: 0;
}

.admin-dashboard {
  display: grid;
  gap: 16px;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 28px rgba(31, 36, 33, 0.045);
}

.admin-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 28px rgba(31, 36, 33, 0.045);
}

.admin-metrics article {
  display: grid;
  gap: 7px;
  padding: 14px 16px;
  background: transparent;
  border-right: 1px solid var(--line);
}

.admin-metrics article:last-child {
  border-right: 0;
}

.admin-metrics span,
.admin-metrics small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.admin-metrics strong {
  font-size: 25px;
  line-height: 1;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
  gap: 16px;
}

.admin-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-panel {
  padding: 20px;
}

.admin-panel h2 {
  font-size: 20px;
  line-height: 1.2;
}

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

.admin-panel-head p,
.empty-panel {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.admin-search {
  min-width: min(360px, 100%);
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 6px 6px 11px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-search input {
  min-height: 34px;
  padding: 0;
  border: 0;
}

.admin-search input:focus {
  box-shadow: none;
}

.admin-user-history-list,
.admin-chat-groups,
.question-list,
.usage-list,
.event-list {
  display: grid;
  gap: 10px;
}

.admin-user-history,
.admin-chat-group,
.question-row,
.usage-list > div,
.event-list > div {
  display: grid;
  gap: 8px;
  padding: 13px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-user-history header,
.admin-chat-title,
.question-row > div,
.usage-list > div,
.event-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-user-history strong,
.admin-chat-title strong,
.question-row strong,
.usage-list strong,
.event-list strong {
  font-size: 14px;
}

.admin-user-history span,
.admin-user-history small,
.admin-chat-title span,
.question-row span,
.usage-list span,
.event-list span {
  color: var(--muted);
  font-size: 12px;
}

.admin-chat-group p,
.question-row p {
  color: #343d38;
  font-size: 13px;
  line-height: 1.55;
}

.admin-subhead {
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.memory-table-wrap {
  overflow: auto;
}

.memory-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.memory-table th,
.memory-table td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.memory-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.memory-table td strong,
.memory-table td small {
  display: block;
}

.memory-table td small {
  margin-top: 3px;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.settings-checks {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.check-row {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 258px;
  }

  .research-header {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .research-controls {
    grid-template-columns: minmax(0, 1fr) 54px;
  }

  .starter-grid {
    width: min(850px, 100%);
  }

  .admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-metrics article:nth-child(2n) {
    border-right: 0;
  }

  .admin-grid,
  .admin-grid.two {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-rows: auto auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .sidebar-top {
    grid-template-rows: auto auto auto auto;
  }

  .side-command-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-project-scroll,
  .sidebar-recent-list {
    display: grid;
    gap: 5px;
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
    padding-right: 2px;
  }

  .sidebar-project-node,
  .sidebar-chat-link {
    width: 100%;
  }

  .sidebar-delete-action {
    opacity: 1;
  }

  .sidebar-project-chats {
    max-height: 128px;
    overflow: auto;
    padding-left: 26px;
  }

  .workspace {
    padding: 10px;
  }

  .research-main {
    min-height: calc(100vh - 20px);
  }

  .research-header {
    min-height: auto;
    padding: 24px 20px 18px;
  }

  .research-content {
    padding: 18px 20px 22px;
  }

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

  .research-empty {
    padding: 34px 18px;
  }

  .admin-hero,
  .admin-panel-head,
  .admin-user-history header,
  .admin-chat-title,
  .question-row > div {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .landing-shell {
    padding: 20px;
  }

  .landing-top {
    align-items: flex-start;
  }

  .landing-brand {
    max-width: 210px;
  }

  .landing-main {
    padding: 58px 0 72px;
  }

  .landing-main h1 {
    font-size: 40px;
  }

  .landing-copy {
    font-size: 16px;
  }

  .login-card {
    padding: 24px;
  }

  .sidebar {
    max-height: 42vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .sidebar-top {
    gap: 16px;
  }

  .sidebar-project-scroll {
    max-height: 190px;
    overflow-y: auto;
  }

  .sidebar-project-chats {
    max-height: 82px;
  }

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

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

  .spark-button {
    display: none;
  }

  .model-options {
    grid-template-columns: 1fr;
  }

  .model-option {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .model-option:last-child {
    border-bottom: 0;
  }

  .research-header h1,
  .admin-hero h1 {
    font-size: 27px;
  }

  .folder-chip-row {
    align-items: stretch;
    flex-direction: column;
  }

  .folder-chip,
  .context-delete-button {
    width: fit-content;
    max-width: 100%;
  }

  .empty-copy h1 {
    font-size: 34px;
  }

  .starter-card {
    grid-template-columns: 44px minmax(0, 1fr) 16px;
  }

  .starter-icon {
    width: 44px;
    height: 44px;
  }

  .research-send-row {
    flex-wrap: wrap;
  }

  .research-send-row > span,
  .research-send-row kbd {
    flex: 1 1 100%;
  }

  .file-upload-button,
  .send-button {
    flex: 1 1 auto;
  }

  .admin-metrics,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .admin-metrics article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-metrics article:last-child {
    border-bottom: 0;
  }

  .admin-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .admin-tab {
    width: 100%;
    justify-content: center;
    padding-inline: 10px;
    white-space: normal;
  }
}
