@import url(fonts.css);

:root {
  --paper: #F2F4F6; --surface: #FFFFFF; --ink: #18222E; --ink2: #4E5C6B; --ink3: #7A8794;
  --rule: #D6DCE3; --rule2: #E7EBEF;
  --accent: #0E6B73; --accent-hi: #0B5A61; --accent-soft: #DDEDEE;
  --live: #1E8E4F; --live-soft: #DFF2E7; --stop: #B9382A; --stop-soft: #F8E3E0; --warn: #8A5E0E; --warn-soft: #F6ECD6;
  --term: #0F1720; --term-ink: #D7DEE6;
  --r-panel: 10px; --r-ctl: 6px; --r-chip: 4px;
  --sans: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box }
html, body { height: 100% }
#app { min-height: 100%; display: flex; flex-direction: column }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em }
h1 { font-size: 29px; line-height: 1.15 } h2 { font-size: 23px; line-height: 1.2 } h3 { font-size: 17px }
p { margin: 0 0 .6em; max-width: 72ch }
a { color: var(--accent); text-underline-offset: 2px }
code, kbd, pre { font-family: var(--mono); font-size: .88em }
code { white-space: nowrap;  background: var(--rule2); padding: 1px 5px; border-radius: var(--r-chip) }
small, .small { font-size: 13px } .mute { color: var(--ink2) } .faint { color: var(--ink3) }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
[hidden] { display: none !important }

/* controls */
button, .btn { font: 500 14px/1 var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-ctl);
  padding: 9px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap }
