/*
 * Crisper's UI, copied for crisper.ai: the pieces the public pages use to show the app as it is (the changelog, case
 * studies, use-case pages). Every class starts `ui-`; tokens, sizes and words follow the app (app/app.css, DESIGN.md,
 * components/waiting.tsx DecisionCard, components/agent-avatar.tsx, the rail in routes/_app.tsx). When the app's look
 * changes, change it here once and every page follows. Pictures, not controls: nothing here is a real button, so each
 * picture gets role="img" and an aria-label saying what it shows. Motion is quiet and stops for reduced motion.
 */
@property --ui-orbit { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.ui {
  --i25: #fafbfb; --i50: #f6f7f8; --i75: #f1f2f4; --i100: #eaecef; --i150: #e4e6ea; --i200: #dee1e5; --i300: #bfc3ca;
  --i400: #8a9099; --i500: #6e747d; --i600: #51555c; --i700: #3d4148; --i800: #272a30; --i900: #15171b; --i950: #0b0c0f;
  --a50: #ecfdf5; --a100: #d3f8e8; --a200: #a7f0d3; --a300: #6ee7b7; --a500: #10b981; --a600: #0e9e74; --a700: #0a7a58;
  --am50: #fffbeb; --am100: #fef3c7; --am200: #fde68a; --am500: #f59e0b; --am900: #78350f;
  --r50: #fef2f2; --r500: #ef4444; --r700: #b91c1c; --s50: #f0f9ff; --s100: #e0f2fe; --s700: #0369a1;
  font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  color: var(--i900); font-size: 13px; line-height: 1.45; text-align: left;
  -webkit-font-smoothing: antialiased;
}
.ui *, .ui *::before, .ui *::after { box-sizing: border-box; }
.ui img { display: block; }
.ui .mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace; font-size: 12px; }

