:root {
  color-scheme: light;
  --ink: #eef4f1;
  --panel: rgba(255, 255, 255, 0.58);
  --panel-strong: rgba(255, 255, 255, 0.78);
  --line: rgba(49, 68, 67, 0.11);
  --paper: #182321;
  --muted: #687977;
  --green: #287760;
  --blue: #276b8f;
  --amber: #9b6c17;
  --danger: #a13f3f;
  --shadow: 0 24px 80px rgba(70, 86, 86, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.95), transparent 28%),
    linear-gradient(135deg, #f7faf8 0%, #edf4f3 42%, #f3f1f7 100%);
  color: var(--paper);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-view="casefile"] {
  overflow: hidden;
}

body[data-view="casefile"] .shell {
  height: 100vh;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

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

.shell {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.12)),
    repeating-linear-gradient(90deg, rgba(24, 35, 33, 0.012) 0 1px, transparent 1px 96px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 251, 250, 0.78);
  backdrop-filter: blur(28px) saturate(1.16);
}

.title-wrap {
  min-width: 0;
}

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

.brand {
  margin: 0;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heartbeat-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9aa6a3;
  box-shadow: 0 0 0 3px rgba(154, 166, 163, 0.12);
}

.heartbeat-dot.online {
  background: #1f9d6a;
  box-shadow: 0 0 0 3px rgba(31, 157, 106, 0.14);
}

.heartbeat-dot.offline {
  background: #c94d4d;
  box-shadow: 0 0 0 3px rgba(201, 77, 77, 0.14);
}

.heartbeat-dot.checking {
  background: #c49a3a;
  box-shadow: 0 0 0 3px rgba(196, 154, 58, 0.14);
}

.notify-state {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  color: rgba(104, 121, 119, 0.82);
  font-size: 10px;
  line-height: 1;
  padding: 4px 7px;
}

.notify-state.active {
  border-color: rgba(40, 119, 96, 0.18);
  background: rgba(40, 119, 96, 0.1);
  color: var(--green);
}

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

.subtitle {
  margin: 0;
  font-size: 11px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px;
}

.case-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 400px;
  gap: 18px;
  min-height: calc(100vh - 73px);
  padding: 16px;
}

.sidebar,
.right-pane,
.timeline {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.38)),
    rgba(255, 255, 255, 0.46);
  box-shadow: var(--shadow);
  backdrop-filter: blur(38px) saturate(1.22);
  overflow: hidden;
}

.right-pane {
  border-left: 1px solid var(--line);
}

.section {
  padding: 20px;
}

.section-title {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.panel {
  border: 1px solid rgba(49, 68, 67, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.46);
  padding: 18px;
  box-shadow: 0 14px 42px rgba(46, 66, 65, 0.055);
  backdrop-filter: blur(22px) saturate(1.1);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.settings-menu {
  position: relative;
}

.settings-menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.46));
  color: var(--paper);
  padding: 0 12px;
  cursor: pointer;
}

.settings-menu summary::-webkit-details-marker {
  display: none;
}

.settings-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.68));
  box-shadow: var(--shadow);
  padding: 6px;
  backdrop-filter: blur(24px) saturate(1.15);
}

.menu-item {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--paper);
  text-align: left;
  padding: 0 10px;
}

.menu-item:hover {
  background: rgba(40, 119, 96, 0.08);
}

.btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--paper);
  padding: 0 12px;
  box-shadow: none;
}

.icon-btn {
  display: grid;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.48));
  color: var(--paper);
  font-size: 22px;
  line-height: 1;
  place-items: center;
  padding: 0;
}

.topbar-back {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.48));
  color: var(--paper);
  font-size: 24px;
  line-height: 1;
  padding: 0;
}

.btn.primary {
  border-color: rgba(40, 119, 96, 0.18);
  background: rgba(40, 119, 96, 0.1);
}

.btn.full {
  width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.38);
}

.badge.green {
  border-color: rgba(125, 160, 140, 0.55);
  color: var(--green);
}

