:root {
  --bg: #080810;
  --surface: #101018;
  --line: #2c3448;
  --text: #d8e0ea;
  --muted: #8a96a8;
  --faint: #6b7588;
  --accent: #79a0d4;
  --ok: #86efac;
  --danger: #f0a0a0;
  --ctrl: 2.25rem;
  --font: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100dvh;
}

body {
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

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

a:hover {
  text-decoration: underline;
}

button,
select,
textarea {
  font: inherit;
  color: var(--text);
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(88px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.42;
}

.glow--a {
  width: min(28rem, 75vw);
  height: min(28rem, 75vw);
  top: -6rem;
  left: -5rem;
  background: radial-gradient(circle, rgba(121, 160, 212, 0.22) 0%, transparent 68%);
}

.glow--b {
  width: min(24rem, 65vw);
  height: min(24rem, 65vw);
  right: -4rem;
  bottom: 10%;
  background: radial-gradient(circle, rgba(51, 79, 117, 0.28) 0%, transparent 70%);
}

.top,
main,
.foot {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 6.75rem;
  min-height: 3.25rem;
}

.auth-home,
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.auth-home:hover,
.brand:hover {
  text-decoration: none;
}

.auth-home {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
}

.brand strong {
  font-weight: 500;
}

.mark {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 0.4rem;
  display: grid;
  place-items: center;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
  background: linear-gradient(135deg, #4a6fa5 0%, #334f75 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.mark--auth {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 55%, #10b981 100%);
  font-size: 0.72rem;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 1.25rem 1.25rem 1rem;
  min-height: 0;
}

.sheet {
  width: min(100%, 46rem);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.lead,
.status {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.toolbar-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.toolbar select,
.toolbar button,
.composer button {
  height: var(--ctrl);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  padding: 0 0.75rem;
}

.toolbar select {
  flex: 1;
  min-width: 0;
}

button {
  cursor: pointer;
  background: #4a6fa5;
  border-color: #4a6fa5;
  color: #fff;
}

button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.log {
  flex: 1;
  min-height: 16rem;
  overflow: auto;
  border: 1px solid var(--line);
  background: rgba(16, 16, 24, 0.72);
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.75rem;
}

.empty {
  margin: 0;
  color: var(--faint);
  font-size: 0.8125rem;
}

.bubble {
  margin: 0 0 0.85rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble:last-child {
  margin-bottom: 0;
}

.who {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--faint);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bubble--user .who {
  color: var(--accent);
}

.think {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.think summary {
  cursor: pointer;
  color: var(--faint);
}

.files {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: var(--ctrl);
  max-width: 100%;
  padding: 0 0.35rem 0 0.7rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8125rem;
}

.file-chip .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.file-chip .file-note {
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}

.file-chip button {
  height: 1.55rem;
  min-width: 1.55rem;
  padding: 0 0.35rem;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.composer {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.composer--drop {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.composer textarea {
  flex: 1;
  min-height: var(--ctrl);
  max-height: 10rem;
  resize: none;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  line-height: 1.35;
}

.composer button {
  align-self: stretch;
  min-height: var(--ctrl);
  height: auto;
}

.msg.error {
  margin: 0.55rem 0 0;
  color: var(--danger);
  font-size: 0.8125rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.foot {
  border-top: 1px solid var(--line);
  padding: 0.7rem 1.25rem 0.85rem;
  color: var(--faint);
  font-size: 0.75rem;
  text-align: center;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {
  .top {
    padding: 0.75rem 1rem 0.75rem 5.5rem;
  }

  .auth-home span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}
