/* Chrome Peach: an iOS-native look. System type, grouped lists, translucent bars, Messages-style bubbles. */
:root {
  --bg: #FFFFFF;          /* lists and conversations */
  --grouped: #F2F2F7;     /* settings background */
  --sheet: #FFFFFF;       /* cards and grouped rows */
  --fill: #E9E9EB;        /* employee bubbles, quiet buttons */
  --field: #FFFFFF;
  --text: #000000;
  --muted: #8A8A8E;
  --line: rgba(60, 60, 67, .22);
  --accent: #E0623F;      /* chrome peach */
  --accent-2: #F28A62;
  --on-accent: #FFFFFF;
  --ok: #248A3D;
  --bad: #D70015;
  --bar: rgba(249, 249, 249, .82);
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 20px rgba(0, 0, 0, .06);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", system-ui, "Helvetica Neue", Arial, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --grouped: #000000; --sheet: #1C1C1E; --fill: #26252A; --field: #1C1C1E;
    --text: #FFFFFF; --muted: #8D8D93; --line: rgba(84, 84, 88, .55);
    --accent: #FF7A55; --accent-2: #FF9A78; --ok: #30D158; --bad: #FF453A;
    --bar: rgba(22, 22, 24, .78); --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --grouped: #000000; --sheet: #1C1C1E; --fill: #26252A; --field: #1C1C1E;
  --text: #FFFFFF; --muted: #8D8D93; --line: rgba(84, 84, 88, .55);
  --accent: #FF7A55; --accent-2: #FF9A78; --ok: #30D158; --bad: #FF453A;
  --bar: rgba(22, 22, 24, .78); --shadow: none;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 17px/1.29 var(--sans); letter-spacing: -.41px; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
#app { height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; background: var(--bg); }

/* ---------- Avatars: contact-style circles ---------- */
.av {
  flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font: 600 22px/1 var(--rounded); letter-spacing: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c, #8E8E93) 62%, #fff), var(--c, #8E8E93));
}
.av.sm { width: 34px; height: 34px; font-size: 15px; }
.av.lg { width: 72px; height: 72px; font-size: 30px; }
.av[data-a="strategy"] { background: conic-gradient(from 210deg, #A86A44 0 33%, #8F8A52 0 67%, #C9683F 0); }
.av[data-a="campaign"] { background: conic-gradient(from 210deg, #3F6B5C 0 17%, #7A5A9E 0 34%, #8F8A52 0 50%, #B0475A 0 67%, #2F7A96 0 84%, #C9683F 0); }
.av[data-a="creative"] { background: conic-gradient(from 210deg, #B0475A 0 33%, #2F7A96 0 67%, #7A5A9E 0); }
.av[data-a="campaign"], .av[data-a="creative"], .av[data-a="strategy"] { color: transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.av.off { filter: grayscale(1) opacity(.45); }

/* ---------- Bars ---------- */
.bar {
  position: sticky; top: 0; z-index: 3;
  padding: calc(var(--safe-top) + 6px) 16px 6px;
  background: var(--bar);
  backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: .5px solid var(--line);
  display: flex; align-items: center; gap: 12px; min-height: 44px;
}
.bar.large { border-bottom-color: transparent; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
.bar .grow { flex: 1; min-width: 0; }
.iconbtn { border: 0; background: none; padding: 8px; margin: -8px; color: var(--accent); display: inline-flex; }
.iconbtn svg { width: 25px; height: 25px; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); text-decoration: none; margin-left: -8px; padding: 6px 4px; font-size: 17px; }
.back svg { width: 24px; height: 24px; }

.scroll { flex: 1; overflow-y: auto; }
.largetitle { font: 700 34px/1.2 var(--display); letter-spacing: .37px; margin: 2px 16px 8px; }

/* ---------- Thread list ---------- */
.list { list-style: none; margin: 0; padding: 0 0 calc(var(--safe-bottom) + 24px); }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 16px 10px 4px; text-decoration: none; position: relative; }
.row::after { content: ""; position: absolute; bottom: 0; left: 80px; right: 0; border-bottom: .5px solid var(--line); }
.list li:last-child .row::after { display: none; }
.row:active { background: var(--fill); }
.row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: transparent; margin-right: -2px; }
.row.unread .dot { background: var(--accent); }
.row .who { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row .name { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .title { color: var(--muted); font-size: 13px; letter-spacing: -.08px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .when { margin-left: auto; color: var(--muted); font-size: 15px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.row .when svg { width: 14px; height: 14px; opacity: .55; }
.row .preview { color: var(--muted); font-size: 15px; letter-spacing: -.24px; margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill { white-space: nowrap; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); margin-right: 4px; }
.row.off .name, .row.off .preview { opacity: .5; }

/* ---------- Conversation ---------- */
.bar.thread { display: grid; grid-template-columns: 72px 1fr 72px; padding-top: calc(var(--safe-top) + 4px); padding-bottom: 6px; }
.bar.thread .spacer { width: 1px; }
.convo-head { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.convo-head .name { font-size: 11px; letter-spacing: .07px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.convo-head .title { display: none; }
.feed { flex: 1; overflow-y: auto; padding: 10px 14px 8px; display: flex; flex-direction: column; gap: 3px; }
.day { align-self: center; color: var(--muted); font-size: 11px; font-weight: 500; margin: 14px 0 6px; }
.msg { max-width: 76%; padding: 7px 12px 8px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; }
.msg.wis { align-self: flex-end; color: var(--on-accent); background: linear-gradient(180deg, var(--accent-2), var(--accent)); background-attachment: fixed; border-bottom-right-radius: 5px; }
.msg.agent { align-self: flex-start; background: var(--fill); border-bottom-left-radius: 5px; }
.msg.note { align-self: center; max-width: 86%; background: none; color: var(--muted); font-size: 13px; text-align: center; padding: 4px 8px; }
.msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.from { font-size: 11px; color: var(--muted); margin: 10px 0 1px 12px; }

.typing { align-self: flex-start; background: var(--fill); border-radius: 18px; padding: 12px 14px; display: flex; gap: 4px; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; opacity: .6; } }

/* ---------- Approval card ---------- */
.card {
  align-self: flex-start; width: min(90%, 420px); margin: 6px 0;
  background: var(--sheet); border-radius: 20px; padding: 14px 16px 16px; box-shadow: var(--shadow);
  border: .5px solid var(--line);
}
.card h4 { margin: 0 0 10px; font-size: 17px; font-weight: 600; }
.card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; letter-spacing: -.24px; }
.card dt { color: var(--muted); }
.card dd { margin: 0; overflow-wrap: anywhere; }
.card .body { margin-top: 12px; font-size: 15px; letter-spacing: -.24px; white-space: pre-wrap; max-height: 260px; overflow: auto; border-top: .5px solid var(--line); padding-top: 12px; }
.card .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.btn { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 600; font-size: 15px; text-align: center; display: inline-block; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.quiet { background: var(--fill); color: var(--accent); }
.btn:disabled { opacity: .45; }
.card .status { margin-top: 12px; font-size: 15px; font-weight: 600; }
.card .status.approved { color: var(--ok); }
.card .status.declined, .card .status.failed { color: var(--bad); }

/* ---------- Composer ---------- */
.composer {
  padding: 6px 10px calc(var(--safe-bottom) + 6px);
  background: var(--bar); border-top: .5px solid var(--line);
  backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px);
}
.field { display: flex; align-items: flex-end; gap: 4px; border: 1px solid var(--line); background: var(--field); border-radius: 20px; padding: 3px 3px 3px 12px; }
.field textarea { flex: 1; resize: none; border: 0; background: transparent; padding: 5px 0; min-height: 30px; max-height: 140px; line-height: 1.25; outline: none; }
.field textarea::placeholder { color: var(--muted); }
.send, .mic { width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none; }
.send { background: var(--accent); color: var(--on-accent); }
.send svg { width: 17px; height: 17px; }
.send:disabled { display: none; }
.mic { background: transparent; color: var(--muted); }
.mic svg { width: 21px; height: 21px; }
.composer.has-text .mic:not(.recording):not(.busy) { display: none; }
.mic.recording { width: auto; border-radius: 15px; padding: 0 10px 0 8px; display: flex; gap: 5px; background: var(--bad); color: #fff; }
.mic.recording svg { width: 14px; height: 14px; }
.mic.recording .timer { font-size: 14px; font-variant-numeric: tabular-nums; }
.mic.busy { opacity: .45; }
.offnote { text-align: center; color: var(--muted); font-size: 15px; padding: 14px 16px calc(var(--safe-bottom) + 14px); border-top: .5px solid var(--line); }

/* ---------- Settings ---------- */
body:has(.page) #app, body:has(.page) { background: var(--grouped); }
.bar.large:has(+ .page) { background: var(--grouped); }
.page { flex: 1; overflow-y: auto; padding: 0 16px calc(var(--safe-bottom) + 32px); background: var(--grouped); }
.page .largetitle { margin: 2px 0 16px; }
.group { background: var(--sheet); border-radius: 10px; margin: 0 0 30px; overflow: hidden; }
.item { padding: 11px 16px; min-height: 44px; display: flex; align-items: center; gap: 12px; position: relative; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--line); }
.item .grow { flex: 1; min-width: 0; }
.item .sub { color: var(--muted); font-size: 13px; letter-spacing: -.08px; margin-top: 2px; overflow-wrap: anywhere; }
.item .btn { padding: 6px 14px; border-radius: 999px; font-size: 15px; }
.group-label { font-size: 13px; letter-spacing: -.08px; text-transform: uppercase; color: var(--muted); margin: 0 0 7px 16px; }
.note-row .del { border: 0; background: none; color: var(--bad); font-size: 15px; }

/* ---------- Sign in ---------- */
.signin { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 32px 28px calc(var(--safe-bottom) + 48px); gap: 14px; }
.signin .appicon { width: 96px; height: 96px; border-radius: 22.5%; box-shadow: 0 8px 24px rgba(0,0,0,.18); margin-bottom: 6px; }
.signin h1 { font: 700 34px/1.15 var(--display); margin: 0; letter-spacing: .37px; }
.signin p { margin: 0; color: var(--muted); max-width: 30ch; }
.signin .roster { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 10px; max-width: 320px; }
.signin .roster .av { width: 28px; height: 28px; font-size: 12px; }
.signin input { width: 100%; max-width: 340px; border: 0; background: var(--fill); border-radius: 12px; padding: 13px 16px; text-align: center; }
.signin .btn { width: 100%; max-width: 340px; padding: 15px 22px; font-size: 17px; border-radius: 14px; }
.err { color: var(--bad); font-size: 15px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 84px); transform: translateX(-50%);
  background: rgba(30, 30, 32, .86); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 15px; z-index: 9;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); max-width: calc(100% - 32px); text-align: center;
}
