:root {
  --ink: #142326;
  --ink-soft: #3d5559;
  --mute: #6d8185;
  --paper: #f7f4ee;
  --paper-deep: #efe9df;
  --line: #d5cdc0;
  --brand: #0f2f33;
  --accent: #c45c26;
  --accent-soft: #f3e0d4;
  --ok: #2f6b4f;
  --rail: #0f2f33;
  --rail-ink: #e8efef;
  --rail-mute: #9bb0b3;
  --shadow: 0 18px 40px rgba(15, 47, 51, 0.12);
  --font-ui: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: Georgia, "Songti SC", "SimSun", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #dce8e6 0%, transparent 55%),
    linear-gradient(160deg, #e7ece9 0%, #d8e0de 45%, #cfd8d5 100%);
}

#app { height: 100%; }

.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  overflow: hidden;
}

.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 16px 18px 20px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.actions-rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 10px 18px;
  background: rgba(255, 255, 255, 0.42);
  border-right: 1px solid rgba(15, 47, 51, 0.08);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  align-items: stretch;
}

.actions-rail-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  text-align: center;
  margin-bottom: 4px;
}

.actions-rail .action-btn {
  width: 100%;
  border-radius: 12px;
  padding: 11px 8px;
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--brand);
}

.brand-sub {
  margin-top: 6px;
  color: var(--mute);
  font-size: 0.92rem;
}

.project-title {
  text-align: right;
  max-width: 55%;
}

.project-title .label {
  color: var(--mute);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-title h1 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.2;
}

.project-title .danger-ghost {
  margin-top: 8px;
  border-color: rgba(138, 58, 42, 0.35);
  color: #8a3a2a;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
}
.project-sync {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  align-items: center;
}
.sync-chip {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #c4b29a;
  color: var(--mute);
  background: rgba(255,255,255,0.7);
}
.sync-chip.on {
  border-color: #6a8f6e;
  color: #2d5a33;
}
.sync-chip.warn,
.sync-chip.off {
  border-color: #c4a070;
  color: #8a5a20;
}

.actions {
  display: none; /* legacy top actions removed; use .actions-rail */
}

.action-btn {
  border: 1px solid var(--line);
  background: rgba(247, 244, 238, 0.92);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.action-btn:hover { transform: translateY(-1px); border-color: #b7aea0; }
.action-btn:active { transform: translateY(0); }
.action-btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #f4f8f8;
}

.board {
  flex: 1;
  min-height: min(70vh, 640px);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55), transparent 28%),
    var(--paper);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px 22px 28px;
}

.board-brief {
  max-width: 860px;
  margin: 0 auto 16px;
  padding: 16px 18px;
  border: 1px solid #c4b29a;
  background: rgba(255, 250, 242, 0.92);
  border-radius: 16px;
  cursor: pointer;
}
.board-brief.is-empty { cursor: default; opacity: 0.92; }
.board-brief-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.board-brief-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.board-brief-body {
  white-space: pre-wrap;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}
.board-brief-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 14px 20px;
}
.board-brief-grid h3 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--mute);
  font-weight: 600;
}
.board-brief-grid section {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.board-brief-purpose { margin-bottom: 6px; color: var(--ink); }
.board-brief-missing { color: var(--mute); }
@media (max-width: 720px) {
  .board-brief-grid { grid-template-columns: 1fr; }
}

.board-empty {
  height: 100%;
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--mute);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.45;
  padding: 40px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 860px;
  margin: 0 auto;
}

.board-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 860px;
  margin: 0 auto 10px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--paper);
  padding: 10px 4px 12px;
  border-bottom: 1px solid var(--line);
}
.board-pager-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}
.board-pager-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  max-width: 100%;
  flex: 1;
}
.board-pager-tabs .sheet-tab,
.board-pager-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.8);
  border-radius: 8px 8px 0 0;
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.board-pager-tabs .sheet-tab.on,
.board-pager-tabs button.on {
  background: var(--brand);
  color: #f4f8f8;
  border-color: var(--brand);
}
.sheet-banner {
  max-width: 860px;
  margin: 0 auto 12px;
  font-size: 0.85rem;
  color: var(--mute);
}
.note-block.note-chat {
  border-color: #3d6b78;
  background: rgba(232, 242, 244, 0.7);
}

.note-block {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.55);
  border-radius: 14px;
  padding: 14px 16px;
  animation: rise 0.28s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.note-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}