button:hover, .btn:hover { border-color: var(--ink3) }
button.pri, .btn.pri { background: var(--accent); border-color: var(--accent); color: #fff }
button.pri:hover { background: var(--accent-hi) }
button.danger { color: var(--stop); border-color: #E3B4AD } button.danger:hover { border-color: var(--stop) }
button.ghost { border-color: transparent; background: transparent; color: var(--ink2) } button.ghost:hover { color: var(--ink); background: var(--rule2) }
button.sm { padding: 6px 10px; font-size: 13px }
button:disabled { opacity: .5; cursor: default }
input, select, textarea { font: 15px/1.4 var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-ctl); padding: 9px 11px; width: 100% }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft) }
textarea { resize: vertical; min-height: 90px }
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink2); margin: 14px 0 6px }
.hint { font-size: 13px; color: var(--ink3); margin-top: 5px }
.err { color: var(--stop); font-size: 14px; min-height: 1.3em; margin-top: 10px }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); margin: 12px 0 0 } .check input { width: auto }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r-ctl); background: var(--surface); padding: 2px }
.seg button { border: 0; padding: 7px 12px; border-radius: 4px } .seg button[aria-pressed=true] { background: var(--ink); color: #fff }

/* shell */
.top { display: flex; align-items: center; gap: 4px; padding: 0 20px; height: 56px; background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 3 }
.brand { font-weight: 700; font-size: 16px; margin-right: 22px; display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none }
.brand svg { color: var(--accent) }
.top nav { display: flex; gap: 2px; align-items: center; min-width: 0; overflow-x: auto }
.top nav a { color: var(--ink2); text-decoration: none; padding: 8px 12px; border-radius: var(--r-ctl); font-weight: 500; font-size: 14.5px; white-space: nowrap }
.top nav a:hover { color: var(--ink); background: var(--rule2) }
.top nav a[aria-current=page] { color: var(--ink); background: var(--accent-soft) }
.top nav .sep { width: 1px; height: 22px; background: var(--rule); margin: 0 8px }
.top .sp { flex: 1 }
.menu { position: relative } .menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--r-ctl) }
.menu > summary::-webkit-details-marker { display: none } .menu > summary:hover { background: var(--rule2) }
.menu .pop { position: absolute; right: 0; top: 44px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-panel); padding: 6px; min-width: 210px; box-shadow: 0 8px 24px rgba(24,34,46,.12) }
.menu .pop button { width: 100%; justify-content: flex-start; border: 0 } .menu .pop .who { padding: 8px 12px; font-size: 13px; color: var(--ink3); border-bottom: 1px solid var(--rule2); margin-bottom: 4px }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600 }
.role { font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: var(--r-chip); padding: 2px 7px }
.callout { display: flex; gap: 14px; align-items: center; padding: 11px 20px; background: var(--warn-soft); color: #4D3606; border-bottom: 1px solid #E8D3A6; font-size: 14px }
.callout b { font-weight: 600 } .callout .sp { flex: 1 } .callout button { background: transparent; border-color: #C9A866 }
.callout.info { background: var(--accent-soft); color: #0B3F44; border-color: #BCD9DB }
main { padding: 24px 28px 40px; max-width: 1280px; margin: 0 auto; width: 100% }
main.wide { max-width: none; padding: 16px 20px; flex: 1; min-height: 520px; display: flex; flex-direction: column } main.wide > .ws { flex: 1; min-height: 0; height: auto }
#app:has(main.wide) { height: 100% }
.pagehead { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap } .pagehead .sp { flex: 1 }
.lede { color: var(--ink2); margin-top: 4px; font-size: 15px }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-panel) }
.empty { padding: 34px 28px; text-align: left } .empty h3 { margin-bottom: 6px } .empty p { color: var(--ink2) } .empty .row { margin-top: 14px }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 14px }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink3) }
.status.on::before { background: var(--live) } .status.off::before { background: var(--stop) } .status.wait::before { background: #C49A3A }
.chip { display: inline-block; font-size: 12.5px; padding: 2px 8px; border-radius: var(--r-chip); background: var(--rule2); color: var(--ink2); margin: 2px 4px 2px 0 }

/* login */
.login { flex: 1; min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 620px); gap: 56px; align-content: center; justify-content: center; padding: 40px }
.login form h1 { margin: 18px 0 8px } .login form p { color: var(--ink2) } .login form button.pri { width: 100%; justify-content: center; margin-top: 18px; padding: 12px }
.login .gh { width: 100%; justify-content: center; margin-top: 18px; padding: 12px } .login .or { margin-top: 14px; font-size: 13px; color: var(--ink3) }
.shot { background: var(--term); color: var(--term-ink); border-radius: var(--r-panel); padding: 22px 24px; font: 14px/1.7 var(--mono); align-self: center; box-shadow: 0 20px 50px rgba(15,23,32,.25) }
.shot .p { color: #6FD0D6 } .shot .d { color: #8796A5 } .shot .ok { color: #7FD69C }
.cursor { display: inline-block; width: 8px; height: 1.1em; background: #6FD0D6; vertical-align: -3px; animation: blink 1.1s steps(1) infinite }
@keyframes blink { 50% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none } }

/* workspace */
.ws { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; height: 100% }
.side { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto } .side > * { flex-shrink: 0 }
.plist { overflow: auto; padding: 6px } .plist .it { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: var(--r-ctl); cursor: pointer; color: var(--ink); text-decoration: none }
.plist .it:hover { background: var(--rule2) } .plist .it[aria-current=true] { background: var(--accent-soft) } .plist .it small { display: block; color: var(--ink3); font-size: 12px }
.plist .it .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 }
.plist .head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 6px; font-weight: 600; font-size: 14px }
.ready { padding: 14px 16px } .ready h3 { font-size: 14px; margin-bottom: 8px }
.ready ol { list-style: none; margin: 0; padding: 0 } .ready li { display: grid; grid-template-columns: 20px 1fr; gap: 6px; padding: 6px 0; font-size: 13.5px; border-top: 1px solid var(--rule2) }
.ready li:first-child { border-top: 0 } .ready li .ic { font-weight: 700; color: var(--ink3) } .ready li.done .ic { color: var(--live) } .ready li.done .t { color: var(--ink3) }
.ready li .how { color: var(--ink2); font-size: 12.5px; margin-top: 2px }
.ready li > div { min-width: 0 } .ready li .how { overflow-wrap: anywhere }
.ready .cx { display: grid; gap: 6px; margin-top: 6px } .ready .cx input { width: 100%; padding: 6px 8px; font: 12px var(--mono) } .ready .cx button { justify-content: center }
.ready .err { font-size: 12px; margin-top: 4px; overflow-wrap: anywhere } .ready .err:empty { display: none }
.termwrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--term); border-radius: var(--r-panel); overflow: hidden }
.termbar { display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 16px; color: var(--term-ink); border-bottom: 1px solid #1E2A36; font-size: 14px }
.termbar b { font-weight: 600 } .termbar .faint { color: #8796A5 } .termbar .sp { flex: 1 }
.termbar button { background: transparent; color: var(--term-ink); border-color: #2A3846 } .termbar button:hover { border-color: #5A6A7A }
.termbar .status { color: #AEB9C4 }
.term { flex: 1; min-height: 0; padding: 8px 4px 4px 12px }
.strip { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 8px 16px; border-top: 1px solid #1E2A36; color: #8796A5; font-size: 12.5px }

/* chats */
.chats { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; height: calc(100vh - 56px - 64px - 64px); min-height: 420px }
.slist { overflow: auto } .slist .it { display: block; padding: 11px 14px; border-bottom: 1px solid var(--rule2); cursor: pointer; text-decoration: none; color: var(--ink) }
.slist .it:hover { background: #F7F9FA } .slist .it[aria-current=true] { background: var(--accent-soft) }
.slist .it .t { font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.slist .it .m { font-size: 12.5px; color: var(--ink3); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap }
.slist .filter { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--surface) }
.slist .filter select { padding: 6px 8px; font-size: 13px }
.transcript { display: flex; flex-direction: column; min-height: 0 }
.thead { padding: 14px 18px; border-bottom: 1px solid var(--rule); display: flex; gap: 16px; align-items: flex-start }
.thead .sp { flex: 1 } .thead .m { font-size: 13px; color: var(--ink2); margin-top: 4px; display: flex; gap: 2px 14px; flex-wrap: wrap }
.tbody { overflow: auto; padding: 16px 18px 24px; flex: 1 }
.turn { margin: 0 0 14px; max-width: 860px } .turn .who { font-size: 12.5px; color: var(--ink3); margin-bottom: 3px }
.turn .tx { white-space: pre-wrap; word-break: break-word }
.turn.user .tx { background: #EEF4F4; border-left: 3px solid var(--accent); padding: 9px 12px; border-radius: 0 var(--r-ctl) var(--r-ctl) 0 }
.call { margin: 0 0 6px; max-width: 860px; font-size: 13px }
.call > summary { cursor: pointer; color: var(--ink2); display: flex; gap: 8px; align-items: baseline; padding: 3px 0 }
.call > summary::marker { color: var(--ink3) } .call .nm { font-family: var(--mono); font-weight: 600; color: var(--ink) }
.call .arg { font-family: var(--mono); color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch }
.call pre { background: var(--term); color: var(--term-ink); padding: 10px 12px; border-radius: var(--r-ctl); white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; margin: 4px 0 8px }
.live { color: var(--live); font-weight: 500 }

/* tasks */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; align-items: start }
.col { background: #E9EDF1; border-radius: var(--r-panel); padding: 10px; min-height: 160px }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px }
.col h3 { font-size: 14px; padding: 4px 6px 10px; display: flex; justify-content: space-between; color: var(--ink2) }
.task { background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--rule); border-radius: var(--r-ctl); padding: 10px 12px; margin-bottom: 8px; cursor: grab; width: 100%; text-align: left; display: block; font: inherit; color: inherit }
.task.p2 { border-left-color: var(--stop) } .task.p1 { border-left-color: var(--accent) }
.task .t { font-weight: 500 } .task .m { font-size: 12.5px; color: var(--ink3); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap }
.task.dragging { opacity: .4 }

/* team */
.summary { font-size: 20px; line-height: 1.45; max-width: 64ch; margin: 2px 0 22px; color: var(--ink) } .summary b { font-weight: 600 }
table { width: 100%; border-collapse: collapse; font-size: 14px }
th { text-align: left; font-weight: 500; color: var(--ink3); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap }
td { padding: 12px 14px; border-bottom: 1px solid var(--rule2); vertical-align: middle }
tr:last-child td { border-bottom: 0 }
tr.link { cursor: pointer } tr.link:hover td { background: #F7F9FA }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }
.tw { overflow-x: auto }
.heat { display: flex; gap: 2px; align-items: flex-end; height: 26px }
.heat i { width: 7px; border-radius: 2px; background: var(--rule2); height: 100% } .heat i.l1 { background: #B9DCDE } .heat i.l2 { background: #7FBEC2 } .heat i.l3 { background: #3E979E } .heat i.l4 { background: var(--accent) }
.person { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap } .person .sp { flex: 1 }
.person .avatar { width: 44px; height: 44px; font-size: 17px }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin: 0 0 18px }
.tabs a { padding: 10px 14px; color: var(--ink2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500 }
.tabs a[aria-current=page] { color: var(--ink); border-color: var(--accent) }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(14px, 1fr); gap: 14px; align-items: end; height: 140px; padding: 0 2px }
.bars div { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; align-items: stretch }
.bars i { background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px } .bars i.z { background: var(--rule2) }
.bars-x { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(14px, 1fr); gap: 14px; font-size: 11.5px; color: var(--ink3); text-align: center; margin-top: 6px }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--rule2); border-radius: var(--r-panel); overflow: hidden; margin-bottom: 18px; border: 1px solid var(--rule) }
.kv div { background: var(--surface); padding: 12px 16px } .kv span { display: block; font-size: 13px; color: var(--ink3) } .kv b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums }

/* settings */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 12px 0 0 }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rule2) }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 13px; font-weight: 600 }
.steps li.done::before { content: "✓"; background: var(--live-soft); color: var(--live) }
.section { padding: 20px 22px; margin-bottom: 16px } .section h3 { margin-bottom: 6px }
.pw { font: 600 20px/1 var(--mono); background: var(--paper); border: 1px dashed var(--rule); padding: 14px; border-radius: var(--r-ctl); user-select: all; margin: 12px 0; letter-spacing: .03em }

