@font-face {
  font-family: "Inter";
  src: url("/assistant/static/fonts/Inter-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assistant/static/fonts/Inter-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #1a1f2b;
  --muted: #5b6577;
  --border: #d9dde5;
  --accent: #0b6e4f;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --user-bg: #e3f1ec;
  --code-bg: #eef0f4;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #1a1e26;
    --surface-2: #232834;
    --text: #e6e9ef;
    --muted: #9aa4b5;
    --border: #2f3646;
    --accent: #3fb68b;
    --accent-text: #08130f;
    --danger: #ff8a80;
    --user-bg: #1f3a31;
    --code-bg: #232834;
  }
}

* {
  box-sizing: border-box;
}
[hidden],
.center-screen[hidden],
.layout[hidden] {
  display: none;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px / 1.5 var(--font);
}
h1 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}
.muted {
  color: var(--muted);
}
.error {
  color: var(--danger);
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-weight: 600;
}
button.danger-solid {
  background: var(--danger);
  color: var(--surface);
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-weight: 600;
}
button.link {
  background: none;
  border: 0;
  padding: 0.25rem;
  color: var(--accent);
  text-decoration: underline;
}
button.link.danger {
  color: var(--danger);
}
button.icon {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
}
input,
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.center-screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: grid;
  gap: 0.9rem;
}
.card label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.card .row {
  display: flex;
  justify-content: space-between;
}
.card p {
  margin: 0;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100%;
}
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 0;
}
.sidebar-head {
  padding: 12px;
}
.sidebar-head button {
  width: 100%;
}
.conversation-list {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  overflow-y: auto;
  flex: 1;
}
.conversation-list button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-list button:hover,
.conversation-list button[aria-current="true"] {
  background: var(--surface-2);
}
.conversation-list button[aria-current="true"] {
  font-weight: 600;
}
.sidebar-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.sidebar-foot span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.chat-head h1 {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.empty {
  margin: auto;
  text-align: center;
}
.msg {
  max-width: min(820px, 100%);
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow-wrap: anywhere;
}
.msg.user {
  align-self: flex-end;
  background: var(--user-bg);
  white-space: pre-wrap;
}
.msg.assistant {
  align-self: flex-start;
  width: 100%;
}
.msg .content > :first-child {
  margin-top: 0;
}
.msg .content > :last-child {
  margin-bottom: 0;
}
.msg h1,
.msg h2,
.msg h3,
.msg h4 {
  margin: 1rem 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.msg p {
  margin: 0.5rem 0;
}
.msg code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}
.msg pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 0.7rem;
  overflow-x: auto;
}
.msg pre code {
  padding: 0;
  background: none;
}
.msg a {
  color: var(--accent);
}
.msg table {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  max-width: 100%;
  margin: 0.6rem 0;
}
.msg th,
.msg td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  text-align: left;
}
.msg th {
  background: var(--surface-2);
}
.status-lines {
  list-style: none;
  margin: 0 0 0.4rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.status-lines:empty {
  display: none;
}
.files {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0.6rem;
}
.files:empty {
  display: none;
}
.file-chart {
  display: block;
  max-width: 100%;
}
.file-chart img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.file-link {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  background: var(--surface-2);
}
.note {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.4rem;
}
.banner {
  padding: 8px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.composer textarea {
  resize: none;
  max-height: 10rem;
}

.scrim {
  display: none;
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
  }
  button.icon {
    display: inline-block;
  }
  .sidebar {
    position: fixed;
    inset: 0 20% 0 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.15s ease;
  }
  .sidebar.open {
    transform: none;
  }
  .scrim:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.45);
  }
  .messages,
  .composer,
  .chat-head {
    padding-left: 12px;
    padding-right: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}