.note-type {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.note-time {
  font-size: 0.78rem;
  color: var(--mute);
}

.note-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.note-body {
  white-space: pre-wrap;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 0.95rem;
}

.rail {
  background: var(--rail);
  color: var(--rail-ink);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 16px;
  gap: 8px;
  border-left: 1px solid rgba(255,255,255,0.06);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rail-head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.rail-title {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rail-mute);
}

.rail-add {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px dashed rgba(255,255,255,0.28);
  background: transparent;
  color: var(--rail-ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.rail-add:hover { background: rgba(255,255,255,0.06); }

.proj-select {
  width: 100%;
  font: inherit;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: var(--rail-ink);
  padding: 7px 8px;
}

.proj-select option { color: #142326; }

.rail-table {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
}

.rail-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  line-height: 1.35;
}

.rail-table th {
  position: sticky;
  top: 0;
  background: #14383c;
  color: var(--rail-mute);
  font-weight: 500;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.rail-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: top;
  word-break: break-word;
}

.rail-table tr {
  cursor: pointer;
}

.rail-table tr:hover td { background: rgba(255,255,255,0.05); }

.rail-table tr.active td {
  background: #f7f4ee;
  color: var(--brand);
  font-weight: 600;
}

.rail-table .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e8a26a;
  margin-right: 4px;
  vertical-align: middle;
}

.ask-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 4px 0 10px;
}

.ask-status {
  font-size: 0.8rem;
  color: var(--mute);
  min-height: 1.2em;
}
.ask-status.soft { margin: 0 0 10px; }

.polish-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.polish-row .btn {
  font-size: 0.78rem;
  padding: 6px 10px;
}

.note-memo {
  cursor: pointer;
  border-color: #c4b29a;
  background: rgba(255, 250, 242, 0.9);
}
.note-memo:hover { border-color: var(--accent); }

.memo-stage { padding-top: 12px; }

.memo-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.memo-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.memo-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.memo-sheet {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #fffefb;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 28px 32px 36px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.memo-kicker {
  margin: 0 0 8px;
  color: var(--mute);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.memo-headline {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-family: var(--font-display);
  font-size: 1.75rem;
  padding: 4px 0 10px;
  color: var(--ink);
  margin-bottom: 12px;
}

.memo-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
  color: var(--mute);
  font-size: 0.88rem;
}

.memo-meta-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.memo-meta-row input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  background: #fff;
  min-width: 160px;
}

.memo-section {
  margin-bottom: 18px;
}

.memo-section h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--brand);
}

.memo-edit {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  line-height: 1.55;
  background: #fffdf9;
  resize: vertical;
  color: var(--ink-soft);
}

