/* Summi — own calm design system. Warm stone neutrals + one sage accent, follows the phone's dark mode.
   Teammates: Mira = muted terracotta, Arjun = muted slate-blue. */
:root {
  /* Calm palette: warm stone neutrals + one sage accent. Colour comes from the content (photos), not the chrome. */
  --bg: #f5f3ef; --bg2: #ebe8e2; --card: #fcfbf9; --ink: #2e2c29; --ink2: #5c5852; --muted: #8f8a82; --line: #e6e2da;
  --brand: #5f7d6e; --brand2: #7d998b; --brand-ink: #ffffff; --soft: #e6ede8;
  --ok: #5f7d6e; --okbg: #e6ede8; --warn: #8a6a3a; --warnbg: #f3eadb; --bad: #a65a52; --badbg: #f5e6e3;
  --mira: #b9785e; --mirabg: #f3e7e1; --arjun: #5a7f95; --arjunbg: #e3ebf0;
  --radius: 20px; --radius-sm: 14px;
  --shadow: none;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141615; --bg2: #1f2220; --card: #1a1d1b; --ink: #e8eae6; --ink2: #b8bdb7; --muted: #868d87; --line: #2a2e2b;
    --brand: #8fb3a0; --brand2: #a9c6b6; --brand-ink: #141615; --soft: #22302a;
    --ok: #8fb3a0; --okbg: #22302a; --warn: #d2b07c; --warnbg: #2e2719; --bad: #d39189; --badbg: #33201e;
    --mira: #d09a82; --mirabg: #33251f; --arjun: #8fb0c4; --arjunbg: #1f2a31;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

/* ---- top bar ---- */
.topbar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; letter-spacing: -.02em; margin-right: auto; }
.brand img { border-radius: 9px; }
#bizSelect { max-width: 46%; padding: 7px 30px 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-weight: 500; font-size: 13px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.iconbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center;
  cursor: pointer; font-size: 17px; color: var(--ink2); }
.iconbtn.on { background: var(--soft); color: var(--brand); border-color: transparent; }
.banner { margin: 0 16px 2px; padding: 2px 0; background: none; color: var(--muted); font-size: 12px; font-weight: 500; text-align: center; }
.banner::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-right: 6px; vertical-align: 1px; opacity: .7; }

main { max-width: 720px; margin: 0 auto; padding: 8px 16px 24px; outline: none; }
h1 { font-size: 26px; line-height: 1.25; letter-spacing: -.025em; margin: 8px 0 4px; font-weight: 600; }
h2 { font-size: 13px; margin: 30px 0 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sub { color: var(--ink2); margin: 0 0 14px; }

/* ---- bottom tabs ---- */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tabs button { border: 0; background: none; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 14px; }
.tabs button .ic { font-size: 19px; line-height: 1.15; }
.tabs button.on { color: var(--brand); }
.tabs button.on .ic { transform: translateY(-1px); }

/* ---- surfaces ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- buttons ---- */
.btn { border: 1px solid transparent; background: var(--bg2); padding: 10px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink); transition: transform .08s ease, background .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ok { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.danger { background: transparent; color: var(--muted); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: progress; }

/* ---- forms ---- */
label { display: block; font-weight: 700; font-size: 13px; margin: 12px 0 6px; color: var(--ink2); }
input[type=text], input[type=url], input[type=number], input[type=password], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--soft); }
textarea { min-height: 90px; resize: vertical; }

/* ---- pills / chips ---- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg2); color: var(--ink2); }
.pill.mira { background: var(--mirabg); color: var(--mira); }
.pill.arjun { background: var(--arjunbg); color: var(--arjun); }
.pill.warn { background: var(--warnbg); color: var(--warn); }
.pill.bad { background: var(--badbg); color: var(--bad); }
.pill.ok { background: var(--okbg); color: var(--ok); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--ink2); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--soft); color: var(--brand); border-color: transparent; font-weight: 600; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg2); border-radius: 999px; padding: 4px; margin: 6px 0 14px; }
.seg button { border: 0; background: none; padding: 9px 6px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); }

/* ---- avatars ---- */
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; flex: none; font-size: 15px; }
.av.sm { width: 30px; height: 30px; font-size: 12px; }
.av.m { background: var(--mirabg); color: var(--mira); }
.av.a { background: var(--arjunbg); color: var(--arjun); }
.av.y { background: var(--soft); color: var(--brand); }
.av.s { background: var(--bg2); color: var(--ink2); }
.av.l { background: var(--bg2); color: var(--ink2); }

