/* Ledger v1.0 — frontend styles (M2)
   Mobile-first, dark-on-light. Confident and minimal: real type hierarchy,
   tight vertical rhythm, no default-browser-styled controls. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-sunk: #fafbfc;
  --ink: #15181d;
  --ink-soft: #545b66;
  --ink-faint: #878e99;
  --line: #e4e7ec;
  --line-strong: #d3d8e0;
  --accent: #2f6df6;
  --accent-ink: #ffffff;
  --accent-soft: #eaf1ff;
  --danger: #cf3434;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --tap: 44px;

  /* Lifecycle pills — each stage visually distinct, dead muted, project celebratory */
  --st-idea-bg: #eceff4;          --st-idea-ink: #4a5566;
  --st-brainstorming-bg: #fff0d4; --st-brainstorming-ink: #8a5200;
  --st-formalizing-bg: #f0e6ff;   --st-formalizing-ink: #6a2fbd;
  --st-draft-bg: #dde9ff;         --st-draft-ink: #1a4fb0;
  --st-pre_generation-bg: #d2f1ec;--st-pre_generation-ink: #0d6a5e;
  --st-dead-bg: #f1f1f2;          --st-dead-ink: #9ba1a9;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- top bar --------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.brand {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px;
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}

/* --- buttons --------------------------------------------------------------- */

.btn {
  min-height: var(--tap);
  padding: 0 16px;
  font-size: 0.94rem;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:hover { border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn:disabled:hover { border-color: var(--line-strong); }

.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #245ce0; border-color: #245ce0; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.86rem; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); border-color: #f0cccc; background: var(--surface); }
.btn-danger:hover { background: #fdf4f4; border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }

/* --- form controls (no browser defaults) ----------------------------------- */

input[type="text"], input[type="search"], input[type="url"], textarea, select {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; line-height: 1.6; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23545b66' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* --- list view ------------------------------------------------------------- */

.list-view { max-width: 760px; margin: 0 auto; }

.filters { display: flex; gap: 10px; margin-bottom: 20px; align-items: stretch; }
.filters input[type="search"] { min-height: var(--tap); flex: 1 1 auto; }

/* multi-select status filter (custom dropdown, no native <select multiple>) */
.statusfilter { position: relative; flex: 0 0 auto; }
.filter-toggle {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 14px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
}
.filter-toggle:hover { border-color: var(--ink-faint); }
.filter-toggle .caret { color: var(--ink-faint); font-size: 0.7rem; }
.filter-toggle[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.filter-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 210px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(15, 20, 30, 0.16);
}
.filter-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  cursor: pointer;
}
.filter-opt:hover { background: var(--surface-sunk); }
.filter-opt input { width: auto; margin: 0; accent-color: var(--accent); }
.sdot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sdot.idea { background: var(--st-idea-ink); }
.sdot.brainstorming { background: var(--st-brainstorming-ink); }
.sdot.formalizing { background: var(--st-formalizing-ink); }
.sdot.draft { background: var(--st-draft-ink); }
.sdot.pre_generation { background: var(--st-pre_generation-ink); }
.sdot.project { background: #17a34a; }
.sdot.dead { background: var(--st-dead-ink); }
.filter-menu-actions {
  display: flex; gap: 6px; margin-top: 4px; padding: 6px 4px 2px;
  border-top: 1px solid var(--line);
}
.filter-menu-actions button {
  flex: 1; padding: 6px; font-family: inherit; font-size: 0.78rem; font-weight: 500;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer;
}
.filter-menu-actions button:hover { border-color: var(--ink-faint); color: var(--ink); }

/* --- cards ----------------------------------------------------------------- */

.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 2px 10px rgba(20, 24, 32, 0.05);
  transform: translateY(-1px);
}

/* Title dominant */
.card-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.32;
  letter-spacing: -0.011em;
  color: var(--ink);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

/* Tags visually obvious */
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 3px 9px 3px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: #2a5bc4;
  border: 1px solid #d5e3ff;
}
.tag::before { content: "#"; opacity: 0.5; margin-right: 2px; }

/* Plain-text notes excerpt (first ~50 words); full render shows on hover */
.card-excerpt {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Shared hover tooltip: rendered notes, floated over the board (desktop) */
.note-tooltip {
  position: absolute;
  z-index: 40;
  max-width: 420px;
  max-height: 340px;
  overflow: hidden;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: 0 14px 40px rgba(15, 20, 30, 0.2);
  pointer-events: none; /* pure preview — never steals hover/click */
  font-size: 0.9rem;
}
.note-tooltip[hidden] { display: none; }
@media (hover: none) { .note-tooltip { display: none !important; } }

/* Metadata quiet */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--ink-faint);
  font-size: 0.78rem;
}
.card-meta .dot { opacity: 0.4; }
.count { display: inline-flex; align-items: center; gap: 4px; }

/* Dead cards recede; project cards get a warm edge */
.card-dead { opacity: 0.62; background: var(--surface-sunk); }
.card-dead .card-title { color: var(--ink-soft); font-weight: 550; }
.card-project { border-color: #b7e7c8; }

/* --- status pills ---------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.015em;
  white-space: nowrap;
}
.pill.idea           { background: var(--st-idea-bg);           color: var(--st-idea-ink); }
.pill.brainstorming  { background: var(--st-brainstorming-bg);  color: var(--st-brainstorming-ink); }
.pill.formalizing    { background: var(--st-formalizing-bg);    color: var(--st-formalizing-ink); }
.pill.draft          { background: var(--st-draft-bg);          color: var(--st-draft-ink); }
.pill.pre_generation { background: var(--st-pre_generation-bg); color: var(--st-pre_generation-ink); }

/* Graduated — celebratory */
.pill.project {
  background: linear-gradient(135deg, #17a34a, #0d9488);
  color: #fff;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.35), 0 0 0 3px rgba(23, 163, 74, 0.13);
}
.pill.project::before { content: "✦"; font-size: 0.8em; }

/* Killed — muted, clearly out of play */
.pill.dead {
  background: var(--st-dead-bg);
  color: var(--st-dead-ink);
  border: 1px dashed var(--line-strong);
  font-weight: 600;
}

/* --- detail: responsive two-column ----------------------------------------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 18px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}
.back:hover { color: var(--accent); }

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 28px; }

@media (min-width: 900px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1fr) 288px;
    gap: 44px;
    align-items: start;
  }
  .detail-rail { position: sticky; top: 76px; }
}

.detail-main { min-width: 0; }

/* Back arrow + title share one row; the arrow reclaims the old "All ideas" line */
.title-row { display: flex; align-items: center; gap: 2px; margin: 0 0 6px -8px; }
.back-arrow {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  color: var(--ink-faint);
  text-decoration: none;
  font-size: 1.5rem;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
}
.back-arrow:hover { background: var(--surface-sunk); color: var(--ink); }
.back-arrow:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); color: var(--ink); }

/* Title — dominant, inline editable, no input chrome until touched */
.title-edit {
  flex: 1;
  min-width: 0;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.025em;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 6px 10px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
}
.title-edit:hover { background: var(--surface-sunk); border-color: var(--line); }
.title-edit:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.detail-sub { color: var(--ink-faint); font-size: 0.82rem; margin-bottom: 28px; }

/* Section rhythm */
.block { margin-bottom: 32px; }
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  margin: 0;
}

