/* Review rate: only tokens from theme.css (colors, shadows). Geometry and animation are local to the experiment. */
:root { --ease: cubic-bezier(.2,.7,.2,1); }

/* Buttons (dark page) */
.btn-dark-primary, .btn-dark-secondary { border-radius: 8px; padding: 6px 12px; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-dark-primary { background: var(--accent); color: var(--accent-text); }
.btn-dark-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }

/* Buttons (light UI) */
.btn-light, .btn-dark { border-radius: 8px; padding: 6px 12px; font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid var(--color-button-secondary-border); background: var(--color-bg-white); color: var(--color-button-secondary-text); transition: background .15s; }
.btn-light:hover { background: var(--color-gray-0-5); }
.btn-dark { background: var(--color-cta); color: var(--color-bg-white); border-color: transparent; position: relative; min-width: 150px; }
.btn-dark:hover { background: var(--color-carbon-black-4); }
.btn-dark[disabled] { cursor: default; }
.btn-dark .btn-label { transition: opacity .15s; }
.btn-dark.loading .btn-label { opacity: 0; }
.btn-dark.loading::after, .spinner { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-dark.loading::after { position: absolute; inset: 0; margin: auto; }
.icon-btn { width: 24px; height: 24px; border-radius: 6px; color: var(--color-text-muted); cursor: pointer; }
.icon-btn:hover { background: var(--color-gray-0-5); }

/* Chips: same specs as the Pills component in the AI Library (Normal 24px, Small 20px, Medium) */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 9999px; font-size: 12px; line-height: 12px; font-weight: 500; white-space: nowrap; }
.chip-sm { height: 20px; padding: 0 6px; gap: 4px; font-size: 10px; line-height: 10px; }
.chip-light { background: var(--color-gray-0-5); color: var(--color-text-muted); }
.chip-neutral { background: var(--color-gray-1); color: var(--color-text-primary); }
.chip-info { background: var(--color-blue-0-5); color: var(--color-blue-8); }
.chip-success { background: var(--color-green-0-5); color: var(--color-green-8); }
.chip-warning { background: var(--color-orange-0-5); color: var(--color-orange-8); }
.chip-danger { background: var(--color-red-0-5); color: var(--color-red-7); }
.chip-outline-success { border: 1px solid var(--color-green-4); color: var(--color-green-8); }

/* Table */
.row { display: grid; grid-template-columns: 1.6fr 1.2fr 1.1fr 1.1fr 1.5fr .8fr 150px; align-items: center; padding: 0 24px; height: 48px; border-top: 1px solid var(--color-border-divider); font-size: 14px; position: relative; transition: background .4s; }
.row-head { height: 36px; background: var(--color-bg-light); border-top: 1px solid var(--color-border-divider); }
.row > span { min-width: 0; padding-right: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row > span.actions { padding-right: 0; overflow: visible; }
.row .who > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .actions { display: flex; justify-content: flex-end; gap: 8px; }
.row .actions .btn-light { padding: 2px 10px; }
.row .more { width: 28px; height: 28px; border: 1px solid var(--color-button-secondary-border); border-radius: 8px; background: var(--color-bg-white); cursor: pointer; color: var(--color-text-muted); }
.row .more:hover { background: var(--color-gray-0-5); }
.row .more, .mc .more { display: grid; place-items: center; padding: 0; line-height: 0; }
.row .who { display: flex; align-items: center; gap: 8px; }
.row .who .avatar { flex: none; }
.avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: var(--color-gray-0-5); }
.avatar-lg { width: 48px; height: 48px; }
.rate-cell { display: flex; align-items: center; gap: 8px; }
.row.hl { background: color-mix(in srgb, var(--color-success) 12%, transparent); }
.diff { opacity: 0; transition: opacity .4s; }
.diff.show { opacity: 1; }

/* Icons (Iconoir, exported from Figma) */
.ico-svg { display: inline-flex; width: 16px; height: 16px; flex: none; }
.ico-svg svg { width: 100%; height: 100%; }
.menu .item > span:first-child, .menu .item .lead { display: inline-flex; align-items: center; gap: 8px; }
.row .more .ico-svg { margin: auto; }
.icon-btn { display: grid; place-items: center; }

