/* Codeply phone: the screens around the chat (phone-app.js), in the shape of
   ChatGPT, Claude and DeepSeek. Chat is the app; the sidebar holds New chat,
   Tasks, Calls, Design and history; Tasks is Claude's agent list; Settings
   is ChatGPT's. Bordered cards on a white canvas, one accent. */

/* ─── Chat-only extras ─── */
body:not([data-view="chat"]) #menuBtn .ico-back { display: none; }
/* phone.js's project chip above the text: shown on the Agent chip instead */
#ctxRow { display: none !important; }
#menuBtn .ico-back { display: none; }

/* ─── Panels: a plain nav bar, then the content ─── */
.panel .top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: var(--bg); }
.panel .top > :last-child { justify-self: end; }
.panel .top .icon-btn { color: var(--text); width: 40px; height: 40px; }
.panel .top-title { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.panel-body { padding: 4px 16px calc(32px + env(safe-area-inset-bottom)); }

/* ─── Shared: section labels, bordered lists ─── */
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 4px 8px; }
.sec h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.sec span, .sec button { font-size: 14px; color: var(--muted); }
.sec button { color: var(--text); font-weight: 500; }
.list { background: var(--group); border: 1px solid var(--sep); border-radius: 18px; overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left; position: relative; color: var(--text); }
.li + .li { border-top: 1px solid var(--sep); }
.li:active { background: var(--fill); }
.li-ico { width: 22px; display: grid; place-items: center; flex: none; color: var(--text); }
.li-ico svg { width: 20px; height: 20px; }
.li-main { flex: 1; min-width: 0; }
.li-main b { display: block; font-size: 16px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-main small { display: block; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.li-main small.wrap { white-space: normal; line-height: 1.4; }
.chev { color: var(--faint); flex: none; width: 14px; height: 14px; }
.li .val { color: var(--muted); font-size: 15px; flex: none; }
.li.danger { color: var(--red); }
.li.danger .li-ico { color: var(--red); }
.note { margin: 8px 6px 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status.on i { background: var(--green); }
.chat-flag { flex: none; font-style: normal; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.chat-flag.needs { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); }
.chat-flag.running { background: var(--surface); color: var(--muted); }
.chat-flag.running i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: flagPulse 1.2s ease-in-out infinite; }
@keyframes flagPulse { 50% { opacity: .3; } }

/* ─── Tasks (Claude's agent list) ─── */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 8px -16px 14px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.chips button span { color: var(--muted); margin-left: 4px; }
.chips button.on { background: var(--surface); box-shadow: none; }
.task { background: var(--group); border: 1px solid var(--sep); border-radius: 18px; padding: 14px; margin-bottom: 10px; }
.task-top { display: flex; align-items: flex-start; gap: 12px; }
.task-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface); color: var(--text); }
.task-ico svg { width: 18px; height: 18px; }
.task-ico.needs { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--orange); }
.task-ico.done { color: var(--green); }
.task-ico.failed { color: var(--red, #e5484d); }
.task-err { color: var(--red, #e5484d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-main { flex: 1; min-width: 0; }
.task-main b { display: block; font-size: 15.5px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-main small { display: flex; align-items: center; gap: 5px; font-size: 13.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; }
.task-main small svg { width: 13px; height: 13px; flex: none; }
.task-main small code { font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.task time { font-size: 13px; color: var(--muted); flex: none; }
.task-ask { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--surface); font-size: 15px; line-height: 1.45; }
.task-ask pre { margin: 8px 0 0; font-family: var(--mono); font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.task-ask pre span { color: var(--muted); }
.task-risk { margin-top: 8px; font-size: 13px; color: var(--red); }
.task .btn-outline { width: 100%; height: 44px; margin-top: 10px; font-size: 15px; }
.task-more { display: flex; justify-content: center; gap: 22px; margin-top: 8px; }
.task-more button { font-size: 14px; color: var(--muted); padding: 4px 2px; }
.task-more button.deny { color: var(--red); }

/* ─── Chat: commands read like a terminal ─── */
.term { position: relative; border-radius: 12px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--sep); margin: 4px 0 6px; }
.term pre { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.term-cmd { padding: 9px 56px 6px 12px; color: var(--text); }
.term-cmd span { color: var(--muted); user-select: none; }
.term-out { padding: 0 12px 9px; color: var(--muted); max-height: 260px; overflow-y: auto; }
.term-end { padding: 6px 12px; font-size: 12px; font-weight: 600; border-top: 1px solid var(--sep); }
.term-end.ok { color: var(--green); } .term-end.bad { color: var(--red); }
.term-copy { position: absolute; top: 6px; right: 6px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.step.cmd > summary .step-label { font-family: var(--mono); font-size: 13px; }
.step.running > summary { color: var(--text); }
.step.running .step-clock { color: var(--muted); }

/* ─── Approval sheet (Claude's card): what it wants, the exact thing, Allow ─── */
.sheet-over { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
#approvalSheet .sheet-card { display: flex; flex-direction: column; gap: 10px; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); }
#approvalSheet .sheet-title, #approvalSheet .sheet-text { margin: 0; }
#approvalDetail { font-family: var(--mono); font-size: 13.5px; line-height: 1.45; color: var(--text); background: var(--surface); border-radius: 14px; padding: 12px; white-space: pre-wrap; max-height: 34vh; overflow-y: auto; }
#approvalDetail:empty { display: none; }
.risk-tag { font-size: 14px; color: var(--red); }
.approval-diff { display: flex; flex-direction: column; gap: 4px; max-height: 30vh; overflow-y: auto; }
.approval-diff .code { margin: 0; }
#approvalSheet .sheet-actions { flex-direction: column; gap: 8px; margin-top: 6px; }
#approvalSheet .sheet-actions .btn { flex: none; width: 100%; }
#approvalSheet #approveBtn { order: 1; background: var(--accent); color: var(--accent-text); }
#approvalSheet #alwaysBtn { order: 2; background: none; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); font-weight: 500; }
#approvalSheet #rejectBtn { order: 3; background: none; color: var(--red); height: 44px; }

/* ─── Settings (ChatGPT's) ─── */
.me { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 0 6px; text-align: center; }
.me-av { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 600; background: var(--blue); color: #fff; }
.me b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.me small { font-size: 15px; color: var(--muted); }
.usage { background: var(--group); border: 1px solid var(--sep); border-radius: 18px; padding: 16px; }
.usage small { font-size: 14px; color: var(--muted); }
.usage .big { font-size: 34px; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; margin: 2px 0 2px; font-variant-numeric: tabular-nums; }
.usage .delta { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.usage .delta b { color: var(--green); font-weight: 600; }
.usage .delta b.down { color: var(--red); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 56px; margin-top: 14px; }
.bars i { flex: 1; border-radius: 3px 3px 1px 1px; background: var(--surface-2); min-height: 3px; }
.bars i.today { background: var(--blue); }
.bars { touch-action: none; cursor: pointer; }
.bars.dense { gap: 1.5px; }
.bars.dense i { border-radius: 2px 2px 1px 1px; }
.bars.picking i { opacity: .45; }
.bars.picking i.sel { opacity: 1; background: var(--text); }
.usage-head { display: block; width: 100%; text-align: left; padding: 0; background: none; color: inherit; font: inherit; }
.usage-head small { display: block; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.seg.wide { display: flex; margin: 14px 0 0; }
.seg.wide button { flex: 1; }
.meter { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }

/* ─── Permissions ─── */
.li .check { color: var(--text); width: 20px; height: 20px; flex: none; visibility: hidden; }
.li.on .check { visibility: visible; }
.li-main .rec { font-size: 12px; font-weight: 600; color: var(--blue); margin-left: 8px; }
.rule-kind { font-size: 14px; color: var(--muted); width: 74px; flex: none; }
.rule-pat { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-x { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; }
.rule-add { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--sep); }
.rule-add select { flex: none; width: 124px; height: 36px; border: 0; border-radius: 10px; background: var(--surface); color: var(--text); padding: 0 8px; font-size: 15px; outline: none; }
.rule-add input { flex: 1; min-width: 0; height: 36px; border: 0; outline: none; background: transparent; color: var(--text); font-family: var(--mono); font-size: 15px; }
.rule-add button { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--accent); color: var(--accent-text); }

/* ─── Sign in / create account: centered, the serif line ─── */
.signin { background: var(--bg); color: var(--text); }
.signin-inner { max-width: 380px; margin: 0 auto; }
.signin .signin-mark { display: none; }
.signin-face .wisp-el { width: 88px; height: 88px; }
.signin-face { margin-bottom: 18px; }
.signin h1 { font-family: var(--font); font-size: 30px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; margin: 0 0 10px; text-shadow: none; }
.signin p.muted { margin: 0 0 26px; color: var(--muted); font-size: 16px; line-height: 1.4; }
.auth-tabs { display: none; }
.signin-form { background: none; padding: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; gap: 10px; color: var(--text); }
.signin-form input { height: 52px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--bg); color: var(--text); padding: 0 16px; font-size: 16px; box-shadow: none; }
.signin-form input:focus { border-color: var(--text); }
.signin-form input::placeholder { color: var(--faint); }
.signin-form .btn { margin-top: 4px; width: 100%; }
.signin-form .btn-primary { background: var(--accent); color: var(--accent-text); }
.signin-form .link-btn { color: var(--muted); text-decoration: none; font-size: 15px; }
.signin-form p.muted { color: var(--muted); margin: 0 0 4px; }
.auth-fine { margin: 6px 4px 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; text-align: center; }
.auth-fine a { color: var(--text); }
.auth-switch { margin: 22px 0 0; font-size: 15px; color: var(--muted); text-align: center; }
.auth-switch button { color: var(--text); font-weight: 600; font-size: 15px; }
.signin-busy { color: var(--muted); }

/* ─── Onboarding ─── */
.onboard { position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column; background: var(--bg); color: var(--text); padding: calc(12px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)); }
.ob-top { display: flex; align-items: center; justify-content: space-between; height: 40px; }
.ob-dots { display: flex; gap: 6px; }
.ob-dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--border-strong); transition: width .2s var(--ease); }
.ob-dots i.on { width: 18px; background: var(--text); }
.ob-skip { color: var(--muted); font-size: 16px; padding: 8px 4px; }
.ob-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.ob-body .wisp-el { width: 72px; height: 72px; margin-bottom: 14px; }
.ob-body h1 { margin: 0; font-family: var(--font); font-size: 30px; font-weight: 700; letter-spacing: -.035em; line-height: 1.12; }
.ob-body > p { margin: 0 0 14px; font-size: 16.5px; line-height: 1.5; color: var(--muted); }
.ob-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--surface); flex: none; }
.ob-found { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); margin: 8px 0 0; }
.ob-found.ok { color: var(--green); }
.ob-found svg { width: 16px; height: 16px; visibility: visible; }
.ob-actions { display: flex; flex-direction: column; gap: 6px; }
.ob-actions .btn-ghost { height: 46px; color: var(--muted); }

/* ─── Voice mode: talk to Codeply, Wisp in the middle ─── */
.call.vm { background: #08090C; padding: calc(env(safe-area-inset-top) + 18px) 20px calc(env(safe-area-inset-bottom) + 18px); }
.vm-head .call-name { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.vm-head .call-status { font-size: 14px; margin-top: 2px; color: rgba(255, 255, 255, .5); }
.vm-orb::before { display: none; }
.vm-wisp, .vm-wisp .wisp-el { width: min(210px, 30vh); height: min(210px, 30vh); }
.call.vm .call-state { font-size: 15px; color: rgba(255, 255, 255, .55); min-height: 20px; margin-top: 14px; }
.call.vm[data-phase="thinking"] .call-state { background: linear-gradient(90deg, rgba(255,255,255,.45) 0%, rgba(255,255,255,.45) 38%, #fff 50%, rgba(255,255,255,.45) 62%, rgba(255,255,255,.45) 100%);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: think-shine 1.9s linear infinite; }
/* Captions: one short line; the newest words come in on the right and older ones slide off the left */
.vm-cap { width: 100%; max-width: 340px; height: 30px; overflow: hidden; display: flex; justify-content: center; align-items: center; }
/* Longer than the line: the newest words stay in view on the right, the oldest fade off the left */
.vm-cap.over { justify-content: flex-end; -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 100%); mask-image: linear-gradient(to right, transparent, #000 18%, #000 100%); }
.call.vm .call-caption { flex: none; max-width: none; min-height: 0; white-space: nowrap; text-align: right; font-size: 18px; line-height: 30px; font-weight: 500; letter-spacing: -.01em; color: rgba(255, 255, 255, .92); font-style: normal; }
.call.vm .call-caption.you { color: rgba(255, 255, 255, .55); font-style: normal; }
.call.vm.no-cc .vm-cap { visibility: hidden; }
.call.vm .call-note { color: rgba(255, 255, 255, .6); }
.vm-bar { flex: none; display: flex; justify-content: center; gap: 22px; margin: 8px auto 6px; }
.vm-btn { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: rgba(255, 255, 255, .12); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .18), inset 0 1px 0 rgba(255, 255, 255, .1);
  transition: transform .32s cubic-bezier(.34, 1.56, .64, 1), background-color .18s ease; }
.vm-btn svg { width: 26px; height: 26px; }
.vm-btn:active { transform: scale(.88); transition-duration: .08s; }
.vm-btn[data-c="cc"]:not(.on) { color: rgba(255, 255, 255, .45); }
.vm-btn[data-c="mute"].on { background: #fff; color: #111; }
.vm-btn.end { background: #FF453A; box-shadow: none; }
.call.vm[data-phase="ended"] .vm-bar { opacity: .4; }

/* Codeply calling you: Wisp ringing in waves of light */
.call.vm.incoming { justify-content: space-between; }
.vm-ring-wrap { position: relative; width: 190px; height: 190px; display: grid; place-items: center; margin-bottom: 22px; animation: vm-bob 1.3s ease-in-out infinite; }
.vm-ring-wrap .vm-wisp, .vm-ring-wrap .vm-wisp .wisp-el { width: 170px; height: 170px; }
.vm-ripple { position: absolute; inset: 10px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .28);
  animation: vm-ripple 2.4s cubic-bezier(.2, .6, .3, 1) infinite; opacity: 0; }
.vm-ripple:nth-child(2) { animation-delay: .8s; }
.vm-ripple:nth-child(3) { animation-delay: 1.6s; }
@keyframes vm-ripple { 0% { transform: scale(.75); opacity: .9; } 100% { transform: scale(2.1); opacity: 0; } }
@keyframes vm-bob { 0%, 100% { transform: translateY(0) rotate(0); } 20% { transform: translateY(-6px) rotate(-4deg); } 40% { transform: translateY(0) rotate(3deg); } 55% { transform: translateY(-3px) rotate(-2deg); } 70% { transform: translateY(0) rotate(0); } }
.vm-in-name { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.vm-in-sub { font-size: 17px; color: rgba(255, 255, 255, .6); margin-top: 4px; }
.vm-in-preview { margin-top: 18px; max-width: 300px; padding: 10px 16px; border-radius: 18px; font-size: 15px; line-height: 1.4; text-align: center; color: rgba(255, 255, 255, .88);
  background: rgba(255, 255, 255, .08); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .14); }
.vm-answer-row { flex: none; display: flex; justify-content: space-between; width: 100%; max-width: 300px; margin: 0 auto 22px; }
.vm-ans { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14px; color: rgba(255, 255, 255, .75); }
.vm-decline, .vm-accept { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; color: #fff; transition: transform .32s cubic-bezier(.34, 1.56, .64, 1); }
.vm-decline { background: #FF453A; }
.vm-accept { background: #30D158; animation: vm-answer 1.6s ease-in-out infinite; }
.vm-accept svg { width: 30px; height: 30px; }
.vm-decline svg { width: 28px; height: 28px; }
.vm-decline:active, .vm-accept:active { transform: scale(.88); }
@keyframes vm-answer { 0%, 100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, .55); } 60% { box-shadow: 0 0 0 16px rgba(48, 209, 88, 0); } }
@media (prefers-reduced-motion: reduce) { .vm-ripple, .vm-ring-wrap, .vm-accept { animation: none !important; } }