/* --- rail ------------------------------------------------------------------ */

.detail-rail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.rail-section { padding: 16px 16px; border-bottom: 1px solid var(--line); }
.rail-section:last-child { border-bottom: none; }
.rail-section .label { margin-bottom: 10px; }

.rail-meta { display: flex; flex-direction: column; gap: 9px; font-size: 0.82rem; }
.rail-meta div { display: flex; justify-content: space-between; gap: 10px; }
.rail-meta dt { color: var(--ink-faint); }
.rail-meta dd { margin: 0; color: var(--ink-soft); text-align: right; font-weight: 500; }

.rail-actions { display: flex; flex-direction: column; gap: 8px; }

/* kill history + published url */
.kill-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.45;
}
.kill-note.history { border-style: dashed; }
.kill-note strong { color: var(--ink); font-weight: 600; }
.kill-note .when { display: block; margin-top: 3px; color: var(--ink-faint); font-size: 0.75rem; }

.url-row { display: flex; gap: 6px; align-items: center; }
.url-row input { flex: 1; min-width: 0; font-size: 0.85rem; padding: 8px 10px; }

/* icon-only "open in new tab" beside the URL field */
.icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s, opacity 0.12s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--ink-faint); background: var(--surface-sunk); }
.icon-btn.disabled { opacity: 0.4; pointer-events: none; }

/* tags editor */
.tags-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-removable { padding-right: 5px; }
.tag-removable button {
  border: none; background: none; cursor: pointer; color: #6f8ec9;
  font-size: 0.95rem; line-height: 1; padding: 0 0 0 5px; min-width: 16px;
}
.tag-removable button:hover { color: var(--danger); }
.tag-add {
  font-size: 0.8rem !important; padding: 5px 9px !important;
  border: 1px dashed var(--line-strong) !important; border-radius: 6px !important;
  background: transparent !important; width: 108px !important;
}

/* --- notes: rendered by default, click to edit in place -------------------- */

.notes-rendered {
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: text;
  transition: border-color 0.12s, background 0.12s;
  min-height: 3em;
}
.notes-rendered:hover { border-color: var(--line); background: var(--surface-sunk); }
.notes-rendered:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.notes-rendered.empty { color: var(--ink-faint); font-style: italic; }

/* Auto-expanding editor: JS sets height to scrollHeight, so no inner scroll. */
.notes-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem;
  line-height: 1.65;
  background: var(--surface);
  resize: none;
  overflow: hidden;
  min-height: 2.6em;
}
.save-row { margin-top: 10px; display: flex; align-items: center; gap: 10px; }

