/* Postcard — ported from the Claude Design bundle (Bone default). */

:root {
  /* Bone (default) — quiet, modern, writing-tool */
  --bg: #EDEDE9;
  --surface: #F7F7F4;
  --surface-2: #E4E4DF;
  --ink: #14171B;
  --ink-2: #44494F;
  --ink-3: #8B9097;
  --rule: #D3D3CC;
  --rule-2: #E2E2DC;
  --accent: #3E6A8C;
  --accent-soft: #CBDBE6;
  --amber: #B88A2E;
  --ok: #5A8C6A;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
[data-theme="paper"] {
  --bg: #F3EFE6;
  --surface: #FBF8F1;
  --surface-2: #EAE4D5;
  --ink: #1E1B16;
  --ink-2: #4B4740;
  --ink-3: #8A8478;
  --rule: #D9D2C1;
  --rule-2: #E7E0CE;
  --accent: #B85C3A;
  --accent-soft: #E9C5B5;
  --amber: #C98A2B;
  --ok: #6F8A55;
}
[data-theme="dusk"] {
  --bg: #141619;
  --surface: #1C1F23;
  --surface-2: #24282D;
  --ink: #E6E8EC;
  --ink-2: #A8ADB4;
  --ink-3: #6B7078;
  --rule: #2E3238;
  --rule-2: #262A2F;
  --accent: #6AA3C8;
  --accent-soft: #2B3A47;
  --amber: #D4A355;
  --ok: #7CB48C;
}

* { box-sizing: border-box; }
html {
  /* Height cascade: prefer the JS-measured visualViewport (--app-h) because
   * Safari/Arc's svh is unreliable around the bottom URL bar. Fall through
   * to svh → dvh → vh for the very first paint before app.jsx runs. */
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  height: var(--app-h, 100svh);
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  background: var(--bg);
  overflow: hidden;
  touch-action: pan-x pan-y;
}
body, #root {
  margin: 0; padding: 0;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  font-feature-settings: "cv11", "ss01";
  -webkit-text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-rows: 52px 1fr;
  height: 100%;
}

/* Topbar */
.topbar {
  display: grid;
  grid-template-columns: 280px 1fr 360px;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}
.brand {
  padding: 0 20px;
  display: flex; align-items: center; gap: 10px;
  border-right: 1px solid var(--rule);
  height: 100%;
}
.brand-mark {
  width: 20px; height: 20px; border-radius: 5px;
  background: var(--ink); color: var(--surface);
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
  letter-spacing: -.02em;
}
.brand-name {
  font-size: 13.5px; font-weight: 600;
  letter-spacing: -.01em;
}
.brand-trip {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
}
.brand-trip:hover { color: var(--ink-2); }

.daynav {
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  height: 100%;
}
.daynav-arrow {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2); cursor: pointer;
  background: transparent; border: none;
  transition: background .12s;
  font-size: 13px;
}
.daynav-arrow:hover { background: var(--surface-2); color: var(--ink); }
.daynav-date {
  font-size: 13.5px; font-weight: 600;
  letter-spacing: -.01em;
  display: flex; align-items: baseline; gap: 10px;
}
.daynav-date .ordinal {
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  letter-spacing: .06em; text-transform: uppercase;
}
.daynav-spacer { flex: 1; }

