/* ═══ hander — app ═══ shares tokens and components with site.css */
@import url("/site.css?v=3");

body { overflow: hidden; }
body.noscroll { overflow: hidden; }
.shell { display: grid; grid-template-columns: 264px 1fr; height: 100dvh; }

/* ── sidebar ── */
.side { background: var(--paper); border-right: var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; overflow-y: auto; }
.side .wm { font-size: 27px; padding: 4px 8px 12px; }
.hire-btn { height: 46px; font-size: 15px; margin-bottom: 10px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-cw a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 14px; text-decoration: none; font: 500 15px/1.2 var(--body); }
.side-nav a:hover, .side-cw a:hover { background: var(--cream); }
.side-nav a.on, .side-cw a.on { background: var(--lime); font-weight: 600; }
.side-nav svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; flex: none; }
.badge { margin-left: auto; background: var(--orange); border: 2px solid var(--ink); border-radius: 99px; font: 700 11.5px/1 var(--body); padding: 3px 7px; }
.dotk { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); }
.dotk.ok { background: #20c45a; } .dotk.no { background: var(--orange); }
.side-h { font: 600 11.5px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 18px 10px 8px; }
.side-cw { display: grid; gap: 2px; }
.side-cw .st { margin-left: auto; }
.side-foot { margin-top: auto; padding: 14px 10px 2px; border-top: 1.5px solid rgba(11,11,11,.1); display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); }
.av { display: inline-block; width: 26px; height: 26px; flex: none; }
.av svg { width: 100%; height: 100%; display: block; overflow: visible; }
.av.lg { width: 54px; height: 54px; }