/* A window of the app: the frame the pictures sit in. */
.ui-win { background: #fff; border: 1px solid var(--i150); border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 2px rgb(11 18 32 / .04), 0 24px 60px -32px rgb(20 26 36 / .35); }
.ui-win.split { display: grid; grid-template-columns: 200px minmax(0, 1fr); }
.ui-pane { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ui-h { display: flex; align-items: center; gap: 10px; }
.ui-h b { font-family: "Schibsted Grotesk", sans-serif; font-weight: 600; font-size: 17px; letter-spacing: -.015em; }
.ui-h small { margin-left: auto; color: var(--i500); font-size: 12px; }
.ui-label { font-size: 11.5px; font-weight: 500; color: var(--i500); }
.ui-muted { color: var(--i500); }

/* The rail: agents with their picture, presence dot, the working arc, and what waits on you. */
.ui-rail { background: #f6f7f9; border-right: 1px solid var(--i100); padding: 12px 8px; display: flex; flex-direction: column; gap: 1px; }
.ui-rail .ui-label { padding: 10px 10px 4px; letter-spacing: .04em; text-transform: uppercase; font-size: 10.5px; color: var(--i400); }
.ui-ag { display: flex; align-items: center; gap: 10px; border-radius: 6px; padding: 4px 10px; color: var(--i600); white-space: nowrap; }
.ui-ag.on { background: rgb(228 230 234 / .8); color: var(--i950); font-weight: 500; }
.ui-ag.off { color: var(--i500); }
.ui-ag > span:not(.ui-av):not(.ui-n) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ui-n { margin-left: auto; border-radius: 99px; background: var(--i900); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; padding: 0 6px; font-variant-numeric: tabular-nums; }

/* An agent's picture (AgentAvatar): .sm 20px, default 32px, .lg 40px. `.dot` adds presence, `.working` the arc. */
.ui-av { position: relative; display: inline-flex; flex-shrink: 0; }
.ui-av > img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; background: var(--i150); }
.ui-av.sm > img { width: 20px; height: 20px; border-radius: 5px; }
.ui-av.lg > img { width: 40px; height: 40px; border-radius: 8px; }
.ui-av.dot::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 99px; background: var(--a500); box-shadow: 0 0 0 2px #fff; }
.ui-av.sm.dot::after { width: 8px; height: 8px; box-shadow: 0 0 0 2px #f6f7f9; }
.ui-av.dot.paused::after { background: #fff; border: 1.5px solid var(--i400); }
.ui-av.working::before { content: ""; position: absolute; inset: -3px; border-radius: 9px; padding: 1.5px;
  background: conic-gradient(from var(--ui-orbit), transparent 0 55%, var(--a300) 75%, var(--a500) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: ui-orbit 1.6s linear infinite; }
.ui-av.sm.working::before { border-radius: 8px; }
.ui-av.lg.working::before { border-radius: 11px; }
@keyframes ui-orbit { to { --ui-orbit: 360deg; } }

/* A person (round, where agents are square). */
.ui-person { width: 20px; height: 20px; border-radius: 99px; display: inline-grid; place-items: center; font-size: 10px; font-weight: 600; color: #fff; background: var(--i500); flex-shrink: 0; }

/* Chips and pills. */
.ui-chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--i75); color: var(--i600); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.ui-chip.amber { background: var(--am50); color: var(--am900); box-shadow: inset 0 0 0 1px var(--am100); }
.ui-pill { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 500; white-space: nowrap; background: var(--i75); color: var(--i600); }
.ui-pill::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; opacity: .8; }
.ui-pill.green { background: var(--a50); color: var(--a700); }
.ui-pill.amber { background: var(--am50); color: #b45309; }
.ui-pill.red { background: var(--r50); color: var(--r700); }
.ui-pill.sky { background: var(--s50); color: var(--s700); }
.ui-pill.plain::before { display: none; }

/* Buttons, as pictures. */
.ui-btn { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1px solid var(--i200); background: #fff; color: var(--i800); white-space: nowrap; }
.ui-btn.go { border-color: transparent; background: var(--a600); color: #fff; box-shadow: inset 0 1px 0 rgb(255 255 255 / .12), 0 1px 2px rgb(8 122 94 / .3); }
.ui-btn.dark { border-color: transparent; background: var(--i950); color: #fff; }
.ui-input { flex: 1; min-width: 0; height: 30px; border-radius: 8px; border: 1px solid var(--i200); padding: 0 10px; color: var(--i400); font-size: 12.5px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; }

/* A plan waiting for you (DecisionCard): amber strip, title, Why, what started it, exactly what runs, buttons. */
.ui-card { background: #fff; border: 1px solid var(--am200); border-radius: 14px; box-shadow: 0 0 0 4px var(--am50); overflow: hidden; }
.ui-card.listed { border-color: var(--i150); box-shadow: 0 1px 2px rgb(11 18 32 / .04); }
.ui-card > .strip { display: flex; align-items: center; gap: 8px; padding: 9px 16px; background: var(--am50); border-bottom: 1px solid var(--am100); color: var(--am900); font-size: 12.5px; font-weight: 500; }
.ui-card > .strip::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--am500); }
.ui-card > .strip small { margin-left: auto; color: var(--i500); font-weight: 400; font-size: 12.5px; }
.ui-card > .body { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 14px; }
.ui-card .who { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--i500); }
.ui-card .who b { color: var(--i800); font-weight: 600; }
.ui-card h4 { margin: 0; font-size: 15px; line-height: 1.35; font-weight: 600; letter-spacing: -.01em; color: var(--i950); }
.ui-card .why p { margin: 3px 0 0; color: var(--i700); font-size: 13px; line-height: 1.5; }
.ui-card .started { display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px; border-radius: 10px; background: var(--i50); color: var(--i600); font-size: 12.5px; }
.ui-card .started q { quotes: none; color: var(--i800); }
.ui-card .runs { border: 1px solid var(--i150); border-radius: 12px; overflow: hidden; }
.ui-card .runs > .cap { padding: 7px 12px; background: var(--i25); border-bottom: 1px solid var(--i100); font-size: 11.5px; color: var(--i500); display: flex; gap: 6px; align-items: center; }
.ui-card .runs > .msg { padding: 10px 12px; font-size: 13px; line-height: 1.55; color: var(--i800); white-space: pre-line; }
.ui-card .runs > .cmd { padding: 10px 12px; background: var(--i950); color: #e6edf3; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.ui-card .runs > .cmd i { font-style: normal; color: var(--a300); }
.ui-card .foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--i100); }
.ui-steps { list-style: none; margin: 0; padding: 0; border: 1px solid var(--i150); border-radius: 12px; overflow: hidden; }
.ui-steps li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--i100); font-size: 13px; color: var(--i800); }
.ui-steps li:first-child { border-top: 0; }
.ui-steps li > .n { width: 18px; height: 18px; border-radius: 99px; background: var(--i75); color: var(--i500); font-size: 11px; font-weight: 600; display: grid; place-items: center; flex-shrink: 0; }
.ui-steps li > span:nth-child(2) { flex: 1; min-width: 0; }
.ui-steps li .ui-pill { margin-left: auto; }

/* Level 1's countdown on a low-stakes reply: the bar fills, and it goes out unless you step in. */
.ui-l1 { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 10px; background: var(--a50); color: var(--a700); font-size: 12.5px; font-weight: 500; }
.ui-l1 .bar { position: relative; flex: 0 0 72px; height: 4px; border-radius: 99px; background: var(--a100); overflow: hidden; }
.ui-l1 .bar::after { content: ""; position: absolute; inset: 0; background: var(--a500); transform-origin: left; animation: ui-fill 10s linear infinite; }
@keyframes ui-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* A decided card, as the list shows it after (DecidedRow). */
.ui-decided { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--i150); font-size: 13px; }
.ui-decided > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--i800); }

