:root {
  --bg: #080b13;
  --bg-raised: #0d121f;
  --panel: #111827;
  --panel-soft: #151e30;
  --panel-hover: #1a263b;
  --line: rgba(170, 190, 225, 0.13);
  --line-strong: rgba(170, 190, 225, 0.23);
  --text: #edf3ff;
  --text-soft: #b8c4d9;
  --muted: #7f8ca3;
  --accent: #7c8cff;
  --accent-bright: #9aa6ff;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --cyan: #52d5c8;
  --green: #4fd39a;
  --amber: #f2bb66;
  --danger: #ff7187;
  --danger-soft: rgba(255, 113, 135, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --sidebar-width: 304px;
  --header-height: 74px;
  --radius: 18px;
  --radius-small: 11px;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  min-width: 320px;
  color: var(--text);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:not(:disabled),
a {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

.noscript-card {
  position: fixed;
  z-index: 1000;
  inset: 20px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
}

/* Private lobby */

.lobby {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 15%, rgba(101, 126, 255, 0.16), transparent 34%),
    radial-gradient(circle at 82% 78%, rgba(73, 204, 190, 0.1), transparent 32%),
    linear-gradient(150deg, #080b13 0%, #0b1020 58%, #090d17 100%);
}

.lobby::before,
.lobby::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(132, 150, 255, 0.08);
  border-radius: 50%;
}

.lobby::before {
  width: 640px;
  height: 640px;
  left: -290px;
  top: -310px;
}

.lobby::after {
  width: 460px;
  height: 460px;
  right: -180px;
  bottom: -250px;
}

.lobby-card {
  width: min(100%, 468px);
  padding: 46px 44px 36px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: linear-gradient(155deg, rgba(19, 27, 44, 0.97), rgba(12, 17, 29, 0.96));
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(22px);
}

.lobby-mark {
  position: relative;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
}

.lobby-mark-core {
  position: relative;
  z-index: 2;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(177, 187, 255, 0.38);
  border-radius: 19px;
  background: linear-gradient(145deg, #8795ff, #5869e6);
  box-shadow: 0 14px 38px rgba(93, 108, 226, 0.34);
  color: #fff;
  font-size: 25px;
  font-weight: 800;
}

.lobby-mark-orbit {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 16px rgba(82, 213, 200, 0.66);
}

.orbit-one {
  top: 5px;
  right: 10px;
}

.orbit-two {
  left: 3px;
  bottom: 16px;
  background: var(--accent-bright);
}

.orbit-three {
  right: 2px;
  bottom: 4px;
  width: 5px;
  height: 5px;
  background: var(--amber);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-bright);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.lobby-card h1 {
  margin: 0;
  font-size: clamp(31px, 8vw, 42px);
  letter-spacing: -0.045em;
}

.lobby-copy {
  max-width: 350px;
  margin: 14px auto 30px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
}

.login-form {
  display: grid;
  gap: 10px;
  text-align: left;
}

.login-form label {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.token-field {
  position: relative;
}

.token-field input {
  width: 100%;
  height: 51px;
  padding: 0 48px 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  outline: 0;
  background: rgba(5, 9, 17, 0.62);
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.token-field input:focus {
  border-color: rgba(139, 153, 255, 0.75);
  background: rgba(7, 11, 21, 0.88);
  box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.1);
}

.token-field input::placeholder,
textarea::placeholder {
  color: #667289;
}

.token-toggle {
  position: absolute;
  top: 7px;
  right: 7px;
}

.form-error {
  margin: 2px 2px 0;
  color: #ff9baa;
  font-size: 13px;
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #7b89fa, #5969df);
  box-shadow: 0 11px 25px rgba(84, 99, 218, 0.25);
}

.primary-button:not(:disabled):hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #8c99ff, #6676e8);
}

.login-button {
  width: 100%;
  min-height: 50px;
  margin-top: 5px;
}

.button-spinner,
.send-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.login-button.loading .button-spinner {
  display: block;
}

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 25px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 11px rgba(79, 211, 154, 0.6);
}

/* Workbench layout */

.workbench {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 72% -10%, rgba(79, 99, 205, 0.08), transparent 32%),
    var(--bg);
}

.workbench.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  z-index: 20;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0e1421 0%, #0b101b 100%);
  transition: transform 180ms ease, opacity 140ms ease;
}