/* Menu */
.menu { position: absolute; z-index: 30; min-width: 220px; padding: 4px; border-radius: 12px; background: var(--color-bg-white); border: 1px solid var(--color-border-divider); box-shadow: var(--shadow-xs); opacity: 0; transform: translateY(-4px) scale(.98); pointer-events: none; transition: opacity .15s, transform .15s var(--ease); font-size: 14px; }
.menu.open { opacity: 1; transform: none; pointer-events: auto; }
.menu .item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--color-text-primary); }
.menu .item:hover, .menu .item.hover { background: var(--color-nav-item-hover); }
.menu .item.danger { color: var(--color-danger); }
.menu .sep { height: 1px; margin: 4px 0; background: var(--color-border-divider); }

/* Scrim + floating panel (jak Consultant layer view) */
.scrim { position: absolute; inset: 0; z-index: 40; background: color-mix(in srgb, var(--color-carbon-black-6) 25%, transparent); opacity: 0; pointer-events: none; transition: opacity .25s; }
.panel { position: absolute; z-index: 50; right: 16px; bottom: 16px; width: min(576px, calc(100% - 32px)); height: 0; overflow: hidden; border-radius: 12px; background: var(--color-bg-white); color: var(--color-text-primary); box-shadow: var(--shadow-default); transform: translateY(calc(100% + 32px)); transition: transform .3s var(--ease), height .3s var(--ease); }
.panel-inner { display: flex; flex-direction: column; }
/* Footer pinned at the bottom of the floating panel; the body above it scrolls */
.float-footer { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--color-border-divider); background: var(--color-bg-white); box-shadow: 0 -6px 16px -8px color-mix(in srgb, black 20%, transparent); position: relative; z-index: 2; }
#stage[data-state="working"] .scrim, #stage[data-state="proposal"] .scrim { opacity: 1; pointer-events: auto; }
#stage[data-state="working"] .panel, #stage[data-state="proposal"] .panel { transform: none; }

/* Steps */
.step { display: none; gap: 8px; }
.step.show { display: flex; animation: rise .35s var(--ease); }
.step .ico { width: 16px; height: 16px; margin-top: 2px; display: flex; align-items: center; justify-content: center; color: var(--color-text-primary); flex: none; }
.step[data-status="pending"] .ico { color: var(--color-text-muted); }
.step[data-status="done"] .ico { color: var(--color-green-6); }
.step .ico .spinner { width: 12px; height: 12px; border-width: 1.5px; color: var(--color-text-primary); }
.step[data-status="pending"] .label { color: var(--color-text-muted); }
.step .label { font-size: 14px; line-height: 20px; }
.step .detail { font-size: 12px; line-height: 18px; color: var(--color-text-muted); }