/* ⓘ markdown help — icon with a compact cheat-sheet tooltip on hover/focus */
.md-hint {
  position: relative;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  color: var(--ink-faint);
  cursor: help;
}
.md-hint:hover, .md-hint:focus-visible { color: var(--ink-soft); outline: none; }
.md-hint-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 45;
  display: none;
  flex-direction: column;
  gap: 5px;
  width: max-content;
  max-width: 240px;
  padding: 9px 11px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-sm);
  box-shadow: 0 10px 28px rgba(15, 20, 30, 0.28);
  font-size: 0.78rem;
  line-height: 1.3;
  cursor: default;
}
.md-hint:hover .md-hint-pop,
.md-hint:focus-within .md-hint-pop { display: flex; }
.md-hint-pop .cheat { display: flex; justify-content: space-between; gap: 14px; white-space: nowrap; }
.md-hint-pop .cheat-k { color: rgba(255, 255, 255, 0.55); }
.md-hint-pop code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 0 5px;
  border-radius: 4px;
}

/* --- rendered markdown ----------------------------------------------------- */

.md { font-size: 0.95rem; }
.md p { margin: 0 0 0.7em; }
.md h1, .md h2, .md h3 { line-height: 1.3; margin: 1.1em 0 0.4em; letter-spacing: -0.015em; }
.md h1 { font-size: 1.25rem; } .md h2 { font-size: 1.1rem; } .md h3 { font-size: 1rem; }
.md ul, .md ol { margin: 0 0 0.7em; padding-left: 1.35em; }
.md li { margin: 0.22em 0; }
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.87em; background: var(--bg); padding: 1.5px 5px; border-radius: 5px;
}
.md pre { background: var(--surface-sunk); border: 1px solid var(--line); padding: 13px; border-radius: var(--r-sm); overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md a { color: var(--accent); }
.md blockquote { margin: 0 0 0.7em; padding-left: 13px; border-left: 3px solid var(--line-strong); color: var(--ink-soft); }
.md :first-child { margin-top: 0; }
.md :last-child { margin-bottom: 0; }
.md-empty { color: var(--ink-faint); font-style: italic; font-size: 0.9rem; }

/* --- comments -------------------------------------------------------------- */

.comment-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.comment {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 15px;
}
.comment-head {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  font-size: 0.78rem; margin-bottom: 7px;
}
.comment-author { font-weight: 650; color: var(--ink-soft); font-size: 0.82rem; }
.comment-when { color: var(--ink-faint); }
.comment-form textarea {
  min-height: 2.6em; font-size: 0.94rem; resize: none; overflow: hidden;
}

/* --- dialogs --------------------------------------------------------------- */

dialog {
  width: min(92vw, 460px);
  border: none;
  border-radius: var(--r-lg);
  padding: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(15, 20, 30, 0.22);
}
dialog::backdrop { background: rgba(18, 22, 30, 0.42); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 6px; font-size: 1.15rem; letter-spacing: -0.015em; }
dialog form > h2 + label { margin-top: 18px; }
.dialog-note { margin: 0 0 4px; font-size: 0.82rem; color: var(--ink-faint); line-height: 1.45; }
dialog label { display: block; font-size: 0.8rem; font-weight: 600; margin: 14px 0 5px; }
.req { color: var(--danger); font-weight: 500; font-size: 0.75rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* --- misc ------------------------------------------------------------------ */

.muted { color: var(--ink-faint); font-weight: 400; }
.empty-state {
  text-align: center; color: var(--ink-faint); padding: 56px 16px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-md); font-size: 0.92rem;
}
.error { color: var(--danger); padding: 16px; text-align: center; font-size: 0.9rem; }
.spinner { text-align: center; color: var(--ink-faint); padding: 48px; font-size: 0.9rem; }
/* --- attachments (M3) ------------------------------------------------------ */

.attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.attach-item { position: relative; }
.attach-thumb {
  display: block;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-sunk);
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb:hover { border-color: var(--ink-faint); }
.attach-thumb:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Delete affordance — corner ×, always tappable, clearer on hover/focus */
.attach-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 20, 30, 0.18);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.attach-del:hover, .attach-del:focus-visible {
  outline: none;
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.attach-empty { color: var(--ink-faint); font-size: 0.82rem; margin-bottom: 12px; }

/* "Add image" — a button-styled <label> wrapping the hidden file input */
.attach-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.attach-add span { display: inline-flex; align-items: center; gap: 7px; }
.attach-add:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-sunk); }
.attach-add:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.attach-hint { margin: 8px 0 0; color: var(--ink-faint); font-size: 0.76rem; line-height: 1.4; }
.attach-progress { margin-top: 8px; color: var(--ink-soft); font-size: 0.8rem; }
.attach-progress[hidden] { display: none; }

/* Toast: brief confirmation of what was just attached */
.attach-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 360px);
  padding: 9px 14px 9px 10px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(15, 20, 30, 0.32);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.attach-toast.show { opacity: 1; transform: translate(-50%, 0); }
.attach-toast img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex: none;
}
.attach-toast span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-toast.error { background: var(--danger); }
