/* ============================================================================
   OBLQAI Workspace — app.css (component layer over tokens.css)
   v1.1 "modern command". NO MOTION: zero animation/transition authored here;
   tokens.css carries the global kill switch. Depth = soft static elevation.
   ========================================================================== */

/* ---------- shell ---------- */
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font-ui); }
.shell { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: 56px 1fr; height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.wordmark { display: flex; align-items: baseline; gap: 1px; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.wordmark sup { font-size: 9px; font-weight: 700; color: var(--accent-text); letter-spacing: .04em; }
.wordmark-app { color: var(--text-2); font-weight: 400; padding-left: 10px; margin-left: 6px; border-left: 1px solid var(--border); }
.topsearch { flex: 1; max-width: 560px; }
.topsearch input { width: 100%; height: 34px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: inherit; }
.topsearch input:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--surface); }
.topbar .spacer { flex: 1; }
.avatar { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.avatar.agent { background: var(--accent); color: var(--accent-ink); }

.rail { background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto;
  display: flex; flex-direction: column; padding: 12px; gap: 2px; }
.ws-switch { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 10px; background: var(--surface); }
.ws-switch .avatar { background: var(--accent-soft); color: var(--accent-text); }
.ws-name { font-weight: 600; font-size: 13px; }
.ws-sub { font-size: 11px; color: var(--text-2); }
.rail-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-2); padding: 12px 8px 4px; }
.rail-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 500; }
.rail-item:hover { background: var(--surface-2); text-decoration: none; }
.rail-item.active { background: var(--accent-soft); color: var(--accent-text); }
.rail-item .ico { width: 18px; text-align: center; color: var(--text-2); font-family: var(--font-mono); font-size: 13px; }
.rail-item.active .ico { color: var(--accent-text); }
.rail-item .count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; }
.rail-item .count.hot { background: var(--accent-soft); color: var(--accent-text); }
.rail-status { margin-top: auto; padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 12px; color: var(--text-2); display: flex; gap: 8px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.danger { background: var(--danger); }

.main { overflow-y: auto; padding: 32px; }
.main.flush { padding: 0; display: flex; flex-direction: column; }

/* ---------- primitives ---------- */
.card-p { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--elev-card, 0 1px 2px rgb(16 24 40 / .04), 0 8px 24px rgb(16 24 40 / .06)); }
.pad { padding: 20px; } .pad-l { padding: 24px; }
.grid { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--text-2); } .small { font-size: 12px; } .mono { font-family: var(--font-mono); }
h1.display { font-size: 30px; line-height: 1.1; font-weight: 600; margin: 0; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
a { color: var(--accent-text); text-decoration: none; } a:hover { text-decoration: underline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid transparent; font: 600 13px/1 var(--font-ui); cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent-text); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok-text); }
.chip.warn { background: var(--warn-soft); color: var(--warn-text); }
.chip.danger { background: var(--danger-soft); color: var(--danger-text); }
.chip.info { background: var(--info-soft); color: var(--info-text); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.agent { background: var(--accent-soft); color: var(--accent-text); letter-spacing: .04em; }

.icochip { width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 15px; font-family: var(--font-mono); font-weight: 700; flex: none; }
.icochip.accent { background: var(--accent-soft); color: var(--accent-text); }
.icochip.ok { background: var(--ok-soft); color: var(--ok-text); }
.icochip.warn { background: var(--warn-soft); color: var(--warn-text); }
.icochip.danger { background: var(--danger-soft); color: var(--danger-text); }
.icochip.info { background: var(--info-soft); color: var(--info-text); }

input[type=text], input[type=email], input[type=date], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; resize: vertical; min-height: 64px; }
label { font-size: 12px; font-weight: 600; color: var(--text-2); display: block; margin-bottom: 4px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg a { padding: 5px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(16 24 40 / .08); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a { padding: 8px 12px; font-weight: 600; font-size: 13px; color: var(--text-2); border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tile { padding: 18px 20px; }
.tile .t-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.tile .t-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.tile .t-value { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .t-unit { font-size: 13px; color: var(--text-2); font-weight: 400; margin-left: 4px; }
.tile .t-delta { margin-top: 8px; font-size: 12.5px; font-weight: 500; }
.t-delta.up { color: var(--ok-text); } .t-delta.down { color: var(--danger-text); } .t-delta.flat { color: var(--text-2); }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--surface); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.kcol { min-width: 264px; width: 264px; flex: none; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; }
.kcol-head .count { color: var(--text-2); font-size: 12px; font-weight: 600; }
.kcard { padding: 12px 14px; margin-bottom: 10px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: 0 1px 2px rgb(16 24 40 / .05); display: block; color: var(--text); }
.kcard:hover { border-color: var(--border-strong); text-decoration: none; }
.kcard .k-title { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.kcard .k-meta { font-size: 12px; color: var(--text-2); display: flex; gap: 8px; flex-wrap: wrap; }
.stage-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.stage-dot.ok { background: var(--ok); } .stage-dot.warn { background: var(--warn); }
.stage-dot.danger { background: var(--danger); } .stage-dot.info { background: var(--info); }
.stage-dot.accent { background: var(--accent); }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 56px); }
.chat-head { padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 2px; }
.chat-foot { border-top: 1px solid var(--border); background: var(--surface); padding: 12px 24px; }
.msg { display: flex; gap: 12px; padding: 5px 8px; border-radius: 8px; }
.msg:hover { background: var(--surface-2); }
.msg .m-body { min-width: 0; flex: 1; }
.msg .m-head { display: flex; align-items: baseline; gap: 8px; }
.msg .m-author { font-weight: 600; font-size: 13.5px; }
.msg .m-time { font-size: 11.5px; color: var(--text-2); font-family: var(--font-mono); }
.msg .m-text { font-size: 14px; }
.msg .m-text p { margin: 2px 0; }
.msg .m-text pre { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; }
.msg .m-text code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); border-radius: 4px; padding: 1px 4px; }
.msg .m-text blockquote { margin: 4px 0; padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.mention { color: var(--accent-text); font-weight: 600; background: var(--accent-soft); border-radius: 4px; padding: 0 3px; }
.thread-link { font-size: 12px; color: var(--accent-text); font-weight: 600; }
.day-divider { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 11.5px;
  font-weight: 600; margin: 14px 0 6px; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.working { display: flex; gap: 10px; align-items: center; padding: 8px 12px; margin: 6px 0; border-radius: 8px;
  background: var(--surface-2); font-size: 13px; color: var(--text-2); font-family: var(--font-mono); }

/* proposal card in stream / inbox */
.proposal { border: 1px solid var(--border-strong); border-radius: 12px; padding: 16px 18px; margin: 8px 0;
  background: var(--surface); box-shadow: 0 1px 2px rgb(16 24 40 / .05); max-width: 560px; }
.proposal .p-tag { margin-bottom: 8px; }
.proposal .p-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.proposal .p-meta { font-size: 12px; color: var(--text-2); font-family: var(--font-mono); margin: 10px 0; }
.proposal .p-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* thread pane / split layout */
.split { display: grid; grid-template-columns: 1fr 380px; height: calc(100vh - 56px); }
.pane { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; padding: 20px; }

/* ---------- 360 ---------- */
.c360-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.c360-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px 20px; margin-top: 16px; }
.fact .f-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.fact .f-value { font-size: 14px; font-weight: 600; margin-top: 2px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.tl-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2); width: 96px; flex: none; padding-top: 2px; }
.tl-title { font-weight: 600; font-size: 13.5px; }
.tl-detail { font-size: 12.5px; color: var(--text-2); }
.doc-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--text); background: var(--surface); }