.status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--rule);
}
.status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3);
}
.status.edited .dot { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 20%, transparent); }
.status.saving .dot { background: var(--accent); animation: pulse 1.2s infinite; }
.status.published .dot { background: #4a8f5e; }
.status.offline .dot { background: var(--amber); }
@keyframes pulse { 50% { opacity: .35; } }

.publish-wrap {
  padding: 0 16px; height: 100%;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  border-left: 1px solid var(--rule);
  position: relative;
}
.btn {
  font-family: var(--sans); font-weight: 500; font-size: 13px;
  border-radius: 6px; padding: 7px 14px; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  color: var(--ink); transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary {
  background: var(--ink); color: var(--surface);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-primary[disabled] { opacity: .4; cursor: default; }
.btn-primary.update { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary.update:hover { filter: brightness(1.05); }
.btn-ghost { color: var(--ink-2); }

/* Main grid — sized by .app's grid-template-rows, not a hardcoded calc(). */
.main {
  display: grid;
  grid-template-columns: 280px 1fr 360px;
  min-height: 0;
  overflow: hidden;
}

/* ---------- Left rail: curation ---------- */
.rail {
  border-right: 1px solid var(--rule);
  background: var(--surface);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.rail-head {
  padding: 14px 18px 10px;
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--rule-2);
}
.rail-head .label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.rail-head .count {
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
}
.filters {
  display: flex; gap: 4px; padding: 8px 12px;
  border-bottom: 1px solid var(--rule-2);
}
.filter {
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  padding: 4px 8px; border-radius: 4px;
  color: var(--ink-3); cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
}
.filter:hover { color: var(--ink-2); }
.filter.on { color: var(--ink); background: var(--surface-2); }

.items { flex: 1; overflow-y: auto; padding: 8px 10px 24px; min-height: 0; }
.items::-webkit-scrollbar { width: 6px; }
.items::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

.item {
  display: flex; flex-direction: column;
  gap: 10px; padding: 8px;
  border-radius: 6px;
  cursor: grab;
  transition: background .1s;
  position: relative;
}
.item:active { cursor: grabbing; }
.item .item-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
}
.item:hover { background: var(--surface-2); }
.item.selected { background: var(--surface-2); }
.item.hidden-item { opacity: .42; }

.item .filename {
  font-size: 9px; color: var(--ink-3); opacity: .7;
  margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 140px;
}
.thumb {
  width: 48px; height: 48px; border-radius: 4px;
  background: var(--surface-2); position: relative;
  overflow: hidden;
  border: 1px solid var(--rule-2);
}
.thumb.photo { background: linear-gradient(135deg, var(--accent-soft), var(--rule)); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: 8px; color: var(--ink-2);
  letter-spacing: .04em; text-align: center; line-height: 1.2;
  opacity: .7;
}
.thumb-kind {
  position: absolute; top: 3px; left: 3px;
  font-family: var(--mono); font-size: 8px; font-weight: 500;
  color: var(--surface); background: rgba(0,0,0,.55);
  padding: 1px 4px; border-radius: 2px;
  letter-spacing: .04em;
}
.status-glyph {
  position: absolute; bottom: 2px; right: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--rule);
  display: grid; place-items: center;
  font-size: 9px; color: var(--ink);
}
.status-glyph.featured { background: var(--ink); color: var(--surface); }
.status-glyph.used { background: var(--accent-soft); color: var(--ink); }
.status-glyph.context { background: var(--surface-2); color: var(--ink-3); }
.status-glyph.hidden { background: var(--surface); color: var(--ink-3); }

.item-body { min-width: 0; }
.item-meta {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--mono); font-size: 9.5px;
  color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase;
}
.item-meta .kind { color: var(--ink-2); font-weight: 500; }
.item-text {
  font-size: 12px;
  color: var(--ink-2); line-height: 1.4;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Status popover */
.statusbar {
  position: absolute;
  top: 6px; right: 6px;
  display: none;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  z-index: 2;
}
.item:hover .statusbar, .item.selected .statusbar { display: flex; }
.statusbar button {
  background: transparent; border: none;
  width: 22px; height: 22px; border-radius: 3px;
  cursor: pointer; font-size: 12px;
  color: var(--ink-2); display: grid; place-items: center;
}
.statusbar button:hover { background: var(--surface-2); color: var(--ink); }
.statusbar button.on { background: var(--ink); color: var(--surface); }

/* Inline preview that expands inside a selected item. */
.item-preview {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 2px 4px;
  cursor: default;
}
.item-preview img {
  width: 100%; max-height: 340px; object-fit: contain;
  background: var(--bg); border-radius: 4px;
  display: block;
}
.item-preview video,
.item-preview audio {
  width: 100%; display: block;
  border-radius: 4px;
}
.item-preview audio {
  height: 34px;
  filter: var(--audio-filter, none);
}
[data-theme="dusk"] .item-preview audio { filter: invert(.92) hue-rotate(180deg); }
.item-preview .preview-text {
  font-family: var(--sans); font-size: 12.5px; line-height: 1.55;
  color: var(--ink); white-space: pre-wrap;
  padding: 8px 10px; background: var(--bg);
  border: 1px solid var(--rule-2); border-radius: 4px;
  max-height: 260px; overflow-y: auto;
}
.item-preview .preview-text::-webkit-scrollbar { width: 4px; }
.item-preview .preview-text::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }
.item-preview .preview-meta {
  display: flex; gap: 8px; font-size: 11.5px; color: var(--ink-2); line-height: 1.5;
}
.item-preview .preview-meta-label {
  font-family: var(--mono); font-size: 9px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em;
  flex-shrink: 0; padding-top: 1px;
  min-width: 44px;
}
.item-preview .preview-actions {
  display: flex; justify-content: space-between; gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--rule-2);
  margin-top: 4px;
}
.item-preview .preview-move,
.item-preview .preview-delete {
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 4px;
  background: transparent; border: 1px solid var(--rule);
  color: var(--ink-3); cursor: pointer;
}
.item-preview .preview-move:hover {
  color: var(--ink); border-color: var(--ink-2);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}