/* dialogs and toast */
dialog { border: 1px solid var(--rule); border-radius: 12px; padding: 24px; width: min(480px, 94vw); color: var(--ink); box-shadow: 0 24px 60px rgba(24,34,46,.25) }
dialog::backdrop { background: rgba(24,34,46,.35) }
dialog h2 { font-size: 20px; margin-bottom: 4px } dialog .row.end { justify-content: flex-end; margin-top: 20px }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-ctl); font-size: 14px; z-index: 10 }

@media (max-width: 900px) {
  .top { padding: 0 12px; gap: 0 } .brand span { display: none } .brand { margin-right: 8px } .top nav .sep { margin: 0 4px }
  main { padding: 16px } main.wide { height: auto; padding: 12px; display: block } #app:has(main.wide) { height: auto }
  .top nav { overflow-x: auto; scrollbar-width: none; min-width: 0 } .top nav a { white-space: nowrap } .side { margin-bottom: 12px }
  .login { grid-template-columns: 1fr; gap: 24px; padding: 24px } .shot { display: none }
  .ws, .chats { grid-template-columns: 1fr; height: auto } .termwrap { height: 70vh } .slist { max-height: 260px }
  .board { grid-template-columns: 1fr } .callout { flex-wrap: wrap; padding: 10px 14px } .summary { font-size: 17px }
}

.loading { color: var(--ink3); padding: 48px 0; text-align: center; animation: fadein .2s .4s both; }
@keyframes fadein { from { opacity: 0 } }
.strip .sp { flex: 1 }
.termbar b { white-space: nowrap } @media (max-width: 900px) { .termbar .faint { display: none } }
@media (max-width: 900px) { .thead { flex-wrap: wrap } .thead > div:first-child { flex-basis: 100% } }
.steprow { display: flex; gap: 12px; align-items: center } .steprow > span { flex: 1 }
@media (max-width: 900px) { .steprow { flex-wrap: wrap } .steprow > span { flex-basis: 100% } .top .menu .role { display: none } }
tr.off td { color: var(--ink3) } tr.off td b { font-weight: 500 }
.clip { display: flex; gap: 10px; align-items: center; padding: 8px 16px; background: #16303A; color: #D7DEE6; font-size: 13px; border-bottom: 1px solid #1E2A36 }
.clip > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap } .clip code { background: #0F1720; color: #9FE3E8 }
.clip .ghost { color: #AEB9C4 }