.workbench.sidebar-collapsed .sidebar {
  position: absolute;
  width: var(--sidebar-width);
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-100%);
}

.sidebar-top {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 0 19px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark,
.provider-logo,
.message-avatar,
.empty-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  font-weight: 800;
}

.brand-mark {
  width: 37px;
  height: 37px;
  border: 1px solid rgba(174, 184, 255, 0.29);
  border-radius: 12px;
  background: linear-gradient(145deg, #7e8cf4, #5262d3);
  box-shadow: 0 8px 24px rgba(78, 93, 203, 0.22);
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 14px;
}

.brand-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 37px;
  height: 37px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  font-size: 20px;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.icon-button:not(:disabled):hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.sidebar-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 15px 24px;
  scrollbar-color: rgba(151, 163, 190, 0.22) transparent;
  scrollbar-width: thin;
}

.identity-panel {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 8px 6px 20px;
}

.mike-avatar {
  position: relative;
  width: 51px;
  height: 51px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(138, 152, 255, 0.26);
  border-radius: 17px;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.17), transparent 24%),
    linear-gradient(145deg, #5566d4, #333f8d);
  color: #fff;
  font-size: 21px;
  font-weight: 800;
}

.avatar-status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  border: 3px solid #0e1421;
  border-radius: 50%;
  background: var(--green);
}

.identity-name,
.identity-role {
  margin: 0;
}

.identity-name {
  font-size: 15px;
  font-weight: 750;
}

