/* Lunes Web — shared visual system. Content surfaces and glass controls are distinct. */
:root {
  color-scheme: light dark;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  font-size: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-small: 12px;
  --radius-card: 22px;
  --radius-panel: 28px;
  --outer: 12px;
  --bg: #f2f2f7;
  --surface: #fff;
  --surface-secondary: #e9e9ef;
  --text: #1c1c1e;
  --secondary: #66666f;
  --line: #dcdce3;
  --accent: #007aff;
  --selection: #e4f0ff;
  --success: #247a43;
  --warning: #995600;
  --danger: #bf2e29;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --shadow: 0 8px 30px #14233b0a;
  --motion: 180ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101012;
    --surface: #1c1c1e;
    --surface-secondary: #2c2c2e;
    --text: #f5f5f7;
    --secondary: #aaaab3;
    --line: #3a3a3e;
    --accent: #5ca9ff;
    --selection: #1b3553;
    --success: #79d194;
    --warning: #e6b56a;
    --danger: #ff8984;
    --glass: rgba(36, 36, 40, 0.72);
    --glass-edge: rgba(255, 255, 255, 0.12);
    --shadow: 0 8px 30px #0002;
  }
}
:root[data-theme="dark"] {
  --bg: #101012;
  --surface: #1c1c1e;
  --surface-secondary: #2c2c2e;
  --text: #f5f5f7;
  --secondary: #aaaab3;
  --line: #3a3a3e;
  --accent: #5ca9ff;
  --selection: #1b3553;
  --success: #79d194;
  --warning: #e6b56a;
  --danger: #ff8984;
  --glass: rgba(36, 36, 40, 0.72);
  --glass-edge: rgba(255, 255, 255, 0.12);
  --shadow: 0 8px 30px #0002;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-small);
  padding: 10px 16px;
  background: var(--surface-secondary);
  cursor: pointer;
  transition:
    background var(--motion),
    color var(--motion);
}
button:disabled {
  opacity: 0.38;
  cursor: default;
}
button[hidden],
[hidden] {
  display: none !important;
}
button.primary,
a.primary {
  background: var(--accent);
  color: #fff;
}
button.danger,
.error {
  color: var(--danger);
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.045em;
}
h2 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 1rem;
  font-weight: 600;
}
p {
  line-height: 1.65;
}
small,
.muted {
  color: var(--secondary);
  line-height: 1.5;
}
small {
  font-size: 0.8125rem;
}
input,
textarea,
select {
  background: var(--surface-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  padding: 12px;
  min-height: 44px;
  max-width: 100%;
  min-width: 0;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}
textarea {
  resize: vertical;
  line-height: 1.6;
}
label {
  display: grid;
  gap: 8px;
  font-size: 0.9375rem;
}
.form {
  display: grid;
  gap: 20px;
}
.search {
  width: 100%;
  max-width: 520px;
  border-radius: 14px;
}
.skip {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 100;
}
.skip:focus {
  top: 12px;
  padding: 12px;
  background: var(--surface);
}
/* One shell, adaptive navigation. */
.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--outer);
  padding: var(--outer);
  padding-bottom: max(var(--outer), env(safe-area-inset-bottom));
}
aside {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 8px;
}
.brand {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 32px;
}
.brand .badge {
  font-weight: 400;
}
nav {
  position: relative;
  display: grid;
  gap: 4px;
  isolation: isolate;
}
nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 16px;
  color: var(--secondary);
  text-decoration: none;
  z-index: 1;
  font-size: 0.9375rem;
}
nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}
.nav-selection {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(160%);
}
.sidebar-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  color: var(--secondary);
  font-size: 0.75rem;
}
.sidebar-bottom button {
  width: 44px;
  padding: 0;
  border-radius: 50%;
}
main {
  min-width: 0;
  min-height: 0;
  border-radius: var(--radius-panel);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}
.toolbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 28px;
  flex-shrink: 0;
  z-index: 3;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}
#actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
#content {
  flex: 1;
  min-height: 0;
  padding: 24px 28px;
  overflow: auto;
  scrollbar-gutter: stable;
}
#content[data-page="chat"] {
  overflow: hidden;
  padding: 0 20px 16px;
}
.stack {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  align-content: start;
}
.stack > * {
  min-width: 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 12px;
  min-width: 0;
}
.card {
  min-width: 0;
  max-width: 100%;
  padding: 20px;
  border-radius: var(--radius-card);
  background: var(--bg);
  border: 1px solid transparent;
  display: grid;
  gap: 12px;
  overflow-wrap: anywhere;
}
button.card {
  text-align: left;
  width: 100%;
}
button.card:hover {
  border-color: var(--line);
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.row > div {
  min-width: 0;
}
.row strong,
.row small {
  display: block;
}
.row strong {
  font-size: 0.9375rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.row small {
  margin-top: 4px;
}
.row .badge {
  flex-shrink: 0;
}
.list {
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--line) 45%, transparent);
}
.list > button,
.list > .row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  text-align: left;
  border-radius: 0;
}
.list > button:not(:last-child)::after,
.list > .row:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
}
.list > button:hover {
  background: var(--selection);
}
.list > button > .row {
  flex: 1;
}
.card > .row {
  min-height: 44px;
}
.list small {
  display: block;
  margin-top: 4px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--secondary);
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-secondary);
  white-space: nowrap;
}
.badge svg {
  width: 12px;
  height: 12px;
}
.badge.success {
  color: var(--success);
}
.badge.warning {
  color: var(--warning);
}
.badge.danger {
  color: var(--danger);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-secondary);
}
.filters button {
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
}
.filters button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 8px #0000000a;
}
.empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  min-height: 230px;
  padding: 32px;
  text-align: center;
}
.empty p {
  max-width: 360px;
  color: var(--secondary);
  font-size: 0.9375rem;
}
.skeleton {
  height: 112px;
  border-radius: var(--radius-card);
  background: linear-gradient(
    100deg,
    var(--bg) 25%,
    var(--surface-secondary) 50%,
    var(--bg) 75%
  );
  background-size: 220% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}
