:root {
  color-scheme: dark;
  --bg: #0b0d0f;
  --surface: #111519;
  --surface-raised: #171c21;
  --surface-hover: #1c2228;
  --border: #2a3036;
  --border-strong: #3a424a;
  --text: #f2f5f4;
  --text-soft: #c4cbd0;
  --muted: #909aa4;
  --dim: #68717a;
  --mint: #2dd4b0;
  --mint-dim: rgba(45, 212, 176, 0.13);
  --blue: #66a6ff;
  --violet: #a78bfa;
  --amber: #ffb020;
  --amber-dim: rgba(255, 176, 32, 0.12);
  --red: #ff5c61;
  --red-dim: rgba(255, 92, 97, 0.12);
  --sans: "HarmonyOS Sans", "MiSans", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --header-height: 68px;
  --status-height: 34px;
  --composer-height: 78px;
  --rail-width: 310px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pair-view {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.pair-panel {
  width: min(100%, 430px);
}

.pair-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 28px;
  place-items: center;
  border: 1px solid rgba(45, 212, 176, 0.38);
  border-radius: 16px;
  background: var(--mint-dim);
  color: var(--mint);
}

.pair-mark svg {
  width: 30px;
  height: 30px;
}

.pair-panel h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 8vw, 38px);
  font-weight: 680;
  letter-spacing: -0.03em;
}

.pair-panel > p {
  margin: 0 0 28px;
  color: var(--muted);
}

.pair-panel label,
.project-dialog label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.pair-panel input,
.project-dialog input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 15px;
}

.pair-panel .primary-button {
  width: 100%;
  margin-top: 14px;
}

.pair-note {
  margin-top: 22px !important;
  font-size: 13px;
  line-height: 1.6;
}

.form-error {
  min-height: 20px;
  margin: 8px 0 0 !important;
  color: var(--red) !important;
  font-size: 13px;
}

.primary-button,
.secondary-button,
.quiet-button,
.new-session-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 10px;
  padding: 0 17px;
  font-size: 14px;
  font-weight: 680;
}

.primary-button {
  background: var(--mint);
  color: #06110e;
}

.primary-button:hover {
  background: #45ddbd;
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
}

.quiet-button {
  min-height: 44px;
  justify-content: flex-start;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.quiet-button:hover {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text);
}

.app-shell {
  display: grid;
  height: 100dvh;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  grid-template-rows: var(--header-height) minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "rail workspace";
  overflow: hidden;
}

.app-header {
  position: relative;
  z-index: 30;
  grid-area: header;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 15, 0.94);
  padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  backdrop-filter: blur(18px);
}

.brand {
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.secure-state,
.host-state {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--mint);
  font-size: 13px;
  font-weight: 620;
}

.host-state {
  margin-left: auto;
  color: var(--text-soft);
}

.host-state svg {
  color: var(--blue);
}

#host-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text);
}

.icon-button svg {
  width: 24px;
  height: 24px;
}

.session-rail {
  position: relative;
  z-index: 20;
  grid-area: rail;
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #0e1114;
}

.rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px 14px;
}

.rail-title {
  font-size: 15px;
  font-weight: 700;
}

.rail-subtitle {
  margin-top: 2px;
  color: var(--dim);
  font-size: 12px;
}

.rail-project-button {
  min-width: 0;
  min-height: 66px;
  grid-template-columns: 38px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  margin: 0 14px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-raised);
  padding: 8px 10px;
  text-align: left;
}

.rail-project-button:hover {
  border-color: rgba(45, 212, 176, 0.45);
  background: var(--mint-dim);
}

.rail-project-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--mint);
}

.rail-project-icon svg {
  width: 23px;
  height: 23px;
}

.rail-project-copy,
.rail-project-copy span,
.rail-project-copy strong {
  display: block;
  min-width: 0;
}

.rail-project-copy span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.rail-project-copy strong {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-project-chevron {
  color: var(--dim);
}

.new-session-button {
  margin: 0 14px 12px;
  justify-content: flex-start;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
}

.new-session-button:hover {
  border-color: rgba(45, 212, 176, 0.45);
  background: var(--mint-dim);
}

.new-session-button svg {
  color: var(--mint);
}

.session-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 2px 8px 18px;
  scrollbar-color: var(--border) transparent;
}

.session-row {
  width: 100%;
  min-height: 74px;
  border-left: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 11px 10px 10px 12px;
  text-align: left;
}