.identity-role {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.side-section {
  padding: 17px 6px;
  border-top: 1px solid var(--line);
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-heading-row h2 {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-chip.neutral {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}

.status-chip.good {
  border-color: rgba(79, 211, 154, 0.2);
  background: rgba(79, 211, 154, 0.08);
  color: var(--green);
}

.status-chip.warning {
  border-color: rgba(242, 187, 102, 0.23);
  background: rgba(242, 187, 102, 0.08);
  color: var(--amber);
}

.status-chip.bad {
  border-color: rgba(255, 113, 135, 0.22);
  background: rgba(255, 113, 135, 0.08);
  color: var(--danger);
}

.status-chip.working {
  border-color: rgba(124, 140, 255, 0.25);
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.status-chip.working::before {
  animation: pulse 1.2s ease-in-out infinite;
}

.provider-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.provider-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.provider-title-row > div:last-child {
  display: grid;
  gap: 2px;
}

.provider-title-row strong {
  font-size: 13px;
}

.provider-title-row span {
  color: var(--muted);
  font-size: 10px;
}

.provider-logo {
  width: 35px;
  height: 35px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #172033;
  color: #dce4f5;
  font-size: 13px;
}

.side-copy,
.quiet-copy {
  margin: 11px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.quiet-copy:empty {
  display: none;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-soft);
}

.secondary-button:not(:disabled):hover {
  border-color: rgba(146, 158, 255, 0.42);
  background: rgba(124, 140, 255, 0.1);
  color: var(--text);
}

.full-width {
  width: 100%;
}

.device-login {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.device-login-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.device-login-head strong {
  font-size: 12px;
}

.device-login p {
  margin: 10px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.device-code {
  width: 100%;
  min-height: 48px;
  margin-bottom: 9px;
  border: 1px dashed rgba(144, 157, 255, 0.46);
  border-radius: 10px;
  background: rgba(124, 140, 255, 0.08);
  color: #dfe4ff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.device-code:hover {
  background: rgba(124, 140, 255, 0.14);
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}

.text-button:not(:disabled):hover {
  color: var(--text);
}

#cancel-device-login {
  width: 100%;
  margin-top: 10px;
  text-align: center;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.status-row strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  text-align: right;
}

.safety-panel {
  border-bottom: 1px solid var(--line);
}

.safety-shield {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(79, 211, 154, 0.09);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.danger-button {
  border: 1px solid rgba(255, 113, 135, 0.24);
  background: var(--danger-soft);
  color: #ff9baa;
}

.danger-button:not(:disabled):hover {
  border-color: rgba(255, 113, 135, 0.44);
  background: rgba(255, 113, 135, 0.18);
}

.danger-button.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 11px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0 21px;
  border-top: 1px solid var(--line);
}

.logout-button {
  text-align: left;
}

.sidebar-scrim {
  display: none;
}

/* Main chat */

.main-pane {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: var(--header-height) minmax(0, 1fr) auto;
  overflow: hidden;
}

.main-header {
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(18px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 19, 0.82);
  backdrop-filter: blur(20px);
}

.header-left,
.header-right,
.title-row {
  display: flex;
  align-items: center;
}

.header-left {
  min-width: 0;
  gap: 12px;
}

.header-right {
  gap: 10px;
}

.title-row {
  gap: 8px;
}

.title-row h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.header-left p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.header-run-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.header-run-dot.working {
  background: var(--accent-bright);
  box-shadow: 0 0 13px rgba(154, 166, 255, 0.75);
  animation: pulse 1.15s ease-in-out infinite;
}

.sidebar-open-button {
  display: none;
}

.workbench.sidebar-collapsed .sidebar-open-button {
  display: inline-grid;
}

.messages {
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-color: rgba(151, 163, 190, 0.22) transparent;
  scrollbar-width: thin;
}

.messages::-webkit-scrollbar,
.sidebar-scroll::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-thumb,
.sidebar-scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(151, 163, 190, 0.22);
  background-clip: padding-box;
}

.message-list,
.history-loader {
  width: min(100%, 920px);
  margin: 0 auto;
}

.message-list {
  min-height: 100%;
  padding: 32px clamp(18px, 4vw, 42px) 50px;
}

.history-loader {
  padding: 18px 24px 0;
  text-align: center;
}

.history-loader .text-button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.empty-state {
  max-width: 690px;
  display: grid;
  justify-items: center;
  margin: clamp(36px, 11vh, 104px) auto 40px;
  text-align: center;
}

.empty-avatar {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border: 1px solid rgba(150, 162, 255, 0.31);
  border-radius: 21px;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.18), transparent 23%),
    linear-gradient(145deg, #6373df, #3d4b9b);
  box-shadow: 0 18px 45px rgba(62, 76, 162, 0.28);
  font-size: 25px;
}

.empty-state h2 {
  margin: 5px 0 12px;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.04em;
}

.empty-state > p:not(.eyebrow) {
  max-width: 540px;
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.75;
}

.starter-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 32px;
}

.starter-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 3px 11px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.starter-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 153, 255, 0.35);
  background: rgba(124, 140, 255, 0.07);
}

.starter-card > span {
  grid-row: 1 / 3;
  color: var(--accent-bright);
  font-size: 19px;
}

.starter-card strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.starter-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-row {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 27px;
  scroll-margin-top: 18px;
}

.message-row.user {
  grid-template-columns: minmax(0, 1fr) 35px;
}

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

.message-row.user .message-column {
  grid-column: 1;
  grid-row: 1;
  align-items: flex-end;
}