.auth {
  max-width: 440px;
  margin: 8vh auto;
}
#notice {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(90%, 520px);
  padding: 12px 20px;
  border-radius: 22px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
}
/* Circular controls carry accessible names, without duplicate visible labels. */
button.icon-action,
button.icon,
.close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 50%;
  gap: 0;
}
button.icon-action .button-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.toolbar button,
.composer button:not(.primary),
.close {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    0 3px 12px #00000007;
  backdrop-filter: blur(18px) saturate(160%);
}
/* Modal header stays separate from the scrolling content. */
dialog {
  width: min(620px, calc(100% - 32px));
  max-height: min(85dvh, 900px);
  padding: 0;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-panel);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 32px 100px #0003;
  overflow: hidden;
  --veil: 0.22;
}
dialog::backdrop {
  background: rgba(16, 20, 30, var(--veil));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
dialog > form {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 4;
  margin: 0;
}
.close {
  font-size: 24px;
  color: var(--secondary);
}
#dialog-content {
  display: grid;
  gap: 20px;
  max-height: calc(85dvh - 2px);
  overflow: auto;
  padding: 24px;
  min-width: 0;
}
#dialog-content > * {
  min-width: 0;
  max-width: 100%;
}
#dialog-content > h2:first-child {
  padding-right: 40px;
  min-height: 32px;
  display: flex;
  align-items: center;
}
#dialog-content p,
#dialog-content h2,
#dialog-content h3 {
  overflow-wrap: anywhere;
}
#dialog-content pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
}
#dialog-content img.qr {
  width: min(280px, 100%);
  margin: auto;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
}
/* Chat is a stable workspace; controls float above its content. */
.chat-layout {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px max(8px, calc((100% - 760px) / 2)) 170px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.message {
  margin: 0 0 24px;
  min-width: 0;
}
.message.user {
  margin-left: auto;
  width: fit-content;
  max-width: 85%;
  padding: 12px 18px;
  border-radius: 22px 22px 6px 22px;
  background: #007aff;
  color: #fff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.assistant {
  line-height: 1.75;
  padding: 4px 0;
}
.message details {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 0.875rem;
}
.message summary {
  cursor: pointer;
  min-height: 24px;
  color: var(--secondary);
}
.message details pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}
.message .copy {
  margin-top: 8px;
  color: var(--secondary);
  background: transparent;
}
.composer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  width: min(calc(100% - 16px), 800px);
  margin: auto;
  padding: 12px 16px;
  display: grid;
  gap: 4px;
  border-radius: 30px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    0 12px 36px #17253d12;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}
.composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  resize: none;
  line-height: 24px;
}
.composer textarea:focus-visible {
  outline: 0;
}
.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--glass-edge));
}
.composer footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
}
.composer footer > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.busy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--secondary);
  max-width: 170px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.busy::before {
  content: "";
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: breathe 1.1s ease-in-out infinite alternate;
}
.message-flight {
  overflow: hidden;
}
.file-chip {
  padding: 8px 12px;
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}
.message img,
.message video {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 16px;
  display: block;
  margin-top: 12px;
}
.message audio {
  max-width: 100%;
}
.markdown {
  line-height: 1.75;
  overflow-wrap: anywhere;
  min-width: 0;
}
.markdown > * + * {
  margin-top: 12px;
}
.markdown h1 {
  font-size: 1.5rem;
}
.markdown h2 {
  font-size: 1.25rem;
}
.markdown h3 {
  font-size: 1.0625rem;
}
.markdown ul,
.markdown ol {
  padding-left: 24px;
}
.markdown pre {
  position: relative;
  padding: 16px;
  border-radius: 16px;
  background: var(--bg);
  overflow: auto;
  max-width: 100%;
  font-size: 0.8125rem;
  line-height: 1.6;
}
.markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
}
.markdown pre code {
  white-space: pre;
  font-size: inherit;
}
.markdown :not(pre) > code {
  background: var(--surface-secondary);
  border-radius: 5px;
  padding: 2px 4px;
}
.markdown table {
  display: block;
  overflow: auto;
  border-collapse: collapse;
  max-width: 100%;
  font-size: 0.875rem;
}
.markdown th,
.markdown td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
}
.markdown blockquote {
  margin: 12px 0;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
  color: var(--secondary);
}
.markdown img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
}
.task-categories {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.task-categories button {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 16px;
  border-radius: 22px;
  background: var(--bg);
  border: 1px solid transparent;
}
.task-categories strong {
  grid-column: 2;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}
.task-categories button[aria-pressed="true"] {
  background: var(--selection);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.task-section {
  display: grid;
  gap: 8px;
}
.task-group-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--secondary);
  padding-inline: 16px;
}
.task-list .row {
  flex: 1;
}
.task-list > button > svg {
  width: 14px;
  height: 14px;
  color: var(--secondary);
}
.review-status {
  padding: 12px;
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  color: var(--secondary);
}
[data-review="reviewing"] {
  border-color: var(--accent) !important;
  animation: review-glow 1.8s ease-in-out infinite alternate;
}
@keyframes review-glow {
  to {
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent),
      0 0 18px color-mix(in srgb, var(--accent) 10%, transparent);
  }
}
@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}
@keyframes breathe {
  to {
    opacity: 0.35;
  }
}
.public-page {
  max-width: 1060px;
  margin: auto;
  padding: 24px;
}
.public-page header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.public-page header .brand {
  padding: 0;
}
.public-page main {
  margin-top: 40px;
  padding: clamp(24px, 6vw, 72px);
}
.public-page h1 {
  font-size: clamp(32px, 6vw, 64px);
  margin-bottom: 24px;
}
.public-page p {
  margin: 12px 0;
}
.public-page .hero-actions {
  display: flex;
  gap: 20px;
  align-items: center;
  margin: 24px 0;
}
.public-page a.primary {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  min-height: 44px;
  border-radius: 999px;
  text-decoration: none;
}
.public-page article h2 {
  margin: 24px 0 12px;
}
.public-page article {
  line-height: 1.8;
}
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 176px minmax(0, 1fr);
  }
  aside {
    padding-inline: 0;
  }
  .brand {
    font-size: 1.5rem;
  }
  .brand .badge {
    display: none;
  }
  .toolbar {
    padding: 16px 20px;
  }
  #content {
    padding: 20px;
  }
  .task-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 680px) {
  :root {
    --outer: 8px;
  }
  .shell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-inline: 8px;
  }
  main {
    order: 0;
    flex: 1;
    border-radius: 26px;
  }
  aside {
    order: 1;
    flex: none;
    padding: 3px 5px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--glass-edge);
    backdrop-filter: blur(24px) saturate(160%);
    box-shadow: var(--shadow);
  }
  aside .brand,
  .sidebar-bottom {
    display: none;
  }
  nav {
    display: flex;
    gap: 2px;
    justify-content: space-around;
  }
  nav a {
    flex: 1;
    min-width: 44px;
    max-width: 64px;
    height: 48px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  nav a span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .nav-selection {
    border-radius: 24px;
  }
  nav svg {
    width: 22px;
    height: 22px;
  }
  .toolbar {
    min-height: 72px;
    padding: 12px 16px;
    gap: 8px;
  }
  .toolbar h1 {
    font-size: 1.375rem;
  }
  #actions {
    gap: 4px;
  }
  #content {
    padding: 16px;
  }
  #content[data-page="chat"] {
    padding: 0 4px 8px;
  }
  .messages {
    padding-top: 20px;
    padding-inline: 12px;
  }
  .composer {
    padding: 10px 12px;
  }
  .message.user {
    max-width: 92%;
  }
  .card {
    padding: 16px;
  }
  .stack {
    gap: 20px;
  }
  .task-list > button {
    padding: 16px;
  }
  .list > button > .row {
    flex-wrap: wrap;
    gap: 8px;
  }
  dialog {
    width: calc(100% - 16px);
    max-height: 90dvh;
    border-radius: 28px;
  }
  #dialog-content {
    max-height: calc(90dvh - 2px);
    padding: 24px;
  }
  .public-page {
    padding: 16px;
  }
  .public-page header {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .toolbar,
  .composer,
  aside,
  .nav-selection,
  .toolbar button,
  .composer button:not(.primary),
  .close {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  dialog::backdrop {
    backdrop-filter: none;
    background: #0008;
  }
}
@media (prefers-contrast: more) {
  :root {
    --line: var(--secondary);
  }
  button,
  .composer,
  .card,
  .list {
    border: 1px solid var(--line);
  }
}

/* Shared interactive selection material. Pointer position and spring state are
   driven by LiquidSelection; the text/icon layer never deforms. */
.liquid-control {
  --selection-outset: 2px;
  --selection-shell-inset: 2px;
  position: relative;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}
.liquid-control[data-liquid-axis="x"] {
  touch-action: pan-y;
}
.liquid-control[data-liquid-axis="y"] {
  touch-action: pan-x;
}
.liquid-lens {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: 24px;
  background: rgb(255 255 255 / calc(0.14 - var(--lift, 0) * 0.08));
  border: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  transform-origin: center;
}
[data-liquid-moving] > .liquid-lens,
[data-liquid-dragging] > .liquid-lens {
  will-change: transform;
}
nav.liquid-control[data-liquid-axis="y"] .liquid-lens {
  border-radius: 16px;
}
.liquid-control > button,
.liquid-control > a {
  position: relative;
  z-index: 1;
}
.liquid-control [data-liquid-preview] {
  color: var(--accent);
}
.filters.liquid-control > button {
  background: transparent;
  box-shadow: none;
}
.filters.liquid-control .liquid-lens {
  border-radius: 999px;
}
@media (prefers-reduced-transparency: reduce) {
  .liquid-lens {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }
}
@media (prefers-contrast: more) {
  .liquid-lens {
    border-color: var(--text);
  }
}

/* Glass may cross its control boundary briefly; the viewport never gains an
   accidental horizontal scroll range. Content panes retain their own scrolling. */
body {
  overflow-x: clip;
}
.liquid-control {
  overflow: visible;
}

/* Shared material contract: clear body + convex rim; frosted selected lens.
   The rim is a browser approximation, not native optical refraction. */
:root {
  --liquid-clear: rgb(255 255 255 / 0.07);
  --liquid-frost: color-mix(in srgb, var(--surface) 24%, transparent);
  --liquid-rim: inset 0 1px 0 #ffffff80,
    inset 1px 0 1px #ffffff30, inset -1px -1px 1px #16233a20,
    0 5px 18px #17253d10;
}
.glass-clear, .toolbar, .composer, .filters.liquid-control {
  background: var(--liquid-clear);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--liquid-rim);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  position: relative;
  isolation: isolate;
}
.composer { position: absolute; }
/* Full-surface optical layer: displacement strongest at the rounded edge,
   smoothly decreasing inward. The foreground itself never gets filtered. */