.item-preview .preview-delete:hover {
  color: #a02828; border-color: #d68888;
  background: color-mix(in srgb, #d68888 15%, transparent);
}

.rail-foot {
  padding: 10px 16px 12px; border-top: 1px solid var(--rule-2);
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  display: flex; justify-content: space-between;
}

/* ---------- Center: editor ---------- */
.editor-col {
  overflow: hidden;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center;
  padding: 32px 48px 32px;
}

.doc {
  width: 100%;
  max-width: 640px;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}
.doc-head {
  margin-bottom: 28px;
}
.doc-kicker {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-3); letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 8px;
}
.doc-title {
  font-family: var(--sans); font-weight: 700;
  font-size: 30px; line-height: 1.18; letter-spacing: -0.022em;
  margin: 0; padding: 0;
  border: none; outline: none; background: transparent;
  color: var(--ink); width: 100%;
  resize: none; overflow: hidden;
}
.doc-title::placeholder { color: var(--ink-3); }

.toolbar {
  display: flex; align-items: center; gap: 4px;
  margin: 18px 0 10px;
  padding: 4px 0;
  border-top: 1px solid var(--rule-2);
  border-bottom: 1px solid var(--rule-2);
}
.tool {
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  padding: 5px 9px; border-radius: 4px;
  color: var(--ink-3); cursor: pointer;
  border: none; background: transparent;
}
.tool:hover { color: var(--ink); background: var(--surface-2); }
.tool.on { color: var(--ink); background: var(--surface-2); }
.tool-sep { width: 1px; height: 16px; background: var(--rule); margin: 0 4px; }
.tool-mono { font-family: var(--mono); font-size: 11px; }

/* Markdown source — plain textarea, with a drag-drop host wrapper so the
 * rail can drop items in. */
.md-editor {
  position: relative;
  flex: 1; min-height: 0;
  width: 100%;
  display: flex;
}
.md-editor.drag-over::after {
  content: "drop to insert";
  position: absolute; inset: 6px;
  display: grid; place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-soft) 60%, transparent);
  color: var(--accent);
  font-family: var(--mono); font-size: 12px;
  letter-spacing: .08em; text-transform: uppercase;
  pointer-events: none;
  z-index: 3;
}
.body-source {
  font-family: var(--mono);
  font-size: 13px; line-height: 1.62;
  color: var(--ink);
  flex: 1; min-height: 0;
  width: 100%;
  outline: none; border: none; background: transparent;
  resize: none;
  white-space: pre-wrap;
  letter-spacing: -.005em;
  overflow-y: auto;
}
.body-source::-webkit-scrollbar { width: 6px; }
.body-source::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

