/* Jarvis — the page. It speaks Unfold's design language: the same tokens
   (tokens.css, copied from Unfold), top bar, pill buttons, fields, hero and
   modals. What Unfold does not have — the conversation — is added in the
   same language, with the chat bubbles the tokens already define. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--canvas-text); font-family: var(--font-sans); -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dim { color: var(--canvas-text-2); }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- top bar ----------------------------------------------------------------- */
.top { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--canvas) 82%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); border-bottom: 0.5px solid var(--line-strong); }
.top__in { padding: 14px 40px 14px 34px; display: flex; align-items: center; gap: 22px; min-height: 64px; }
.top__mark { font-weight: 800; letter-spacing: -1px; font-size: 22px; text-decoration: none; flex: none; }
.top__end { display: flex; align-items: center; gap: 14px; flex: none; margin-left: auto; }
.top__who { display: flex; align-items: center; gap: 10px; }
.who { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff;
  background: var(--av-2); flex: none; }
.iconbtn { display: grid; place-items: center; width: 36px; height: 36px; border: none; background: none; border-radius: 10px; color: var(--canvas-text-2); padding: 0; flex: none; }
.iconbtn:hover { background: var(--surface-2); color: var(--canvas-text); }
.iconbtn svg { width: 19px; height: 19px; display: block; }
.themebtn { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.themebtn button { border: none; background: none; padding: 7px 13px; border-radius: 8px; font-size: 13px; color: var(--text-2); }
.themebtn button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* --- buttons (hz h-btn) ------------------------------------------------------------------ */
.btn, .tbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border: none; border-radius: 999px;
  font-size: 16px; font-weight: 600; letter-spacing: -0.2px; white-space: nowrap; text-decoration: none; user-select: none;
  transition: transform .16s cubic-bezier(.22,1,.36,1), filter .16s; }
.btn { background: var(--accent); color: var(--on-accent); }
.tbtn { background: var(--surface-2); color: var(--text); }
.btn:hover, .tbtn:hover { filter: brightness(1.08); }
.btn:active, .tbtn:active { transform: scale(0.96); }
.btn:disabled, .tbtn:disabled { opacity: .4; pointer-events: none; }
.btn--block, .tbtn--block { display: flex; width: 100%; height: 50px; font-size: 17px; }
.tbtn--danger { color: var(--danger); background: var(--danger-soft); }
.tbtn--sm { height: 34px; padding: 0 14px; font-size: 15px; }

/* --- sign in: hero and form ------------------------------------------------------------------ */
.wrap { width: 100%; max-width: 1680px; margin: 0 auto; padding: 0 40px 120px; }
.hero { padding: 72px 0 12px; max-width: 700px; }
.hero h1 { font-size: 58px; letter-spacing: -2.4px; line-height: 1; margin: 0; font-weight: 800; }
.hero p { font-size: 18px; line-height: 1.55; color: var(--canvas-text-2); margin: 22px 0 0; }
.auth { max-width: 460px; padding-top: 72px; }
.auth .hero { padding-top: 0; }
.auth .hero h1 { font-size: 46px; letter-spacing: -1.8px; }
.auth .hero p { font-size: 17px; margin-top: 14px; }
.form { display: flex; flex-direction: column; gap: 18px; margin-top: 34px; }
.form__err { color: var(--danger); background: var(--danger-soft); padding: 10px 14px; border-radius: 12px; font-size: 14px; margin: 0; }
.field { display: flex; flex-direction: column; }
.field > span { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.2px; padding: 0 16px 7px; }
.field input, .field select { min-height: 52px; padding: 13px 16px; border-radius: 16px; border: none; background: var(--surface); color: var(--text); font-size: 17px; outline: none; appearance: none; }
.field input:focus, .field select:focus { box-shadow: 0 0 0 2px var(--accent); }
.field small { font-size: 13px; color: var(--text-2); padding: 7px 16px 0; line-height: 18px; }
.field code { font-family: var(--font-mono); font-size: 12.5px; }

/* --- modals ------------------------------------------------------------------------------ */
.modal-scrim { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px 16px; overflow: auto;
  background: color-mix(in srgb, var(--canvas) 45%, transparent); -webkit-backdrop-filter: blur(16px) saturate(120%); backdrop-filter: blur(16px) saturate(120%);
  animation: scrim-in .25s ease; }
