:root {
  --ink: #1c1b1a; --muted: #6e6a63; --faint: #a29d94; --line: #e6e1d8; --bg: #f6f4ef; --card: #fff;
  --accent: #ee5a12; --accent-d: #c94508; --accent-s: #fde9dc; --green: #1d8a57; --green-s: #e1f3ea;
  --red: #d2342a; --red-s: #fbe4e2; --blue: #2563eb; --blue-s: #e3ecfd; --amber: #b7791f; --amber-s: #fdf1dc;
  --r: 14px; --shadow: 0 1px 2px rgba(28, 27, 26, .06), 0 2px 10px rgba(28, 27, 26, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-d); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--faint); font-weight: 600; }
.hidden { display: none !important; }
.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; fill: currentColor; }

/* ---- shell */
.shell { max-width: 1180px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(76px + var(--safe-b)); }
.top { position: sticky; top: 0; z-index: 20; background: rgba(246, 244, 239, .94); backdrop-filter: blur(8px); padding: 12px 16px 8px; }
.top-row { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 19px; letter-spacing: -.01em; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand .logo .ico { width: 19px; height: 19px; }
.grow { flex: 1; }
.sync { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.sync.off .dot { background: var(--red); }
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 13px; font-size: 13.5px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip .n { color: var(--faint); font-weight: 600; font-size: 12px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.on .n { color: rgba(255, 255, 255, .6); }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; }
.chip.soft.on { background: var(--accent-s); color: var(--accent-d); border-color: #f6c7aa; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: var(--safe-b); }
.nav button { flex: 1; max-width: 200px; border: 0; background: none; padding: 9px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--faint); }
.nav button.on { color: var(--accent-d); }
.nav .ico { width: 23px; height: 23px; }

.fab { position: fixed; right: 18px; bottom: calc(86px + var(--safe-b)); z-index: 31; width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(238, 90, 18, .35); display: grid; place-items: center; }
.fab .ico { width: 28px; height: 28px; }

main { padding: 4px 16px 24px; }
.bar { display: flex; gap: 8px; align-items: center; margin: 6px 0 12px; flex-wrap: wrap; }
.search { flex: 1; min-width: 180px; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.search input { border: 0; outline: 0; background: none; padding: 10px 0; width: 100%; }
.search .ico { color: var(--faint); width: 18px; height: 18px; }
.seg { display: inline-flex; background: #ebe7df; border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 11px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.iconbtn { border: 1px solid var(--line); background: var(--card); border-radius: 11px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); flex: none; }
.iconbtn.on { color: var(--amber); border-color: #f2d49b; background: var(--amber-s); }

/* ---- idea cards */
.list { display: grid; gap: 10px; }
@media (min-width: 760px) { .list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .list { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 13px 14px; display: flex; gap: 12px; text-align: left; border: 0; width: 100%; position: relative; }
.card:active { transform: scale(.995); }
.thumb { width: 64px; height: 92px; border-radius: 10px; background: #efebe4 center/cover no-repeat; flex: none; display: grid; place-items: center; color: var(--faint); }
.thumb .ico { width: 26px; height: 26px; }
.cbody { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 650; background: var(--accent-s); color: var(--accent-d); white-space: nowrap; }
.pill.grey { background: #efebe4; color: var(--muted); }
.pill.green { background: var(--green-s); color: var(--green); }
.pill.blue { background: var(--blue-s); color: var(--blue); }
.pill.amber { background: var(--amber-s); color: var(--amber); }
.pill.red { background: var(--red-s); color: var(--red); }
.ctitle { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnote { color: var(--ink); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cinstr { color: var(--accent-d); font-size: 13.5px; font-weight: 550; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cfoot { display: flex; gap: 10px; color: var(--faint); font-size: 12.5px; margin-top: 2px; align-items: center; flex-wrap: wrap; }
.cfoot span { display: inline-flex; align-items: center; gap: 4px; }
.cfoot .ico { width: 15px; height: 15px; }
.star { position: absolute; top: 10px; right: 10px; color: var(--amber); }
.star .ico { width: 18px; height: 18px; }
.claude-said { background: var(--blue-s); color: #1e3a8a; border-radius: 9px; padding: 6px 9px; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { width: 64px; height: 64px; border-radius: 20px; background: var(--accent-s); color: var(--accent); display: grid; place-items: center; margin: 0 auto 14px; }
.empty .big .ico { width: 34px; height: 34px; }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 auto; max-width: 380px; font-size: 14px; }

/* ---- panel (detail) */
.panel-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(28, 27, 26, .38); display: flex; justify-content: flex-end; }
.panel { background: var(--bg); width: 100%; max-width: 640px; height: 100%; overflow-y: auto; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.ptop { position: sticky; top: 0; z-index: 2; background: rgba(246, 244, 239, .96); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ptop .title { font-weight: 700; font-size: 16px; }
.pbody { padding: 14px 16px 120px; display: grid; gap: 14px; }
.box { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; }
.box h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.box h4 .grow { flex: 1; }
label.f { display: grid; gap: 5px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
.in, textarea.in, select.in { width: 100%; border: 1px solid var(--line); background: #fbfaf7; border-radius: 11px; padding: 10px 12px; outline: 0; color: var(--ink); font-weight: 450; font-size: 15px; }
.in:focus { border-color: #f3b28c; background: #fff; box-shadow: 0 0 0 3px var(--accent-s); }
textarea.in { resize: vertical; min-height: 76px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 11px; padding: 9px 14px; font-weight: 650; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.btn .ico { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--red); }
.btn.rec { background: var(--red); border-color: var(--red); color: #fff; }
.btn:disabled { opacity: .5; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }
.reel { display: flex; gap: 12px; }
.reel .thumb { width: 96px; height: 170px; }
.reel .info { display: grid; gap: 4px; align-content: start; font-size: 14px; min-width: 0; }
.reel .creator { font-weight: 700; }
.reel .stats { color: var(--muted); font-size: 13px; }
.linkline { word-break: break-all; font-size: 13.5px; color: var(--muted); }
.sheet-img { width: 100%; border-radius: 10px; display: block; }
details summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.transcript { white-space: pre-wrap; font-size: 13.5px; color: var(--ink); background: #fbfaf7; border-radius: 10px; padding: 10px; margin-top: 6px; max-height: 260px; overflow: auto; }
.voice { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.voice audio { width: 100%; height: 38px; }
.voice .vt { font-size: 13.5px; color: var(--ink); }
.voice .vt.wait { color: var(--faint); font-style: italic; }
.voice .vh { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.media img, .media video { width: 100%; border-radius: 10px; display: block; background: #000; }
.thread { display: grid; gap: 8px; }
.msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { justify-self: end; background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
.msg.claude { justify-self: start; background: var(--blue-s); color: #172554; border-bottom-left-radius: 5px; }
.msg .who { font-size: 11px; font-weight: 700; opacity: .65; margin-bottom: 2px; }
.msg .at { font-size: 10.5px; opacity: .55; margin-top: 3px; }
.saved { font-size: 12px; color: var(--green); font-weight: 650; opacity: 0; transition: opacity .2s; }
.saved.show { opacity: 1; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--red); }

/* ---- channels / settings */
.clist { display: grid; gap: 8px; }
@media (min-width: 760px) { .clist { grid-template-columns: repeat(2, 1fr); } }
.ch { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; display: flex; gap: 12px; align-items: center; border: 0; text-align: left; width: 100%; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--accent-s); color: var(--accent-d); display: grid; place-items: center; font-weight: 750; font-size: 16px; flex: none; text-transform: uppercase; }
.ch .t { font-weight: 650; }
.ch .s { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.settings { display: grid; gap: 14px; max-width: 720px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0ece5; }
.srow:last-child { border-bottom: 0; }
.srow .t { font-weight: 600; }
.srow .s { font-size: 12.5px; color: var(--muted); }
.swatch { width: 26px; height: 26px; border-radius: 8px; border: 0; flex: none; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d9d4cb; border-radius: 999px; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.help { font-size: 13.5px; color: var(--muted); }
.help ol { padding-left: 20px; margin: 6px 0; }
.help li { margin: 3px 0; }

/* ---- modal + login + toast */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(28, 27, 26, .42); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal-wrap { align-items: center; } }
.modal { background: var(--card); width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); display: grid; gap: 12px; max-height: 92vh; overflow-y: auto; animation: up .18s ease-out; }
@media (min-width: 640px) { .modal { border-radius: 20px; } }
@keyframes up { from { transform: translateY(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0; font-size: 17px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.checks { display: flex; gap: 7px; flex-wrap: wrap; }
.login { max-width: 380px; margin: 14vh auto 0; padding: 0 20px; display: grid; gap: 14px; text-align: center; }
.login .brand { justify-content: center; font-size: 24px; }
.login .brand .logo { width: 40px; height: 40px; border-radius: 12px; }
.login p { color: var(--muted); margin: 0; font-size: 14px; }
.err { color: var(--red); font-size: 13.5px; font-weight: 600; }
#toast { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%) translateY(10px); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }

@media (min-width: 900px) {
  .nav { position: static; border: 0; background: none; justify-content: flex-start; gap: 4px; padding: 12px 16px 0; }
  .nav button { flex: none; flex-direction: row; gap: 7px; font-size: 14px; padding: 8px 14px; border-radius: 10px; }
  .nav button.on { background: var(--card); box-shadow: var(--shadow); }
  .nav .ico { width: 19px; height: 19px; }
  .shell { padding-bottom: 40px; }
  .fab { bottom: 28px; right: 28px; }
}