/* Preview mode (rendered markdown) */
.body-preview {
  font-family: var(--sans);
  font-size: 15px; line-height: 1.62;
  color: var(--ink);
  letter-spacing: -.005em;
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.body-preview::-webkit-scrollbar { width: 6px; }
.body-preview::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
.body-preview p { margin: 0 0 1em; }
.body-preview p:last-child { margin-bottom: 0; }
.body-preview blockquote {
  margin: 1em 0; padding: 0 16px;
  color: var(--ink-2); font-style: italic;
  border-left: 2px solid var(--rule);
}
.body-preview img, .body-preview figure img, .body-preview .preview-figure .ph {
  display: block;
  width: 100%; height: auto;
  border-radius: 2px;
  margin: 28px 0 8px;
}
.body-preview audio, .body-preview video { width: 100%; display: block; margin: 14px 0; border-radius: 2px; }
.body-preview figcaption, .body-preview em.caption {
  font-family: var(--sans); font-size: 12.5px;
  color: var(--ink-3); margin-top: 8px;
  font-style: italic; display: block;
}


/* ---------- Right: assistant ---------- */
.assist {
  border-left: 1px solid var(--rule);
  background: var(--surface);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.assist-head {
  padding: 12px 18px 10px;
  border-bottom: 1px solid var(--rule-2);
  display: flex; justify-content: space-between; align-items: center;
}
.assist-head .label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.assist-head .sub {
  font-size: 12px; color: var(--ink-2); font-weight: 500;
}
.assist-clear {
  font-family: var(--mono); font-size: 10px;
  padding: 4px 8px; border-radius: 4px;
  color: var(--ink-3); background: transparent; border: 1px solid transparent;
  cursor: pointer; letter-spacing: .06em; text-transform: uppercase;
}
.assist-clear:hover:not(:disabled) { color: var(--ink); background: var(--surface-2); border-color: var(--rule); }
.assist-clear:disabled { opacity: .35; cursor: default; }

.chat {
  flex: 1; overflow-y: auto;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 16px;
  min-height: 0;
}
.chat::-webkit-scrollbar { width: 6px; }
.chat::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

.msg {
  font-family: var(--sans);
  font-size: 13px; line-height: 1.5;
}
.msg .role {
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 4px;
}
.msg.user .bubble {
  background: var(--surface-2); padding: 8px 12px;
  border-radius: 10px 10px 2px 10px;
  display: inline-block; max-width: 100%;
  color: var(--ink); white-space: pre-wrap;
}
.msg.assistant .role { color: var(--accent); }
.msg.assistant .bubble { color: var(--ink); padding: 0 2px; white-space: pre-wrap; }

.typing-dots {
  display: inline-flex; gap: 4px; align-items: center;
  color: var(--accent);
}
.typing-dots span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: bounce 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.proposal {
  margin-top: 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}
.proposal-head {
  padding: 8px 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--rule-2);
}
.proposal-body {
  padding: 10px 14px 12px;
  font-family: var(--sans); font-size: 12.5px;
  color: var(--ink-2); line-height: 1.6;
  max-height: 260px; overflow-y: auto;
  white-space: pre-wrap;
}
.proposal-body::-webkit-scrollbar { width: 6px; }
.proposal-body::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
.proposal-actions {
  display: flex; gap: 6px; padding: 8px 10px;
  border-top: 1px solid var(--rule-2);
  background: var(--surface);
}
.proposal-actions button {
  font-family: var(--sans); font-size: 11.5px; font-weight: 500;
  padding: 5px 10px; border-radius: 4px;
  border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink-2); cursor: pointer;
}
.proposal-actions button:hover { color: var(--ink); }
.proposal-actions button.primary {
  background: var(--ink); color: var(--surface); border-color: var(--ink);
}
.proposal-actions button.primary:hover { background: var(--ink-2); }

.suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 18px;
  border-top: 1px solid var(--rule-2);
}
.sugg {
  font-family: var(--sans); font-size: 11.5px;
  padding: 4px 9px; border-radius: 4px;
  background: var(--bg); border: 1px solid var(--rule);
  color: var(--ink-2); cursor: pointer;
}
.sugg:hover { color: var(--ink); border-color: var(--ink-3); }

.composer {
  border-top: 1px solid var(--rule);
  padding: 10px 12px 12px;
  background: var(--surface);
}
.composer-box {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .12s;
}
.composer-box:focus-within { border-color: var(--ink-3); }
.composer textarea {
  border: none; outline: none; resize: none;
  background: transparent; color: var(--ink);
  font-family: var(--sans); font-size: 13px; line-height: 1.45;
  min-height: 22px; max-height: 120px;
  width: 100%;
}
.composer-row {
  display: flex; justify-content: space-between; align-items: center;
}
.composer-hint {
  font-family: var(--mono); font-size: 9.5px;
  color: var(--ink-3); letter-spacing: .04em;
}
.composer-send {
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 4px;
  background: var(--ink); color: var(--surface);
  border: none; cursor: pointer;
}
.composer-send[disabled] { opacity: .35; cursor: default; }