.badge.amber {
  border-color: rgba(215, 181, 109, 0.55);
  color: var(--amber);
}

.badge.blue {
  border-color: rgba(126, 166, 191, 0.55);
  color: var(--blue);
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.6);
  padding: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.22);
}

.login-card h1 {
  margin: 8px 0 8px;
  font-size: 30px;
}

.field {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--paper);
  padding: 12px 14px;
  outline: none;
}

.field:focus {
  border-color: rgba(125, 160, 140, 0.8);
}

.compact-field {
  min-height: 38px;
  margin: 8px 0 10px;
  border-radius: 999px;
}

.create-form {
  display: grid;
  gap: 6px;
  margin: 8px 0 10px;
}

.create-form .compact-field {
  margin: 0;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.inline-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.error {
  border: 1px solid rgba(161, 63, 63, 0.2);
  border-radius: 16px;
  background: rgba(161, 63, 63, 0.08);
  color: var(--danger);
  padding: 10px;
}

.list {
  display: grid;
  gap: 8px;
}

.list-button {
  width: 100%;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  border-radius: 16px;
  padding: 10px 12px;
}

.list-button:hover,
.list-button.active {
  background: rgba(255, 255, 255, 0.6);
  color: var(--paper);
}

.timeline {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.timeline-scroll,
.pane-body {
  overflow: auto;
}

.timeline-scroll {
  flex: 1;
  padding: 14px;
}

.composer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
  padding: 10px;
}

.composer form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.run-menu {
  position: relative;
}

.run-menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-width: 38px;
  justify-content: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.48));
  color: var(--paper);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 600;
}

.run-menu summary::-webkit-details-marker {
  display: none;
}

.run-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 25;
  display: grid;
  gap: 8px;
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.68));
  box-shadow: var(--shadow);
  padding: 10px;
  backdrop-filter: blur(26px) saturate(1.15);
}

.mini-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  border-top: 1px solid var(--line);
  color: var(--paper);
  font-size: 12px;
  padding-top: 8px;
}

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

.select-inline {
  max-width: 220px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--paper);
  padding: 4px 8px;
}

.select-inline.compact {
  max-width: 110px;
}

.rename-panel {
  padding: 14px;
}

.rename-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.rename-form #workdir-input,
.rename-form .inline-check {
  grid-column: 1 / -1;
}

.shell-panel {
  display: grid;
  gap: 8px;
}

.shell-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.shell-output {
  min-height: 132px;
  margin: 0;
  background: rgba(25, 35, 33, 0.88);
  color: #d9eee8;
  border-color: rgba(25, 35, 33, 0.16);
}

textarea.field {
  min-height: 38px;
  max-height: 160px;
  resize: vertical;
  border-radius: 20px;
  padding: 9px 12px;
}

.send-btn {
  min-width: 58px;
}

.event-line {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 5px;
  border: 1px solid rgba(49, 68, 67, 0.08);
  border-left-width: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.42);
  padding: 6px 9px;
}

.event-line.agent-card {
  border-left-color: rgba(40, 119, 96, 0.55);
  background: rgba(242, 249, 246, 0.7);
}

.event-line.start-card {
  border-left-color: rgba(39, 107, 143, 0.45);
  background: rgba(244, 249, 252, 0.68);
}

.event-line.error-card {
  border-left-color: rgba(161, 63, 63, 0.58);
  background: rgba(255, 246, 244, 0.72);
}

.event-line.approval-card {
  border-left-color: rgba(155, 108, 23, 0.55);
  background: rgba(255, 250, 239, 0.72);
}

.event-line.file-card {
  border-left-color: rgba(83, 96, 135, 0.5);
  background: rgba(247, 247, 252, 0.72);
}

