:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d1117;
  color: #e6edf3;
  --surface: #161b22;
  --surface-raised: #21262d;
  --surface-soft: #1c2128;
  --border: #30363d;
  --border-strong: #484f58;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-strong: #79c0ff;
  --button: #238636;
  --button-hover: #2ea043;
  --danger-light: rgba(255, 255, 255, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(13, 17, 23, 0.98), rgba(8, 12, 18, 0.98)),
    #0d1117;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--button);
  color: white;
  padding: 10px 14px;
  cursor: pointer;
}

button:hover {
  background: var(--button-hover);
}

.ghost {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--border-strong);
}

.login-page {
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(420px, calc(100vw - 32px));
}

.brand-mark {
  font-size: 34px;
  font-weight: 750;
  margin-bottom: 18px;
  color: var(--accent-strong);
}

.compact-heading {
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.2;
}

.login-panel {
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 6px;
}

label span,
.eyebrow,
.message-meta,
.upload-meta {
  color: var(--text-muted);
  font-size: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  background: #0d1117;
  color: #e6edf3;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(88, 166, 255, 0.18);
}

textarea {
  resize: vertical;
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: #0d1117;
  position: sticky;
  top: 0;
  z-index: 2;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.2;
}

.workspace {
  height: calc(100vh - 75px);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  max-width: 1240px;
  margin: 0 auto;
}

.workspace--single {
  grid-template-columns: minmax(0, 980px);
  justify-content: center;
}

.chat-pane {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: rgba(22, 27, 34, 0.35);
}

.report-sidebar {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  border-left: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.82);
}

.sidebar-heading {
  margin-bottom: 14px;
}

.sidebar-heading h2 {
  margin: 2px 0 0;
  font-size: 17px;
  line-height: 1.25;
}

.report-list {
  display: grid;
  gap: 10px;
}

.report-link {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: #e6edf3;
  text-decoration: none;
}

.report-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.report-link span {
  overflow-wrap: anywhere;
  font-weight: 650;
  line-height: 1.3;
}

.report-link small {
  color: var(--text-muted);
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.message--upload {
  background: var(--surface-soft);
}

.message-body {
  margin-top: 6px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.upload-inline {
  margin-top: 6px;
}

.upload-inline a {
  color: var(--accent-strong);
  font-weight: 650;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.upload-note {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.composer-shell {
  display: grid;
  border-top: 1px solid var(--border);
  background: #0d1117;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
}

.composer textarea {
  min-height: 48px;
  max-height: 180px;
}

.composer-actions,
.drawer-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.upload-drawer {
  display: grid;
  grid-template-columns: minmax(160px, 280px) minmax(0, 1fr) auto;
  gap: 10px;
  padding: 0 14px 14px;
  align-items: end;
}

.upload-drawer[hidden] {
  display: none;
}

.empty {
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 14px;
  background: var(--danger-light);
}

.empty--compact {
  padding: 12px;
  font-size: 13px;
  line-height: 1.35;
}

.button-link {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 10px 14px;
  text-decoration: none;
}

.report-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px;
}

.report-document {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.report-document pre {
  margin: 12px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
  font: inherit;
}

@media (max-width: 820px) {
  .workspace {
    height: auto;
    min-height: calc(100vh - 75px);
    grid-template-columns: 1fr;
  }

  .report-sidebar {
    border-left: 0;
    border-bottom: 1px solid var(--border);
  }

  .chat-pane {
    min-height: 60vh;
    border-left: 0;
    border-right: 0;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    justify-content: end;
  }

  .upload-drawer {
    grid-template-columns: 1fr;
  }
}