@keyframes scrim-in { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 26px 26px 28px; border-radius: 28px;
  background: var(--surface); color: var(--text); border: 0.5px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0,0,0,.45); animation: modal-in .35s cubic-bezier(.22,1,.36,1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.modal__head { display: flex; align-items: center; gap: 12px; }
.modal__head h2 { flex: 1; margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.modal__close { width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--text); font-size: 15px; display: grid; place-items: center; flex: none; padding: 0; }
.modal__close svg { width: 14px; height: 14px; }
.modal__sub { margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.modal .form { margin-top: 24px; }
.modal .field input, .modal .field select { background: var(--surface-2); }
.modal .row { display: flex; gap: 10px; flex-wrap: wrap; }
.modal__foot { margin-top: 14px; }
.modal--wide { width: min(680px, 100%); }
.modal__sec { margin-top: 26px; padding-top: 22px; border-top: 0.5px solid var(--line); }
.modal__sec h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.modal__sec .row { margin-top: 14px; }
.repos { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.repos li { padding: 10px 14px; border-radius: 12px; background: var(--surface-2); overflow-wrap: anywhere; }
.repos .dim { color: var(--text-2); }

/* --- jobs ------------------------------------------------------------------------------- */
.jobsbtn { position: relative; }
.badge { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--on-accent);
  font: 700 10px/16px var(--font-sans); text-align: center; }
.jobsbtn[data-waiting] .badge { background: var(--warn); color: #fff; }
.jobs { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.jobs > .dim { color: var(--text-2); }
.job { padding: 14px 16px; border-radius: 18px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.job__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.job__head .dim { color: var(--text-2); font-size: 13px; margin-left: auto; }
.job p { margin: 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.job__goal { color: var(--text-2); }
.job__q { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--warn) 14%, transparent); }
.job__q .type input { background: var(--surface); }
.job__links a { color: var(--accent-ink); }
.job .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 0; }
.pill { display: inline-flex; align-items: center; font-weight: 600; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); }
.job[data-status="running"] .pill { background: var(--accent-soft); color: var(--accent-ink); }
.job[data-status="waiting"] .pill { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.job[data-status="done"] .pill { background: var(--accent); color: var(--on-accent); }
.job[data-status="failed"] .pill { background: var(--danger-soft); color: var(--danger); }
.joblog { list-style: none; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface); font-family: var(--font-mono); font-size: 12.5px;
  line-height: 1.5; max-height: 280px; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.joblog li { overflow-wrap: anywhere; white-space: pre-wrap; }
.joblog__step { color: var(--text-2); }
.joblog__error { color: var(--danger); }
.state { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.state[data-on]::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* --- the conversation ------------------------------------------------------------------- */
#main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.talkview { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 760px; margin: 0 auto; min-height: 0; }
.notice { margin: 20px 16px 0; padding: 14px 16px; border-radius: 18px; background: var(--surface); color: var(--text);
  border: 0.5px solid var(--line-strong); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 15px; line-height: 1.45; }
.notice > span { flex: 1; min-width: 200px; }
.log { list-style: none; margin: 0; padding: 24px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; }
.msg p { margin: 0; padding: 9px 14px; border-radius: var(--r-bubble); max-width: 82%; font-size: var(--t-body); line-height: var(--t-body-lh);
  overflow-wrap: anywhere; white-space: pre-wrap; }
.msg--jarvis p { background: var(--bubble-in); color: var(--bubble-in-text); border: 0.5px solid var(--line); border-bottom-left-radius: 6px; }
.msg--robert { justify-content: flex-end; }
.msg--robert p { background: var(--bubble-out); color: var(--bubble-out-text); border-bottom-right-radius: 6px; }
.msg--live p { opacity: .7; min-width: 3em; min-height: 40px; }
.msg--live p:empty::after, .msg--wait p:empty::after { content: "…"; }
.msg--error p { background: var(--danger-soft); color: var(--danger); border: none; }
.msg--event { justify-content: center; }
.msg--event p { max-width: 92%; background: var(--surface-2); color: var(--text); border-radius: 16px; font-size: 15px; line-height: 21px; border: 0.5px dashed var(--line-strong); }
.msg--event a { color: var(--accent-ink); }
.msg--first p { color: var(--text-2); }

.dock { position: sticky; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 12px 16px max(18px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--canvas) 82%, transparent); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-top: 0.5px solid var(--line-strong); }
.status { margin: 0; min-height: 20px; color: var(--canvas-text-2); font-size: 14px; line-height: 20px; text-align: center; }
.talk { width: 88px; height: 88px; border-radius: 50%; border: 0.5px solid var(--line-strong); background: var(--surface); color: var(--text);
  display: grid; place-items: center; box-shadow: var(--glass-shadow); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform var(--dur-fast) var(--spring), background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur); }
.talk svg { width: 34px; height: 34px; pointer-events: none; }
.talk:hover { filter: brightness(1.04); }
.talk--on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); transform: scale(1.08);
  box-shadow: 0 0 0 10px var(--accent-soft), var(--glass-shadow); }
.type { display: flex; gap: 8px; width: 100%; max-width: 520px; }
.type input { flex: 1; min-width: 0; height: 42px; padding: 0 16px; border-radius: 999px; border: none; background: var(--surface); color: var(--text);
  font-size: 16px; outline: none; }
.type input:focus { box-shadow: 0 0 0 2px var(--accent); }

@media (max-width: 800px) {
  .wrap, .top__in { padding-left: 16px; padding-right: 16px; }
  .top__in { gap: 12px; }
  .hero h1, .auth .hero h1 { font-size: 40px; }
  .themebtn button { padding: 7px 9px; }
  .top__end { gap: 8px; }
  .top__who { gap: 2px; }
  .top__who .who { display: none; }
  .auth { padding-top: 40px; }
  .modal { padding: 22px 18px 24px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