.glass-clear::before, .toolbar::before, .composer::before, .filters.liquid-control::before, aside::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  backdrop-filter: var(--water-filter, none) saturate(115%);
  -webkit-backdrop-filter: saturate(115%);
}
@supports (backdrop-filter: url("#water-glass")) {
  .glass-clear::before, .toolbar::before, .composer::before, .filters.liquid-control::before, aside::before {
    backdrop-filter: var(--water-filter, none) saturate(115%);
  }
}

.liquid-lens {
  /* A locally frosted patch in the same pane: no raised rim or halo. */
  border: 0;
  box-shadow: none;
  background: var(--liquid-frost);
  backdrop-filter: blur(5px) saturate(125%);
  -webkit-backdrop-filter: blur(5px) saturate(125%);
}
@media (max-width: 680px) {
  aside {
    background: var(--liquid-clear);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: var(--liquid-rim);
  }
}
.glass-demo { display: grid; gap: 24px; }
.glass-demo-stage {
  position: relative; min-height: 380px; padding: 32px 20px;
  border-radius: 28px; overflow: hidden;
  background: linear-gradient(135deg,#246b9277,transparent 60%),
    radial-gradient(ellipse at 85% 65%,#dc915c99,transparent 60%), var(--surface-secondary);
}
.glass-demo-stage .filters { margin: 24px auto; }
.glass-demo-stage .composer { bottom: 20px; }
.glass-demo-backdrop { font-size: clamp(32px,8vw,68px); font-weight: 600; opacity: .45; }
.glass-demo-stage .composer textarea { min-height: 66px; }
@media (prefers-reduced-transparency: reduce) {
  .glass-clear, .toolbar, .composer, .filters.liquid-control, .liquid-lens, aside {
    background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .glass-clear::before, .toolbar::before, .composer::before, .filters.liquid-control::before { display:none; }
}

/* The desktop sidebar is navigation layout, not a floating glass capsule. */
aside { position: relative; }
@media (min-width: 681px) { aside::before { display: none; } }
@media (prefers-reduced-transparency: reduce) { aside::before { display: none; } }

.glass-demo-backdrop {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  font: 500 18px/32px ui-monospace, monospace; opacity: .65;
  background-image: linear-gradient(#ffffff50 1px, transparent 1px), linear-gradient(90deg,#ffffff50 1px, transparent 1px);
  background-size: 24px 24px;
}
.glass-demo-backdrop > div { white-space: nowrap; }
.glass-demo-stage .filters { margin-top: 64px; }

/* The dense pattern is an opt-in optical test, not the demo's default content. */
.glass-demo-stage:not(.inspect-refraction) .glass-demo-backdrop {
  font-size: 42px; line-height: 100px; opacity: .2;
  background-image: none;
}
.glass-demo-stage:not(.inspect-refraction) .glass-demo-backdrop > div:nth-child(even) {
  transform: translateX(-70px);
}

/* Transmission falls toward the center without smearing background detail. */
.glass-clear::before, .toolbar::before, .composer::before, .filters.liquid-control::before, aside::before {
  background: radial-gradient(ellipse at center,
    color-mix(in srgb, var(--surface) var(--glass-center-opacity, 22%), transparent) 0%,
    color-mix(in srgb, var(--surface) var(--glass-mid-opacity, 12%), transparent) 45%, transparent 88%);
}
/* The selected lens retains its frosted overlay above the optical body. */

.demo-sent { position: absolute; right: 16px; top: 164px; max-width: 80%; max-height: 60px; overflow: auto; }

.glass-demo-backdrop { inset: -120px 0; }
.demo-optical-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.demo-optical-controls label { display: grid; gap: 8px; flex: 1 1 180px; }
.demo-optical-controls input { width: 100%; }

/* Native range semantics with a shared iOS-inspired liquid interaction skin. */
.liquid-range { position: relative; display: block; width: 100%; height: 44px; isolation: isolate; }
.liquid-range input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 44px; min-height: 44px;
  margin: 0; padding: 0; border: 0; border-radius: 22px;
  background: transparent; box-shadow: none; cursor: pointer;
  appearance: none; -webkit-appearance: none; z-index: 2;
}
.liquid-range input::-webkit-slider-runnable-track { height: 6px; border: 0; background: transparent; }
.liquid-range input::-moz-range-track { height: 6px; border: 0; background: transparent; }
.liquid-range input::-moz-range-progress { background: transparent; }
.liquid-range input::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 40px; height: 24px; margin-top: -9px;
  background: transparent; border: 0; box-shadow: none;
}
.liquid-range input::-moz-range-thumb { width: 40px; height: 24px; background: transparent; border: 0; box-shadow: none; }
.range-track { position: absolute; left: 20px; right: 20px; top: 19px; height: 6px;
  border-radius: 999px; background: color-mix(in srgb,var(--secondary) 20%, transparent); pointer-events: none; overflow: hidden; }
.range-fill { display: block; width: calc(var(--range-progress,0)*100%); height: 100%; background: var(--accent); border-radius: inherit; }
.range-thumb { position: absolute; z-index: 1; pointer-events: none;
  left: calc((100% - 40px)*var(--range-progress,0)); top: 10px; width: 40px; height: 24px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--glass-edge);
  box-shadow: 0 2px 5px #0002, inset 0 1px 0 #ffffff80;
  transition: background 160ms ease, box-shadow 160ms ease; }
.range-thumb::before { content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  backdrop-filter:var(--water-filter,none); -webkit-backdrop-filter:var(--water-filter,none); }
.liquid-range[data-pressed] .range-thumb { background: color-mix(in srgb,var(--surface) 18%,transparent); box-shadow: 0 4px 12px #0002,inset 0 1px 0 #ffffffa0; }
.liquid-range:focus-within .range-track { outline-offset: 8px; }
.liquid-range input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.liquid-range[data-disabled] { opacity: .45; }
.liquid-range[data-disabled] input { cursor: not-allowed; }
@media (prefers-reduced-transparency: reduce) {
  .liquid-range[data-pressed] .range-thumb { background: var(--surface); }
  .range-thumb::before { backdrop-filter:none; -webkit-backdrop-filter:none; }
}
@media (forced-colors: active) {
  .range-track,.range-thumb { display:none; }
  .liquid-range input[type="range"] { appearance:auto; -webkit-appearance:auto; }
  .liquid-range input::-webkit-slider-thumb { appearance:auto; -webkit-appearance:auto; }
}

/* Continuous controls track directly; discrete values settle onto native steps. */
.liquid-range[data-stepped] .range-thumb { transition: left 120ms cubic-bezier(.16,1,.3,1), background 160ms ease, box-shadow 160ms ease; }
.liquid-range[data-stepped] .range-fill { transition: width 120ms cubic-bezier(.16,1,.3,1); }
.liquid-control { transform-origin: center; }

/* Shared icon-over-label tabs, with a flat selected material. */
:root {
  --tab-label-size: .625rem;
  --tab-label-weight: 500;
  --tab-icon-size: 22px;
  --tab-icon-stroke: 1.7;
  --tab-item-height: 52px;
  --tab-content-gap: 8px;
  --tab-item-gap: 6px;
}
.filters:has(.glass-tab) {
  gap: var(--tab-item-gap);
  width: min(100%, 288px);
  flex-wrap: nowrap;
  padding: 3px;
  border-radius: 999px;
}
.filters .glass-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--tab-content-gap);
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--tab-item-height);
  padding: 4px 12px;
  font-weight: var(--tab-label-weight);
}
.glass-tab > svg {
  width: var(--tab-icon-size); height: var(--tab-icon-size);
  stroke-width: var(--tab-icon-stroke); flex: none;
}
.glass-tab-label { font-size: var(--tab-label-size); line-height: 1.3; }