/* A thread: messages, one-line notes, run markers. */
.ui-tl { display: flex; flex-direction: column; gap: 12px; }
.ui-msg { display: flex; gap: 10px; }
.ui-msg > div { flex: 1; min-width: 0; }
.ui-msg .meta { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--i500); }
.ui-msg .meta b { color: var(--i900); font-weight: 600; }
.ui-msg .text { margin-top: 3px; color: var(--i800); font-size: 13px; line-height: 1.55; }
.ui-msg.contact .text { padding: 9px 12px; border-radius: 10px; background: var(--i50); }
.ui-msg.sent .text { padding: 9px 12px; border-radius: 10px; background: var(--a50); box-shadow: inset 0 0 0 1px var(--a100); }
.ui-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--i500); padding-left: 6px; }
.ui-line::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: var(--i300); flex-shrink: 0; }
.ui-line.green::before { background: var(--a500); }
.ui-line.red::before { background: var(--r500); }
.ui-line b { font-weight: 500; color: var(--i700); }
.ui-day { align-self: center; padding: 2px 10px; border-radius: 99px; background: var(--i75); color: var(--i500); font-size: 11.5px; font-weight: 500; }

/* A pull request row (the thread's Pull requests rail, a babysitter case). */
.ui-pr { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--i100); font-size: 13px; }
.ui-pr:first-child { border-top: 0; }
.ui-pr svg { width: 15px; height: 15px; flex-shrink: 0; }
.ui-pr > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--i800); }
.ui-pr .ref { color: var(--i500); font-variant-numeric: tabular-nums; }
.ui-box { border: 1px solid var(--i150); border-radius: 12px; overflow: hidden; background: #fff; }

/* Thread rows (the Threads tab) and Home's sections. */
.ui-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--i100); }
.ui-row:first-child { border-top: 0; }
.ui-row > div { flex: 1; min-width: 0; }
.ui-row .t { font-weight: 600; color: var(--i900); font-size: 13.5px; line-height: 1.35; }
.ui-row .s { color: var(--i500); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-row .r { color: var(--i500); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ui-group { padding: 12px 12px 4px; font-size: 12px; font-weight: 600; color: var(--i500); display: flex; gap: 6px; }
.ui-group em { font-style: normal; color: var(--i400); font-weight: 500; }

/* Board view: a column per group. */
.ui-board { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px; }
.ui-col { background: var(--i50); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.ui-col > .ui-label { padding: 2px 4px 4px; display: flex; gap: 6px; }
.ui-tile { background: #fff; border: 1px solid var(--i150); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; font-weight: 500; color: var(--i800); line-height: 1.35; }
.ui-tile small { display: block; margin-top: 3px; color: var(--i500); font-weight: 400; }

/* Shipped: the one count an agent's Home shows, with 8 weekly bars. */
.ui-shipped { display: flex; align-items: flex-end; gap: 16px; }
.ui-shipped .num { font-family: "Schibsted Grotesk", sans-serif; font-size: 34px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.ui-shipped .unit { color: var(--i600); font-size: 13px; margin-top: 4px; }
.ui-bars { display: flex; align-items: flex-end; gap: 5px; height: 56px; margin-left: auto; }
.ui-bars i { width: 14px; border-radius: 3px 3px 1px 1px; background: var(--a200); height: var(--h); }
.ui-bars i:last-child { background: var(--a600); }
.ui-bars i.pre { background: none; border: 1px dashed var(--i300); height: 10px; }
.ui-best { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: var(--a50); color: var(--a700); font-size: 11.5px; font-weight: 600; }

/* Launch calendar: a lane per channel, a column per day. */
.ui-cal { display: grid; grid-template-columns: 82px repeat(var(--days, 5), minmax(0, 1fr)); border: 1px solid var(--i150); border-radius: 12px; overflow: hidden; font-size: 12px; }
.ui-cal > * { padding: 7px 8px; border-top: 1px solid var(--i100); border-left: 1px solid var(--i100); min-height: 38px; }
.ui-cal > .hd { min-height: 0; background: var(--i25); color: var(--i500); font-weight: 500; border-top: 0; }
.ui-cal > .ln { border-left: 0; color: var(--i600); font-weight: 500; background: var(--i25); }
.ui-cal .ev { display: block; padding: 4px 6px; border-radius: 6px; font-weight: 500; line-height: 1.3; background: var(--i75); color: var(--i700); }
.ui-cal .ev.done { background: var(--a50); color: var(--a700); }
.ui-cal .ev.wait { background: var(--am50); color: #b45309; }
.ui-cal .ev.plan { background: var(--s50); color: var(--s700); }

/* A line chart drawn by Crisper (save_chart): an SVG inside this frame. */
.ui-chart { border: 1px solid var(--i150); border-radius: 12px; padding: 12px 14px 8px; background: #fff; }
.ui-chart .ttl { font-weight: 600; font-size: 13px; color: var(--i900); }
.ui-chart .src { color: var(--i400); font-size: 11px; margin-top: 4px; }
.ui-chart svg { display: block; width: 100%; height: auto; margin-top: 8px; }

/* Chat: the question, the folded steps, the answer. */
.ui-q { align-self: flex-end; max-width: 85%; padding: 9px 12px; border-radius: 14px 14px 4px 14px; background: var(--i75); color: var(--i900); font-size: 13px; }
.ui-steps-fold { display: inline-flex; align-items: center; gap: 6px; color: var(--i500); font-size: 12px; }
.ui-steps-fold::before { content: ""; width: 12px; height: 12px; border-radius: 99px; background: var(--a500); -webkit-mask: radial-gradient(circle, #000 0 2.5px, transparent 3px); }
.ui-a { color: var(--i800); font-size: 13px; line-height: 1.55; }

/* A phone: the lock screen with Crisper's notification, Approve and Reject on it. */
.ui-phone { width: 270px; border-radius: 40px; padding: 10px; background: #111; box-shadow: 0 30px 60px -30px rgb(0 0 0 / .5); }
.ui-phone > .scr { border-radius: 31px; min-height: 480px; padding: 54px 12px 16px; display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(160deg, #3a5a52 0%, #1d2b33 55%, #151a22 100%); color: #fff; }
.ui-phone .clock { text-align: center; font-family: "Schibsted Grotesk", sans-serif; font-size: 58px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.ui-phone .date { text-align: center; font-size: 14px; opacity: .8; margin: 4px 0 26px; }
.ui-note { border-radius: 18px; padding: 11px 12px; background: rgb(245 245 245 / .9); color: var(--i900); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 10px 30px -20px #000; }
.ui-note .hd { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--i500); }
.ui-note .hd img { width: 16px; height: 16px; border-radius: 4px; }
.ui-note .hd span { margin-left: auto; }
.ui-note p { margin: 0; font-size: 13px; line-height: 1.4; }
.ui-note p b { display: block; }
.ui-note .acts { display: flex; gap: 6px; }
.ui-note .acts span { flex: 1; text-align: center; height: 32px; line-height: 32px; border-radius: 10px; font-size: 13px; font-weight: 600; background: rgb(0 0 0 / .07); }
.ui-note .acts span.go { background: var(--i950); color: #fff; }

/* Arriving: something new slides in once, like the app's live arrivals. */
.ui-arrive { animation: ui-arrive .5s cubic-bezier(.2, 0, 0, 1) both; animation-delay: var(--d, 0s); }
@keyframes ui-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ui-av.working::before { animation: none; background: var(--a500); }
  .ui-l1 .bar::after { animation: none; transform: scaleX(.6); }
  .ui-arrive { animation: none; }
}
@media (max-width: 640px) {
  .ui-win.split { grid-template-columns: minmax(0, 1fr); }
  .ui-win.split > .ui-rail { display: none; }
  .ui-board { grid-template-columns: minmax(0, 1fr); }
  .ui-board > .ui-col:nth-child(n+2) { display: none; }
}
