/* Furrever Collab — ukiyo-e washi + indigo + vermillion. Buildless, no framework.
   Calm by design: the opposite of the WhatsApp firehose. */
@import url('https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@500;600;700&family=Zen+Kaku+Gothic+New:wght@400;500;700&display=swap');

:root {
  --paper: #ece4d3;
  --paper-2: #e3d9c4;
  --card: #faf6eb;
  --ink: #1a1a18;
  --ink-soft: #544c40;
  --muted: #8a8170;
  --indigo: #2b3a55;
  --indigo-2: #3a4d72;
  --indigo-deep: #1f2c44;
  --vermillion: #b6543a;
  --vermillion-2: #a04531;
  --line: #ddd2bb;
  --good: #3f7d54;
  --warn: #b07c2e;
  --shadow: 0 1px 2px rgba(26,26,24,.06), 0 6px 18px rgba(26,26,24,.07);
  --radius: 12px;
  --side-w: 212px;
  --bar-h: 52px;
}
* { box-sizing: border-box; }

/* ---- Boot splash ---- */
.boot { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: radial-gradient(120% 80% at 50% -10%, var(--paper-2), var(--paper)); }
.boot.hidden { display: none; }
.boot .seal { width: 56px; height: 56px; border-radius: 12px; background: var(--vermillion); color: #fff; display: grid; place-items: center; font-family: 'Shippori Mincho', serif; font-weight: 700; font-size: 30px; box-shadow: var(--shadow); }
.boot-text { color: var(--ink-soft); font-size: 13px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--indigo); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Zen Kaku Gothic New', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Shippori Mincho', Georgia, serif; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
.hidden { display: none !important; }

/* ---- Login ---- */
.login-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 80% at 50% -10%, var(--paper-2), var(--paper));
}
.login-card {
  width: min(380px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px; text-align: center;
}
.seal {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 12px;
  background: var(--vermillion); color: #fff; display: grid; place-items: center;
  font-family: 'Shippori Mincho', serif; font-weight: 700; font-size: 30px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 4px 0 2px; font-size: 22px; color: var(--indigo); }
.login-card p.sub { margin: 0 0 20px; color: var(--ink-soft); font-size: 13px; }
.field { text-align: left; margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.field input {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font-size: 16px;
}
.field input:focus { outline: 2px solid var(--indigo-2); border-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border: 1px solid transparent; border-radius: 9px;
  background: var(--indigo); color: #fff; font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--indigo-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--indigo); border-color: var(--line); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--vermillion); border-color: var(--line); }
.btn.danger:hover { background: #f7ece8; }
.error { color: var(--vermillion); font-size: 13px; min-height: 18px; margin: 4px 0 0; }

/* ---- App shell ---- */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 12px; height: var(--bar-h); padding: 0 16px;
  background: var(--indigo); color: #fff; position: sticky; top: 0; z-index: 30;
}
.hamburger { display: none; background: transparent; border: 0; color: #fff; font-size: 22px; padding: 4px 6px; margin-left: -4px; }
.topbar .brand { display: flex; align-items: center; gap: 9px; font-family: 'Shippori Mincho', serif; font-weight: 700; }
.topbar .brand .dot {
  width: 28px; height: 28px; border-radius: 7px; background: var(--vermillion);
  display: grid; place-items: center; font-size: 16px; font-family: 'Shippori Mincho', serif;
}
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; opacity: .9; }
.topbar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.12); }

.shell { display: flex; flex: 1; min-height: 0; position: relative; }
.scrim { display: none; }

.sidebar {
  width: var(--side-w); flex: 0 0 var(--side-w); background: var(--paper-2);
  border-right: 1px solid var(--line); padding: 12px 10px; overflow-y: auto;
  position: sticky; top: var(--bar-h); height: calc(100dvh - var(--bar-h));
}
.nav-close { display: none; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 14px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 10px 11px; border-radius: 9px;
  color: var(--ink-soft); font-weight: 600; font-size: 14px; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(43,58,85,.08); }
.nav-item.active { background: var(--indigo); color: #fff; }
.nav-ico { width: 19px; height: 19px; flex: 0 0 19px; color: var(--vermillion); }
.nav-item.active .nav-ico { color: #fff; }
.badge {
  margin-left: auto; min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 18px;
  text-align: center; border-radius: 9px; background: var(--vermillion); color: #fff;
}

main { flex: 1; min-width: 0; padding: 20px; max-width: 940px; }
.panel { display: none; }
.panel.active { display: block; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.panel h2 { margin: 2px 0; color: var(--indigo); font-size: 20px; }
.panel .lede { color: var(--ink-soft); font-size: 13px; margin: 4px 0 16px; max-width: 900px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px;
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 12px; }
textarea, input.text, select.text {
  width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 64px; }
input.text:focus, textarea:focus, select.text:focus { outline: 2px solid var(--indigo-2); border-color: transparent; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid var(--line); color: var(--ink-soft); background: #fff; }
.pill.todo { color: var(--ink-soft); }
.pill.in_progress, .pill.doing { color: var(--indigo-2); border-color: #c4cee2; background: #eef2fb; }
.pill.done { color: var(--good); border-color: #cfe3d6; background: #eef6f0; }
.pill.blocked { color: var(--vermillion); border-color: #eccdc6; background: #fbeeeb; }

/* ---- Stages ---- */
.stage-group { margin-bottom: 14px; }
.stage-head { display: flex; align-items: center; gap: 8px; width: 100%; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; color: var(--ink); position: sticky; top: var(--bar-h); z-index: 6; box-shadow: 0 2px 6px rgba(26,26,24,.05); }
.todo.editing { border-color: var(--indigo-2); box-shadow: 0 0 0 2px rgba(58,77,114,.15); }
.stage-head strong { font-family: 'Shippori Mincho', serif; }
.stage-head .chev { color: var(--vermillion); }
.stage-head .muted { margin-left: auto; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .body { flex: 1; }
.step h3 { margin: 0 0 3px; font-size: 15px; }
.step p { margin: 0; color: var(--ink-soft); font-size: 13px; white-space: pre-wrap; }

/* ---- Chat (WhatsApp-style) ---- */
.chat-card { padding: 10px; }
.chat-log { display: flex; flex-direction: column; gap: 6px; max-height: 58vh; overflow-y: auto; padding: 6px; background: var(--paper); border-radius: 10px; }
.day-sep { text-align: center; margin: 8px 0 4px; }
.day-sep span { background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-soft); font-size: 11px; padding: 2px 10px; border-radius: 20px; }
.msg { max-width: 80%; align-self: flex-start; padding: 7px 10px 4px; border-radius: 12px; background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 1px rgba(26,26,24,.04); }
.msg.mine { align-self: flex-end; background: #e7ecf6; border-color: #d3dcec; }
.msg .meta { font-size: 11px; font-weight: 700; color: var(--indigo); margin-bottom: 2px; }
.msg .text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: 14px; }
.msg .stamp { font-size: 10px; color: var(--muted); text-align: right; margin-top: 2px; }
.chat-img { max-width: min(240px, 60vw); border-radius: 8px; display: block; margin-bottom: 4px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13px; margin-bottom: 4px; }
.attach-preview { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 8px; margin-top: 8px; background: var(--paper-2); border-radius: 8px; }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.chat-compose textarea { min-height: 44px; }
.clip { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 18px; cursor: pointer; flex: 0 0 auto; }
.clip:hover { background: var(--paper-2); }

/* ---- Board (to-dos) ---- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.col h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 2px 4px 8px; font-family: inherit; }
.todo { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; box-shadow: var(--shadow); margin-bottom: 8px; }
.todo h4 { margin: 0 0 4px; font-size: 14px; font-family: inherit; }
.todo p { margin: 0 0 8px; color: var(--ink-soft); font-size: 12px; white-space: pre-wrap; }
.todo .foot { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.avatar { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--indigo-2); }
.avatar.john { background: var(--vermillion); }
.avatar.none { background: #b9b3a3; }

/* ---- Ideas ---- */
.idea { border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 0 10px 10px 0; padding: 10px 12px; }
.idea.triaged { opacity: .6; border-left-color: var(--good); }
.idea .text { white-space: pre-wrap; }

/* ---- Previews / Products / Files grid ---- */
.previews-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.preview img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--paper-2); }
.preview h3 { margin: 8px 0 2px; font-size: 15px; }
.preview .desc { color: var(--ink-soft); font-size: 13px; margin: 0 0 8px; white-space: pre-wrap; }
.prod-noimg, .file-tile { display: grid; place-items: center; width: 100%; height: 120px; border-radius: 8px; border: 1px dashed var(--line); background: var(--paper-2); font-size: 16px; font-weight: 600; color: var(--indigo); text-decoration: none; cursor: pointer; gap: 6px; }
.prod-noimg { font-size: 40px; }
.file-tile:hover { background: var(--paper); }
.comments { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.comment { font-size: 13px; margin-bottom: 6px; }
.comment .meta { font-size: 11px; color: var(--muted); }
.comment-compose { display: flex; gap: 6px; margin-top: 6px; }

/* ---- Finance ---- */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.subnav button { border: 1px solid var(--line); background: #fff; color: var(--ink-soft); padding: 8px 12px; border-radius: 20px; font-weight: 600; font-size: 13px; }
.subnav button.active { background: var(--indigo); color: #fff; border-color: transparent; }
.fin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.fin-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.fin-card span { color: var(--muted); font-size: 12px; }
.fin-card strong { font-family: 'Shippori Mincho', serif; font-size: 24px; color: var(--indigo); }
.fin-card.good { border-color: #cfe3d6; } .fin-card.good strong { color: var(--good); }
.fin-card.bad { border-color: #eccdc6; } .fin-card.bad strong { color: var(--vermillion); }
.ftable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ftable th { text-align: left; color: var(--ink-soft); font-weight: 600; padding: 6px 8px; font-family: inherit; }
.ftable td { padding: 6px 8px; }
.ftable.list tr + tr { border-top: 1px solid var(--line); }
.ftable.list tr:first-child th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ftable .emph th, .ftable .emph td { font-weight: 700; border-top: 2px solid var(--line); }
.ftable .struck td { text-decoration: line-through; color: var(--muted); }
.amtwrap { display: inline-flex; align-items: center; gap: 2px; }
.ftable .amt { width: 78px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.ftable td input[type="text"], .ftable td select { padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 13px; width: auto; max-width: 140px; }
.ftable input:focus, .ftable select:focus { outline: 2px solid var(--indigo-2); border-color: transparent; }
.ftable.list td { vertical-align: middle; }
.ftable .rowact { display: flex; gap: 4px; white-space: nowrap; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; color: #fff; }
.chip.ch-site { background: var(--indigo); }
.chip.ch-etsy { background: var(--vermillion); }
.chip.ch-both { background: var(--warn); }

/* ---- Home ---- */
.home-hero h2 { font-size: 24px; color: var(--indigo); margin: 4px 0 2px; }
.home-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.home-chips button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; padding: 8px 13px; border-radius: 20px; font-weight: 600; font-size: 13px; color: var(--ink-soft); }
.home-chips button:hover { background: var(--paper-2); }
.ico { width: 18px; height: 18px; flex: 0 0 18px; color: var(--vermillion); }
.feed-title { color: var(--indigo); font-size: 16px; margin: 18px 0 10px; }
.feed-item { display: flex; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; align-items: flex-start; }
.feed-item:hover { border-color: var(--indigo-2); }
.feed-icon { display: flex; align-items: center; color: var(--vermillion); padding-top: 1px; }
.feed-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.feed-meta { font-size: 11px; color: var(--muted); }
.feed-text { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Mobile footer bar (next action + menu) ---- */
.footbar { display: none; }
@media (max-width: 820px) {
  .footbar {
    display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: var(--indigo); box-shadow: 0 -2px 10px rgba(26,26,24,.18);
  }
  .foot-next {
    flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
    background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 11px;
    padding: 8px 13px; text-align: left; overflow: hidden; min-width: 0;
  }
  .foot-label { font-size: 9px; letter-spacing: .14em; opacity: .75; }
  .foot-next-text { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 64vw; }
  .foot-menu {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    background: var(--vermillion); color: #fff; border: 0; border-radius: 11px; padding: 6px 16px;
  }
  .foot-menu-ico { font-size: 18px; line-height: 1; }
  .foot-menu span:last-child { font-size: 10px; }
  main { padding-bottom: 84px; } /* clear the fixed footer */
}

.empty { text-align: center; color: var(--ink-soft); padding: 28px; font-size: 14px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13px; box-shadow: var(--shadow); z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ============ MOBILE ============ */
@media (max-width: 820px) {
  .hamburger { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: 252px; flex-basis: 252px;
    transform: translateX(-100%); transition: transform .22s ease; z-index: 50;
    padding-top: calc(var(--bar-h) + 8px); box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-close { display: flex; align-items: center; gap: 6px; width: 100%; justify-content: center; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); font-weight: 600; padding: 9px; border-radius: 9px; margin-bottom: 6px; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(26,26,24,.42); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  main { max-width: none; }
}

@media (max-width: 560px) {
  main { padding: 14px 12px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .brand { font-size: 15px; }
  .topbar .who { display: none; }
  .panel h2 { font-size: 18px; }
  .panel .lede { font-size: 12px; }

  .board { grid-template-columns: 1fr; }
  .previews-grid { grid-template-columns: 1fr; }

  /* stages: stack pill, body, controls */
  .step { flex-direction: column; }
  .step .body { width: 100%; }
  .step > .stack { flex-direction: row; align-self: stretch; align-items: center; }
  .step > .stack select { flex: 1; }

  /* to-do footer wraps */
  .todo .foot { flex-wrap: wrap; gap: 8px; }
  .todo .foot > .row:first-child { flex: 1 1 100%; }

  .chat-log { max-height: 62vh; }
  .msg { max-width: 88%; }
  .fin-card strong { font-size: 20px; }
  .ftable { font-size: 13px; }

  /* 16px inputs prevent iOS zoom-on-focus */
  input.text, textarea, select.text, .field input { font-size: 16px; }
  .btn.sm { padding: 8px 12px; }
}

@supports (padding: max(0px)) {
  .topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  main { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