.session-section-title {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 6px 4px 3px;
  background: rgba(17, 21, 25, 0.96);
  padding: 7px 8px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.session-row.is-opening {
  border-left-color: var(--blue);
  background: rgba(102, 166, 255, 0.09);
}

.session-row:hover,
.session-row.is-active {
  background: var(--surface-raised);
}

.session-row.is-active {
  border-left-color: var(--mint);
}

.session-row-title,
.session-row-preview,
.session-row-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-row-title {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.session-row-preview {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.session-row-meta {
  margin-top: 5px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
}

.session-empty {
  padding: 26px 18px;
  color: var(--dim);
  font-size: 13px;
  text-align: center;
}

.rail-footer {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--border);
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
}

.workspace {
  position: relative;
  grid-area: workspace;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.project-bar {
  display: grid;
  min-height: 78px;
  align-items: center;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 12px clamp(16px, 3vw, 28px);
  text-align: left;
}

.project-bar:hover {
  background: var(--surface-raised);
}

.project-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--text-soft);
}

.project-icon svg {
  width: 26px;
  height: 26px;
}

.project-copy {
  display: block;
  min-width: 0;
}

.project-label,
.project-path {
  display: block;
}

.project-label {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
}

.project-path {
  overflow: hidden;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-history {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
}

.empty-state {
  align-self: center;
  justify-self: center;
  width: min(100%, 520px);
  padding: 40px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 24px;
  place-items: center;
  border: 1px solid rgba(45, 212, 176, 0.3);
  border-radius: 15px;
  background: var(--mint-dim);
  color: var(--mint);
}

.empty-icon svg {
  width: 30px;
  height: 30px;
}

.empty-state h1 {
  margin: 0 0 10px;
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 680;
  letter-spacing: -0.025em;
}

.empty-state p {
  margin: 0 auto 24px;
  color: var(--muted);
}

.timeline {
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  padding: 20px clamp(14px, 3vw, 30px) 36px;
  list-style: none;
  scrollbar-color: var(--border) transparent;
  scroll-behavior: smooth;
}

.timeline-entry {
  --entry-color: var(--muted);
  --entry-border: #343b42;
  --entry-bg: #171c21;
  --entry-line: #2d3339;
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 13px;
  padding-bottom: 24px;
}

.timeline-entry:not(:last-child)::before {
  position: absolute;
  top: 42px;
  bottom: -3px;
  left: 20px;
  width: 1px;
  background: var(--entry-line);
  content: "";
}

.timeline-entry[data-kind="user"] { --entry-color: var(--blue); --entry-border: #355879; --entry-bg: #152331; --entry-line: #283b4c; }
.timeline-entry[data-kind="agent"] { --entry-color: var(--mint); --entry-border: #276b5d; --entry-bg: #112823; --entry-line: #24443e; }
.timeline-entry[data-kind="command"] { --entry-color: #9ba3ab; --entry-border: #41484f; --entry-bg: #1a1e22; --entry-line: #343a40; }
.timeline-entry[data-kind="diff"] { --entry-color: var(--violet); --entry-border: #5a477d; --entry-bg: #241d31; --entry-line: #3b324c; }
.timeline-entry[data-kind="approval"] { --entry-color: var(--amber); --entry-border: #79591f; --entry-bg: #2c2312; --entry-line: #4b3c21; }
.timeline-entry[data-kind="error"] { --entry-color: var(--red); --entry-border: #773b3e; --entry-bg: #2c191a; --entry-line: #4c2c2e; }

.entry-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--entry-border);
  border-radius: 10px;
  background: var(--entry-bg);
  color: var(--entry-color);
}

.entry-icon svg {
  width: 23px;
  height: 23px;
}

.entry-content {
  min-width: 0;
  padding-top: 2px;
}

.entry-header {
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
}

.entry-title {
  color: var(--entry-color);
  font-size: 15px;
  font-weight: 680;
}

.entry-time {
  color: var(--dim);
  font-size: 11px;
}

.entry-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.entry-state::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.entry-state.is-live {
  color: var(--mint);
}

.entry-state.is-live::before {
  animation: pulse 1.4s ease-in-out infinite;
}

.entry-body {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.image-surface {
  max-width: 720px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #090b0d;
}

.image-link {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: inherit;
  text-decoration: none;
}

.generated-image {
  display: block;
  width: 100%;
  max-height: min(62vh, 620px);
  object-fit: contain;
}

.image-surface.is-unavailable .generated-image {
  min-height: 150px;
  opacity: 0.3;
}

.image-caption {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.entry-subline {
  margin-top: 8px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
}

.code-surface {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1114;
}

.code-command,
.code-output,
.diff-output {
  margin: 0;
  overflow-x: auto;
  padding: 12px 14px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-output {
  max-height: 220px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.command-result {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding: 6px 13px;
  color: var(--muted);
  font-size: 11px;
}

.command-result.is-success {
  color: var(--mint);
}

.command-result.is-failed {
  color: var(--red);
}

.diff-output {
  max-height: 280px;
  color: #c7b9fb;
}

.approval-surface {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 176, 32, 0.42);
  border-radius: 9px;
  background: var(--amber-dim);
}

.approval-reason {
  padding: 10px 13px 0;
  color: #e3c486;
  font-size: 12px;
}

.approval-command {
  margin: 0;
  padding: 12px 13px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.approval-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 10px 10px;
}

.approval-actions button {
  min-height: 44px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 680;
}

.approval-decline {
  border: 1px solid var(--border-strong);
  background: #111519;
  color: var(--text-soft);
}

.approval-accept {
  background: var(--amber);
  color: #181006;
}

.approval-surface.is-resolved {
  border-color: var(--border);
  background: var(--surface);
  opacity: 0.66;
}

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

.plan-list li {
  position: relative;
  padding-left: 17px;
  color: var(--muted);
  font-size: 13px;
}

.plan-list li::before {
  position: absolute;
  top: 9px;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  content: "";
}

.plan-list li[data-status="inProgress"] {
  color: var(--text-soft);
}

.plan-list li[data-status="inProgress"]::before {
  background: var(--mint);
}

.plan-list li[data-status="completed"]::before {
  background: var(--mint);
  box-shadow: 0 0 0 3px var(--mint-dim);
}

.streaming-caret::after {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 4px;
  background: var(--mint);
  vertical-align: -0.15em;
  animation: blink 0.9s steps(1) infinite;
  content: "";
}

.connection-error {
  position: absolute;
  z-index: 4;
  top: 94px;
  right: 18px;
  left: 18px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(255, 92, 97, 0.4);
  border-radius: 12px;
  background: rgba(43, 18, 20, 0.96);
  padding: 13px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
}

.connection-error > svg {
  margin-top: 2px;
  color: var(--red);
}

.connection-error strong {
  font-size: 13px;
}

.connection-error p {
  margin: 2px 0 0;
  color: #d3aaa9;
  font-size: 12px;
}

.composer {
  position: relative;
  z-index: 5;
  display: grid;
  min-height: var(--composer-height);
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
  border-top: 1px solid var(--border);
  background: rgba(13, 16, 19, 0.97);
  padding: 11px clamp(12px, 2.5vw, 24px);
  backdrop-filter: blur(18px);
}

.attachment-list {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  overflow-x: auto;
  padding: 0 1px 2px;
  scrollbar-width: thin;
}

.attachment-list[hidden] {
  display: none;
}

.attachment-input {
  position: absolute !important;
  inset: 0;
  z-index: 2;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden;
  opacity: 0 !important;
  cursor: pointer;
}

.attachment-chip {
  display: grid;
  min-width: min(245px, 78vw);
  max-width: 310px;
  grid-template-columns: 38px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-raised);
  padding: 6px;
}

.attachment-thumb,
.attachment-file-icon {
  width: 38px;
  height: 38px;
  border-radius: 7px;
}

.attachment-thumb {
  object-fit: cover;
}

.attachment-file-icon {
  display: grid;
  place-items: center;
  background: var(--mint-dim);
  color: var(--mint);
  font-size: 10px;
  font-weight: 800;
}

.attachment-copy {
  min-width: 0;
}

.attachment-copy strong,
.attachment-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-copy strong {
  font-size: 12px;
}

.attachment-copy small {
  margin-top: 2px;
  color: var(--dim);
  font-size: 10px;
}

.attachment-remove {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
}

.attachment-remove svg {
  width: 16px;
  height: 16px;
}

.attachment-remove:hover:not(:disabled) {
  background: var(--red-dim);
  color: var(--red);
}

.composer textarea {
  width: 100%;
  min-height: 50px;
  max-height: 136px;
  resize: none;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-raised);
  padding: 13px 14px;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: var(--dim);
}

.attach-button,
.send-button,
.stop-button {
  display: inline-flex;
  min-width: 88px;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
}

.attach-button {
  position: relative;
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--muted);
  cursor: pointer;
}

.attach-button:hover:not(:disabled) {
  border-color: rgba(45, 212, 176, 0.42);
  color: var(--mint);
}

.attach-button.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.send-button {
  border: 1px solid rgba(45, 212, 176, 0.42);
  background: var(--mint-dim);
  color: var(--mint);
}

.send-button:hover:not(:disabled) {
  background: rgba(45, 212, 176, 0.21);
}

.stop-button {
  border: 1px solid rgba(255, 92, 97, 0.55);
  background: var(--red-dim);
  color: var(--red);
}

.status-bar {
  display: flex;
  min-height: calc(var(--status-height) + env(safe-area-inset-bottom));
  align-items: flex-start;
  gap: 12px;
  border-top: 1px solid rgba(42, 48, 54, 0.75);
  background: #090b0d;
  padding: 7px clamp(14px, 2.5vw, 24px) max(7px, env(safe-area-inset-bottom));
  color: var(--dim);
  font-size: 10px;
}

.status-bar > span,
.status-bar > span > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-bar svg {
  width: 13px;
  height: 13px;
  color: var(--mint);
}

.status-divider {
  width: 1px;
  height: 13px;
  background: var(--border);
}

.online-state {
  margin-left: auto;
  color: var(--mint);
}

.online-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.online-state.is-offline {
  color: var(--red);
}

.project-dialog {
  width: min(calc(100% - 28px), 540px);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.62);
}

.project-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.project-dialog form {
  padding: 22px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 680;
}

.dialog-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.rail-backdrop {
  position: fixed;
  z-index: 15;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(2px);
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  display: grid;
  width: min(calc(100% - 28px), 360px);
  gap: 8px;
  pointer-events: none;
}

.toast {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(23, 28, 33, 0.97);
  padding: 11px 13px;
  color: var(--text-soft);
  font-size: 12px;
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.38);
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  border-color: rgba(255, 92, 97, 0.55);
}

.mobile-only {
  display: none;
}

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

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

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

@media (max-width: 899px) {
  :root {
    --header-height: calc(62px + env(safe-area-inset-top));
  }

  .mobile-only {
    display: inline-grid;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "workspace";
  }

  .app-header {
    gap: 10px;
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .brand {
    font-size: 18px;
  }

  .secure-state span {
    display: none;
  }

  .host-state {
    gap: 5px;
    font-size: 11px;
  }

  #host-name {
    max-width: 138px;
  }

  .session-rail {
    position: fixed;
    z-index: 25;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86vw, 340px);
    border-right: 1px solid var(--border-strong);
    padding-top: env(safe-area-inset-top);
    transform: translateX(-102%);
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .session-rail.is-open {
    transform: translateX(0);
  }

  .project-bar {
    display: none;
  }

  .connection-error {
    top: 14px;
  }

  .empty-state #empty-start {
    display: none;
  }
}

@media (max-width: 599px) {
  .project-bar {
    min-height: 72px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 13px;
  }

  .project-icon {
    width: 34px;
  }

  .project-icon svg {
    width: 23px;
    height: 23px;
  }

  .project-history {
    gap: 4px;
    font-size: 11px;
  }

  .project-history svg {
    width: 17px;
    height: 17px;
  }

  .timeline {
    padding: 17px 12px 28px;
  }

  .timeline-entry {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 20px;
  }

  .timeline-entry:not(:last-child)::before {
    top: 38px;
    left: 18px;
  }

  .entry-icon {
    width: 38px;
    height: 38px;
  }

  .entry-icon svg {
    width: 21px;
    height: 21px;
  }

  .entry-header {
    flex-wrap: wrap;
    gap: 5px 8px;
  }

  .entry-title {
    font-size: 14px;
  }

  .entry-body {
    font-size: 13px;
  }

  .entry-state {
    font-size: 10px;
  }

  .code-command,
  .code-output,
  .diff-output,
  .approval-command {
    font-size: 11px;
  }

  .composer {
    grid-template-columns: 48px minmax(0, 1fr) 50px 54px;
    gap: 6px;
    padding: 9px 10px;
  }

  .composer textarea {
    min-height: 48px;
    padding: 12px;
    font-size: 14px;
  }

  .attach-button,
  .send-button,
  .stop-button {
    min-width: 0;
    min-height: 48px;
    gap: 0;
    padding: 0;
  }

  .attach-button span,
  .send-button span,
  .stop-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .attach-button svg,
  .send-button svg,
  .stop-button svg {
    width: 22px;
    height: 22px;
  }

  .status-bar {
    gap: 8px;
    font-size: 9px;
  }

  #transport-label {
    display: none;
  }

  .status-divider {
    display: none !important;
  }

  .project-dialog {
    margin-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .project-dialog form {
    padding: 18px;
  }
}

@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;
  }
}