.event-meta {
  display: grid;
  align-content: start;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.event-kind {
  color: var(--paper);
  font-weight: 650;
}

.event-text {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: #253230;
  font: 12px/1.48 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.event-content {
  min-width: 0;
}

.event-submeta {
  margin-top: 2px;
  color: rgba(104, 121, 119, 0.72);
  font-size: 10px;
  line-height: 1.2;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.text-toggle {
  margin-top: 5px;
  border: 0;
  border-radius: 999px;
  background: rgba(49, 68, 67, 0.06);
  color: rgba(104, 121, 119, 0.82);
  font-size: 10px;
  padding: 3px 8px;
}

.markdown-body {
  color: #253230;
  font-size: 13px;
  line-height: 1.48;
}

.markdown-body p,
.markdown-body ul,
.markdown-body pre,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5 {
  margin: 0 0 7px;
}

.markdown-body p:last-child,
.markdown-body ul:last-child,
.markdown-body pre:last-child {
  margin-bottom: 0;
}

.markdown-body ul {
  padding-left: 18px;
}

.markdown-body code {
  border-radius: 5px;
  background: rgba(49, 68, 67, 0.07);
  padding: 1px 4px;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.markdown-body .md-code {
  padding: 8px;
  white-space: pre-wrap;
}

.chat-row {
  display: flex;
  margin-bottom: 7px;
}

.chat-row .event-content {
  max-width: min(76%, 720px);
  border: 1px solid rgba(49, 68, 67, 0.09);
  border-radius: 15px;
  padding: 7px 10px;
  backdrop-filter: blur(24px) saturate(1.16);
}

.chat-row.user-chat {
  justify-content: flex-end;
}

.chat-row.user-chat .event-content {
  background: rgba(40, 119, 96, 0.12);
  border-color: rgba(40, 119, 96, 0.15);
  border-bottom-right-radius: 6px;
}

.chat-row.agent-chat {
  justify-content: flex-start;
}

.chat-row.agent-chat .event-content {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.5));
  border-bottom-left-radius: 6px;
}

.chat-row.system-chat,
.chat-row.error-chat {
  justify-content: center;
}

.chat-row.system-chat .event-content,
.chat-row.error-chat .event-content {
  max-width: 88%;
  background: rgba(255, 255, 255, 0.42);
}

.chat-row.error-chat .event-content {
  background: rgba(255, 246, 244, 0.76);
  border-color: rgba(161, 63, 63, 0.22);
}

.mobile-nav {
  display: none;
}

.empty-panel {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

pre {
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.42);
  padding: 10px;
  color: #263634;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.26);
}

.tab {
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-transform: capitalize;
  font-size: 12px;
}

.tab.active {
  background: rgba(255, 255, 255, 0.58);
  color: var(--paper);
}

.files-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.files-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.48);
  padding: 4px;
  margin-bottom: 10px;
}

.file-up {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 12px;
  background: rgba(40, 119, 96, 0.08);
  color: var(--paper);
  font-size: 22px;
}

.crumbs {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
  overflow-x: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.crumbs button {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--paper);
  padding: 4px 6px;
}

.crumbs button:hover {
  background: rgba(40, 119, 96, 0.08);
}

.file-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.82fr) minmax(0, 1.18fr);
  gap: 10px;
  min-height: 0;
}

.file-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.38));
  padding: 5px;
}

.file-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--paper);
  text-align: left;
  padding: 0 8px;
}

.file-row:hover,
.file-row.active {
  background: rgba(40, 119, 96, 0.08);
}

.file-row.active {
  box-shadow: inset 0 0 0 1px rgba(40, 119, 96, 0.12);
}

.file-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: rgba(49, 68, 67, 0.06);
  color: var(--muted);
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.file-icon.directory {
  background: rgba(39, 107, 143, 0.09);
  color: var(--blue);
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.file-meta,
.file-time {
  color: rgba(104, 121, 119, 0.72);
  font-size: 10px;
  white-space: nowrap;
}

.file-preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.42));
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-open,
.file-list-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--paper);
  font-size: 11px;
  line-height: 1;
  padding: 0 9px;
  text-decoration: none;
}

.file-list-toggle {
  margin-left: auto;
}