.message-avatar {
  width: 35px;
  height: 35px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: linear-gradient(145deg, #5d6ed9, #3d4b9b);
  font-size: 12px;
}

.message-row.user .message-avatar {
  background: linear-gradient(145deg, #25334a, #192338);
  color: #cbd5e7;
}

.message-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.message-meta strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.message-status {
  color: var(--accent-bright);
}

.message-card {
  position: relative;
  width: fit-content;
  max-width: min(100%, 760px);
  min-width: 120px;
  padding: 14px 16px 9px;
  border: 1px solid var(--line);
  border-radius: 6px 16px 16px 16px;
  background: rgba(17, 24, 39, 0.78);
  box-shadow: 0 9px 25px rgba(0, 0, 0, 0.08);
}

.message-row.user .message-card {
  border-color: rgba(124, 140, 255, 0.19);
  border-radius: 16px 6px 16px 16px;
  background: linear-gradient(145deg, rgba(91, 105, 215, 0.22), rgba(58, 71, 147, 0.2));
}

.message-row.pending .message-card {
  width: min(100%, 710px);
  border-color: rgba(124, 140, 255, 0.22);
}

.message-row.failed .message-card,
.message-row.interrupted .message-card {
  border-color: rgba(255, 113, 135, 0.22);
}

.message-content {
  color: #e3eaf7;
  font-size: 13.5px;
  line-height: 1.72;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-actions {
  min-height: 23px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  margin-top: 5px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.message-card:hover .message-actions,
.message-card:focus-within .message-actions {
  opacity: 1;
}

.copy-message {
  padding: 4px;
}

.progress-panel {
  overflow: hidden;
  margin: -2px 0 13px;
  border: 1px solid rgba(129, 145, 255, 0.16);
  border-radius: 12px;
  background: rgba(7, 11, 20, 0.47);
}

.progress-panel summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px 14px;
  padding: 11px 12px 10px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.progress-panel summary::-webkit-details-marker {
  display: none;
}

.progress-panel summary::after {
  content: "+";
  grid-column: 2;
  grid-row: 1;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.progress-panel[open] summary::after {
  content: "−";
}

.progress-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.progress-heading strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-count,
.progress-elapsed {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.progress-elapsed {
  align-self: center;
}

.activity-track {
  grid-column: 1 / -1;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.activity-bar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transform-origin: left center;
}

.progress-panel.active .activity-bar {
  width: 42%;
  animation: activity 1.7s ease-in-out infinite;
}

.progress-panel.done .activity-bar {
  background: var(--green);
}

.progress-panel.failed .activity-bar {
  background: var(--danger);
}

.progress-detail {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.progress-current {
  margin: 11px 0 8px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.5;
}

.progress-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.progress-item .step-mark {
  width: 13px;
  height: 13px;
  display: grid;
  place-items: center;
  margin-top: 1px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  font-size: 8px;
}

.progress-item.done .step-mark {
  border-color: rgba(79, 211, 154, 0.36);
  background: rgba(79, 211, 154, 0.11);
  color: var(--green);
}

.progress-item.current {
  color: var(--text-soft);
}

.progress-item.current .step-mark {
  border-color: var(--accent-bright);
  border-top-color: transparent;
  animation: spin 800ms linear infinite;
}

.progress-item time {
  color: #626f84;
  font-size: 9px;
  white-space: nowrap;
}

.pending-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-bright);
  animation: typing 1.2s ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 140ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 280ms;
}

.job-stop-button {
  margin-top: 12px;
  min-height: 32px;
  padding: 0 11px;
  font-size: 10px;
}

.jump-latest {
  position: sticky;
  z-index: 8;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  min-height: 35px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(20, 29, 46, 0.96);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  backdrop-filter: blur(16px);
}

.jump-latest:hover {
  border-color: rgba(141, 155, 255, 0.4);
  color: var(--text);
}

/* Composer */

.composer-shell {
  z-index: 9;
  padding: 12px clamp(18px, 4vw, 42px) max(15px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(8, 11, 19, 0.93);
  backdrop-filter: blur(20px);
}

.composer {
  width: min(100%, 836px);
  margin: 0 auto;
}

.composer-main {
  min-height: 53px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 7px 7px 7px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #111827;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.composer-main:focus-within {
  border-color: rgba(139, 153, 255, 0.52);
  box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.07), 0 12px 35px rgba(0, 0, 0, 0.18);
}

.composer textarea {
  width: 100%;
  min-height: 36px;
  max-height: 190px;
  resize: none;
  overflow-y: auto;
  padding: 8px 0 6px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  scrollbar-width: thin;
}

.composer textarea:disabled {
  opacity: 0.58;
}

.send-button {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, #7d8af4, #5b6bdc);
  color: #fff;
  box-shadow: 0 8px 18px rgba(83, 98, 210, 0.24);
  font-size: 19px;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease;
}

.send-button:not(:disabled):hover {
  transform: translateY(-1px);
  background: linear-gradient(145deg, #8c98fa, #6878e4);
}

.send-button.sending .send-icon {
  display: none;
}

.send-button.sending .send-spinner {
  display: block;
}

.composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 4px 0;
  color: #67748a;
  font-size: 9.5px;
}

#draft-state.saved {
  color: var(--green);
}

#draft-state.error {
  color: var(--amber);
}

/* Toast */

.toast-region {
  position: fixed;
  z-index: 200;
  top: 18px;
  right: 18px;
  width: min(360px, calc(100vw - 36px));
  display: grid;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(20, 28, 44, 0.97);
  box-shadow: var(--shadow);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent-bright);
}

.toast.success::before {
  background: var(--green);
}

.toast.warning::before {
  background: var(--amber);
}

.toast.error::before {
  background: var(--danger);
}

.toast-close {
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

/* Motion */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.86);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

@keyframes activity {
  0% {
    transform: translateX(-105%);
  }
  55% {
    transform: translateX(130%);
  }
  100% {
    transform: translateX(240%);
  }
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.38;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* Responsive */

@media (max-width: 860px) {
  :root {
    --sidebar-width: min(322px, calc(100vw - 50px));
    --header-height: 66px;
  }

  .workbench,
  .workbench.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .workbench.sidebar-collapsed .sidebar {
    position: absolute;
    width: var(--sidebar-width);
    height: 100%;
    pointer-events: auto;
    opacity: 1;
    transform: translateX(-100%);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.36);
  }

  .workbench.mobile-sidebar-open .sidebar,
  .workbench.sidebar-collapsed.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: absolute;
    z-index: 19;
    inset: 0;
    display: block;
    pointer-events: none;
    opacity: 0;
    background: rgba(3, 6, 12, 0.67);
    transition: opacity 160ms ease;
  }

  .workbench.mobile-sidebar-open .sidebar-scrim {
    pointer-events: auto;
    opacity: 1;
  }

  .sidebar-open-button,
  .workbench.sidebar-collapsed .sidebar-open-button {
    display: inline-grid;
  }

  #collapse-sidebar span {
    transform: rotate(180deg);
  }

  .main-header {
    padding: 0 14px;
  }

  .message-list {
    padding: 25px 16px 42px;
  }

  .composer-shell {
    padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  }

  .message-card {
    max-width: 100%;
  }
}

@media (max-width: 580px) {
  .lobby {
    padding: 15px;
  }

  .lobby-card {
    padding: 36px 24px 29px;
    border-radius: 22px;
  }

  .header-right #header-cloud-chip {
    display: none;
  }

  .danger-button.compact {
    min-height: 32px;
    padding: 0 9px;
  }

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

  .empty-state {
    margin-top: 38px;
  }

  .message-row,
  .message-row.user {
    grid-template-columns: 29px minmax(0, 1fr);
    gap: 9px;
  }

  .message-row.user .message-avatar {
    grid-column: 1;
  }

  .message-row.user .message-column {
    grid-column: 2;
    align-items: flex-start;
  }

  .message-row.user .message-card {
    border-radius: 6px 16px 16px 16px;
  }

  .message-avatar {
    width: 29px;
    height: 29px;
    border-radius: 9px;
    font-size: 10px;
  }

  .message-card {
    width: 100%;
    padding: 13px 14px 8px;
  }

  .message-row.pending .message-card {
    width: 100%;
  }

  .composer-meta span:last-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
