:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: rgba(17, 20, 25, 0.8);
  --panel-strong: rgba(21, 25, 31, 0.96);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f1ea;
  --muted: #a5aab5;
  --accent: #d57e42;
  --accent2: #5d8d76;
  --danger: #ff6b77;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --radius-sm: 14px;
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(213, 126, 66, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(93, 141, 118, 0.18), transparent 34%),
    linear-gradient(180deg, #0b0d10 0%, #0d1016 48%, #090b0f 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.backdrop {
  position: fixed;
  inset: auto;
  width: 42rem;
  height: 42rem;
  filter: blur(80px);
  opacity: 0.32;
  pointer-events: none;
}

.backdrop-one {
  top: -14rem;
  left: -12rem;
  background: rgba(213, 126, 66, 0.34);
}

.backdrop-two {
  bottom: -12rem;
  right: -14rem;
  background: rgba(93, 141, 118, 0.33);
}

.noise {
  position: fixed;
  inset: 0;
  opacity: 0.08;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 30px 30px;
  mix-blend-mode: soft-light;
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.sidebar,
.workspace,
.login-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border-radius: var(--radius);
  overflow: hidden;
}

.brand {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.brand-kicker,
.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.brand h2,
.topbar h1,
.login-card h1 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand h2 {
  margin-top: 8px;
  font-size: 1.55rem;
}

.sidebar-card,
.composer-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.sidebar-card {
  padding: 14px;
  margin-bottom: 14px;
}

.sidebar-actions,
.topbar-actions,
.composer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.sessions-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 4px 10px;
  color: var(--muted);
  font-size: 13px;
}

.session-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.session-item {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.session-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.12);
}

.session-item.active {
  border-color: rgba(213, 126, 66, 0.45);
  background: linear-gradient(180deg, rgba(213, 126, 66, 0.14), rgba(255, 255, 255, 0.04));
}

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

.session-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.session-actions {
  display: flex;
  gap: 6px;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: clamp(1.15rem, 2.2vw, 1.85rem);
}

.status-line {
  margin: 8px 0 0;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.pill.online {
  color: #dff7e9;
  background: rgba(93, 141, 118, 0.18);
}

.pill.offline {
  color: #ffd8d8;
  background: rgba(255, 107, 119, 0.14);
}

.message-list {
  padding: 18px 22px 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
}

.message {
  display: grid;
  gap: 8px;
  max-width: min(840px, 100%);
}

.message.self {
  margin-left: auto;
}

.bubble {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  border-radius: 20px;
  padding: 14px 16px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.self .bubble {
  background: linear-gradient(180deg, rgba(213, 126, 66, 0.16), rgba(255, 255, 255, 0.045));
  border-color: rgba(213, 126, 66, 0.25);
}

.message.assistant .bubble {
  background: linear-gradient(180deg, rgba(93, 141, 118, 0.18), rgba(255, 255, 255, 0.05));
  border-color: rgba(93, 141, 118, 0.24);
}

.message.system .bubble {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag.user {
  background: rgba(213, 126, 66, 0.16);
  color: #ffd9bf;
}

.tag.assistant {
  background: rgba(93, 141, 118, 0.16);
  color: #d6f0e2;
}

.tag.system {
  background: rgba(255, 255, 255, 0.08);
  color: #d6dae2;
}

.composer-shell {
  margin: 18px 18px 18px;
  padding: 16px;
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.composer-title {
  font-size: 14px;
  font-weight: 600;
}

.composer {
  display: grid;
  gap: 12px;
}

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 15px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  outline: none;
}

textarea:focus,
input:focus {
  border-color: rgba(213, 126, 66, 0.45);
  box-shadow: 0 0 0 4px rgba(213, 126, 66, 0.12);
}

.voice-preview {
  width: 100%;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.primary,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--text);
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.primary {
  background: linear-gradient(135deg, rgba(213, 126, 66, 1), rgba(237, 171, 106, 1));
  color: #160f0a;
  font-weight: 700;
}

.ghost {
  background: rgba(255, 255, 255, 0.06);
}

.small {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.primary:hover,
.ghost:hover {
  transform: translateY(-1px);
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

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

.hint {
  margin: 0;
  color: var(--muted);
}

.hint-error {
  color: #ffb4be;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(480px, 100%);
  border-radius: 28px;
  padding: 28px;
  display: grid;
  gap: 14px;
}

.login-copy {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .sidebar {
    order: 2;
  }

  .workspace {
    min-height: 70vh;
    order: 1;
  }

  .topbar {
    flex-direction: column;
  }

  .composer-shell {
    margin: 12px;
  }
}