.preview-head strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 230px;
  font-size: 13px;
}

.file-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  padding: 2px 7px;
  white-space: nowrap;
}

.file-code {
  flex: 1;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: auto;
}

.media-stage {
  display: grid;
  flex: 1;
  min-height: 0;
  place-items: center;
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(49, 68, 67, 0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(49, 68, 67, 0.045) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(49, 68, 67, 0.045) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(49, 68, 67, 0.045) 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  padding: 12px;
}

.image-preview {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(46, 66, 65, 0.12);
}

.pdf-preview {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.64);
}

.file-placeholder,
.file-empty {
  display: grid;
  gap: 4px;
  place-content: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

.path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}

.log-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.46);
  overflow: hidden;
}

.log-row summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  color: var(--muted);
  cursor: pointer;
}

.log-row pre {
  margin: 0 10px 10px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .case-layout {
    display: block;
    height: calc(100vh - 50px);
    min-height: 0;
    padding: 8px 8px 76px;
    overflow: hidden;
  }

  .sidebar {
    display: none;
  }

  .right-pane,
  .timeline {
    display: none;
    height: calc(100vh - 134px);
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 22px;
  }

  .case-layout.mobile-chat .timeline {
    display: flex;
  }

  .case-layout.mobile-files .right-pane,
  .case-layout.mobile-settings .right-pane {
    display: block;
  }

  .case-layout.mobile-files .tabs,
  .case-layout.mobile-settings .tabs {
    display: none;
  }

  .timeline-scroll,
  .pane-body {
    min-height: 0;
    max-height: none;
  }

  .timeline-scroll {
    flex: 1;
    height: auto;
  }

  .case-layout.mobile-files .pane-body,
  .case-layout.mobile-settings .pane-body {
    height: calc(100vh - 160px);
  }

  .case-layout.mobile-files .files-shell {
    height: 100%;
  }

  .case-layout.mobile-files .file-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, 0.48fr) minmax(0, 0.52fr);
    height: 100%;
  }

  .case-layout.mobile-files .files-shell.preview-focused .file-grid {
    grid-template-rows: minmax(0, 1fr);
  }

  .case-layout.mobile-files .files-shell.preview-focused .file-list {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    left: 50%;
    bottom: 12px;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: min(420px, calc(100vw - 24px));
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 14px 40px rgba(46, 66, 65, 0.16);
    padding: 5px;
    backdrop-filter: blur(28px) saturate(1.18);
  }

  .mobile-nav button {
    min-height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
  }

  .mobile-nav button.active {
    background: rgba(40, 119, 96, 0.12);
    color: var(--paper);
  }
}

@media (max-width: 640px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .topbar,
  .layout,
  .section {
    padding: 10px;
  }

  .topbar {
    min-height: 50px;
  }

  .subtitle {
    display: none;
  }

  .settings-menu summary {
    min-height: 32px;
    font-size: 12px;
  }

  .file-grid,
  .composer form {
    grid-template-columns: 1fr;
  }

  .case-layout.mobile-files .file-grid {
    grid-template-columns: 1fr;
  }

  .file-row {
    grid-template-columns: 24px minmax(0, 1fr) auto;
  }

  .file-time {
    display: none;
  }

  .preview-head strong {
    max-width: 190px;
  }

  .preview-actions {
    gap: 4px;
  }

  .file-chip {
    max-width: 104px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .composer form {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .event-line {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 7px;
  }

  .chat-row .event-content {
    max-width: 84%;
    padding: 7px 9px;
  }

  .event-meta {
    display: grid;
    justify-content: stretch;
  }

  .run-popover {
    left: 0;
    min-width: min(320px, calc(100vw - 34px));
  }

  .select-inline {
    width: 100%;
    max-width: none;
  }

  .run-menu summary,
  .send-btn {
    min-height: 38px;
    padding: 0 11px;
  }

  textarea.field {
    resize: none;
    font-size: 16px;
    line-height: 1.35;
  }
}
