/* Coide workspace: Tasks, History and Deploy panels (features.js). Uses the app.css palette,
   so the Sand / Dusk / Dark themes apply on their own. */

.fx-view { flex: 1; min-height: 0; overflow: auto; padding: clamp(18px, 3vw, 32px); }
.fx-head { max-width: 720px; display: grid; gap: 8px; margin-bottom: 20px; }
.fx-head h2 { font-family: var(--display); font-size: 24px; font-weight: 400; letter-spacing: -.015em; }
.fx-head p { font-size: 13px; line-height: 1.6; color: var(--ink-soft); }
.fx-head p b { color: var(--ink); font-weight: 500; }
.fx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fx-spacer { flex: 1; }
.fx-empty { color: var(--ink-faint); font-size: 13px; line-height: 1.6; }
.fx-hero { display: grid; gap: 4px; max-width: 520px; padding: 26px 22px; border: 1px dashed var(--line-strong); border-radius: 14px; }
.fx-hero b { color: var(--ink); font-weight: 500; font-size: 14px; }
.muted { color: var(--ink-faint); }
.plus { color: var(--green); font-weight: 500; }
.minus { color: var(--red); font-weight: 500; }

/* spinner */
.spin { display: inline-block; width: 10px; height: 10px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: fx-spin .8s linear infinite; vertical-align: -1px; }
@keyframes fx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