/* Publish panel */
.publish-panel {
  position: absolute; top: 48px; right: 10px;
  width: 340px; z-index: 30;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(20,15,5,.12);
  padding: 14px 16px;
  display: none;
}
.publish-panel.open { display: block; }
.publish-panel h4 {
  margin: 0 0 4px; font-weight: 600; font-size: 14px; letter-spacing: -.01em;
}
.publish-panel p {
  margin: 0 0 12px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5;
}
.publish-summary {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  border-top: 1px dashed var(--rule);
  padding-top: 10px; margin-top: 2px;
}
.publish-summary b { color: var(--ink); font-weight: 500; }
.publish-actions { display: flex; gap: 8px; margin-top: 12px; }
.publish-actions button {
  flex: 1; padding: 7px 10px; border-radius: 5px;
  font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--rule); background: var(--bg); color: var(--ink);
  cursor: pointer;
}
.publish-actions .confirm {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.publish-draft-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 8px 10px;
  border: 1px dashed var(--rule); border-radius: 5px;
  font-size: 12px; color: var(--ink-2);
  cursor: pointer;
}
.publish-draft-toggle input { margin: 0; }
.publish-draft-toggle:hover { border-color: var(--ink-3); color: var(--ink); }

/* Trip dropdown (brand-trip click) */
.trip-menu {
  position: absolute; top: 46px; left: 16px; width: 340px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(20,15,5,.12);
  padding: 6px;
  z-index: 40;
}
.trip-menu-head {
  padding: 8px 10px 6px;
  font-family: var(--mono); font-size: 9.5px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em;
  border-bottom: 1px solid var(--rule-2); margin-bottom: 4px;
}
.trip-menu-head em { color: var(--accent); font-style: normal; }

.trip-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 5px;
  cursor: pointer; font-size: 13px;
  color: var(--ink);
}
.trip-row:hover { background: var(--surface-2); }
.trip-row.viewing { background: var(--surface-2); }
.trip-row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-row .slug {
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .06em;
  justify-self: end;
}
.trip-row-pill {
  font-family: var(--mono); font-size: 9.5px;
  padding: 2px 7px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .08em;
  border: 1px solid var(--rule);
  background: transparent; color: var(--ink-3);
  cursor: pointer;
}
.trip-row-pill.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  cursor: default;
}
.trip-row-pill.ghost { opacity: 0; transition: opacity .1s; }
.trip-row:hover .trip-row-pill.ghost { opacity: 1; }
.trip-row-pill.ghost:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface); }

.trip-row.new {
  grid-template-columns: 1fr;
  color: var(--accent);
}

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  padding: 8px 14px;
  background: var(--ink); color: var(--surface);
  border-radius: 8px;
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 100;
}
.toast.err { background: var(--amber); color: var(--ink); }

/* Onboarding (full-screen on its own) */
.onboard-wrap {
  height: 100vh; display: grid; place-items: center;
  padding: 40px 20px; background: var(--bg);
}
.onboard {
  width: 100%; max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 32px 32px 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,.04);
}
.onboard .step {
  font-family: var(--mono); font-size: 10px;
  color: var(--accent); text-transform: uppercase; letter-spacing: .12em;
  margin-bottom: 8px;
}
.onboard h2 {
  font-family: var(--sans); font-weight: 700;
  font-size: 24px; letter-spacing: -.015em; margin: 0 0 6px;
}
.onboard p.sub { color: var(--ink-2); margin: 0 0 18px; font-size: 13px; line-height: 1.55; }
.field { display: block; margin: 10px 0; }
.field label {
  display: block;
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px;
}
.field input {
  display: block; width: 100%;
  padding: 8px 10px; border-radius: 5px;
  background: var(--bg); border: 1px solid var(--rule);
  font-family: var(--sans); font-size: 13px;
  color: var(--ink); outline: none;
}
.field input:focus { border-color: var(--ink-3); }
.onboard .actions { margin-top: 18px; display: flex; gap: 10px; }

