:root {
  color-scheme: light;
  --bg: #f4efe5;
  --panel: rgba(255, 250, 241, 0.88);
  --line: rgba(59, 39, 18, 0.12);
  --text: #26180b;
  --ink: var(--text);
  --muted: #715942;
  --text-muted: var(--muted);
  --accent: #b24f2f;
  --accent-deep: #7f2f15;
  --brand-ink: #24140c;
  --brand-highlight: #f7dbc0;
  --brand-dot: #d96a3b;
  --shadow: 0 24px 60px rgba(61, 36, 10, 0.12);
  --radius: 22px;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 251, 245, 0.98);
  --surface-soft: rgba(255, 255, 255, 0.55);
  --surface-hover: rgba(255, 247, 237, 0.92);
  --surface-input: rgba(255, 255, 255, 0.7);
  --surface-accent: rgba(255, 245, 235, 0.95);
  --surface-accent-hover: rgba(255, 240, 225, 0.9);
  --surface2: rgba(38, 24, 11, 0.06);
  --bg-2: rgba(38, 24, 11, 0.04);
  --control-border: rgba(178, 79, 47, 0.22);
  --focus-ring: rgba(178, 79, 47, 0.26);
  --message-user-bg: linear-gradient(180deg, #fff6ed 0%, #f8e0cb 100%);
  --app-background:
    radial-gradient(circle at top left, rgba(242, 170, 118, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(150, 57, 24, 0.16), transparent 24%),
    linear-gradient(180deg, #f8f3eb 0%, #eee3d4 100%);
  --font-mono: "JetBrains Mono", monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111513;
  --panel: rgba(23, 29, 26, 0.9);
  --line: rgba(240, 226, 207, 0.14);
  --text: #f4efe7;
  --ink: var(--text);
  --muted: #b8a895;
  --text-muted: var(--muted);
  --accent: #df7a4d;
  --accent-deep: #f0a66f;
  --brand-ink: #090c0b;
  --brand-highlight: #ffd7b5;
  --brand-dot: #ff8757;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --surface: rgba(35, 43, 39, 0.82);
  --surface-strong: rgba(30, 37, 34, 0.98);
  --surface-soft: rgba(39, 47, 43, 0.62);
  --surface-hover: rgba(54, 63, 58, 0.78);
  --surface-input: rgba(14, 18, 16, 0.5);
  --surface-accent: rgba(70, 48, 37, 0.72);
  --surface-accent-hover: rgba(88, 58, 42, 0.82);
  --surface2: rgba(255, 255, 255, 0.07);
  --bg-2: rgba(255, 255, 255, 0.05);
  --control-border: rgba(223, 122, 77, 0.32);
  --focus-ring: rgba(223, 122, 77, 0.3);
  --message-user-bg: linear-gradient(180deg, rgba(96, 57, 40, 0.95) 0%, rgba(70, 42, 32, 0.96) 100%);
  --app-background:
    radial-gradient(circle at top left, rgba(223, 122, 77, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(92, 136, 116, 0.12), transparent 26%),
    linear-gradient(180deg, #161a18 0%, #0e1210 100%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: var(--app-background);
}

body {
  padding: 24px;
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 24%, rgba(242, 170, 118, 0.24), transparent 24%),
    radial-gradient(circle at 76% 20%, rgba(217, 106, 59, 0.2), transparent 22%),
    linear-gradient(180deg, #21120b 0%, #120905 100%);
  color: #fff6ef;
  transition: opacity 520ms ease, visibility 520ms ease;
}

.app-splash--done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-splash__glow {
  position: absolute;
  width: 42vw;
  height: 42vw;
  min-width: 240px;
  min-height: 240px;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.42;
}

.app-splash__glow--left {
  left: -8vw;
  bottom: -12vw;
  background: radial-gradient(circle, rgba(242, 170, 118, 0.45) 0%, rgba(242, 170, 118, 0) 70%);
}

.app-splash__glow--right {
  right: -10vw;
  top: -14vw;
  background: radial-gradient(circle, rgba(217, 106, 59, 0.34) 0%, rgba(217, 106, 59, 0) 72%);
}

.app-splash__inner {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
}

.app-splash__badge {
  position: relative;
  width: 116px;
  height: 116px;
  border-radius: 34px;
  border: 1px solid rgba(247, 219, 192, 0.16);
  background:
    linear-gradient(145deg, rgba(247, 219, 192, 0.08), rgba(247, 219, 192, 0.02)),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 22px 56px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.app-splash__badge::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 24px;
  border: 1px solid rgba(247, 219, 192, 0.12);
}

.app-splash__badge-mark {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.92em;
  height: 1.38em;
  transform: translateX(0.3em);
  font-family: "JetBrains Mono", monospace;
  font-size: 2.3rem;
  font-weight: 700;
  letter-spacing: -0.08em;
  color: var(--brand-highlight);
}

.app-splash__badge-letter,
.app-splash__glyph {
  position: absolute;
  top: 50%;
  line-height: 1;
  opacity: 1;
  filter: blur(0);
  transform: translate3d(0, -50%, 0) scale(1);
  will-change: transform, opacity;
}

.app-splash__badge-letter--k {
  left: 0;
}

.app-splash__badge-letter--stem {
  left: 0.69em;
}

.app-splash__badge-dot,
.app-splash__dot {
  position: absolute;
  top: 0.18em;
  width: 0.13em;
  height: 0.13em;
  border-radius: 999px;
  background: var(--brand-dot);
  box-shadow: 0 0 18px rgba(217, 106, 59, 0.28);
  transform: translate3d(0, -0.25em, 0) scale(1);
  will-change: transform, opacity;
}

.app-splash__badge-dot {
  top: 0.16em;
  transform: translate3d(0, -0.22em, 0) scale(1);
}

.app-splash__badge-letter--stem .app-splash__badge-dot--lead {
  left: 0.08em;
}

.app-splash__badge-letter--stem .app-splash__badge-dot--trail {
  left: 0.24em;
}

.app-splash__word {
  position: relative;
  width: min(78vw, 3.78em);
  height: 1.16em;
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  color: var(--brand-highlight);
}

.app-splash__glyph--a1 {
  left: 0;
}

.app-splash__glyph--n {
  left: 0.76em;
}

.app-splash__glyph--k {
  left: 1.46em;
}

.app-splash__glyph--a2 {
  left: 2.14em;
}

.app-splash__glyph--stem {
  left: 2.79em;
  overflow: visible;
}

.app-splash__glyph--stem .app-splash__dot--lead {
  left: -0.03em;
}

.app-splash__glyph--stem .app-splash__dot--trail {
  left: 0.15em;
}

.app-splash__tag {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(247, 219, 192, 0.72);
}

.app-splash--play .app-splash__badge-letter--k {
  animation: splashBadgeK 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__badge-letter--stem {
  animation: splashBadgeStem 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__badge-dot--lead {
  animation: splashBadgeLeadDot 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__badge-dot--trail {
  animation: splashBadgeTrailDot 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__glyph--k {
  animation: splashWordK 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__glyph--a1 {
  animation: splashWordA1 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__glyph--n {
  animation: splashWordN 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__glyph--a2 {
  animation: splashWordA2 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__glyph--stem {
  animation: splashWordStem 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__dot--lead {
  animation: splashWordLeadDot 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-splash--play .app-splash__dot--trail {
  animation: splashWordTrailDot 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes splashBadgeK {
  0%, 20% {
    opacity: 1;
    transform: translate3d(0.54em, -50%, 0) scale(1);
  }

  52%, 100% {
    opacity: 1;
    transform: translate3d(0, -50%, 0) scale(1);
  }
}

@keyframes splashBadgeStem {
  0%, 20% {
    opacity: 1;
    transform: translate3d(-0.52em, -50%, 0) scale(1);
  }

  52%, 100% {
    opacity: 1;
    transform: translate3d(0, -50%, 0) scale(1);
  }
}

@keyframes splashBadgeLeadDot {
  0%, 22% {
    opacity: 1;
    transform: translate3d(0.12em, -0.22em, 0) scale(1);
  }

  58%, 72% {
    opacity: 1;
    transform: translate3d(0.12em, -0.22em, 0) scale(1);
  }

  86%, 100% {
    opacity: 1;
    transform: translate3d(0, -0.22em, 0) scale(1);
  }
}

@keyframes splashBadgeTrailDot {
  0%, 76% {
    opacity: 0;
    transform: translate3d(0, -0.22em, 0) scale(0.3);
  }

  90%, 100% {
    opacity: 1;
    transform: translate3d(0, -0.22em, 0) scale(1);
  }
}

@keyframes splashWordK {
  0%, 18% {
    opacity: 1;
    transform: translate3d(0.52em, -50%, 0) scale(1);
  }

  50%, 100% {
    opacity: 1;
    transform: translate3d(0, -50%, 0) scale(1);
  }
}

@keyframes splashWordA1 {
  0%, 24% {
    opacity: 0;
    transform: translate3d(0.22em, -38%, 0) scale(0.9);
  }

  54%, 100% {
    opacity: 1;
    transform: translate3d(0, -50%, 0) scale(1);
  }
}

@keyframes splashWordN {
  0%, 32% {
    opacity: 0;
    transform: translate3d(0.18em, -36%, 0) scale(0.92);
  }

  60%, 100% {
    opacity: 1;
    transform: translate3d(0, -50%, 0) scale(1);
  }
}

@keyframes splashWordA2 {
  0%, 40% {
    opacity: 0;
    transform: translate3d(0.12em, -36%, 0) scale(0.94);
  }

  68%, 100% {
    opacity: 1;
    transform: translate3d(0, -50%, 0) scale(1);
  }
}

@keyframes splashWordStem {
  0%, 18% {
    opacity: 1;
    transform: translate3d(-0.28em, -50%, 0) scale(1);
  }

  54%, 100% {
    opacity: 1;
    transform: translate3d(0, -50%, 0) scale(1);
  }
}

@keyframes splashWordLeadDot {
  0%, 18% {
    opacity: 1;
    transform: translate3d(0.1em, -0.25em, 0) scale(1);
  }

  56%, 70% {
    opacity: 1;
    transform: translate3d(0.1em, -0.25em, 0) scale(1);
  }

  84%, 100% {
    opacity: 1;
    transform: translate3d(0, -0.25em, 0) scale(1);
  }
}

@keyframes splashWordTrailDot {
  0%, 76% {
    opacity: 0;
    transform: translate3d(0, -0.25em, 0) scale(0.3);
  }

  90%, 100% {
    opacity: 1;
    transform: translate3d(0, -0.25em, 0) scale(1);
  }
}

.shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  height: calc(100dvh - 48px);
  min-height: 0;
}

.sidebar,
.hero,
.app-header,
.chat-header,
.chat-log,
.composer {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar {
  border-radius: calc(var(--radius) + 8px);
  padding: 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.sidebar__top {
  padding: 0 20px 8px;
}

.sidebar__top h1,
.hero h2,
.empty-state h3 {
  margin: 0;
  line-height: 1;
}

.sidebar__top h1 {
  font-size: 2rem;
  margin-bottom: 16px;
}

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

.sidebar__brand {
  margin-bottom: 0;
}

.sidebar__hooks {
  display: none;
}

.brand__badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 56px;
  padding: 0 16px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(247, 219, 192, 0.15), rgba(247, 219, 192, 0.03)),
    var(--brand-ink);
  color: var(--brand-highlight);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 16px 28px rgba(36, 20, 12, 0.18);
  font-family: "JetBrains Mono", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.1em;
}

.brand__badge::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 12px;
  border: 1px solid rgba(247, 219, 192, 0.1);
}

.brand__wordmark {
  display: inline-block;
  min-width: 0;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.06em;
  white-space: nowrap;
}

.brand--compact {
  gap: 10px;
}

.brand--compact .brand__badge {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 14px;
  font-size: 1rem;
}

.brand--compact .brand__badge::after {
  inset: 6px;
  border-radius: 9px;
}

.brand--compact .brand__wordmark {
  font-size: 1.08rem;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
}

.session-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  min-height: 0;
  padding: 12px 20px 20px;
}

.session-card {
  flex: 0 0 auto;
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: inset 4px 0 0 rgba(59, 39, 18, 0.12);
  cursor: pointer;
  color: inherit;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  display: flex;
  align-items: center;
  min-height: 0;
}

.session-card__info {
  flex: 1;
  min-width: 0;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-card__unread-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
}

.session-card__info strong {
  display: block;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
  line-height: 1.2;
}

.session-card--archived .session-card__info strong {
  opacity: 0.6;
}

.session-card--running {
  border-color: rgba(178, 79, 47, 0.35);
  box-shadow: inset 4px 0 0 var(--accent);
  background: rgba(255, 244, 232, 0.96);
}

.session-card--automation {
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.92) 0%, rgba(243, 229, 208, 0.96) 100%);
  border-style: dashed;
}

.session-card--automation.session-card--running {
  background: linear-gradient(180deg, rgba(255, 244, 232, 0.96) 0%, rgba(247, 228, 203, 0.98) 100%);
}

.session-card--projected {
  border-color: var(--project-accent-line, rgba(178, 79, 47, 0.28));
  box-shadow: inset 4px 0 0 var(--project-accent, var(--accent));
  background: linear-gradient(180deg, var(--project-accent-soft, rgba(255, 247, 237, 0.92)) 0%, rgba(255, 255, 255, 0.74) 100%);
}

.session-card--projected.session-card--running {
  background: linear-gradient(180deg, var(--project-accent-soft, rgba(255, 247, 237, 0.92)) 0%, rgba(255, 250, 245, 0.96) 100%);
}

.session-card--glow-active {
  box-shadow: 0 0 0 2px rgba(178, 79, 47, 0.7), 0 0 12px 4px rgba(178, 79, 47, 0.4);
  animation: session-glow-pulse 1.4s ease-in-out infinite;
}

@keyframes session-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(178, 79, 47, 0.7), 0 0 12px 4px rgba(178, 79, 47, 0.4); }
  50% { box-shadow: 0 0 0 2px rgba(178, 79, 47, 1), 0 0 22px 8px rgba(178, 79, 47, 0.6); }
}

.session-card--projected.session-card--glow-active {
  box-shadow: inset 4px 0 0 var(--project-accent, var(--accent)), 0 0 0 2px rgba(178, 79, 47, 0.65), 0 0 12px 4px rgba(178, 79, 47, 0.38);
  animation: session-glow-pulse-projected 1.4s ease-in-out infinite;
}

@keyframes session-glow-pulse-projected {
  0%, 100% { box-shadow: inset 4px 0 0 var(--project-accent, var(--accent)), 0 0 0 2px rgba(178, 79, 47, 0.65), 0 0 12px 4px rgba(178, 79, 47, 0.38); }
  50% { box-shadow: inset 4px 0 0 var(--project-accent, var(--accent)), 0 0 0 2px rgba(178, 79, 47, 0.95), 0 0 22px 8px rgba(178, 79, 47, 0.58); }
}

.archive-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 10px 4px 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: inherit;
  transition: color 140ms ease;
}

.archive-toggle:hover {
  color: var(--text);
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-group__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-group__toggle,
.sidebar-group__open {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  color: inherit;
  font: inherit;
}

.sidebar-group__toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.sidebar-group__toggle:hover,
.sidebar-group__open:hover {
  border-color: rgba(178, 79, 47, 0.3);
}

.sidebar-group__toggle:hover {
  transform: translateY(-1px);
}

.sidebar-group__caret {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1;
}

.sidebar-group__content {
  flex: 1;
  min-width: 0;
}

.sidebar-group__content strong,
.sidebar-group__meta {
  display: block;
}

.sidebar-group__content strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-group__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.sidebar-group__open {
  flex-shrink: 0;
  padding: 0 12px;
  min-height: 38px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.sidebar-group__open:hover {
  background: rgba(255, 247, 237, 0.92);
  transform: translateY(-1px);
}

.sidebar-group__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 16px;
  padding-left: 12px;
  border-left: 1px dashed rgba(59, 39, 18, 0.14);
}

.sidebar-group__subsection-label {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-group__empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-group--project .sidebar-group__toggle,
.sidebar-group--project .sidebar-group__open {
  border-color: var(--project-accent-line, rgba(178, 79, 47, 0.28));
  background: linear-gradient(135deg, var(--project-accent-soft, rgba(255, 247, 237, 0.92)) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.sidebar-group--project .sidebar-group__caret {
  color: var(--project-accent, var(--accent));
}

.sidebar-group--project .sidebar-group__content strong {
  color: var(--project-accent-text, var(--accent-deep));
}

.sidebar-group--project .sidebar-group__body {
  border-left-color: var(--project-accent-line, rgba(178, 79, 47, 0.28));
}

.sidebar-group--automation .sidebar-group__toggle,
.sidebar-group--automation .sidebar-group__open {
  background: rgba(255, 250, 242, 0.88);
  border-style: dashed;
  border-color: rgba(178, 79, 47, 0.28);
}

.sidebar-group--nested {
  gap: 6px;
}

.sidebar-group--nested .sidebar-group__toggle,
.sidebar-group--nested .sidebar-group__open {
  border-radius: 14px;
}

.sidebar-group--loose .sidebar-group__toggle {
  background: rgba(255, 255, 255, 0.48);
}

.sidebar-section-label {
  margin: 6px 0 0;
  color: var(--accent-deep);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-section-label--empty {
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
}

.archive-toggle--automation {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 6px 0 0;
}

.sidebar-section-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent-deep);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: inherit;
  padding: 2px 0;
  text-align: left;
  transition: color 140ms ease;
}

.sidebar-section-toggle:hover {
  color: var(--accent);
}

.sidebar-group__add {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  font-family: inherit;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
  padding: 0;
}

.sidebar-group__add:hover {
  color: var(--accent);
  border-color: rgba(178, 79, 47, 0.4);
  background: rgba(178, 79, 47, 0.06);
}

.sidebar-group__add--sm {
  width: 24px;
  height: 24px;
  font-size: 0.9rem;
}

.sidebar-group__subsection-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 6px 0 0;
}

.sidebar-group__subsection-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: inherit;
  padding: 2px 0;
  text-align: left;
  transition: color 140ms ease;
}

.sidebar-group__subsection-toggle:hover {
  color: var(--text);
}

.sidebar-group__open--icon {
  padding: 0 8px;
  font-size: 0.9rem;
}

.sidebar-group__open--plain {
  min-width: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.44);
}

.sidebar-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-action__main {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-action__main:hover {
  color: var(--accent-deep);
}

.sidebar-action--active .sidebar-action__main {
  color: var(--accent-deep);
  font-weight: 700;
}

.sidebar-action--switch {
  justify-content: space-between;
}

.sidebar-switch {
  flex: 0 0 auto;
  position: relative;
  width: 38px;
  height: 22px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.sidebar-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s;
}

.sidebar-switch--on {
  background: var(--accent, #b24f2f);
  border-color: var(--accent, #b24f2f);
}

.sidebar-switch--on::after {
  transform: translateX(16px);
}

.sidebar-provider-status {
  display: grid;
  gap: 2px;
  padding: 6px 0;
}

.sidebar-provider-status__name {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-provider-status__usage {
  font-size: 0.9rem;
  font-weight: 600;
}

.sidebar-provider-status__detail {
  font-size: 0.75rem;
  color: var(--muted);
}

.sidebar-provider-switch-wrapper {
  padding: 6px 0 4px;
}

.sidebar-provider-switch__label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.sidebar-provider-switch {
  display: flex;
}

.sidebar-provider-switch__btn {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-provider-switch__btn:first-child {
  border-radius: 6px 0 0 6px;
  border-right: none;
}

.sidebar-provider-switch__btn:last-child {
  border-radius: 0 6px 6px 0;
}

.sidebar-provider-switch__btn--active {
  background: var(--accent, #b24f2f);
  color: #fff;
  border-color: var(--accent, #b24f2f);
}

.sidebar-provider-switch__btn--active + .sidebar-provider-switch__btn {
  border-left-color: var(--accent, #b24f2f);
}

.session-card:hover,
.session-card.is-active {
  transform: translateY(-1px);
  border-color: rgba(178, 79, 47, 0.35);
  background: rgba(255, 247, 237, 0.92);
}

.session-card--projected:hover,
.session-card--projected.is-active {
  border-color: var(--project-accent, var(--accent));
  background: linear-gradient(180deg, var(--project-accent-soft, rgba(255, 247, 237, 0.92)) 0%, rgba(255, 252, 248, 0.98) 100%);
}

.main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.view-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  background: rgba(255, 250, 241, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
  box-shadow: 0 10px 28px rgba(61, 36, 10, 0.08);
}

.view-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.view-tab:hover {
  color: var(--text);
  background: rgba(255, 245, 235, 0.82);
}

.view-tab--active {
  color: #fff;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 10px 18px rgba(127, 47, 21, 0.18);
}

.main-view {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.main-view[hidden] {
  display: none !important;
}

.chat-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.chat-header {
  border-radius: calc(var(--radius) + 8px);
  padding: 10px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 4;
  isolation: isolate;
}

.chat-header__top {
  min-width: 0;
}

.chat-header__title-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-header__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.chat-header__title-row {
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.chat-header__title-row .chat-version-switcher {
  margin-left: auto;
  flex-shrink: 0;
}

.chat-header__title-row .chat-version-switcher[hidden] + .chat-archive-button {
  margin-left: auto;
}

.chat-header .eyebrow {
  margin-bottom: 0;
}

.chat-header__title {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.35rem);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
}

.chat-header__project {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.chat-header__controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 247, 239, 0.82);
  border: 1px solid rgba(178, 79, 47, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.chat-version-switcher,
.chat-move-project-switcher {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.chat-header__icon-button,
.message__icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 999px;
}

/* Inside the pill container, buttons should be transparent — no own border/ring */
.chat-header__controls .chat-header__icon-button {
  background: transparent;
  border: none;
  box-shadow: none;
}

.chat-header__controls .chat-header__icon-button:hover {
  background: rgba(178, 79, 47, 0.1);
}

.chat-header__archive {
  align-self: center;
}

.chat-header__icon-button svg {
  width: 20px;
  height: 20px;
}

.chat-header__icon-button[data-count]::after {
  content: attr(data-count);
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 3px 8px rgba(71, 31, 17, 0.22);
}

.chat-version-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: min(320px, calc(100vw - 48px));
  max-width: min(360px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(178, 79, 47, 0.18);
  background: rgba(255, 251, 245, 0.98);
  box-shadow: 0 18px 40px rgba(36, 20, 12, 0.18);
  z-index: 30;
}

.chat-version-menu[hidden] {
  display: none;
}

.chat-version-menu__summary {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 2px 4px 0;
  line-height: 1.35;
}

.chat-version-menu__item {
  border: 1px solid rgba(178, 79, 47, 0.14);
  border-radius: 14px;
  background: rgba(255, 247, 239, 0.94);
  color: var(--ink);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.chat-version-menu__item:hover {
  border-color: rgba(178, 79, 47, 0.3);
}

.chat-version-menu__item.is-active {
  border-color: rgba(178, 79, 47, 0.4);
  background: rgba(255, 240, 229, 0.98);
}

.chat-version-menu__item-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

.chat-version-menu__item-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.chat-move-project-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: min(260px, calc(100vw - 48px));
  max-width: min(320px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(178, 79, 47, 0.18);
  background: rgba(255, 251, 245, 0.98);
  box-shadow: 0 18px 40px rgba(36, 20, 12, 0.18);
  z-index: 30;
}

.chat-move-project-menu[hidden] {
  display: none;
}

.chat-move-project-menu__label {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 2px 6px 4px;
  line-height: 1.35;
}

.chat-move-project-menu__item {
  border: 1px solid rgba(178, 79, 47, 0.14);
  border-radius: 12px;
  background: rgba(255, 247, 239, 0.94);
  color: var(--ink);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.3;
}

.chat-move-project-menu__item:hover {
  border-color: rgba(178, 79, 47, 0.3);
}

.chat-move-project-menu__item.is-active {
  border-color: rgba(178, 79, 47, 0.4);
  background: rgba(255, 240, 229, 0.98);
  font-weight: 600;
}

.chat-move-project-menu__item--none {
  color: var(--muted);
}

.storage-view {
  flex: 1;
  min-height: 0;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: calc(var(--radius) + 8px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.storage-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.storage-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}

.storage-panel__header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.storage-sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.storage-sort-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.storage-sort-btn {
  font-size: 0.8rem;
  padding: 4px 10px;
}

.storage-sort-btn--active {
  border-color: var(--accent);
  color: var(--accent);
}

.storage-summary {
  padding: 8px 20px;
  font-size: 0.85rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.storage-list {
  overflow-y: auto;
  flex: 1;
}

.storage-loading,
.storage-error,
.storage-empty {
  padding: 24px 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.storage-error {
  color: #e55;
}

.storage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.storage-row:last-child {
  border-bottom: none;
}

.storage-row__info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.storage-row__title {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 400px;
}

.storage-row__date {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.storage-row__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.storage-row__size {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

.storage-delete-btn {
  font-size: 0.8rem;
  padding: 4px 10px;
}

.storage-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  font-weight: 500;
}

.storage-badge--archived {
  background: rgba(120, 120, 120, 0.2);
  color: var(--muted);
}

.storage-badge--auto {
  background: rgba(80, 140, 255, 0.15);
  color: #7ab;
}

.storage-row--confirming > .storage-row__info,
.storage-row--confirming > .storage-row__right {
  display: none;
}

.storage-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 2px 0;
}

.storage-confirm__text {
  flex: 1;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.storage-confirm__yes {
  font-size: 0.8rem;
  padding: 4px 12px;
  background: #c33;
  border-color: #c33;
  color: #fff;
  flex-shrink: 0;
}

.storage-confirm__yes:hover:not(:disabled) {
  background: #e44;
  border-color: #e44;
}

.storage-confirm__no {
  font-size: 0.8rem;
  padding: 4px 12px;
  flex-shrink: 0;
}

.storage-row {
  cursor: pointer;
}

.storage-row:hover {
  background: rgba(178, 79, 47, 0.05);
}

/* Storage chat preview overlay */
.storage-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
}

.storage-preview-overlay[hidden] {
  display: none;
}

.storage-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 12, 5, 0.55);
  backdrop-filter: blur(3px);
}

.storage-preview-popup {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  width: min(720px, 94vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.storage-preview-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  flex-shrink: 0;
}

.storage-preview-popup__meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.storage-preview-popup__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.storage-preview-popup__size {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.storage-preview-popup__nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.storage-preview-popup__arrow {
  font-size: 1rem;
  padding: 4px 10px;
  line-height: 1;
}

.storage-preview-popup__counter {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 50px;
  text-align: center;
}

.storage-preview-popup__delete {
  font-size: 0.8rem;
  padding: 4px 10px;
}

.storage-preview-popup__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background 140ms ease;
}

.storage-preview-popup__close svg {
  width: 18px;
  height: 18px;
}

.storage-preview-popup__close:hover {
  background: rgba(178, 79, 47, 0.1);
  color: var(--accent);
}

.storage-preview-popup__messages {
  overflow-y: auto;
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.storage-preview-loading,
.storage-preview-empty,
.storage-preview-error {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 0;
}

.storage-preview-error {
  color: #e55;
}

.storage-preview-msg {
  display: flex;
  gap: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 100%;
}

.storage-preview-msg--user {
  flex-direction: row-reverse;
}

.storage-preview-msg__role {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 2px;
  flex-shrink: 0;
}

.storage-preview-msg--user .storage-preview-msg__role {
  color: var(--accent);
}

.storage-preview-msg__text {
  background: rgba(178, 79, 47, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 0;
  max-height: 200px;
  overflow-y: auto;
}

.storage-preview-msg--user .storage-preview-msg__text {
  background: rgba(178, 79, 47, 0.12);
}

.automations-view {
  flex: 1;
  min-height: 0;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: calc(var(--radius) + 8px);
  overflow: hidden;
}

.automations-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
}

.automations-panel__list {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-divider {
  display: none;
}

.automations-panel__list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.automations-panel__list-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.automation-auto-prompts-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.automation-project-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
}

.automation-project-group--project {
  border-color: var(--project-accent-line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--project-accent-soft) 72%, white) 0%, rgba(255, 255, 255, 0.66) 100%);
}

.automation-project-group__header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 2px 0;
}

.automation-project-group__header strong {
  font-size: 0.9rem;
  color: var(--project-accent-text, var(--text));
}

.automation-project-group__meta {
  font-size: 0.76rem;
  color: var(--muted);
}

.automation-project-group__cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.management-card {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 140ms ease, border-color 140ms ease;
}

.management-card:hover,
.management-card.is-selected {
  background: rgba(255, 247, 237, 0.95);
  border-color: rgba(178, 79, 47, 0.35);
}

.management-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.management-card__header strong {
  flex: 1;
  font-size: 0.92rem;
}

.management-card__badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.management-card__badge--active {
  background: rgba(34, 119, 85, 0.12);
  color: #21573f;
}

.management-card__badge--paused {
  background: rgba(178, 79, 47, 0.1);
  color: var(--accent);
}

.management-card__meta,
.management-card__next {
  font-size: 0.8rem;
  color: var(--muted);
}

.automations-panel__detail {
  overflow-y: auto;
  padding: 0;
  min-height: 0;
}

.automation-detail__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}

.automation-detail {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  max-width: 100%;
}

.automation-detail__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.automation-detail__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.automation-detail__title h3 {
  margin: 0;
  font-size: 1.3rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.automation-detail__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.automation-detail__delete {
  font-size: 0.82rem;
  padding: 4px 8px;
  border-radius: 8px;
}

.automation-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.88rem;
  color: var(--muted);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.automation-detail__lastrun {
  width: 100%;
}

.automation-detail__section-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.automation-detail__prompt-text {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  background: rgba(178, 79, 47, 0.06);
  border: 1px solid rgba(178, 79, 47, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
}

.automation-runs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.automation-run-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.automation-run-item__time {
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 130px;
}

.automation-run-item__title {
  flex: 1 1 180px;
  font-size: 0.88rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-run-item__status {
  font-size: 0.8rem;
  color: #21573f;
  flex-shrink: 0;
}

.automation-run-item__status--running {
  color: var(--accent);
}

.automation-run-item__open {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 0.82rem;
}

.automation-detail--form {
  gap: 16px;
}

.automation-form--detail {
  gap: 12px;
}

.automation-form__label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.automation-form__label--project {
  margin-bottom: 8px;
}

.automation-form__label--checkbox {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.automation-form__label--checkbox input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  flex-shrink: 0;
}

.automation-form__label input,
.automation-form__label textarea,
.automation-form__label select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  font: inherit;
}

.automation-form__label textarea {
  resize: vertical;
}

.automation-form__label input:focus,
.automation-form__label textarea:focus,
.automation-form__label select:focus {
  outline: 2px solid rgba(178, 79, 47, 0.26);
  border-color: rgba(178, 79, 47, 0.22);
}

.automation-sidebar-header {
  width: 100%;
  text-align: left;
  background: rgba(255, 250, 242, 0.88);
  border: 1px dashed rgba(178, 79, 47, 0.28);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 140ms ease;
}

.automation-sidebar-header:hover {
  background: rgba(255, 247, 237, 0.95);
}

.automation-sidebar-header strong {
  font-size: 0.88rem;
  display: block;
}

.automation-sidebar-header span {
  font-size: 0.78rem;
  color: var(--muted);
  display: block;
}

.automation-sidebar-header__meta {
  font-size: 0.74rem !important;
  color: rgba(113, 89, 66, 0.65) !important;
}

.hero {
  border-radius: calc(var(--radius) + 8px);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.hero__copy {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
}

.chat-log {
  flex: 1;
  min-height: 0;
  border-radius: calc(var(--radius) + 8px);
  padding: 24px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  touch-action: pan-y;
}

body.public-share-mode {
  padding: 0;
}

.public-share-mode .shell {
  display: block;
  height: 100dvh;
}

.public-share-mode .sidebar,
.public-share-mode .sidebar-backdrop,
.public-share-mode .app-header,
.public-share-mode .chat-header,
.public-share-mode .composer,
.public-share-mode .share-overlay,
.public-share-mode .chat-swipe-hint,
.public-share-mode .message__actions,
.public-share-mode .message__meta,
.public-share-mode .initial-prompt-wrapper {
  display: none !important;
}

.public-share-mode .main {
  height: 100dvh;
  padding: 0;
  gap: 0;
}

.public-share-mode .chat-view {
  height: 100dvh;
  gap: 0;
}

.public-share-mode .chat-log {
  height: 100dvh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  backdrop-filter: none;
  padding: clamp(16px, 3vw, 32px);
}

.public-share-mode .message {
  max-width: min(840px, calc(100% - 56px));
}

.public-share-mode .message--has-one-action,
.public-share-mode .message--has-two-actions {
  padding-right: 18px;
}

.message {
  width: fit-content;
  max-width: min(840px, calc(100% - 56px));
  box-sizing: border-box;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  position: relative;
}

.message--user {
  align-self: flex-end;
  background: linear-gradient(180deg, #fff6ed 0%, #f8e0cb 100%);
}

.message--has-one-action {
  padding-right: 68px;
}

.message--has-two-actions {
  padding-right: 116px;
}

.message--assistant {
  align-self: flex-start;
}

.message--notice {
  align-self: center;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 8px 14px;
  max-width: min(560px, 92%);
  opacity: 0.72;
}

.message--notice .message__meta::before {
  content: "⏰ ";
}

.message--notice .message__body {
  font-style: italic;
  color: var(--muted);
  font-size: 0.92em;
}

.message--queued {
  opacity: 0.56;
  border-style: dashed;
}

.message__meta {
  margin-bottom: 8px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.message__body {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.message__body > :first-child {
  margin-top: 0;
}

.message__body > :last-child {
  margin-bottom: 0;
}

.message__body p,
.message__body ul,
.message__body ol,
.message__body blockquote,
.message__body pre,
.message__body h1,
.message__body h2,
.message__body h3,
.message__body h4,
.message__body h5,
.message__body h6 {
  margin: 0 0 0.9em;
}

.message__body ul,
.message__body ol {
  padding-left: 1.35em;
}

.message__body li + li {
  margin-top: 0.3em;
}

.message__body a {
  color: var(--accent-deep);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.14em;
}

.message__body code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92em;
  background: rgba(92, 44, 28, 0.08);
  border: 1px solid rgba(92, 44, 28, 0.08);
  border-radius: 6px;
  padding: 0.1em 0.35em;
}

.message__body pre {
  overflow-x: auto;
  background: rgba(92, 44, 28, 0.06);
  border: 1px solid rgba(92, 44, 28, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
}

.message__body pre code {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  white-space: pre-wrap;
}

.message__body blockquote {
  margin-left: 0;
  padding-left: 14px;
  border-left: 3px solid rgba(178, 79, 47, 0.35);
  color: var(--muted);
}

.message__body h1,
.message__body h2,
.message__body h3,
.message__body h4,
.message__body h5,
.message__body h6 {
  line-height: 1.25;
}

.md-table-wrapper {
  overflow-x: auto;
  margin: 0.5em 0;
  border-radius: 6px;
  border: 1px solid rgba(128, 128, 128, 0.25);
}

.md-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9em;
}

.md-table th,
.md-table td {
  padding: 6px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
  white-space: nowrap;
}

.md-table th {
  background: rgba(128, 128, 128, 0.1);
  font-weight: 600;
  border-bottom: 2px solid rgba(128, 128, 128, 0.25);
}

.md-table tbody tr:last-child td {
  border-bottom: none;
}

.md-table tbody tr:hover {
  background: rgba(128, 128, 128, 0.05);
}

.message__body h1 {
  font-size: 1.45rem;
}

.message__body h2 {
  font-size: 1.28rem;
}

.message__body h3 {
  font-size: 1.14rem;
}

.message__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.attachments-collapsible {
  width: 100%;
}

.attachments-collapsible__summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted, #888);
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.attachments-collapsible__summary::before {
  content: "▶";
  font-size: 0.65rem;
  transition: transform 0.15s;
}

.attachments-collapsible[open] .attachments-collapsible__summary::before {
  transform: rotate(90deg);
}

.attachments-collapsible__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.message__actions,
.message__edit-actions,
.message__queue-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.message__actions {
  position: absolute;
  top: 12px;
  right: 12px;
  margin-top: 0;
  z-index: 1;
}

.message__actions .button,
.message__edit-actions .button,
.message__queue-actions .button {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.message__icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  line-height: 0;
  background: rgba(255, 250, 246, 0.95);
  box-shadow: 0 6px 18px rgba(77, 40, 24, 0.08);
}

.message__icon-button svg {
  width: 20px;
  height: 20px;
}

.message--editing {
  border-color: rgba(178, 79, 47, 0.36);
  box-shadow: 0 0 0 3px rgba(178, 79, 47, 0.08);
}

.message__edit-input {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid rgba(178, 79, 47, 0.24);
  border-radius: 14px;
  background: rgba(255, 252, 248, 0.96);
  padding: 12px 14px;
  font: inherit;
  line-height: 1.55;
  color: var(--ink);
}

.message__edit-input:focus {
  outline: none;
  border-color: rgba(178, 79, 47, 0.52);
  box-shadow: 0 0 0 3px rgba(178, 79, 47, 0.12);
}

.attachment-image {
  display: block;
  max-width: 100%;
  max-height: 400px;
  border-radius: 12px;
  border: 1px solid var(--line);
  object-fit: contain;
}

.inline-artifact-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: contain;
  vertical-align: middle;
  cursor: zoom-in;
}

.img-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.img-lightbox--open {
  display: flex;
}

.img-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.img-lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.img-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.img-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 40px;
  line-height: 1;
  width: 48px;
  height: 64px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.img-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.img-lightbox__nav--prev {
  left: 16px;
}

.img-lightbox__nav--next {
  right: 16px;
}

.inline-artifact-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  border: 1px solid rgba(178, 79, 47, 0.22);
  background: rgba(255, 245, 235, 0.95);
  color: var(--accent-deep);
  font-size: 0.82em;
  padding: 1px 8px 1px 6px;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  white-space: nowrap;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-artifact-link:hover {
  background: rgba(178, 79, 47, 0.1);
}

.artifact-type-icon {
  width: 30px;
  min-width: 30px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 4px;
  background: #5f6f52;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.artifact-type-icon--pdf {
  background: #b42318;
}

.artifact-type-icon--csv,
.artifact-type-icon--sheet {
  background: #1f7a4d;
}

.artifact-type-icon--image {
  background: #2563eb;
}

.artifact-type-icon--video {
  background: #7c3aed;
}

.artifact-type-icon--text {
  background: #52616b;
}

.artifact-type-icon--doc {
  background: #315a9f;
}

.artifact-type-icon--archive {
  background: #8a5a16;
}

.artifact-type-icon--audio {
  background: #be185d;
}

.inline-artifact-link .inline-artifact-img {
  display: block;
  margin-top: 4px;
}

.attachment-pdf-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.attachment-pdf {
  width: 100%;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.pending-thumbnail {
  height: 20px;
  width: auto;
  border-radius: 4px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 4px;
}

.pending-pdf-icon {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--accent-deep);
  color: #fff;
  border-radius: 3px;
  padding: 1px 4px;
  margin-right: 4px;
  vertical-align: middle;
}

.attachment-pill,
.artifact-link,
.upload-pill,
.voice-pill,
.provider-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(178, 79, 47, 0.22);
  background: rgba(255, 245, 235, 0.95);
  color: var(--accent-deep);
  font-size: 0.86rem;
  padding: 8px 12px;
  text-decoration: none;
}

.file-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.file-preview-overlay[hidden] {
  display: none;
}

.file-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 24, 21, 0.42);
  backdrop-filter: blur(3px);
}

.file-preview-popover {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(178, 79, 47, 0.22);
  border-radius: 12px;
  background: #fffdf9;
  box-shadow: 0 22px 70px rgba(28, 24, 21, 0.28);
}

.file-preview-popover__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.file-preview-popover__title {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-popover__close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.file-preview-popover__close:hover {
  color: var(--ink);
  background: rgba(178, 79, 47, 0.08);
}

.file-preview-popover__body {
  min-height: 220px;
  overflow: auto;
  padding: 14px;
  background: #fffaf4;
}

.file-preview-popover__actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fffdf9;
}

.file-preview-popover__download {
  text-decoration: none;
}

.browser-handoff-inline {
  width: min(100%, 680px);
  display: grid;
  grid-template-rows: clamp(300px, 56dvh, 520px) auto auto;
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid rgba(31, 93, 154, 0.22);
  border-radius: 8px;
  background: #f7fafc;
}

.browser-handoff-inline__bar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 180px) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  grid-row: 2;
  border-top: 1px solid rgba(31, 93, 154, 0.16);
  background: #fff;
}

.browser-handoff-inline__title {
  min-width: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-handoff-inline__zoom-label {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.browser-handoff-inline__zoom {
  width: 100%;
  min-width: 0;
}

.browser-handoff-inline__open,
.browser-handoff-inline__finish {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1;
  padding: 7px 9px;
  text-decoration: none;
  cursor: pointer;
}

.browser-handoff-inline__finish {
  border-color: #1f6f50;
  background: #1f6f50;
  color: #fff;
}

.browser-handoff-inline__finish:disabled {
  opacity: 0.72;
  cursor: default;
}

.browser-handoff-inline__frame {
  grid-row: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  touch-action: auto;
}

.browser-handoff-inline__hint {
  grid-row: 3;
  padding: 6px 8px;
  border-top: 1px solid rgba(31, 93, 154, 0.12);
  color: var(--muted);
  background: #fff;
  font-size: 0.76rem;
  line-height: 1.25;
}

.browser-handoff-inline--finished .browser-handoff-inline__bar {
  background: #f1faf5;
}

.browser-handoff-inline--closed {
  width: min(100%, 520px);
  display: block;
  padding: 10px 12px;
  background: #f6f7f9;
}

.browser-handoff-inline__closed {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.browser-handoff-inline__closed strong {
  color: var(--ink);
  font-size: 0.88rem;
}

html[data-theme="dark"] .browser-handoff-inline {
  border-color: var(--line);
  background: var(--surface);
}

html[data-theme="dark"] .browser-handoff-inline__bar,
html[data-theme="dark"] .browser-handoff-inline__hint {
  border-color: var(--line);
  background: var(--surface-strong);
}

html[data-theme="dark"] .browser-handoff-inline__open {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

html[data-theme="dark"] .browser-handoff-inline--finished .browser-handoff-inline__bar {
  background: rgba(31, 111, 80, 0.24);
}

html[data-theme="dark"] .browser-handoff-inline--closed {
  background: var(--surface-strong);
}

.file-preview-popover__loading,
.file-preview-popover__error,
.file-preview-popover__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.file-preview-popover__error {
  color: #b42318;
}

.file-preview-popover__hint {
  margin-top: 10px;
}

.file-preview-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
  font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.file-preview-image,
.file-preview-video {
  display: block;
  max-width: 100%;
  max-height: 66vh;
  margin: 0 auto;
  border-radius: 8px;
  object-fit: contain;
}

.file-preview-video {
  width: 100%;
  background: #111;
}

.file-preview-pdf {
  display: block;
  width: 100%;
  height: min(66vh, 680px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-preview-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.file-preview-table th,
.file-preview-table td {
  max-width: 260px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.file-preview-table th {
  position: sticky;
  top: 0;
  background: #fff4e8;
  font-weight: 800;
  z-index: 1;
}

@media (max-width: 720px) {
  .file-preview-overlay {
    padding: 10px;
  }

  .file-preview-popover {
    max-height: calc(100vh - 20px);
    border-radius: 10px;
  }

  .file-preview-popover__body {
    padding: 10px;
  }

  .browser-handoff-inline {
    width: 100%;
    grid-template-rows: clamp(280px, 46dvh, 400px) auto auto;
    border-radius: 8px;
  }

  .message--assistant .browser-handoff-inline {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  .browser-handoff-inline__bar {
    grid-template-columns: minmax(0, 1fr) minmax(92px, 120px) auto;
    gap: 6px;
    padding: 6px;
  }

  .browser-handoff-inline__title {
    font-size: 0.82rem;
  }

  .browser-handoff-inline__open {
    display: none;
  }

  .browser-handoff-inline__finish {
    min-height: 30px;
    padding: 6px 8px;
    font-size: 0.76rem;
  }

  .browser-handoff-inline__hint {
    display: none;
  }
}

.provider-switch {
  color: var(--muted);
  min-width: 0;
  width: 100%;
  justify-content: space-between;
}

.provider-switch select {
  border: none;
  background: transparent;
  color: var(--accent-deep);
  font: inherit;
  font-weight: 700;
  min-width: 0;
  width: 100%;
  text-align: right;
}

.provider-switch span {
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.composer {
  border-radius: calc(var(--radius) + 8px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.composer__side {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.composer__row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.composer__row--primary {
  justify-content: flex-start;
}

.composer__row--secondary {
  justify-content: stretch;
}

.composer__row--secondary .provider-switch {
  flex: 1 1 0;
  width: auto;
}

.composer__actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
  align-items: center;
  justify-content: flex-end;
}

.composer__icon-button[hidden] {
  display: none;
}

.composer__icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--accent-deep);
  position: relative;
}

.composer__icon-button:hover {
  background: rgba(178, 79, 47, 0.1);
}

.composer__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.composer__send-cluster {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer__send-button {
  width: 56px;
  min-width: 56px;
  color: #fff;
  background: var(--accent-deep);
  box-shadow: 0 10px 22px rgba(178, 79, 47, 0.26);
  touch-action: none;
}

.composer__send-button:hover {
  background: color-mix(in srgb, var(--accent-deep) 88%, #000 12%);
}

.composer__send-button .composer__icon {
  width: 22px;
  height: 22px;
}

.composer__send-menu[hidden] {
  display: none;
}

.composer__send-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 150px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, #fff 4%);
  box-shadow: 0 18px 36px rgba(36, 20, 12, 0.22);
}

.composer__send-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  position: relative;
}

.composer__send-menu-item:hover,
.composer__send-menu-item:focus-visible,
.composer__send-menu-item--selected {
  background: rgba(178, 79, 47, 0.12);
  color: var(--accent-deep);
  outline: none;
}

.composer__menu-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.composer__send-menu .voice-pill__dot {
  right: 8px;
  bottom: 8px;
  opacity: 0;
}

.composer__send-menu .voice-pill--active .voice-pill__dot,
.composer__send-menu .voice-pill--busy .voice-pill__dot {
  opacity: 1;
}

.pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-pill--uploading {
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--accent) 22%, rgba(255, 245, 235, 0.95)) var(--pct, 0%),
    rgba(255, 245, 235, 0.95) var(--pct, 0%)
  );
  transition: background 0.15s;
}

.message--pending-upload {
  opacity: 0.55;
  border-style: dashed;
}

.attachment-pill--error {
  border-color: rgba(200, 50, 50, 0.4);
  background: rgba(255, 235, 235, 0.95);
  color: #a33;
}

.attachment-pill-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.attachment-pill-error-label {
  font-size: 0.7rem;
  color: #c03030;
  padding-left: 4px;
  white-space: nowrap;
}

.upload-progress-bar {
  display: inline-block;
  width: 48px;
  height: 4px;
  background: rgba(178, 79, 47, 0.15);
  border-radius: 2px;
  vertical-align: middle;
  overflow: hidden;
}

.upload-progress-fill {
  display: block;
  height: 100%;
  background: var(--accent-deep);
  border-radius: 2px;
  transition: width 0.15s;
}

.upload-done-icon {
  color: #2a7a2a;
  font-size: 0.8rem;
  font-weight: 700;
}

.upload-error-icon {
  color: #a33;
  font-size: 0.8rem;
  font-weight: 700;
}

.pending-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.pending-file-remove:hover {
  opacity: 1;
}

#file-input {
  display: none;
}

.upload-pill {
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.12s;
}


.voice-pill {
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.12s, color 0.18s;
  font: inherit;
}

.voice-pill:hover:not(:disabled) {
  background: rgba(178, 79, 47, 0.12);
  border-color: rgba(178, 79, 47, 0.5);
  transform: scale(1.04);
}

.composer__send-menu .voice-pill:hover:not(:disabled) {
  transform: none;
}

.voice-pill:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.voice-pill--active {
  background: rgba(178, 79, 47, 0.16);
  border-color: rgba(178, 79, 47, 0.62);
  color: var(--accent-deep);
}

.voice-pill--busy {
  background: rgba(38, 24, 11, 0.08);
  color: var(--muted);
}

.voice-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  position: absolute;
  right: 9px;
  bottom: 9px;
  box-shadow: 0 0 0 2px rgba(255, 245, 235, 0.95);
}

.voice-pill--active .voice-pill__dot {
  animation: voice-pulse 1s ease-in-out infinite;
}

.upload-pill:hover {
  background: rgba(178, 79, 47, 0.12);
  border-color: rgba(178, 79, 47, 0.5);
  transform: scale(1.04);
}

#message-input {
  flex: 1;
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  font: inherit;
  resize: none;
  min-height: unset;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#message-input:focus {
  outline: 2px solid rgba(178, 79, 47, 0.26);
  border-color: rgba(178, 79, 47, 0.22);
}

.button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
}

.button--ghost {
  color: var(--accent-deep);
  background: rgba(255, 245, 235, 0.95);
  border: 1px solid rgba(178, 79, 47, 0.22);
}

.button svg {
  width: 18px;
  height: 18px;
  display: block;
}

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

.button:disabled {
  opacity: 0.65;
  cursor: progress;
}

.message__spinner {
  display: none;
  height: 20px;
  margin-top: 10px;
}

.message--loading .message__spinner {
  display: flex;
  align-items: center;
}

.message--loading .message__spinner::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: msg-spin 0.75s linear infinite;
  flex-shrink: 0;
}

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

.status-line {
  display: none;
  flex: 1;
  min-width: 180px;
  color: var(--muted);
  font-size: 0.92rem;
}

@keyframes voice-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.5);
    opacity: 0.45;
  }
}

.empty-state {
  max-width: 520px;
  margin: auto;
  text-align: center;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border-radius: calc(var(--radius) + 8px);
  flex-shrink: 0;
}

.app-header__left,
.app-header__right {
  display: flex;
  align-items: center;
  min-width: 0;
}

.app-header__left {
  display: none;
  gap: 14px;
  margin-right: auto;
}

.app-header__right {
  gap: 10px;
  margin-left: auto;
  min-width: 0;
  justify-content: flex-end;
}

.app-project-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  width: fit-content;
  max-width: min(100%, 300px);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(178, 79, 47, 0.22);
  background: rgba(255, 245, 235, 0.95);
  color: var(--muted);
}

.app-project-switch span {
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-project-switch select {
  border: none;
  background: transparent;
  color: var(--accent-deep);
  font: inherit;
  font-weight: 700;
  flex: 0 0 auto;
  min-width: 0;
  width: auto;
  max-width: 160px;
  text-align: right;
}

.app-header__icon-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-header__icon-button svg {
  width: 20px;
  height: 20px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(38, 24, 11, 0.42);
  backdrop-filter: blur(2px);
}

.sidebar-backdrop--visible {
  display: block;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-toggle span {
  display: block;
  width: 100%;
  flex: 0 0 2px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 200ms ease, opacity 200ms ease;
}

.mobile-header__title {
  margin-right: auto;
}

.mobile-header__title .brand__wordmark {
  white-space: nowrap;
}

.mobile-install-button {
  flex: 0 0 auto;
}

.sidebar__buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar__buttons .button {
  flex: 1 1 calc(50% - 4px);
}

.button--icon-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
  min-width: 0;
}

.context-indicator {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent, #7c6af0);
  margin: 4px 0 0;
  padding: 2px 6px;
  background: color-mix(in srgb, var(--accent, #7c6af0) 12%, transparent);
  border-radius: 4px;
  display: inline-block;
}

/* Secrets modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38, 24, 11, 0.5);
  backdrop-filter: blur(3px);
}

.modal__box {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 24px;
  width: min(520px, 92vw);
  max-height: 80vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal__box--wide {
  width: min(760px, 94vw);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.modal__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 8px;
  line-height: 1;
  transition: background 140ms ease;
}

.modal__close:hover {
  background: rgba(178, 79, 47, 0.1);
  color: var(--accent);
}

.modal__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.modal__hint code {
  font-family: "JetBrains Mono", monospace;
  background: rgba(178, 79, 47, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.projects-view {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.projects-panel {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100%;
  min-height: 0;
}

.projects-panel__list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.projects-panel__list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.projects-panel__list-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.projects-panel__detail {
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  min-height: 0;
}

.projects-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-detail__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
}

.project-detail__desc {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.project-detail__desc p + p {
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.project-detail__automations,
.project-detail__chats {
  padding: 16px 24px;
}

.project-detail__automations {
  border-bottom: 1px solid var(--line);
}

.project-detail__automations-header,
.project-detail__chats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.project-detail__automation-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-detail__automation-main {
  flex: 1;
  min-width: 0;
}

.project-detail__automation-meta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-word;
}

.project-detail__add-chat {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  min-width: 0;
}

.project-detail__add-chat .button {
  flex-shrink: 0;
}

.project-detail__chat-select {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 8px;
  font-size: 0.875rem;
}

.project-detail__chat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-detail__secrets,
.project-detail__skills {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.project-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: flex-start;
}

.project-inline-form__key {
  flex: 1;
  min-width: 80px;
  max-width: 160px;
}

.project-inline-form__value {
  flex: 2;
  min-width: 120px;
}

.project-inline-form--skill {
  flex-direction: column;
  flex-wrap: nowrap;
}

.project-inline-form--skill .automation-form__label {
  width: 100%;
}

.project-inline-form--skill textarea {
  width: 100%;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 8px;
  font-size: 0.875rem;
  font-family: var(--font-mono, monospace);
}

.project-inline-form__buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-form__fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px 14px;
  margin: 0;
}

.project-form__fieldset legend {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  padding: 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.perm-table {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  font-size: 0.875rem;
  padding-top: 6px;
}

.perm-table span {
  color: var(--text);
}

.perm-table select {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.perm-table select:focus {
  outline: 2px solid rgba(178, 79, 47, 0.26);
  border-color: rgba(178, 79, 47, 0.22);
}

.perm-acl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  font-size: 0.82rem;
  margin-top: 6px;
}

.perm-acl-grid__label {
  color: var(--muted);
  font-size: 0.75rem;
}

.perm-acl-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(178, 79, 47, 0.08);
  color: var(--accent-deep, #a0400e);
}

.perm-acl-badge--none {
  background: rgba(0,0,0,0.04);
  color: var(--muted);
  font-weight: 400;
}

.project-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 24px 24px;
}

.project-form textarea {
  width: 100%;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  font-family: inherit;
  font-size: 0.875rem;
}

.session-card__badge--project {
  background: var(--project-accent-soft, rgba(178, 79, 47, 0.12));
  color: var(--project-accent-text, var(--accent-deep));
  font-size: 0.65rem;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-card__badge--project::before {
  background: var(--project-accent, var(--accent));
  box-shadow: 0 0 0 4px var(--project-accent-soft, rgba(178, 79, 47, 0.12));
}

.secrets-view {
  flex: 1;
  min-height: 0;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: calc(var(--radius) + 8px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.secrets-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 20px;
  gap: 16px;
}

.secrets-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.secrets-panel__header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.secrets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.secrets-feedback {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(34, 119, 85, 0.08);
  color: #21573f;
  font-size: 0.9rem;
}

.secrets-feedback--error {
  background: rgba(178, 79, 47, 0.12);
  color: var(--accent);
}

.secrets-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.secret-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.skill-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.skill-row:hover {
  background: rgba(255, 255, 255, 0.88);
}

.skill-row__copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-row__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.skill-row__title strong {
  font-size: 1rem;
}

.skill-row__meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.skill-row__description {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.skill-row__content {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(38, 24, 11, 0.04);
  border: 1px solid rgba(59, 39, 18, 0.08);
  color: var(--text);
  font: 0.85rem/1.5 "JetBrains Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.skill-row__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.secret-key {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
  color: var(--accent-deep);
  flex-shrink: 0;
}

.secret-value {
  flex: 1;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secret-toggle,
.secret-edit {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  flex-shrink: 0;
}

.secret-toggle:hover,
.secret-edit:hover {
  background: rgba(255, 255, 255, 0.95);
}

.secret-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 3px 6px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 140ms ease, color 140ms ease;
}

.secret-delete:hover {
  background: rgba(178, 79, 47, 0.12);
  color: var(--accent);
}

.claude-plan-setting {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--bg-2, #1a1a1a);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.claude-plan-setting__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.claude-plan-setting__hint {
  font-weight: 400;
  color: var(--text-muted, #888);
  font-size: 12px;
}

.claude-plan-setting__controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.claude-plan-setting__select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg, #111);
  color: var(--text);
  font-size: 14px;
}

.button--small {
  padding: 6px 14px;
  font-size: 13px;
}

.claude-plan-setting__feedback {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted, #888);
}

.secrets-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.skills-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.secret-value-field {
  flex: 1.4;
  min-width: 220px;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.secrets-form-actions {
  display: flex;
  gap: 8px;
}

.secrets-form input {
  flex: 1;
  min-width: 100px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  font: inherit;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88rem;
}

.skills-form input,
.skills-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  font: inherit;
}

.skills-form textarea {
  min-height: 240px;
  resize: vertical;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.5;
}

.secrets-form input:focus {
  outline: 2px solid rgba(178, 79, 47, 0.26);
  border-color: rgba(178, 79, 47, 0.22);
}

.skills-form input:focus,
.skills-form textarea:focus {
  outline: 2px solid rgba(178, 79, 47, 0.26);
  border-color: rgba(178, 79, 47, 0.22);
}

.secret-value-field .secret-toggle {
  align-self: stretch;
}

.automation-interval,
.automation-enabled {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.automation-interval input {
  width: 100px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  font: inherit;
}

.automation-form__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.automation-enabled-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 4px;
}

.automation-toggle-btn {
  border: 1.5px solid rgba(178, 79, 47, 0.3);
  background: rgba(255, 245, 235, 0.95);
  color: var(--accent-deep);
  border-radius: 999px;
  padding: 8px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
}

.automation-toggle-btn--active {
  background: rgba(255, 240, 220, 0.9);
  border-color: rgba(178, 79, 47, 0.5);
}

.automation-toggle-btn--paused {
  background: rgba(240, 240, 240, 0.9);
  border-color: rgba(120, 120, 120, 0.3);
  color: var(--muted);
}

.automation-toggle-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.automation-weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.automation-weekday-btn {
  border: 1.5px solid rgba(178, 79, 47, 0.2);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 38px;
  text-align: center;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.automation-weekday-btn--all {
  border-style: dashed;
  color: var(--accent-deep);
  background: rgba(255, 246, 235, 0.82);
}

.automation-weekday-btn:hover {
  border-color: rgba(178, 79, 47, 0.4);
  background: rgba(255, 240, 225, 0.9);
}

.automation-weekday-btn.is-selected {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  border-color: var(--accent-deep);
  color: #fff;
}

.automation-timemode-tabs {
  display: flex;
  gap: 2px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 3px;
  width: fit-content;
}

.automation-timemode-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 8px 16px;
  font: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease, box-shadow 130ms ease;
}

.automation-timemode-tab.is-selected {
  background: #fff;
  color: var(--accent-deep);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.automation-time-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.automation-form__label--compact {
  width: auto;
}

.automation-allday-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 8px;
  cursor: pointer;
}

.automation-schedule {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.96) 0%, rgba(255, 246, 235, 0.86) 100%);
}

.automation-schedule__intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.automation-schedule__intro strong {
  font-size: 0.96rem;
}

.automation-schedule__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.automation-schedule__section-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.automation-schedule__intro span {
  color: var(--muted);
  font-size: 0.88rem;
}

.automation-schedule__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.automation-schedule-option {
  border: 1px solid rgba(178, 79, 47, 0.18);
  background: rgba(255, 255, 255, 0.78);
  color: inherit;
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: inherit;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.automation-schedule-option strong {
  font-size: 0.92rem;
}

.automation-schedule-option span {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.automation-schedule-option:hover {
  transform: translateY(-1px);
  border-color: rgba(178, 79, 47, 0.3);
}

.automation-schedule-option.is-selected {
  border-color: rgba(178, 79, 47, 0.46);
  background: rgba(255, 240, 225, 0.96);
  box-shadow: 0 10px 24px rgba(178, 79, 47, 0.08);
}

.automation-schedule__panels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.automation-schedule-panel {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(178, 79, 47, 0.14);
  background: rgba(255, 255, 255, 0.76);
}

.automation-interval-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.automation-interval-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.automation-form__label--inline {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.automation-form__label--inline > span {
  color: var(--text);
}

.automation-form__label--inline input,
.automation-form__label--inline select {
  width: auto;
}

.automation-interval-every-label {
  min-height: 42px;
}

.automation-interval-every {
  width: 4.6rem !important;
  min-width: 4.6rem;
  text-align: center;
}

.automation-week-interval__input,
.automation-form__label--compact input[type="number"] {
  width: auto;
}

.automation-interval-window .automation-form__label--inline {
  min-height: 42px;
}

.automation-interval input {
  min-width: 88px;
}

.automation-schedule-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(38, 24, 11, 0.04);
  border: 1px solid rgba(38, 24, 11, 0.08);
}

.automation-schedule-preview__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.automation-schedule-preview strong {
  font-size: 0.95rem;
}

.automation-schedule-preview span:last-child {
  color: var(--muted);
  font-size: 0.88rem;
}

html[data-theme="dark"] .session-card,
html[data-theme="dark"] .sidebar-group__toggle,
html[data-theme="dark"] .sidebar-group__open,
html[data-theme="dark"] .sidebar-group__open--plain,
html[data-theme="dark"] .automation-sidebar-header,
html[data-theme="dark"] .management-card,
html[data-theme="dark"] .automation-run-item,
html[data-theme="dark"] .secret-row,
html[data-theme="dark"] .skill-row,
html[data-theme="dark"] .automation-project-group,
html[data-theme="dark"] .automation-detail__meta,
html[data-theme="dark"] .automation-schedule-option,
html[data-theme="dark"] .automation-schedule-panel,
html[data-theme="dark"] .chat-version-menu__item,
html[data-theme="dark"] .chat-move-project-menu__item,
html[data-theme="dark"] .storage-preview-msg__text {
  background: var(--surface-soft);
}

html[data-theme="dark"] .session-card:hover,
html[data-theme="dark"] .session-card.is-active,
html[data-theme="dark"] .sidebar-group__open:hover,
html[data-theme="dark"] .automation-sidebar-header:hover,
html[data-theme="dark"] .management-card:hover,
html[data-theme="dark"] .management-card.is-selected,
html[data-theme="dark"] .skill-row:hover,
html[data-theme="dark"] .search-result:hover,
html[data-theme="dark"] .search-result:focus {
  background: var(--surface-hover);
}

html[data-theme="dark"] .session-card--running,
html[data-theme="dark"] .session-card--automation,
html[data-theme="dark"] .session-card--automation.session-card--running,
html[data-theme="dark"] .sidebar-group--automation .sidebar-group__toggle,
html[data-theme="dark"] .sidebar-group--automation .sidebar-group__open,
html[data-theme="dark"] .automation-toggle-btn,
html[data-theme="dark"] .automation-weekday-btn--all {
  background: var(--surface-accent);
}

html[data-theme="dark"] .session-card__unread-dot {
  background: #4ade80;
}

html[data-theme="dark"] .session-card--projected,
html[data-theme="dark"] .session-card--projected:hover,
html[data-theme="dark"] .session-card--projected.is-active,
html[data-theme="dark"] .sidebar-group--project .sidebar-group__toggle,
html[data-theme="dark"] .sidebar-group--project .sidebar-group__open,
html[data-theme="dark"] .automation-project-group--project {
  background:
    linear-gradient(180deg, var(--project-accent-soft, rgba(223, 122, 77, 0.18)) 0%, rgba(35, 43, 39, 0.76) 100%);
}

html[data-theme="dark"] .sidebar-group--project .sidebar-group__content strong,
html[data-theme="dark"] .automation-project-group__header strong,
html[data-theme="dark"] .session-card__badge--project {
  color: color-mix(in srgb, var(--project-accent, var(--accent)) 55%, white);
}

html[data-theme="dark"] .view-tabs,
html[data-theme="dark"] .chat-header__controls,
html[data-theme="dark"] .app-project-switch,
html[data-theme="dark"] .button--ghost,
html[data-theme="dark"] .message__icon-button,
html[data-theme="dark"] .chat-version-menu,
html[data-theme="dark"] .chat-move-project-menu,
html[data-theme="dark"] .share-popup,
html[data-theme="dark"] .share-tab--active,
html[data-theme="dark"] .search-popup,
html[data-theme="dark"] .mobile-back-btn {
  background: var(--surface-strong);
  border-color: var(--control-border);
}

html[data-theme="dark"] .message {
  background: var(--surface);
}

html[data-theme="dark"] .message--user {
  background: var(--message-user-bg);
}

html[data-theme="dark"] .message--notice {
  background: transparent;
}

html[data-theme="dark"] .message__body code,
html[data-theme="dark"] .message__body pre,
html[data-theme="dark"] .skill-row__content,
html[data-theme="dark"] .automation-detail__prompt-text,
html[data-theme="dark"] .automation-schedule-preview,
html[data-theme="dark"] .initial-prompt-content,
html[data-theme="dark"] .share-popup__tabs,
html[data-theme="dark"] .automation-timemode-tabs {
  background: var(--surface2);
  border-color: var(--line);
}

html[data-theme="dark"] #message-input,
html[data-theme="dark"] .message__edit-input,
html[data-theme="dark"] .share-popup__select,
html[data-theme="dark"] .share-popup__link-input,
html[data-theme="dark"] .project-detail__chat-select,
html[data-theme="dark"] .project-inline-form--skill textarea,
html[data-theme="dark"] .project-form textarea,
html[data-theme="dark"] .perm-table select,
html[data-theme="dark"] .secrets-form input,
html[data-theme="dark"] .skills-form input,
html[data-theme="dark"] .skills-form textarea,
html[data-theme="dark"] .automation-interval input,
html[data-theme="dark"] .automation-form__label input,
html[data-theme="dark"] .automation-form__label textarea,
html[data-theme="dark"] .automation-form__label select,
html[data-theme="dark"] .claude-plan-setting__select {
  background: var(--surface-input);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] #message-input:focus,
html[data-theme="dark"] .message__edit-input:focus,
html[data-theme="dark"] .secrets-form input:focus,
html[data-theme="dark"] .skills-form input:focus,
html[data-theme="dark"] .skills-form textarea:focus,
html[data-theme="dark"] .automation-form__label input:focus,
html[data-theme="dark"] .automation-form__label textarea:focus,
html[data-theme="dark"] .automation-form__label select:focus,
html[data-theme="dark"] .perm-table select:focus {
  outline-color: var(--focus-ring);
  border-color: var(--control-border);
}

html[data-theme="dark"] .automation-schedule {
  background: linear-gradient(180deg, rgba(38, 46, 42, 0.88) 0%, rgba(27, 33, 30, 0.92) 100%);
}

html[data-theme="dark"] .automation-weekday-btn,
html[data-theme="dark"] .secret-toggle,
html[data-theme="dark"] .secret-edit {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .automation-weekday-btn:hover,
html[data-theme="dark"] .secret-toggle:hover,
html[data-theme="dark"] .secret-edit:hover,
html[data-theme="dark"] .view-tab:hover,
html[data-theme="dark"] .search-tab:hover,
html[data-theme="dark"] .mobile-back-btn:hover {
  background: var(--surface-hover);
}

html[data-theme="dark"] .automation-timemode-tab.is-selected {
  background: var(--surface-strong);
  color: var(--accent-deep);
}

html[data-theme="dark"] .sidebar-switch {
  border-color: rgba(240, 226, 207, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .sidebar-switch::after {
  background: #f4efe7;
}

html[data-theme="dark"] .sidebar-switch--on {
  background: var(--accent);
  border-color: var(--accent);
}

html[data-theme="dark"] .sidebar-backdrop,
html[data-theme="dark"] .modal__backdrop,
html[data-theme="dark"] .share-overlay,
html[data-theme="dark"] .search-overlay {
  background: rgba(0, 0, 0, 0.58);
}

html[data-theme="dark"] .voice-pill__dot {
  box-shadow: 0 0 0 2px var(--surface-strong);
}

@media (max-width: 920px) {
  body {
    padding: 0;
  }

  .app-splash__badge {
    width: 92px;
    height: 92px;
    border-radius: 28px;
  }

  .app-splash__badge-mark {
    font-size: 1.9rem;
  }

  .app-splash__word {
    width: min(84vw, 3.86em);
    height: 1.12em;
    font-size: clamp(2.1rem, 13vw, 3.9rem);
  }

  .app-splash__tag {
    letter-spacing: 0.22em;
    font-size: 0.76rem;
  }

  .shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    gap: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: min(300px, 85vw);
    z-index: 200;
    border-radius: 0 calc(var(--radius) + 8px) calc(var(--radius) + 8px) 0;
    transform: translateX(-105%);
    transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar--open {
    transform: translateX(0);
  }

  .app-header {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: space-between;
  }

  .main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .app-header__left {
    display: flex;
  }

  .app-header__right {
    flex: 1 1 auto;
    max-width: none;
  }

  .app-project-switch {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  .app-project-switch span {
    display: none;
  }

  .mobile-install-button {
    display: none !important;
  }

  .sidebar-toggle {
    display: flex;
  }

  .view-tabs {
    width: 100%;
    overflow-x: auto;
    padding: 6px;
    gap: 6px;
  }

  .view-tab {
    flex: 1;
    min-width: max-content;
    text-align: center;
  }

  .chat-view {
    gap: 12px;
  }

  .chat-header {
    border-radius: var(--radius);
    padding: 8px 12px 7px;
  }

  .chat-header .eyebrow {
    font-size: 0.68rem;
    letter-spacing: 0.18em;
  }

  .chat-header__title-row {
    align-items: center;
    gap: 4px;
  }

  .chat-header__title {
    font-size: 1.1rem;
  }

  .chat-header__project {
    font-size: 0.76rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-header__controls {
    gap: 4px;
    padding: 3px;
  }

  .chat-header__icon-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }

  .chat-header__icon-button svg {
    width: 18px;
    height: 18px;
  }

  .chat-header__icon-button[data-count]::after {
    top: -1px;
    right: -1px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    font-size: 0.6rem;
    line-height: 14px;
  }

  .chat-version-menu {
    position: absolute;
    left: auto;
    right: -4px;
    top: calc(100% + 10px);
    bottom: auto;
    width: min(300px, calc(100vw - 28px));
    min-width: 0;
    max-width: calc(100vw - 28px);
    max-height: min(52vh, 420px);
    overflow-y: auto;
    border-radius: 22px;
    padding: 12px;
    box-shadow: 0 28px 56px rgba(36, 20, 12, 0.24);
  }

  .chat-version-menu__item {
    padding: 12px 14px;
  }

  .message {
    max-width: calc(100% - 32px);
  }

  .message--user {
    padding-right: 18px;
  }

  .message--has-one-action {
    padding-right: 64px;
  }

  .message--has-two-actions {
    padding-right: 112px;
  }

  .message__actions {
    top: 10px;
    right: 10px;
  }

  .message__icon-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  .message__icon-button svg {
    width: 20px;
    height: 20px;
  }

  .chat-log {
    flex: 1;
    min-height: 0;
    border-radius: var(--radius);
    margin-bottom: 0;
  }

  .composer {
    border-radius: var(--radius);
    flex-shrink: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    padding: 6px 10px;
  }

  #pending-files:not(:empty) {
    flex: 0 0 100%;
    order: -1;
  }

  #message-input {
    max-height: 80px;
  }

  .composer__side {
    flex-shrink: 0;
    align-self: stretch;
    gap: 0;
  }

  .composer__actions {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 2px;
    justify-content: flex-end;
    align-items: stretch;
  }

  .composer__icon-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }

  .composer__icon {
    width: 18px;
    height: 18px;
  }

  .composer__send-cluster {
    align-self: stretch;
  }

  .composer__send-button {
    width: 48px;
    min-width: 48px;
    height: 100%;
  }

  .composer__send-button .composer__icon {
    width: 20px;
    height: 20px;
  }

  .composer__send-menu {
    right: -2px;
    width: 142px;
  }

  .status-line {
    min-width: 0;
    width: 100%;
  }

  .brand--compact {
    gap: 8px;
  }

  .brand--compact .brand__badge {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 0.9rem;
  }

  .brand--compact .brand__wordmark {
    font-size: 1rem;
  }

  .automations-panel {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .automations-panel__list {
    border-right: none;
    border-bottom: none;
    max-height: none;
    min-height: 0;
  }

  .automations-panel__detail {
    display: none;
  }

  .automations-panel--detail-open .automations-panel__list {
    display: none;
  }

  .automations-panel--detail-open .automations-panel__detail {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .projects-panel {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .projects-panel__list {
    border-right: none;
    border-bottom: none;
    min-height: 0;
  }

  .projects-panel__detail {
    display: none;
  }

  .projects-panel--detail-open .projects-panel__list {
    display: none;
  }

  .projects-panel--detail-open .projects-panel__detail {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .mobile-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(255, 250, 245, 0.96);
    border: none;
    border-bottom: 1px solid var(--line);
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    width: 100%;
    text-align: left;
  }

  .mobile-back-btn:hover {
    background: rgba(252, 241, 234, 0.98);
  }

  /* Project detail overrides: title full width, buttons compact below */
  .projects-panel__detail .automation-detail__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .projects-panel__detail .automation-detail__actions {
    width: auto;
    justify-content: flex-start;
    flex-shrink: 0;
  }

  .projects-panel__detail .automation-detail__actions .button,
  .projects-panel__detail .automation-detail__actions .secret-delete {
    width: auto;
  }

  .automation-detail {
    padding: 16px;
  }

  .automation-detail__header {
    flex-direction: column;
    align-items: stretch;
  }

  .automation-detail__actions {
    width: 100%;
    justify-content: stretch;
  }

  .automation-detail__actions .button,
  .automation-detail__actions .secret-delete {
    width: 100%;
    text-align: center;
  }

  .automation-run-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .automation-run-item__time,
  .automation-run-item__title,
  .automation-run-item__status,
  .automation-run-item__open {
    width: 100%;
    min-width: 0;
  }

  .automation-run-item__title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: anywhere;
  }

  .automation-run-item__open {
    margin-left: 0;
  }

  .automation-schedule__options {
    grid-template-columns: 1fr;
  }

  .automation-form--detail {
    gap: 18px;
  }

  .automation-schedule {
    gap: 16px;
  }

  .automation-schedule-panel {
    padding: 12px;
  }

  .automation-time-inputs {
    gap: 10px;
  }

  .automation-form__label--compact.automation-form__label--inline {
    flex-wrap: wrap;
    width: auto;
  }

  .automation-form__label--compact input[type="time"],
  .automation-form__label--compact input[type="number"] {
    width: auto;
    min-width: 90px;
  }

  .automation-timemode-tabs {
    width: 100%;
  }

  .automation-timemode-tab {
    flex: 1;
    text-align: center;
  }

  .automation-weekday-btn {
    min-width: 36px;
    padding: 8px 6px;
  }

  .automation-weekday-btn--all {
    padding-inline: 12px;
  }

  .automation-enabled-toggle-row {
    gap: 10px;
  }

  .automation-interval-row {
    gap: 10px;
    align-items: flex-start;
  }

  .automation-interval-window .automation-form__label--inline {
    align-items: center;
  }

  .automation-allday-label {
    margin-top: 0;
    min-height: 42px;
  }

  .message {
    max-width: calc(100% - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-splash,
  .app-splash * {
    animation: none !important;
    transition-duration: 180ms !important;
  }

  .app-splash__badge-letter,
  .app-splash__glyph,
  .app-splash__badge-dot,
  .app-splash__dot {
    opacity: 1;
    filter: none;
  }

  .app-splash__badge-letter--k,
  .app-splash__badge-letter--stem,
  .app-splash__glyph {
    transform: translate3d(0, -50%, 0) scale(1);
  }

  .app-splash__badge-dot--lead {
    transform: translate3d(0, -0.22em, 0) scale(1);
  }

  .app-splash__badge-dot--trail {
    transform: translate3d(0, -0.22em, 0) scale(1);
  }

  .app-splash__dot--lead {
    transform: translate3d(0, -0.25em, 0) scale(1);
  }

  .app-splash__dot--trail {
    transform: translate3d(0, -0.25em, 0) scale(1);
  }
}

/* Collapsible section toggles */
.section-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 8px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.section-collapse-btn:hover {
  background: rgba(59, 39, 18, 0.06);
  color: var(--text);
}

/* Skill popup overlay */
.skill-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(38, 24, 11, 0.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.skill-popup {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 620px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

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

.skill-popup__header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.skill-popup__desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 12px;
}

.skill-popup__content {
  white-space: pre-wrap;
  font: 0.85rem/1.55 "JetBrains Mono", monospace;
  background: rgba(38, 24, 11, 0.04);
  border: 1px solid rgba(59, 39, 18, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  max-height: 40vh;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.skill-popup__actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.skill-popup__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--muted);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.skill-popup__close:hover {
  color: var(--text);
  background: rgba(59, 39, 18, 0.06);
}

/* Chat swipe hint overlay */
.chat-swipe-hint {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 24px;
  background: var(--bg, #fff);
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  border: 1px solid rgba(59, 39, 18, 0.10);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  user-select: none;
}
.chat-swipe-hint--visible {
  opacity: 1;
}
.chat-swipe-hint--left {
  left: 16px;
}
.chat-swipe-hint--right {
  right: 16px;
}
.chat-swipe-hint__arrow {
  font-size: 1.1rem;
}

/* Initial prompt collapsable */
.initial-prompt-wrapper {
  padding: 6px 12px 0;
}
.initial-prompt-details {
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding-bottom: 8px;
}
.initial-prompt-details summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted, #888);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.initial-prompt-details summary::before {
  content: "▶";
  font-size: 0.65rem;
  transition: transform 0.15s;
}
.initial-prompt-details[open] summary::before {
  transform: rotate(90deg);
}
.initial-prompt-content {
  margin-top: 8px;
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,0.04);
  border-radius: 6px;
  padding: 10px 12px;
  max-height: 400px;
  overflow-y: auto;
  color: var(--text-muted, #666);
}
.initial-prompt-tokens {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--text-muted, #888);
}

/* ─── Message Steps (collapsible intermediate steps) ─────────────────────── */

.message-steps {
  margin-bottom: 0.9em;
  border-left: 2px solid rgba(0,0,0,0.1);
  padding-left: 10px;
}

.message-steps__summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
}

.message-steps__summary::before {
  content: "▶";
  font-size: 0.6rem;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.message-steps[open] .message-steps__summary::before {
  transform: rotate(90deg);
}

.message-steps__body {
  margin-top: 8px;
  font-size: 0.88em;
  color: var(--text-muted, #666);
  line-height: 1.5;
}

.message-steps__body p {
  margin: 0 0 0.35em;
}

.message-steps__body > :last-child {
  margin-bottom: 0;
}

/* ─── Share Popup ─────────────────────────────────────────────────────────── */

.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 16px;
}

.share-overlay[hidden] {
  display: none;
}

.share-popup {
  background: var(--surface, #fff);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  padding: 20px 20px 16px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.share-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.share-popup__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.share-popup__close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #888);
}

.share-popup__close:hover {
  background: rgba(0, 0, 0, 0.07);
}

.share-popup__tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  padding: 3px;
}

.share-tab {
  flex: 1;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted, #666);
  transition: background 0.15s, color 0.15s;
}

.share-tab--active {
  background: var(--surface, #fff);
  color: var(--text, #222);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.share-popup__tab-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-popup__tab-panel[hidden] {
  display: none;
}

.share-popup__hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted, #777);
}

.share-popup__scope {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0 2px;
}

.share-popup__checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  font-size: 0.88rem;
  color: var(--text, #333);
  cursor: pointer;
}

.share-popup__checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #111);
  flex: 0 0 auto;
}

.share-popup__checkbox-label:has(input:disabled) {
  color: var(--muted, #777);
  cursor: default;
}

.share-popup__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-popup__label {
  font-size: 0.85rem;
  color: var(--text, #333);
  white-space: nowrap;
}

.share-popup__select {
  flex: 1;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  background: var(--surface, #fff);
  font-size: 0.875rem;
  cursor: pointer;
}

.share-popup__link-row {
  display: flex;
  gap: 8px;
}

.share-popup__link-row[hidden] {
  display: none;
}

.share-popup__link-input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.04);
  font-size: 0.8rem;
  color: var(--text, #333);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-popup__copy-btn {
  white-space: nowrap;
}

.share-popup__actions {
  display: flex;
  gap: 8px;
}

.share-popup__native-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.share-popup__status {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted, #777);
  text-align: center;
}

.share-popup__status[hidden] {
  display: none;
}

/* Message share button — hidden until hover */
.message__actions .message__share-btn {
  opacity: 0;
  transition: opacity 0.15s;
}

.message:hover .message__actions .message__share-btn,
.message:focus-within .message__actions .message__share-btn {
  opacity: 1;
}

/* ─── Search Overlay ──────────────────────────────────────────────────────── */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}

.search-overlay[hidden] {
  display: none;
}

.search-popup {
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  background: var(--panel, #fff);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-popup__input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.search-popup__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-popup__input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  min-width: 0;
}

.search-popup__input::placeholder {
  color: var(--muted);
}

.search-popup__input::-webkit-search-cancel-button {
  display: none;
}

.search-popup__close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
}

.search-popup__close:hover {
  background: rgba(0, 0, 0, 0.07);
}

.search-popup__close svg {
  width: 16px;
  height: 16px;
}

.search-popup__tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.search-popup__tabs::-webkit-scrollbar {
  display: none;
}

.search-tab {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.search-tab:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.search-tab--active {
  background: var(--accent-deep, #7c2d12);
  color: #fff !important;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  min-height: 60px;
}

.search-results__empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-results__hint {
  padding: 24px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-section {
  padding: 4px 0;
}

.search-section__label {
  padding: 4px 16px 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.1s;
}

.search-result:hover,
.search-result:focus {
  background: rgba(0, 0, 0, 0.05);
  outline: none;
}

.search-result__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(178, 79, 47, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-deep, #7c2d12);
}

.search-result__icon svg {
  width: 15px;
  height: 15px;
}

.search-result__body {
  flex: 1;
  min-width: 0;
}

.search-result__title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.search-result__title {
  display: block;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result__badge {
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  padding: 1px 6px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
}

.search-result__meta {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Interactive map blocks */
.message:has(.md-map-wrapper) {
  width: min(760px, calc(100% - 56px));
}

.message:has(.md-map-wrapper).message--has-one-action,
.message:has(.md-map-wrapper).message--has-two-actions {
  padding-right: 18px;
}

.md-map-wrapper {
  width: min(700px, calc(100vw - 96px));
  max-width: 100%;
  margin: 0.75rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border, rgba(0,0,0,0.15));
}
.md-map-title {
  padding: 6px 10px;
  background: var(--surface2, rgba(0,0,0,0.06));
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.md-map {
  height: 320px;
  width: 100%;
}
.md-map .leaflet-popup-content img {
  display: block;
  max-width: min(240px, 100%);
  max-height: 180px;
  width: auto;
  height: auto;
  margin: 6px 0;
  border-radius: 6px;
  object-fit: contain;
}
.md-map-error {
  padding: 8px 12px;
  color: var(--error, #c0392b);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .message:has(.md-map-wrapper) {
    width: calc(100% - 32px);
  }

  .md-map-wrapper {
    width: 100%;
  }
}

/* Landscape phone: merge app-header + chat-header and compact composer */
@media (orientation: landscape) and (max-width: 920px) {
  .main {
    gap: 0;
    padding: 6px;
    position: relative;
  }

  .app-header {
    min-height: 48px;
    box-shadow: none;
    gap: 8px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .app-header__left {
    flex: 0 0 auto;
    gap: 12px;
  }

  .mobile-header__title {
    flex: 0 0 auto;
  }

  .mobile-header__title .brand__wordmark {
    display: inline-block;
    font-size: 0.98rem;
  }

  .brand--compact .brand__badge {
    min-width: 34px;
    height: 34px;
    padding: 0 7px;
    border-radius: 11px;
  }

  .chat-header {
    position: absolute;
    top: 6px;
    left: 180px;
    right: 80px;
    height: 48px;
    z-index: 5;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: none;
  }

  .chat-header__top,
  .chat-header__title-block,
  .chat-header__title-row {
    height: 100%;
    min-width: 0;
  }

  .chat-header__title-row {
    pointer-events: auto;
  }

  .chat-header__title {
    font-size: 0.98rem;
  }

  .chat-header__meta {
    display: none;
  }

  .chat-header__icon-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  .chat-header__icon-button svg {
    width: 17px;
    height: 17px;
  }

  .chat-view {
    gap: 6px;
  }
}