@media (max-width: 680px) {
  nav { gap: var(--tab-item-gap); }
  nav svg {
    width: var(--tab-icon-size); height: var(--tab-icon-size);
    stroke-width: var(--tab-icon-stroke);
  }
  nav a {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    min-height: var(--tab-item-height);
    height: auto;
    flex-direction: column;
    gap: var(--tab-content-gap);
    padding: 4px 0;
    border-radius: 999px;
  }
  nav a span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    font-size: var(--tab-label-size);
    font-weight: var(--tab-label-weight);
    line-height: 1.3;
    text-align: center;
  }
}

@media (max-width: 360px) {
  nav { gap: 4px; }
}

/* iOS WebKit accepts SVG backdrop URLs syntactically but does not render their
   displacement. Keep a visible material fallback; do not claim optical parity. */
@supports (-webkit-touch-callout: none) {
  .glass-clear::before, .toolbar::before, .composer::before, .filters.liquid-control::before, .range-thumb::before {
    -webkit-backdrop-filter: blur(2px) saturate(125%);
    backdrop-filter: blur(2px) saturate(125%);
  }
  .liquid-lens {
    background: color-mix(in srgb, var(--surface) 28%, transparent);
    -webkit-backdrop-filter: blur(5px) saturate(125%);
    backdrop-filter: blur(5px) saturate(125%);
    border: 0;
    box-shadow: none;
  }
  .liquid-control, .liquid-control > a, .liquid-control > button {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }
  @media (max-width: 680px) {
    aside::before {
      -webkit-backdrop-filter: blur(2px) saturate(125%);
      backdrop-filter: blur(2px) saturate(125%);
    }
  }
  @media (prefers-reduced-transparency: reduce) {
    .glass-clear::before, .toolbar::before, .composer::before, .filters.liquid-control::before, .range-thumb::before, aside::before {
      display: none;
    }
    .liquid-lens {
      background: var(--surface);
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }
  }
}

/* Debug metering never blocks the composer or consumes a message. */
.usage-live{font-size:11px;max-width:360px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-height:32px;padding:6px 10px;color:var(--secondary);}
#content .usage-row{white-space:pre-line;}
@media(max-width:680px){.usage-live{max-width:170px;font-size:10px;}}

.chat-subagents{flex:0 0 auto;margin:8px 12px;border-radius:18px;background:var(--surface);max-height:30%;overflow:auto;padding:10px 14px}.chat-subagents[hidden]{display:none}.chat-subagents summary{cursor:pointer}.chat-subagents .row{gap:8px}.chat-subagents .row>div{flex:1;min-width:0}.chat-history-placeholder{min-height:240px}.messages{overflow-anchor:none}.messages>button:first-child{display:block;margin:0 auto 20px}.messages>button[hidden]{display:none}

.account-avatar{display:inline-flex;width:44px;height:44px;object-fit:cover;border-radius:50%;vertical-align:middle;margin-inline-end:12px;font-size:32px;}