.memo-foot {
  margin-top: 20px;
  color: var(--mute);
  font-size: 0.82rem;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot.on { background: #5fbf8a; }
.status-dot.off { background: #c27b6a; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 28, 30, 0.42);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 200;
  animation: fade 0.18s ease;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(520px, 100%);
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
  border: 1px solid rgba(255,255,255,0.5);
}

.modal.wide { width: min(720px, 100%); }

.modal-backdrop.diagram-backdrop {
  padding: 10px;
  place-items: stretch;
  align-items: stretch;
}

.modal.diagram-modal {
  width: 100%;
  max-width: none;
  height: calc(100dvh - 20px);
  max-height: calc(100dvh - 20px);
  display: flex;
  flex-direction: column;
  padding: 14px 16px 12px;
  border-radius: 14px;
}

.diagram-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.diagram-head h2 { margin: 0 0 2px; }
.diagram-head .hint { margin: 0; }
.diagram-head-actions {
  margin: 0;
  flex-shrink: 0;
}

.modal h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.55rem;
}

.modal .hint {
  color: var(--mute);
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-size: 0.8rem;
  color: var(--mute);
  letter-spacing: 0.04em;
}

.field input,
.field textarea {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fffdf9;
  color: var(--ink);
  resize: vertical;
}

.field textarea { min-height: 110px; }

.modal.mail-modal {
  width: min(520px, 100%);
  max-height: calc(100svh - 24px);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mail-modal .mail-fields {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.mail-card-pick-label {
  font-size: 0.78rem;
  color: var(--mute);
  margin: 0 0 6px;
}
.mail-card-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(28vh, 168px);
  overflow: auto;
  margin: 0 0 10px;
  -webkit-overflow-scrolling: touch;
}
.mail-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--ink);
}
.mail-card-row .t {
  flex: 0 0 auto;
  color: var(--mute);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.mail-card-row .s {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-card-row.on {
  border-color: var(--brand);
  background: #eef4f3;
}
.mail-card-row.label-only {
  opacity: 0.88;
}
.mail-card-empty { margin: 0 0 8px; }
.mail-modal textarea { min-height: 88px; max-height: 28vh; }
.mail-card-pick {
  margin-bottom: 12px;
}
.mail-card-pick > label {
  display: block;
  font-size: 0.8rem;
  color: var(--mute);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.mail-card-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 28vh;
  overflow: auto;
}
.mail-card-chip {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fffdf9;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
}
.mail-card-chip.on {
  border-color: var(--brand);
  background: rgba(15, 47, 51, 0.08);
}
.mail-card-k {
  display: block;
  font-size: 0.72rem;
  color: var(--mute);
}
.mail-card-v {
  display: block;
  margin-top: 2px;
  font-size: 0.88rem;
  color: var(--ink);
}
.mail-modal .modal-actions {
  flex-shrink: 0;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 9px 14px;
  font: inherit;
  cursor: pointer;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #f4f8f8;
}

.diagram-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
  flex-shrink: 0;
}

.sym {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.sym.active { border-color: var(--accent); background: var(--accent-soft); }
.sym-glyph { margin-right: 4px; }

.diagram-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.diagram-canvas {
  position: relative;
  flex: 1 1 auto;
  min-height: 420px;
  height: auto;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fffdf9;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.diagram-world {
  position: relative;
  width: 100%;
  min-height: 900px;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px),
    linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
    #fffdf9;
  background-size: 24px 24px;
}

.diagram-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.diagram-links path[data-link] {
  pointer-events: stroke;
  cursor: crosshair;
}

.diagram-node {
  position: absolute;
  z-index: 2;
  min-width: 80px;
  padding: 8px 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--brand);
  background: #fff;
  font-size: 0.75rem;
  text-align: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: 0 6px 14px rgba(15,47,51,0.08);
}
.diagram-node:active { cursor: grabbing; }
.diagram-node.selected { outline: 2px solid var(--accent); }
.node-glyph { font-size: 1.1rem; line-height: 1.2; }
.diagram-node.note-node {
  min-width: 96px;
  background: #fffef6;
  border-style: dashed;
}
.diagram-node.note-node .node-label {
  color: var(--ink);
  font-weight: 600;
}

.diagram-node.junction-node {
  min-width: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 扩大点击热区，黑点视觉仍小 */
}
.diagram-node.junction-node.selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.junction-dot {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #0f2f33;
  box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(15, 47, 51, 0.35);
  pointer-events: none;
}
.diagram-node.junction-node .node-del {
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  font-size: 12px;
}

.node-del {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #8a3a2a;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(15,47,51,0.12);
}
.diagram-node.selected .node-del,
.diagram-node:hover .node-del {
  display: inline-flex;
}

.note-block.note-feedback,
.note-block[data-type="feedback"] {
  border-color: #9bb8a8;
  background: rgba(232, 244, 238, 0.65);
}

.note-block.note-kun {
  border-color: #c45c26;
  background: rgba(243, 224, 212, 0.55);
}
.note-block.note-mail {
  border-color: #3d6a88;
  background: rgba(226, 236, 242, 0.7);
}
.note-block.mail-picked {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.note-block.note-next {
  border-color: #2f6b4f;
  background: rgba(232, 244, 238, 0.7);
}

.note-block.note-diagram {
  background: rgba(255, 253, 249, 0.9);
}

.board-diagram {
  margin-top: 8px;
  width: 100%;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px),
    linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
    #fffdf9;
  background-size: 20px 20px;
  overflow: hidden;
}

.board-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 110px;
  max-height: 420px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--brand);
  color: #f4f8f8;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 50;
  animation: rise 0.2s ease;
}
body:has(.composer) .toast { bottom: 108px; }

.composer {
  flex-shrink: 0;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--brand);
  color: #e8efef;
}
.composer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  color: #e8efef;
  font-size: 1.05rem;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn.tiny {
  width: auto;
  padding: 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  height: 32px;
}
.icon-btn.tiny.rollup {
  background: #e8d5b5;
  color: #142326;
  font-weight: 650;
}
.composer .send {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
#composer-text {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: #f7f4ee;
  color: var(--ink);
}
.file-cam {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.note-photo {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr) 156px; }
  .stage { padding: 12px 10px 14px 8px; }
  .brand-mark { font-size: 1.45rem; }
  .project-title h1 { font-size: 1.15rem; }
  .rail-table { font-size: 0.66rem; }
}