/* ---------- misc ---------- */
.empty { padding: 40px; text-align: center; color: var(--text-2); font-size: 13.5px; }
.list-row { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.doc-prose { font-size: 16px; line-height: 1.6; max-width: 72ch; }
.doc-prose h1 { font-size: 26px; } .doc-prose h2 { font-size: 20px; } .doc-prose h3 { font-size: 17px; }
.doc-prose pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.doc-prose code { font-family: var(--font-mono); font-size: 13px; }
.doc-prose table { border-collapse: collapse; } .doc-prose td, .doc-prose th { border: 1px solid var(--border); padding: 6px 10px; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 360px; }
.notice { padding: 10px 14px; border-radius: 8px; font-size: 13px; background: var(--info-soft); color: var(--info-text); }
.notice.ok { background: var(--ok-soft); color: var(--ok-text); }
.notice.danger { background: var(--danger-soft); color: var(--danger-text); }
.svgchart text { font-family: var(--font-mono); font-size: 10.5px; fill: var(--text-2); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); }
.legend .swatch { width: 14px; height: 3px; display: inline-block; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .split { grid-template-columns: 1fr; } .pane { border-left: 0; border-top: 1px solid var(--border); }
  .main { padding: 16px; }
}

/* ---------- inline edit forms (card edit, board structure) ---------- */
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px 20px; margin-top: 18px; }
.edit-grid label { margin-bottom: 5px; }

/* file inputs sit inline with buttons; no custom control, just restraint */
.file-slim { font-size: 12px; color: var(--text-2); max-width: 210px; }
.file-slim::file-selector-button { font: 600 12px/1 var(--font-ui); height: 30px; padding: 0 10px;
  margin-right: 8px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; }

/* ---------- mention autocomplete ---------- */
.mention-menu { position: absolute; bottom: calc(100% + 6px); left: 0; min-width: 280px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px;
  box-shadow: var(--elev-overlay, 0 12px 32px rgb(16 24 40 / .12)); }
.mention-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px;
  font-size: 13.5px; cursor: pointer; }
.mention-item.active, .mention-item:hover { background: var(--surface-2); }
.mention-item .mi-name { font-weight: 600; }
.mention-item .mi-handle { margin-left: auto; color: var(--text-2); font-family: var(--font-mono); font-size: 12px; }