.lunes-bulletin-dialog {box-sizing:border-box;width:min(540px,calc(100vw - 32px));max-height:85dvh;overflow:auto;border:1px solid #8884;border-radius:28px;padding:24px;color:CanvasText;background:Canvas;overflow-wrap:anywhere;animation:bulletin-appear .28s cubic-bezier(.2,.8,.2,1)}
.lunes-bulletin-dialog::backdrop {background:#0005;backdrop-filter:blur(6px)}
.lunes-bulletin-dialog h2 {font-size:1.35rem;margin-top:0}
.lunes-bulletin-dialog button {min-height:44px;padding:8px 20px;border-radius:24px;margin-top:16px}
.lunes-bulletin-dialog img,.lunes-bulletin-history img {max-width:100%}
.lunes-bulletin-dialog pre,.lunes-bulletin-history pre {overflow:auto}
.lunes-bulletin-history {padding:16px;margin-block:12px;border:1px solid #8884;border-radius:22px;overflow-wrap:anywhere}
@keyframes bulletin-appear {from{opacity:0;transform:translateY(12px) scale(.97)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.lunes-bulletin-dialog{animation:none}}

/* Shared selection material: touch-down lifts clear glass; release restores frost. */
.liquid-control>.liquid-lens {
  transition:background 240ms cubic-bezier(.16,1,.3,1),backdrop-filter 240ms cubic-bezier(.16,1,.3,1),-webkit-backdrop-filter 240ms cubic-bezier(.16,1,.3,1),box-shadow 240ms cubic-bezier(.16,1,.3,1);
}
.liquid-control[data-liquid-pressed]>.liquid-lens {
  background:var(--liquid-clear);
  backdrop-filter:saturate(115%);
  -webkit-backdrop-filter:saturate(115%);
  box-shadow:var(--liquid-rim);
  transition-duration:120ms;
}
@media(prefers-reduced-motion:reduce){.liquid-control>.liquid-lens{transition:none;}}
@media(prefers-reduced-transparency:reduce){
 .liquid-control>.liquid-lens,.liquid-control[data-liquid-pressed]>.liquid-lens{background:var(--surface);backdrop-filter:none;-webkit-backdrop-filter:none;box-shadow:none;}
}
/* Page primitives are structural: callers choose content, not a second visual system. */
.ui-section{min-width:0;display:grid;gap:var(--space-4);}
.ui-field{display:grid;gap:var(--space-2);min-width:0;font-size:13px;}
.ui-field>input,.ui-field>select{width:100%;min-width:0;min-height:44px;}
.ui-table-scroll{min-width:0;overflow-x:auto;}
.ui-empty{padding:var(--space-6) 0;color:var(--secondary);font-size:14px;}

/* Pressed selection uses the same water displacement as the composer. */
.liquid-control[data-liquid-pressed]>.liquid-lens {
  backdrop-filter:var(--water-filter, none) saturate(115%);
  -webkit-backdrop-filter:var(--water-filter, none) saturate(115%);
  background:radial-gradient(ellipse at center,
    color-mix(in srgb,var(--surface) var(--glass-center-opacity,22%),transparent) 0%,
    color-mix(in srgb,var(--surface) var(--glass-mid-opacity,12%),transparent) 45%,transparent 88%);
  border:0;box-shadow:none;
}
.liquid-control[data-liquid-input=pointer]>button:focus-visible,
.liquid-control[data-liquid-input=pointer]>a:focus-visible{outline:none;box-shadow:none;}
@supports(-webkit-touch-callout:none){
 .liquid-control[data-liquid-pressed]>.liquid-lens{backdrop-filter:blur(2px) saturate(125%);-webkit-backdrop-filter:blur(2px) saturate(125%);}
}
@media(prefers-reduced-transparency:reduce){
 .liquid-control[data-liquid-pressed]>.liquid-lens{background:var(--surface);backdrop-filter:none;-webkit-backdrop-filter:none;}
}
/* Route loading is an overlay; unfinished renderer DOM never flashes through. */
.page-preparing{opacity:0!important;pointer-events:none}.page-load-cover{position:absolute;z-index:4;pointer-events:none;overflow:hidden;border-radius:inherit;max-width:100%;background:var(--bg)}
.page-load-snapshot{pointer-events:none!important;animation:none!important;transform:none!important;opacity:1!important;max-height:80dvh;overflow:hidden!important}
.page-load-cover.is-waiting::after{content:'';position:absolute;top:0;left:0;width:32%;height:2px;border-radius:999px;background:var(--accent);animation:page-wait 1.6s cubic-bezier(.45,0,.25,1) infinite;opacity:.55}
.page-placeholder{display:grid;gap:16px;padding:24px;opacity:0;transition:opacity .2s ease}.is-waiting .page-placeholder{opacity:1}.page-placeholder-row{display:grid;grid-template-columns:36px 1fr;gap:10px 14px;padding:16px;border-radius:22px;background:var(--surface)}.page-placeholder-row i{grid-row:span 2;width:36px;height:36px;border-radius:12px;background:var(--surface-secondary)}.page-placeholder-row span,.page-placeholder-row small{display:block;height:12px;border-radius:6px;background:var(--surface-secondary);width:64%}.page-placeholder-row small{height:9px;width:40%}.page-placeholder[data-kind=chat] .page-placeholder-row{display:block;width:76%;height:80px}.page-placeholder[data-kind=chat] .page-placeholder-row:nth-child(odd){margin-left:auto;width:48%;height:48px}.page-placeholder[data-kind=chat] i{display:none}.page-placeholder[data-kind=chat] span{margin-bottom:12px}.page-placeholder[data-kind=overview],.page-placeholder[data-kind=usage],.page-placeholder[data-kind=hosting]{grid-template-columns:repeat(2,minmax(0,1fr))}
@keyframes page-wait{0%{transform:translateX(-110%)}100%{transform:translateX(420%)}}
@media(prefers-reduced-motion:reduce){.page-load-cover.is-waiting::after{animation:none;width:100%;opacity:.2}.page-placeholder{transition:none}}
@media(max-width:600px){.page-placeholder{padding:12px;gap:12px}.page-placeholder-row{padding:12px}}
/* Per-route placeholders mirror the page's content structure, not a generic list. */
.page-placeholder{gap:20px;padding:20px;align-content:start}.page-placeholder .ph-shape{flex-shrink:0;border-radius:6px;background:var(--surface-secondary);max-width:100%}.ph-panel{padding:20px;border-radius:var(--radius-card);background:var(--surface);display:flex;flex-direction:column;gap:16px;min-width:0}.ph-heading,.ph-text,.ph-field{display:flex;flex-direction:column;gap:10px}.ph-heading{padding:4px 0 12px}.ph-text{flex:1;min-width:0}.ph-row{display:flex;align-items:center;gap:14px;padding:16px 0;min-height:64px}.ph-avatar.ph-shape{width:36px;height:36px;border-radius:50%}.ph-list{padding:0 16px;background:var(--surface);border-radius:var(--radius-card)}.ph-list>.ph-row+.ph-row{border-top:1px solid var(--line)}.ph-panel .ph-list{padding:0}.ph-tabs{display:flex;gap:6px;padding:6px;border-radius:999px;background:var(--surface);max-width:420px}.ph-tabs .ph-shape{flex:1;min-width:0;border-radius:999px}.ph-grid,.ph-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.ph-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.ph-filterbar{display:grid;grid-template-columns:2fr 1fr auto;gap:12px;align-items:center}.ph-slider{display:flex;flex-direction:column;gap:18px;padding:8px 0}.ph-table{border-radius:var(--radius-card);background:var(--surface);padding:4px 16px}.ph-table-head,.ph-table-row{display:grid;grid-template-columns:repeat(var(--ph-columns),minmax(0,1fr));gap:16px;align-items:center;min-height:60px}.ph-table-head{min-height:44px}.ph-table-row{border-top:1px solid var(--line)}.ph-connection{min-height:260px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px}.ph-chat{display:flex;flex-direction:column;min-height:clamp(320px,65dvh,720px);gap:28px}.ph-chat-messages{display:flex;flex-direction:column;gap:28px;flex:1}.ph-user,.ph-assistant{display:flex;flex-direction:column;gap:14px;padding:20px;border-radius:22px;max-width:76%;width:480px;background:var(--surface)}.ph-user{margin-left:auto;width:280px}.ph-composer{display:flex;align-items:center;justify-content:space-between;min-height:72px;background:var(--surface);padding:16px 20px;border-radius:28px}.ph-send.ph-shape{width:36px;height:36px;border-radius:50%}
@media(max-width:680px){.page-placeholder{padding:12px;gap:16px}.ph-panel{padding:16px}.ph-grid,.ph-columns{grid-template-columns:minmax(0,1fr)}.ph-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.ph-table-head{display:none}.ph-table-row{grid-template-columns:repeat(2,minmax(0,1fr));padding:16px 0;gap:14px}.ph-filterbar{grid-template-columns:minmax(0,1fr) auto}.ph-filterbar>:nth-child(2){display:none}.ph-tabs{max-width:100%}.ph-user,.ph-assistant{max-width:88%}}
.page-placeholder[data-layout="client/tools"] .ph-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr));gap:12px}
.page-placeholder[data-layout="client/task-detail"],.page-placeholder[data-layout="client/task-runs"]{opacity:1;padding:16px 0;animation:detail-loading 1.8s ease-in-out infinite alternate}
@keyframes detail-loading{from{opacity:.5}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.page-placeholder[data-layout="client/task-detail"],.page-placeholder[data-layout="client/task-runs"]{animation:none}}
.task-list>button{padding-block:20px}
.workspace-search{max-width:760px;margin:0 auto;width:100%;gap:20px}
.workspace-search>.search{width:100%;font-size:16px}
.search-scopes{display:flex;gap:8px;overflow-x:auto;padding-bottom:4px}
.search-scopes button{flex:none;border-radius:999px;min-height:40px;padding:8px 16px;font-size:14px}
.search-scopes button[aria-pressed=true]{color:var(--accent);background:var(--surface-secondary)}
.search-intro{padding:24px 4px 16px}.search-intro>svg{width:32px;height:32px;color:var(--accent);margin-bottom:16px}
.search-intro h2{font-size:22px;margin-bottom:12px}.search-intro p{font-size:15px}
.search-categories{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.search-categories button{display:flex;align-items:center;gap:12px;text-align:left;padding:20px 16px;min-height:64px;border-radius:22px;background:var(--surface)}
.search-categories svg{width:22px;height:22px;color:var(--accent)}
.search-result{display:flex;align-items:flex-start;gap:16px;min-width:0;width:100%;padding:20px 16px;background:var(--surface);border-radius:22px;text-align:left}
.search-result>.row{flex:1;min-width:0;padding:0;border:0}.search-result strong{font-size:15px;line-height:1.4}.search-result small{font-size:13px;line-height:1.6;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.search-result>svg{width:22px;height:22px;flex:none;color:var(--secondary)}.search-result>svg:last-child{width:14px;height:14px;margin-top:4px}
.search-placeholder{opacity:1;padding:0}
.shell{width:100%;max-width:none;overflow:hidden}.shell>aside{overflow:hidden}.shell>aside>nav{min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}.shell>main>#content{overscroll-behavior:contain}.shell>main>.toolbar{flex-shrink:0}.shell .messages{overscroll-behavior:contain}
@media(max-width:680px){.shell>aside>nav{overflow-x:auto;overflow-y:hidden}}

/* User workspaces retain the same left/right structure at every width.
   A compact icon rail replaces the bottom navigation; each pane owns scrolling. */
.shell{display:grid;grid-template-columns:220px minmax(0,1fr);grid-template-rows:minmax(0,1fr);height:100dvh;overflow:hidden}
.shell>aside{order:0;min-height:0;overflow:hidden;border-radius:var(--radius-panel);display:flex;flex-direction:column;box-shadow:none}
.shell>aside>nav{display:flex;flex-direction:column;justify-content:flex-start;flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;gap:4px;}
.shell>aside>nav>a{display:flex;flex:none;width:100%;max-width:none;min-height:48px;height:auto;justify-content:flex-start;flex-direction:row;padding:12px 16px;gap:12px;border-radius:16px}
.shell>aside>nav>a>span{position:static;width:auto;height:auto;clip-path:none;overflow:visible;font-size:14px;line-height:1.4}
.shell>aside>.sidebar-bottom{display:flex;flex:none;padding:12px 4px;flex-wrap:wrap}
.shell>aside>.brand{display:flex;flex:none;padding-bottom:20px}
.shell>main{order:1;min-height:0;height:100%}
@media(max-width:1000px){
 .shell{grid-template-columns:72px minmax(0,1fr);gap:8px}
 .shell>aside{padding:12px 4px;background:var(--glass);border:1px solid var(--glass-edge)}
 .shell>aside>.brand{font-size:15px;justify-content:center;padding:8px 0 16px;letter-spacing:-.06em}
 .shell>aside>nav>a{justify-content:center;padding:10px 0;min-height:48px;border-radius:16px}
 .shell>aside>nav>a>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .shell>aside>nav svg{width:21px;height:21px;flex:none}
 .shell>aside>.sidebar-bottom{justify-content:center;gap:4px}
 .shell>aside #connection{display:none}
}
@media(max-width:540px){
 .shell{grid-template-columns:56px minmax(0,1fr);padding:8px;padding-top:max(8px,env(safe-area-inset-top));padding-bottom:max(8px,env(safe-area-inset-bottom));gap:8px}
 .shell>aside{padding:8px 3px;border-radius:24px}
 .shell>aside>.brand{font-size:12px}
 .shell .toolbar{padding:12px;min-height:64px;flex-wrap:wrap}
 .shell .toolbar h1{font-size:20px}
 .shell #content{padding:16px 12px}
 .shell #content[data-page=chat]{padding:0 4px 8px}
 .shell .toolbar #actions{flex-wrap:wrap;gap:4px}
 .shell .toolbar #actions button{min-width:36px;width:36px;height:44px;padding:0}
}
/* Settings are a directory of scoped detail pages, not a stack of editors. */
.settings-directory{width:100%;max-width:760px;margin:0 auto;display:grid;gap:24px}
.ph-settings-group{display:grid;gap:10px;max-width:760px;width:100%;margin:0 auto}
.settings-group-title{font-size:13px;font-weight:500;color:var(--secondary);margin:0 16px 8px}
.settings-list{border-radius:22px;background:var(--surface-secondary,var(--bg));overflow:hidden}
.settings-link{display:flex;align-items:center;gap:16px;min-height:64px;padding:12px 16px;color:var(--text);text-decoration:none;transition:background .18s ease}
.settings-link+.settings-link{border-top:1px solid var(--line)}
.settings-link>svg{width:20px;height:20px;flex:0 0 20px;color:var(--secondary)}
.settings-link-text{display:grid;gap:4px;min-width:0;flex:1}
.settings-link-title{font-size:15px;font-weight:500}.settings-link-detail{font-size:12px;color:var(--secondary);line-height:1.5}
.settings-chevron{font-size:22px;color:var(--secondary)}
.settings-link:hover,.settings-link:focus-visible{background:var(--line)}
#workspace-back{flex:0 0 44px;width:44px;height:44px;padding:0;font-size:28px;border-radius:50%}
#workspace-back svg{width:20px;height:20px}
.policy-content{max-width:760px;margin:0 auto;line-height:1.75}.policy-content h2{font-size:18px;margin:28px 0 12px}

/* Compact, borderless media. Only the incoming image resolves from soft blur. */
.chat-image-preview {
  --image-width: 280px;
  --image-ratio: 1.5;
  position: relative;
  display: block;
  width: var(--image-width);
  max-width: 100%;
  aspect-ratio: var(--image-ratio);
  margin-block: 12px;
  isolation: isolate;
}
.message .chat-image-preview img, .markdown .chat-image-preview img {
  width: 100%; height: 100%; max-height: 220px;
  object-fit: contain; margin: 0; border: 0; border-radius: 0;
  opacity: 0; filter: blur(8px);
  transition: opacity 320ms ease-out, filter 320ms ease-out;
  cursor: zoom-in;
}
.chat-image-placeholder {
  position: absolute; inset: 0; overflow: hidden; border-radius: 12px;
  background: color-mix(in srgb, var(--secondary) 9%, transparent);
  transition: opacity 320ms ease-out; pointer-events: none;
}
.chat-image-placeholder::before {
  content: ''; position: absolute; inset: -20%;
  background: radial-gradient(ellipse at 25% 25%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 65%),
              radial-gradient(ellipse at 80% 75%, color-mix(in srgb, var(--secondary) 12%, transparent), transparent 60%);
  filter: blur(20px); animation: image-soft-load 2.4s ease-in-out infinite alternate;
}
.chat-image-preview[data-state=ready] img { opacity: 1; filter: blur(0); }
.chat-image-preview[data-state=ready] .chat-image-placeholder { opacity: 0; }
.chat-image-preview[data-state=ready] .chat-image-placeholder::before { animation: none; }
.chat-image-retry { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; font-size: 13px; }
.chat-image-preview[data-state=failed] img { pointer-events: none; visibility: hidden; }
.chat-image-preview[data-state=failed] .chat-image-placeholder::before { animation: none; }
.message.user .chat-image-preview { margin-inline-start: auto; }
@keyframes image-soft-load { from { transform: translate(-3%, -2%) scale(.97); opacity: .55; } to { transform: translate(3%, 2%) scale(1.03); opacity: .95; } }
@media (prefers-reduced-motion: reduce) {
  .chat-image-placeholder::before { animation: none; }
  .chat-image-preview img, .chat-image-placeholder { transition: none; filter: none; }
}