/* Proposal */
.card-stack { display: grid; }
.card-stack > * { grid-area: 1 / 1; }
.skeleton { display: none; flex-direction: column; align-self: start; opacity: 0; transition: opacity .35s; }
.sk-line { display: flex; align-items: center; }
.skeleton.show { display: flex; opacity: 1; }
.skeleton.hide { opacity: 0; }
.sk { border-radius: 6px; background: linear-gradient(90deg, var(--color-gray-1) 25%, var(--color-gray-0-5) 50%, var(--color-gray-1) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.proposal { align-self: start; display: none; opacity: 0; transform: translateY(6px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.proposal.measure { display: block; visibility: hidden; }
.proposal.pending { display: block; }
.proposal.show { display: block; opacity: 1; transform: none; }
#verdict.pop { animation: pop .45s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: none; } }
/* Approve and counter offer wait for the proposal */
#stage[data-state="working"] #approve, #stage[data-state="working"] #counter { opacity: .4; pointer-events: none; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.suggested-input { width: 110px; border: 1px solid var(--color-field-border-focus); border-radius: 8px; padding: 0 8px; box-shadow: 0 0 0 2px var(--color-focus-neutral); outline: none; }
.hidden { display: none; }
.track { position: relative; height: 24px; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 8px; border-radius: 999px; background: var(--color-gray-1); }
.band { transition: left .5s var(--ease), width .5s var(--ease); position: absolute; top: 8px; height: 8px; border-radius: 999px; background: var(--color-blue-2); left: 0; width: 0; }
.pin { position: absolute; top: 0; width: 4px; height: 24px; border-radius: 999px; left: 0; transition: left .7s var(--ease); }
.pin-limit { background: var(--color-text-primary); }
.pin-suggested { background: var(--color-blue-6); cursor: ew-resize; touch-action: none; }
.pin-suggested::after { content: ""; position: absolute; inset: -4px -9px; }
.pin-suggested::before { content: attr(data-v); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 2px 6px; border-radius: 6px; background: var(--color-bg-black); color: var(--color-gray-0-5); font-size: 10px; line-height: 14px; font-style: normal; font-weight: 500; white-space: nowrap; opacity: 0; transition: opacity .15s; pointer-events: none; }
.pin-suggested:hover::before, .pin-suggested.drag::before { opacity: 1; }
.pin.drag { transition: none; }
.pin-current { background: var(--color-danger); }
.why .lead { display: inline-flex; align-items: center; gap: 6px; }
.why { display: flex; width: 100%; align-items: center; justify-content: space-between; border-radius: 6px; padding: 2px 4px; color: var(--color-blue-9); font-size: 12px; font-weight: 500; cursor: pointer; }
.why-wrap { border-radius: 8px; padding: 2px; background: var(--color-blue-0-5); }
.why .chev { transition: transform .2s; }
.why[aria-expanded="true"] .chev { transform: rotate(180deg); }
.why-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); margin-top: 2px; }
.why-body.open { grid-template-rows: 1fr; }
.why-inner { overflow: hidden; }
.why-inner > p:first-child { margin-top: 0; }
.why-inner p { padding: 0 6px; background: var(--color-bg-white); }
.why-inner > p:first-child { padding-top: 8px; border-radius: 6px 6px 0 0; }
.why-inner > p:nth-child(2) { padding-bottom: 8px; margin-top: 0; border-radius: 0 0 6px 6px; }
.why-inner .foot { padding: 4px 6px 2px; background: transparent; color: var(--color-blue-9); }

/* Toast + cursor */
.toast { box-shadow: var(--shadow-default); position: absolute; z-index: 60; left: 50%; bottom: 24px; display: flex; align-items: center; gap: 16px; padding: 8px 16px; border-radius: 12px; background: var(--color-bg-black); color: var(--color-gray-0-5); font-size: 14px; transform: translate(-50%, 24px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { font-weight: 500; color: var(--color-gray-0-5); cursor: pointer; }
.cursor { position: absolute; z-index: 90; width: 16px; height: 16px; left: 0; top: 0; border-radius: 50% 50% 50% 0; background: var(--color-text-primary); border: 2px solid var(--color-bg-white); transform: translate(-3px,-3px) rotate(-45deg); opacity: 0; transition: left .7s var(--ease), top .7s var(--ease), opacity .2s, scale .15s; pointer-events: none; }
.cursor.on { opacity: 1; }
.cursor.click { scale: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile: one contractor card instead of the table, panel becomes a bottom sheet */
.mcard { display: none; }
@media (max-width: 720px) {
  main { padding: 24px 16px !important; gap: 24px !important; }
  #stage { height: 820px !important; }
  #app .row, #app .row-head, #rows { display: none; }
  .mcard { display: flex; flex-direction: column; gap: 12px; margin: 0 16px 16px; }
  .mc { display: flex; flex-direction: column; gap: 16px; padding: 16px; border: 1px solid var(--color-border-light); border-radius: 12px; background: var(--color-bg-white); position: relative; transition: background .4s; }
  .mc.hl { background: color-mix(in srgb, var(--color-success) 12%, transparent); }
  .mc .top { display: flex; gap: 12px; align-items: center; }
  .mc .meta { display: flex; flex-wrap: wrap; gap: 8px; }
  .mc .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 12px; border-top: 1px solid var(--color-border-divider); font-size: 14px; }
  .mc .facts small { display: block; font-size: 12px; color: var(--color-text-muted); }
  .mc .actions { display: flex; gap: 8px; }
  .mc .actions .btn-light { flex: 1; }
  .mc .more { width: 32px; height: 32px; border: 1px solid var(--color-button-secondary-border); border-radius: 8px; background: var(--color-bg-white); color: var(--color-text-muted); display: grid; place-items: center; }
  .panel { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .menu { min-width: 200px; }
  .toast { left: 16px; right: 16px; transform: translateY(24px); }
  .toast.show { transform: none; }
}

/* Preview mode (16:10, no page chrome) */
body.preview main { padding: 0 !important; gap: 0 !important; }
body.preview header { display: none; }
body.preview #steps { display: none; }
body.preview #stage { width: 780px; height: 488px !important; border-radius: 0; box-shadow: none; }
body.preview .panel, body.preview .scrim { transition: none; }

/* Record mode (?record): 16:9 stage, no page chrome, demo autoplays in a loop. For screen recordings. */
body.record main { padding: 0 !important; gap: 0 !important; }
body.record header { display: none; }
body.record #stage { width: var(--rw, 1280px); height: var(--rh, 720px) !important; border-radius: 0; box-shadow: none; transition: transform .8s var(--ease); }
body.record .window { width: var(--rw, 1280px); height: var(--rh, 720px); overflow: hidden; }
body.record .cursor { transition: left calc(.7s / var(--speed, 1)) var(--ease), top calc(.7s / var(--speed, 1)) var(--ease), opacity .2s, scale .15s; }
body.paused *, body.paused *::before, body.paused *::after { animation-play-state: paused !important; }
/* Record control bar: fixed to the bottom of the viewport, below the capture area */
#recbar { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 1000; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; max-width: calc(100vw - 24px); padding: 8px 12px; border-radius: 14px; background: color-mix(in srgb, var(--color-bg-black) 88%, transparent); border: 1px solid var(--color-gray-9); color: var(--color-gray-0-5); font-size: 12px; backdrop-filter: blur(12px); }
#recbar { transition: opacity .15s; }
#recbar.hidden { display: none; }
#recbar.away { opacity: 0; pointer-events: none; }
#recbar .lab { color: var(--color-gray-4); display: inline-flex; align-items: center; gap: 6px; }
#recbar .hint { margin-left: 4px; }
#recbar .rb { height: 28px; padding: 0 10px; border-radius: 8px; color: var(--color-gray-0-5); background: transparent; cursor: pointer; }
#recbar .rb:hover { background: var(--color-gray-9); }
#recbar .rb.on { background: var(--color-gray-0-5); color: var(--color-bg-black); }
#recbar > .rb { border: 1px solid var(--color-gray-9); }
#recbar .seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 10px; border: 1px solid var(--color-gray-9); }

/* The verdict pill may wrap onto its own line (mobile) instead of stretching the card */
#verdict { max-width: 100%; white-space: normal; height: auto; min-height: 24px; padding-top: 4px; padding-bottom: 4px; line-height: 14px; }

/* Braille loaders: the agent is thinking */
.ascii { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; line-height: 1; letter-spacing: 0; white-space: pre; color: var(--color-text-primary); }
.chip .ascii { font-size: 13px; color: currentColor; }

.step .ico .ascii { font-size: 16px; width: 16px; text-align: center; }

/* While the Why disclosure animates, the panel height follows the content with no transition */
.panel.sync { transition: transform .3s var(--ease); }

/* Running agent step: shimmering text, like a "generating…" label (a light band sweeps across the letters) */
.step[data-status="running"] .label, .step[data-status="running"] .detail, .chip.shimmer {
  color: transparent; -webkit-text-fill-color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(100deg, var(--color-gray-8) 35%, var(--color-gray-3) 50%, var(--color-gray-8) 65%);
  background-size: 250% 100%; background-position: 150% 0; animation: textShimmer 1.7s linear infinite;
}
.step[data-status="running"] .detail { background-image: linear-gradient(100deg, var(--color-gray-6) 35%, var(--color-gray-2) 50%, var(--color-gray-6) 65%); }
@keyframes textShimmer { to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .step[data-status="running"] .label, .step[data-status="running"] .detail { animation: none; color: var(--color-text-muted); -webkit-text-fill-color: currentColor; background: none; } }


/* Embed mode (?embed): the record stage with no bar, no scrollbars, transparent page */
body.embed { overflow: hidden; background: transparent; }