/* ---- home ---- */
.hero { padding: 6px 2px 4px; margin: 4px 0 14px; }
.hero .date { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hero h1 { font-size: 30px; margin: 4px 0 2px; }
.hero p { margin: 0; color: var(--ink2); }
.mates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.mate { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px; display: flex; gap: 10px; align-items: center; text-align: left; color: var(--ink); cursor: pointer; }
.mate b { display: block; font-size: 14px; font-weight: 600; }
.mate span { font-size: 12px; color: var(--muted); line-height: 1.3; display: block; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 8px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.stat span { font-size: 11.5px; color: var(--muted); font-weight: 500; line-height: 1.2; display: block; }
.count { background: var(--bg2); color: var(--ink2); letter-spacing: 0; text-transform: none; font-size: 12px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; }
.askbar { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 10px 10px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; text-align: left; color: var(--muted); font-weight: 500; margin-top: 14px; }
.askbar .go { margin-left: auto; background: var(--brand); color: var(--brand-ink); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.empty { text-align: center; padding: 22px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 2px; }

/* feed */
.feed { position: relative; }
.fitem { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.fitem:first-child { border-top: 0; padding-top: 2px; }
.fitem .who { font-weight: 600; }
.fitem .when { font-size: 12px; color: var(--muted); }
.cardhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cardhead .t { line-height: 1.25; }
.cardhead .t b { display: block; font-size: 14px; font-weight: 600; }
.cardhead .t span { font-size: 12.5px; color: var(--muted); }
.cardhead .right { margin-left: auto; }
.quote { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; color: var(--ink2); margin-bottom: 8px; }
.upnext { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.upnext::-webkit-scrollbar { display: none; }
.thumb { flex: none; width: 128px; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.thumb canvas { width: 128px; height: 128px; border-radius: 14px; display: block; }
.thumb b { display: block; font-size: 12.5px; margin-top: 6px; line-height: 1.25; }
.thumb span { font-size: 11.5px; color: var(--muted); }

/* ---- content tab ---- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 4px 0 14px; }
.wday { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 8px 0 6px; text-align: center; cursor: pointer; }
.wday small { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.wday b { display: block; font-size: 17px; font-weight: 600; }
.wday i { display: block; height: 6px; }
.wday i::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.wday.has i::after { background: var(--brand); }
.wday.today { border-color: var(--brand); }
.wday.on { background: var(--soft); color: var(--brand); border-color: var(--brand); }
.wday.on small { color: var(--brand); }
.plan-item { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.plan-item:first-of-type { border-top: 0; }
.day { background: var(--soft); color: var(--brand); border-radius: 12px; text-align: center; font-weight: 600; padding: 6px 0; font-size: 12px; line-height: 1.2; }
.day b { display: block; font-size: 18px; }
canvas.post { width: 100%; max-width: 420px; aspect-ratio: 1; border-radius: 16px; display: block; margin: 4px 0 10px; }
.caption { white-space: pre-wrap; background: var(--bg); border-radius: var(--radius-sm); padding: 12px; font-size: 14px; color: var(--ink2); }
details.more { margin-top: 8px; }
details.more summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--brand); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
pre.box { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: 10px; font: 13px/1.4 ui-monospace, monospace; overflow-x: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---- leads & chat ---- */
.list .item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.list .item .body { flex: 1; min-width: 0; }
.list .item .last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score { width: 44px; text-align: center; flex: none; }
.score b { display: block; font-size: 15px; font-weight: 600; }
.score i { display: block; height: 4px; border-radius: 4px; background: var(--bg2); overflow: hidden; margin-top: 4px; }
.score i::after { content: ""; display: block; height: 100%; width: var(--w, 0%); background: var(--brand); }
.chat { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.bubble { max-width: 85%; padding: 9px 13px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; box-shadow: var(--shadow); }
.bubble.in { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.out { align-self: flex-end; background: var(--soft); color: var(--ink); border-bottom-right-radius: 6px; }
.bubble.draft { align-self: flex-end; background: var(--soft); border: 1px dashed var(--brand); color: var(--ink); }
.bubble.failed, .bubble.rejected { opacity: .6; text-decoration: line-through; }
.bubble .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.bubble.out .meta { color: var(--muted); }
.composer { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; gap: 8px; background: var(--bg); padding: 8px 0; }
.composer input { flex: 1; border-radius: 999px; padding-left: 18px; background: var(--card); }

/* ---- team chat ---- */
.teamhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.avs { display: flex; }
.avs .av + .av { margin-left: -10px; border: 2px solid var(--bg); }
.avs .av:first-child { border: 2px solid var(--bg); }
.tmsg { display: flex; gap: 8px; align-items: flex-end; }
.tmsg.owner { justify-content: flex-end; }
.tmsg .tb { max-width: 84%; padding: 10px 14px; border-radius: 20px; border-bottom-left-radius: 6px; white-space: pre-wrap; word-wrap: break-word; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tmsg.owner .tb { background: var(--soft); color: var(--ink); border-color: transparent; border-radius: 20px; border-bottom-right-radius: 6px; }
.tmsg .who { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.tmsg .who.mira { color: var(--mira); } .tmsg .who.arjun { color: var(--arjun); }
.result { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; }
.result b { display: block; margin-bottom: 2px; }
.composer .mic { width: 46px; padding: 0; font-size: 18px; }
.composer .mic.on { background: var(--bad); color: #fff; border-color: var(--bad); }
.typing { color: var(--muted); font-size: 13px; padding: 4px 38px; }
.rule { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.rule:first-of-type { border-top: 0; }
.rule.dim { opacity: .55; }

/* ---- misc ---- */
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: 999px; z-index: 20; max-width: calc(100% - 32px); font-weight: 600; font-size: 14px; box-shadow: var(--shadow); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { max-width: 360px; margin: 18vh auto; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.toggle:first-of-type { border-top: 0; }
.toggle input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.toggle input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.toggle input[type=checkbox]:checked { background: var(--brand); border-color: var(--brand); }
.toggle input[type=checkbox]:checked::after { left: 21px; }
@media (max-width: 380px) { .stats { grid-template-columns: repeat(2, 1fr); } h1 { font-size: 23px; } }
.pill { white-space: nowrap; }
.cardhead .t { flex: 1; min-width: 0; }
.cardhead .right { flex: none; }