/* ── main ── */
.main { overflow-y: auto; padding: 30px clamp(16px, 3.5vw, 48px) 80px; }
.main > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.top h1, .cw-meta h1, .run-head h1 { font-weight: 800; font-size: clamp(32px, 4vw, 50px); letter-spacing: -.045em; line-height: 1; }
.sub { color: var(--ink-2); margin-top: 8px; font-size: 15px; }
.top-r { display: flex; gap: 10px; }
.fine { font-size: 13.5px; color: var(--ink-3); }
.empty { color: var(--ink-3); font-size: 14.5px; padding: 10px 0; }
.chip { display: inline-block; font: 600 11.5px/1 var(--body); font-style: normal; padding: 5px 9px; border: 1.5px solid var(--ink); border-radius: 99px; background: var(--paper); }
.st { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; flex: none; }
.st-work { background: var(--sky); animation: pulse 1.4s infinite; } .st-ask { background: var(--orange); } .st-done { background: var(--mint); }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; background: var(--yel); border: var(--line); border-radius: 18px; margin-bottom: 22px; font-size: 15px; box-shadow: 0 4px 0 var(--ink); }
.banner .btn { margin-left: auto; }
.note-box { padding: 14px 18px; background: rgba(255,255,255,.6); border: 2px dashed var(--ink); border-radius: 18px; margin-bottom: 18px; font-size: 14.5px; }
.danger { color: #b0331f; }
.linkish { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; color: inherit; }

/* forms */
input, textarea, select { font: 400 15px/1.45 var(--body); color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; padding: 11px 14px; width: 100%; outline: none; transition: box-shadow .2s; }
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 4px rgba(162,159,245,.55); }
textarea { resize: vertical; }
label { display: grid; gap: 6px; font: 600 13.5px/1.2 var(--body); }
label small { font-weight: 500; color: var(--ink-3); }
.row { display: flex; gap: 10px; } .row input { flex: 1; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.row-end select { width: auto; }
.row-start { display: flex; gap: 10px; flex-wrap: wrap; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.x { border: 0; background: none; cursor: pointer; font-size: 14px; color: var(--ink-3); padding: 6px; border-radius: 8px; }
.x:hover { background: var(--cream); color: var(--ink); }
.panel { background: var(--paper); border: var(--line); border-radius: 24px; padding: 22px; box-shadow: var(--drop); display: grid; gap: 14px; margin-bottom: 18px; }
.panel h2 { font-size: 22px; letter-spacing: -.03em; }
fieldset { border: 2px solid rgba(11,11,11,.14); border-radius: 16px; padding: 12px 14px; margin: 0; display: grid; gap: 10px; }
legend { font: 600 13.5px/1 var(--body); padding: 0 6px; }
.ck { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.ck input { width: auto; }

/* onboarding */
.onb { display: grid; grid-template-columns: 220px 1fr; gap: 30px; align-items: center; background: var(--paper); border: var(--line); border-radius: 30px; padding: 30px; box-shadow: 0 8px 0 var(--ink); margin-bottom: 26px; }
.onb-l .mascot { width: 100%; height: auto; }
.onb h2 { font-weight: 800; font-size: clamp(30px, 3.4vw, 44px); letter-spacing: -.045em; line-height: 1; }
.onb-r > p { color: var(--ink-2); margin: 14px 0 20px; max-width: 520px; }
.onb .fine { margin-top: 12px; }

/* crew */
.crew { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 30px; }
.crew-c { background: var(--paper); border: var(--line); border-radius: 22px; padding: 10px 12px 14px; text-decoration: none; box-shadow: 0 5px 0 var(--ink); display: grid; gap: 2px; text-align: left; font: inherit; cursor: pointer; transition: transform .25s var(--ease); }
.crew-c:hover { transform: translateY(-3px); }
.crew-f { height: 120px; display: flex; justify-content: center; align-items: flex-end; background: var(--lime); border-radius: 14px; margin-bottom: 8px; border: 2px solid var(--ink); }
.crew-f .mascot { width: 90px; height: 112px; }
.crew-c b { font: 700 17px/1.1 var(--display); }
.crew-c span { font-size: 12.5px; color: var(--ink-3); line-height: 1.3; }
.crew-add .crew-f { background: var(--cream); border-style: dashed; align-items: center; }
.crew-add .crew-f span { font: 400 46px/1 var(--display); color: var(--ink-3); }

/* board columns */
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.col h2 { display: flex; align-items: center; gap: 8px; font: 600 14px/1 var(--body); margin: 0 4px 12px; }
.col h2 em { font-style: normal; color: var(--ink-3); }
.col-empty { font-size: 13.5px; color: var(--ink-3); border: 2px dashed rgba(11,11,11,.2); border-radius: 18px; padding: 18px; text-align: center; }
.rcard { display: block; text-decoration: none; background: var(--paper); border: 2px solid var(--ink); border-radius: 18px; padding: 14px; margin-bottom: 12px; box-shadow: 0 4px 0 var(--ink); transition: transform .2s var(--ease); }
.rcard:hover { transform: translateY(-2px); }
.rcard header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.rcard header time { margin-left: auto; font: 500 12px/1 ui-monospace, "SF Mono", monospace; color: var(--ink-3); }
.rcard p { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.rc-waiting { background: #fff4ec; }
.rc-ask { margin-top: 10px; padding: 10px 12px; background: var(--paper); border: 2px solid var(--orange); border-radius: 12px; font-weight: 600; font-size: 14px; }
.rc-now { margin-top: 10px; font: 500 12.5px/1.35 ui-monospace, "SF Mono", monospace; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-err { margin-top: 10px; font-size: 13px; color: #b0331f; }
.rc-out { margin-top: 8px; font-size: 13px; color: var(--ink-3); }

/* coworker page */
.cw-head { display: flex; gap: 24px; align-items: flex-end; margin-bottom: 22px; }
.cw-fig { width: 130px; flex: none; }
.cw-fig .mascot { width: 100%; height: auto; }
.cw-meta h1 span { font: 500 18px/1 var(--body); color: var(--ink-3); letter-spacing: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.composer { background: var(--paper); border: var(--line); border-radius: 22px; padding: 12px; box-shadow: var(--drop); margin-bottom: 24px; }
.composer textarea { border: 0; padding: 6px 8px; box-shadow: none !important; font-size: 16px; }
.composer-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 4px 0 8px; }
.composer.slim { margin-top: 18px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { font: 600 14px/1 var(--body); padding: 10px 14px; border: 2px solid var(--ink); border-radius: 99px; background: rgba(255,255,255,.55); cursor: pointer; }
.tabs button.on { background: var(--ink); color: var(--lime); }
.tabs em { font-style: normal; opacity: .55; margin-left: 2px; }
.runlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 14px; }
.mem { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.mem li { padding: 8px 4px; border-bottom: 1.5px solid rgba(11,11,11,.08); }
.mem li span { display: inline; }
.mem li .x { float: right; }
.files { display: grid; gap: 8px; }
.file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 14px; }
.file span { color: var(--ink-3); font-size: 13px; margin-right: auto; }
.upl { justify-self: start; }
.filev { white-space: pre-wrap; font: 13px/1.5 ui-monospace, "SF Mono", monospace; max-height: 60vh; overflow: auto; background: var(--cream); border: 2px solid var(--ink); border-radius: 14px; padding: 14px; }
.looks { display: flex; gap: 8px; flex-wrap: wrap; }
.looks label { cursor: pointer; }
.looks input { display: none; }
.looks span { display: block; width: 46px; height: 46px; padding: 6px; border: 2px solid transparent; border-radius: 14px; }
.looks span svg { width: 100%; height: 100%; overflow: visible; }
.looks .sw { width: 34px; height: 34px; padding: 0; border: 2px solid var(--ink); border-radius: 50%; }
.looks input:checked + span { border-color: var(--ink); background: var(--lime); }
.looks input:checked + .sw { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }

/* routines */
.routine { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 18px; flex-wrap: wrap; }
.routine > div { display: grid; gap: 3px; flex: 1; min-width: 200px; }
.routine b { font-size: 15px; }
.routine span { font: 500 12px/1.2 ui-monospace, "SF Mono", monospace; color: var(--ink-3); }
.routine .next { font: 600 12px/1 var(--body); font-style: normal; background: var(--lime); border: 2px solid var(--ink); padding: 6px 10px; border-radius: 99px; }
.rtform { display: grid; grid-template-columns: auto 1fr auto 130px auto; gap: 10px; align-items: center; padding-top: 6px; }
.rtform select { width: 150px; }
.days { display: flex; gap: 4px; }
.days label { cursor: pointer; }
.days input { display: none; }
.days span { display: grid; place-items: center; width: 32px; height: 32px; border: 2px solid var(--ink); border-radius: 50%; font: 600 13px/1 var(--body); }
.days input:checked + span { background: var(--ink); color: var(--lime); }

/* run page */
.back { display: inline-block; text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.run-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.run-head > div { flex: 1; }
.run-head h1 { font-size: clamp(24px, 2.8vw, 36px); line-height: 1.08; }
.pill { font: 700 11.5px/1 var(--body); padding: 4px 9px; border-radius: 99px; border: 2px solid var(--ink); margin-right: 4px; }
.pill-working, .pill-queued { background: var(--sky); } .pill-waiting { background: var(--orange); } .pill-done { background: var(--mint); } .pill-failed { background: #ffc9c0; }
.run-grid { display: grid; grid-template-columns: 1fr 330px; gap: 20px; align-items: start; }
.run-main { min-width: 0; }
.output { background: var(--paper); border: var(--line); border-radius: 24px; padding: clamp(18px, 3vw, 32px); box-shadow: var(--drop); min-height: 120px; overflow-wrap: anywhere; }
.output:empty { display: none; }
.typing { white-space: pre-wrap; color: var(--ink-2); }
.typing::after { content: "▍"; animation: pulse 1s infinite; }
.md h1, .md h2, .md h3 { letter-spacing: -.03em; margin: 1.1em 0 .4em; line-height: 1.15; }
.md h1 { font-size: 30px; } .md h2 { font-size: 24px; } .md h3 { font-size: 19px; }
.md > :first-child { margin-top: 0; }
.md p, .md ul, .md ol { margin: 0 0 .9em; }
.md li { margin: .25em 0; }
.md a { text-decoration: underline; text-underline-offset: 3px; }
.md code { font: 13.5px ui-monospace, "SF Mono", monospace; background: var(--cream); padding: 1px 5px; border-radius: 6px; }
.md pre { background: var(--cream); border: 2px solid var(--ink); border-radius: 14px; padding: 14px; overflow: auto; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 0 0 1em; display: block; overflow-x: auto; }
.md th, .md td { border: 1.5px solid rgba(11,11,11,.18); padding: 7px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--lime); }
.md blockquote { margin: 0 0 1em; padding: 4px 14px; border-left: 4px solid var(--lav); color: var(--ink-2); }
.out-actions { display: flex; gap: 8px; margin-top: 14px; }
.run-side { background: var(--paper); border: var(--line); border-radius: 22px; padding: 18px; box-shadow: var(--drop); position: sticky; top: 0; max-height: calc(100dvh - 60px); overflow: auto; }
.run-side h3 { font-size: 18px; margin-bottom: 10px; }
.steplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.steplist li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; font-size: 13px; line-height: 1.4; padding: 5px 0; border-bottom: 1px solid rgba(11,11,11,.06); overflow-wrap: anywhere; }
.steplist i { font-style: normal; font-weight: 700; text-align: center; }
.s-search i, .s-read i { color: #2b6fd6; } .s-remember i, .s-write_file i { color: #1f9d5c; } .s-ask_human i, .s-now i { color: var(--orange); } .s-you { font-weight: 600; }
.s-note span { color: var(--ink-3); }
.s-now i { animation: pulse 1s infinite; }
.think { margin-top: 14px; font-size: 13px; }
.think summary { cursor: pointer; font-weight: 600; }
.think div { margin-top: 8px; color: var(--ink-2); max-height: 300px; overflow: auto; }
.askbox { background: #fff4ec; border: var(--line); border-radius: 22px; padding: 18px; margin-bottom: 18px; box-shadow: 0 6px 0 var(--ink); display: grid; gap: 12px; }
.askbox header { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.askbox header b { color: var(--ink); }
.askbox > p { font: 700 19px/1.3 var(--display); letter-spacing: -.02em; }
.opts, .ask-row { display: flex; gap: 8px; flex-wrap: wrap; }
.errbox { padding: 14px 16px; border: 2px solid #b0331f; background: #fff1ee; border-radius: 16px; margin-bottom: 16px; font-size: 14.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.props { margin-bottom: 18px; }
.props h3 { font-size: 22px; margin-bottom: 12px; }
.prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.prop { background: var(--paper); border: var(--line); border-radius: 20px; padding: 14px; box-shadow: 0 5px 0 var(--ink); display: grid; gap: 6px; align-content: start; }
.prop .mascot { width: 70px; height: 88px; }
.prop b { font: 700 18px/1.1 var(--display); }
.prop b span, .prop em { font: 500 13px/1.3 var(--body); color: var(--ink-3); font-style: normal; }
.prop p { font-size: 13px; color: var(--ink-2); }
.prop small { font-size: 12px; color: var(--ink-3); }
.prop .btn { justify-self: start; margin-top: 4px; }
.inbox-i { max-width: 640px; }
.empty-big { text-align: center; padding: 60px 0; color: var(--ink-3); }
.empty-big .mascot { width: 120px; height: auto; }

/* vault */
.keyrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.keyrow code, .app code { font: 13px ui-monospace, "SF Mono", monospace; background: var(--cream); padding: 6px 10px; border-radius: 8px; border: 1.5px solid rgba(11,11,11,.15); }
.app { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.app code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appform { display: grid; grid-template-columns: 160px 1fr 200px auto; gap: 10px; }

/* modal + toasts */
.modal { position: fixed; inset: 0; background: rgba(11,11,11,.45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-card { position: relative; background: var(--lime); border: var(--line); border-radius: 30px; box-shadow: 0 10px 0 var(--ink); width: min(920px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: clamp(20px, 3vw, 34px); display: grid; gap: 14px; }
.modal-card h2 { font-weight: 800; font-size: clamp(30px, 3.6vw, 44px); letter-spacing: -.045em; line-height: 1; }
.modal-card form { display: grid; gap: 12px; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); cursor: pointer; font-size: 15px; }
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tpl { background: var(--paper); border: var(--line); border-radius: 20px; padding: 0 14px 14px; text-align: left; cursor: pointer; display: grid; gap: 3px; box-shadow: 0 5px 0 var(--ink); overflow: hidden; font: inherit; transition: transform .2s var(--ease); }
.tpl:hover { transform: translateY(-3px); }
.tpl-f { background: var(--bg); margin: 0 -14px 10px; height: 110px; display: flex; justify-content: center; align-items: flex-end; border-bottom: var(--line); }
.tpl-f .mascot { width: 84px; height: 105px; margin-bottom: -4px; }
.tpl b { font: 700 18px/1.1 var(--display); }
.tpl span { font-size: 13.5px; color: var(--ink-2); }
.tpl small { font-size: 12px; color: var(--ink-3); }
.custom { background: var(--paper); border: var(--line); border-radius: 22px; padding: 18px; }
.custom h3 { font-size: 20px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; max-width: min(380px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--paper); padding: 13px 16px; border-radius: 16px; font-size: 14px; border: 2px solid var(--ink); animation: in .35s var(--ease) both; transition: opacity .4s, transform .4s; }
.toast.ask { background: var(--orange); color: var(--ink); }
.toast.bad { background: #ffc9c0; color: var(--ink); }
.toast.out { opacity: 0; transform: translateY(8px); }
.menu-btn { display: none; }

@media (max-width: 1000px) {
  .run-grid { grid-template-columns: 1fr; }
  .run-side { position: static; max-height: none; }
  .cols { grid-template-columns: 1fr; }
  .rtform { grid-template-columns: 1fr; }
  .rtform select { width: 100%; }
  .appform { grid-template-columns: 1fr; }
  .tpl-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 90; transform: translateX(-102%); transition: transform .35s var(--ease); }
  body.side-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(11,11,11,.35); }
  .menu-btn { display: grid; place-items: center; position: fixed; top: 12px; right: 12px; z-index: 95; width: 44px; height: 44px; border-radius: 50%; border: var(--line); background: var(--paper); font-size: 18px; box-shadow: 0 3px 0 var(--ink); }
  .main { padding-top: 66px; }
  .onb { grid-template-columns: 1fr; text-align: left; }
  .onb-l { width: 130px; }
  .g2 { grid-template-columns: 1fr; }
  .cw-head { flex-direction: column; align-items: flex-start; }
  .cw-fig { width: 96px; }
  .tpl-grid { grid-template-columns: 1fr 1fr; }
  .row { flex-direction: column; }
}
.panel .routine:nth-child(n) { margin-left: 0; box-shadow: none; }
.modal[hidden] { display: none; }