/* agent glyph tiles */
.ta-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 6px; font-style: normal; font-size: 12px; color: #fff; background: #3a3a40; }
.ta-ico[data-agent="claude"] { background: var(--brand-claude, #d97757); }
.ta-ico[data-agent="codex"] { background: var(--brand-codex, #10a37f); }
.ta-ico[data-agent="gemini"] { background: var(--brand-gemini, #6d7cff); }
.ta-ico[data-agent="grok"] { background: #000; box-shadow: inset 0 0 0 1px #ffffff33; }

/* ---------------------------------------------------------------- Tasks */
.task-form { max-width: 980px; display: grid; gap: 10px; margin-bottom: 22px; }
.task-agents { display: flex; flex-wrap: wrap; gap: 6px; }
.task-agent { position: relative; cursor: pointer; }
.task-agent input { position: absolute; opacity: 0; pointer-events: none; }
.task-agent > span { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 6px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink-soft); transition: border-color .15s, background .15s, color .15s; }
.task-agent > span small { font-size: 11px; color: var(--ink-faint); }
.task-agent input:checked + span { color: var(--ink); border-color: var(--ink-soft); background: #ffffff10; }
.task-agent input:disabled + span { opacity: .45; cursor: not-allowed; }
.task-agent input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-input { display: flex; gap: 8px; align-items: stretch; }
.task-input textarea { flex: 1; min-width: 0; min-height: 46px; max-height: 220px; resize: vertical; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg-deep); color: var(--ink); font: 13.5px/1.5 var(--sans); outline: none; }
html[data-theme] .task-input textarea { background: rgb(0 0 0 / .18); }
.task-input textarea::placeholder { color: var(--ink-faint); }
.task-input textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #bd968622; }
.task-input .btn { height: auto; min-height: 46px; padding: 0 18px; }
.task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 12px; max-width: 1280px; align-items: start; }
.task-card { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #ffffff05; min-width: 0; }
.task-card.live { border-color: var(--line-strong); }
.tc-head { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.tc-head b { font-weight: 500; }
.tc-status { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; color: var(--ink-soft); background: #ffffff0d; }
.tc-status.s-running, .tc-status.s-starting { color: var(--amber); }
.tc-status.s-done { color: var(--green); }
.tc-status.s-failed { color: var(--red); }
.tc-status.s-applied { color: var(--ink); background: #ffffff1a; }
.tc-prompt { font-size: 13.5px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.tc-sum { font-size: 12px; color: var(--ink-soft); }
.tc-tail { margin: 0; padding: 8px 10px; border-radius: 8px; background: rgb(0 0 0 / .22); color: var(--ink-faint); font: 11px/1.45 var(--mono); white-space: pre-wrap; overflow: hidden; max-height: 48px; }
.tc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-detail { display: grid; gap: 10px; min-width: 0; padding-top: 6px; border-top: 1px solid var(--line); }
.tc-detail .eyebrow { margin-top: 4px; }
.btn.danger { color: var(--red); }

/* ---------------------------------------------------------------- shared: files + diff + logs */
.fx-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 12px; }
.fx-files li { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px 0; }
.fx-files .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.fx-files small { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.fx-files .st { font-style: normal; font-size: 10.5px; padding: 1px 6px; border-radius: 4px; text-align: center; background: #ffffff0f; color: var(--ink-soft); }
.fx-files .st-A { color: var(--green); }
.fx-files .st-D { color: var(--red); }
.fx-diff, .fx-log, .deploy-log {
  margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--term, #111112); color: #d9d9dc;
  font: 11.5px/1.5 var(--mono); white-space: pre; overflow: auto; max-height: 420px; tab-size: 2;
}
.fx-diff span { display: block; min-height: 1.5em; }
.fx-diff .a { color: #a6dfb2; background: #7ac28a1a; }
.fx-diff .d { color: #f0a0a0; background: #e07a7a1a; }
.fx-diff .h { color: #94aee6; }
.fx-diff .m { color: #7c7c84; }
.fx-diff .f { color: #fff; font-weight: 600; margin-top: 10px; padding-top: 6px; border-top: 1px solid #ffffff14; }
.fx-diff .f:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.fx-log { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 300px; color: #b9b9bf; }

/* ---------------------------------------------------------------- History */
.fx-split { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 0; padding: 0; }
.fx-col { min-width: 0; min-height: 0; overflow: auto; padding: clamp(18px, 2.6vw, 28px); }
.fx-split > .fx-col:first-child { border-right: 1px solid var(--line); }
.fx-detail { display: grid; align-content: start; gap: 14px; }
.hist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hist-day { margin: 14px 0 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.hist-day:first-child { margin-top: 0; }
.hist-item { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.hist-item:hover { background: #ffffff08; }
.hist-item.on { background: #ffffff12; }
.hist-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.hist-item b { display: block; font-size: 13px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-item small { font-size: 11.5px; color: var(--ink-faint); }
.hist-item small b { display: inline; font-size: inherit; }
.hist-dot { width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: var(--ink-faint); }
.hist-dot[data-source="edit"], .hist-dot[data-source="manual"] { background: var(--ink-soft); }
.hist-dot[data-source="restore"], .hist-dot[data-source="undo"] { background: var(--amber); }
.hist-dot[data-agent="claude"] { background: var(--brand-claude, #d97757); }
.hist-dot[data-agent="codex"] { background: var(--brand-codex, #10a37f); }
.hist-dot[data-agent="gemini"] { background: #6d7cff; }
.hist-dot[data-agent="opencode"] { background: #9a9aa2; }
.hist-dot[data-agent="grok"] { background: #fff; }
.hist-head { display: grid; gap: 6px; }
.hist-head h3 { font-family: var(--display); font-size: 20px; font-weight: 400; letter-spacing: -.01em; }
.hist-head p { font-size: 12px; }

/* ---------------------------------------------------------------- Deploy */
.deploy-card { max-width: 980px; display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #ffffff05; }
.deploy-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.deploy-top .seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.deploy-top .seg label { position: relative; cursor: pointer; }
.deploy-top .seg input { position: absolute; opacity: 0; pointer-events: none; }
.deploy-top .seg span { display: inline-flex; align-items: center; height: 28px; padding: 0 14px; border-radius: 999px; font-size: 12.5px; color: var(--ink-soft); }
.deploy-top .seg input:checked + span { background: #ffffff18; color: var(--ink); }
.deploy-top .seg input:focus-visible + span { outline: 2px solid var(--accent); }
.deploy-top .check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.deploy-top .btn.primary { height: 38px; padding: 0 22px; font-size: 13.5px; }
.deploy-note { font-size: 12.5px; color: var(--ink-faint); }
.deploy-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.deploy-steps:empty { display: none; }
.deploy-steps li { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.deploy-steps li i { grid-row: 1 / span 2; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-style: normal; font-size: 11px; background: #ffffff10; color: var(--ink-faint); }
.deploy-steps li b { font-weight: 500; }
.deploy-steps li small { font-size: 11px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deploy-steps .st-running { border-color: var(--line-strong); }
.deploy-steps .st-running i { color: var(--amber); }
.deploy-steps .st-done i { background: #7ac28a26; color: var(--green); }
.deploy-steps .st-failed { border-color: #e07a7a55; }
.deploy-steps .st-failed i { background: #e07a7a26; color: var(--red); }
.deploy-steps .st-skipped, .deploy-steps .st-pending { opacity: .6; }
.deploy-result { display: grid; }
.dep-ok, .dep-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 12px; }
.dep-ok { background: #7ac28a14; box-shadow: inset 0 0 0 1px #7ac28a40; }
.dep-ok .eyebrow { color: var(--green); }
.dep-id { margin: 4px 0 2px; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.dep-error { display: grid; gap: 6px; background: #e07a7a12; box-shadow: inset 0 0 0 1px #e07a7a40; }
.dep-error b { color: var(--red); font-weight: 500; }
.dep-error p { font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.deploy-log { max-height: 360px; white-space: pre-wrap; overflow-wrap: anywhere; color: #b9b9bf; }

@media (max-width: 860px) {
  .fx-split { grid-template-columns: minmax(0, 1fr); overflow: auto; }
  .fx-split > .fx-col { overflow: visible; }
  .fx-split > .fx-col:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .task-input { flex-direction: column; }
  .task-input .btn { min-height: 42px; }
}

/* phones: seven tabs scroll sideways, the top bar keeps only what fits */
@media (max-width: 600px) {
  .tabs { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; }
  .topbar .top-link, .topbar .cluster-pill, .topbar .email { display: none; }
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar .brand img { width: 92px; }
  .topbar .project-select { max-width: 112px; min-width: 0; }
  .topbar-right { gap: 6px; }
  #logout { padding: 0 6px; }
}

/* deploy: contract picker and constructor arguments */
.deploy-contract { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.dc-field { display: grid; gap: 5px; font-size: 11.5px; color: var(--ink-faint); min-width: 0; }
.dc-field > span { display: flex; gap: 6px; align-items: baseline; }
.dc-field small { font-family: var(--mono); font-size: 10.5px; opacity: .8; }
.dc-field select, .dc-field input { height: 34px; min-width: 170px; max-width: 100%; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--bg-deep); color: var(--ink); font: 13px var(--sans); outline: none; }
html[data-theme] .dc-field select, html[data-theme] .dc-field input { background: rgb(0 0 0 / .18); }
.dc-field input:focus, .dc-field select:focus { border-color: var(--accent); }