.existing-list {
  display: flex; flex-direction: column; gap: 4px;
  margin: 8px 0 18px;
}
.existing-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 5px;
  background: var(--bg); border: 1px solid var(--rule);
  cursor: pointer;
}
.existing-row:hover { border-color: var(--ink-3); }
.existing-row .slug { font-size: 13px; font-weight: 500; }
.existing-row .branch { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

/* Tweaks panel (theme switcher) */
#tweaks {
  display: none;
  position: fixed; right: 16px; bottom: 16px;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px 14px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  width: 240px;
}
#tweaks.on { display: block; }
#tweaks h5 {
  margin: 0 0 10px; font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  display: flex; justify-content: space-between;
}
#tweaks .swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatch {
  cursor: pointer; padding: 8px;
  border-radius: 6px; border: 1px solid var(--rule);
  background: var(--bg);
  display: flex; flex-direction: column; gap: 8px;
  font-size: 11px; font-weight: 500; color: var(--ink-2);
  transition: border-color .15s;
}
.swatch:hover { border-color: var(--ink-3); }
.swatch.on { border-color: var(--ink); color: var(--ink); }
.swatch-chips { display: flex; gap: 3px; }
.swatch-chip { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.08); }

::selection { background: var(--accent-soft); color: var(--ink); }

.center-note {
  padding: 60px 20px; text-align: center; color: var(--ink-3);
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .14em;
}

/* Mobile tab bar — hidden on desktop */
.mobile-tabs { display: none; }

/* ---------- Mobile: switch between Assets / Content / Heron via tabs ---------- */
@media (max-width: 720px) {
  body { overscroll-behavior: none; }

  .app {
    grid-template-rows: 52px 1fr auto;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
  }
  .brand { padding: 0 12px; gap: 8px; }
  .brand .brand-name { display: none; }
  .brand .brand-trip { margin-left: 0; font-size: 11px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .daynav { padding: 0 8px; gap: 4px; }
  .daynav-date { font-size: 12px; }
  .daynav-date .ordinal { display: none; }
  .status { font-size: 10px; padding: 3px 8px 3px 7px; }

  .publish-wrap { padding: 0 8px; gap: 6px; }
  .publish-wrap .btn { padding: 6px 10px; font-size: 12px; }
  .publish-wrap .publish-panel {
    position: fixed; top: 58px; right: 8px; left: 8px; width: auto;
  }

  .main {
    grid-template-columns: 1fr;
  }
  /* Show only the active tab's pane */
  .main.mobile-tab-assets  .rail       { display: flex; }
  .main.mobile-tab-assets  .editor-col,
  .main.mobile-tab-assets  .assist     { display: none; }
  .main.mobile-tab-content .editor-col { display: flex; }
  .main.mobile-tab-content .rail,
  .main.mobile-tab-content .assist     { display: none; }
  .main.mobile-tab-heron   .assist     { display: flex; }
  .main.mobile-tab-heron   .rail,
  .main.mobile-tab-heron   .editor-col { display: none; }

  .assist { border-left: none; }
  .rail   { border-right: none; }
  .editor-col { padding: 24px 20px 24px; }

  .trip-menu {
    position: fixed; top: 58px; left: 8px; right: 8px; width: auto;
  }

  /* Mobile inputs default to 16px+ so iOS Safari doesn't auto-zoom on focus.
   * Any editable/input element below 16px triggers focus-zoom, so we apply
   * this everywhere. */
  input, textarea, select,
  .body-source, .md-editor-ta,
  .composer textarea { font-size: 16px; }

  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--surface);
    border-top: 1px solid var(--rule);
  }
  .mobile-tab {
    padding: 10px 8px;
    background: transparent; border: none;
    font-family: var(--sans); font-size: 12px; font-weight: 500;
    color: var(--ink-3); cursor: pointer;
    letter-spacing: .01em;
    position: relative;
  }
  .mobile-tab:active { background: var(--surface-2); }
  .mobile-tab.on { color: var(--ink); }
  .mobile-tab.on::after {
    content: ""; position: absolute;
    left: 20%; right: 20%; top: 4px;
    height: 2px; border-radius: 1px;
    background: var(--accent);
  }
  .mobile-tab-badge {
    display: inline-block; margin-left: 6px;
    font-family: var(--mono); font-size: 9px;
    padding: 0 5px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
    min-width: 14px; text-align: center;
    vertical-align: 1px;
  }
}
