/* Ember Workspace — design system lifted verbatim from mockups/workspace-web.html.
   Do not redesign here; the mock is the source of truth. */

:root {
  --tray: #edeae6;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-soft: #f7f5f2;
  --line: #e6e2dc;
  --line-strong: #d6d1c9;
  --text: #221f1b;
  --muted: #6f6a62;
  --faint: #a29c92;

  --ember: #e8590c;
  --ember-deep: #c2410c;
  --ember-soft: #fdeee3;
  --ember-glow: rgba(232, 89, 12, 0.25);

  --green: #1f9d55;
  --green-soft: #e7f6ec;
  --amber: #b45309;
  --amber-soft: #fdf3df;

  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

/* Blazor mounts into #app; it must not break the body grid below. */
#app { display: contents; }

body {
  font-family: var(--ui);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 480px at 88% -8%, rgba(232,89,12,0.055), transparent 60%),
    var(--tray);
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 288px 1fr;
  gap: 10px;
  padding: 10px;
}

.pill {
  min-height: 0;
  background: var(--surface);
  border: 0.5px solid rgba(255,255,255,0.9);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(40,30,20,0.05), 0 8px 22px rgba(40,30,20,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ================= NAV ================= */

.context {
  padding: 14px 14px 12px;
  border-bottom: 0.5px solid var(--line);
}
.org-line-wrap, .ws-line-wrap { position: relative; }
.org-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--muted); font-weight: 560;
  padding: 0 2px 9px;
  cursor: pointer;
}
.org-mark {
  width: 17px; height: 17px; border-radius: 5.5px;
  background: linear-gradient(150deg, #ff9d2e, #c2410c);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 9.5px;
  box-shadow: 0 1px 3px var(--ember-glow);
}
.org-mark.org-mango, .ws-mark.org-mango, .ctx-mark.org-mango {
  background: linear-gradient(150deg, #a78bfa, #6d28d9);
  box-shadow: 0 1px 3px rgba(109,40,217,0.3);
}
.org-line .chev { font-size: 8px; color: var(--faint); }
.org-line .cog { margin-left: auto; color: var(--faint); font-size: 13px; cursor: pointer; }

.ws-line { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.ws-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background:
    radial-gradient(14px 10px at 30% 22%, rgba(255,255,255,0.4), transparent 60%),
    linear-gradient(150deg, #ffb35c, #e8590c);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 2px 7px var(--ember-glow), inset 0 0.5px 0 rgba(255,255,255,0.5);
}
.ws-name { font-size: 14.5px; font-weight: 690; letter-spacing: -0.2px; flex: 1; }
.ws-line .chev { color: var(--faint); font-size: 10px; }

/* ---- Context switcher dropdowns ---- */
.ctx-backdrop { position: fixed; inset: 0; z-index: 40; background: transparent; }
.ctx-menu {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px;
  z-index: 50;
  background: var(--surface-strong);
  border: 0.5px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(40,30,20,0.08), 0 10px 30px rgba(40,30,20,0.12);
  padding: 6px;
}
.ctx-menu .ctx-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 8px;
  font-size: 13px; color: var(--text); font-weight: 530;
  cursor: pointer;
}
.ctx-menu .ctx-row:hover { background: var(--surface-soft); }
.ctx-menu .ctx-row.inert { color: var(--faint); cursor: default; }
.ctx-menu .ctx-row.inert:hover { background: none; }
.ctx-menu .ctx-row .tick { margin-left: auto; color: var(--ember); font-size: 12px; }
.ctx-menu .ctx-row .ctx-cog, .ctx-menu .ctx-row .ctx-add { margin-left: auto; font-size: 12px; color: var(--faint); }
.ctx-menu .ctx-divider { height: 0.5px; background: var(--line); margin: 5px 2px; }
.ctx-mark {
  width: 16px; height: 16px; border-radius: 5px; flex: none;
  background: linear-gradient(150deg, #ff9d2e, #c2410c);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 9px;
}

.nav-scroll { flex: 1; overflow-y: auto; padding: 12px 10px 12px; min-height: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7.5px 10px; border-radius: 9px;
  font-size: 13px; color: var(--muted); font-weight: 530;
  margin-bottom: 1px;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-soft); }
.nav-item.active {
  background: var(--surface-strong); color: var(--text); font-weight: 640;
  box-shadow: 0 0 0 0.5px var(--line-strong), 0 1px 3px rgba(40,30,20,0.07);
}
.nav-glyph { width: 18px; text-align: center; font-size: 13px; color: var(--faint); }
.nav-item.active .nav-glyph { color: var(--ember); }

.nav-badge {
  margin-left: auto;
  background: linear-gradient(150deg, #f0620d, var(--ember-deep));
  color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px;
  display: grid; place-items: center; padding: 0 5px;
  box-shadow: 0 1px 3px var(--ember-glow);
}

.nav-group {
  font-size: 10px; font-weight: 680; letter-spacing: 1px;
  text-transform: uppercase; color: var(--faint);
  padding: 18px 10px 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-group .add { font-size: 12px; font-weight: 400; }
.nav-group .disclose { font-size: 8.5px; }

.nav-item .live-dot {
  margin-left: auto;
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums;
}
@keyframes breathe { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.live-dot i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: breathe 2.4s ease-in-out infinite;
}

.nav-item .more { margin-left: auto; font-size: 10.5px; color: var(--faint); }

.staff-dots { margin-left: auto; display: flex; }
.staff-dots .mini {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--surface-strong);
  margin-left: -5px;
  display: grid; place-items: center;
  color: #fff; font-size: 6.5px; font-weight: 700;
}
.staff-dots .mini:first-child { margin-left: 0; }

.a-owner  { background: linear-gradient(150deg, #ffb35c, #e8590c); }
.a-violet { background: linear-gradient(150deg, #a78bfa, #6d28d9); }
.a-cyan   { background: linear-gradient(150deg, #22d3ee, #0e7490); }
.a-slate  { background: linear-gradient(150deg, #a8b0ba, #5f6b78); }
.a-moss   { background: linear-gradient(150deg, #a3e635, #4d7c0f); }

.nav-footer {
  border-top: 0.5px solid var(--line);
  padding: 11px 14px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 680; color: #fff; flex: none;
  box-shadow: inset 0 0.5px 0 rgba(255,255,255,0.45), 0 1px 2px rgba(40,30,20,0.12);
}
.nav-footer .avatar { width: 26px; height: 26px; font-size: 10.5px; }
.nav-footer .who { flex: 1; min-width: 0; }
.nav-footer .nm { font-weight: 620; font-size: 12.5px; }
.nav-footer .em { font-size: 10px; color: var(--faint); }
.nav-footer .cog { color: var(--faint); font-size: 13px; }

/* ================= MAIN / BRIEFING ================= */

.main { position: relative; }

.brief-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.brief-inner { max-width: 860px; margin: 0 auto; padding: 40px 40px 24px; }

.brief-date {
  font-size: 11px; font-weight: 650; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--faint);
}
.brief-title {
  font-size: 26px; font-weight: 740; letter-spacing: -0.5px;
  margin: 6px 0 4px;
}
.brief-lede {
  font-size: 14px; color: var(--muted); line-height: 1.55;
  max-width: 620px;
}
.brief-lede b { color: var(--text); font-weight: 640; }
.prepared {
  display: flex; align-items: center; gap: 7px;
  margin-top: 14px; font-size: 11px; color: var(--faint);
}
.prepared .mini {
  width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 6.5px; font-weight: 700;
  border: 1.5px solid var(--surface-strong);
  margin-left: -5px;
}
.prepared .mini:first-child { margin-left: 0; }

.brief-section { margin-top: 34px; }
.sec-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px;
}
.sec-title { font-size: 13px; font-weight: 690; letter-spacing: -0.1px; }
.sec-link { font-size: 11.5px; color: var(--ember); font-weight: 600; margin-left: auto; }

/* needs you */
.need-card {
  display: flex; align-items: center; gap: 13px;
  border: 0.5px solid #f3d9bd;
  background: linear-gradient(180deg, #fff9f2, #fdf0e2);
  border-radius: 13px;
  padding: 13px 16px;
  margin-bottom: 8px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(232,89,12,0.06);
}
.need-card .pen {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  background: var(--surface-strong);
  border: 0.5px solid #f0dcc0;
  display: grid; place-items: center; font-size: 14px;
  box-shadow: 0 1px 3px rgba(40,30,20,0.06);
}
.need-card .ntext b { font-weight: 650; }
.need-card .nsub { font-size: 11px; color: var(--muted); margin-top: 1.5px; }
.need-card .spacer { flex: 1; }
.btn {
  font-size: 11.5px; font-weight: 630; padding: 6px 13px;
  border-radius: 8px; border: 0.5px solid var(--line-strong);
  background: var(--surface-strong); color: var(--text);
  box-shadow: 0 1px 2px rgba(40,30,20,0.05);
}
.btn.primary {
  background: linear-gradient(150deg, #f0620d, var(--ember-deep));
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px var(--ember-glow), inset 0 0.5px 0 rgba(255,255,255,0.3);
}

/* in motion rows */
.motion-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px;
  border-bottom: 0.5px solid var(--line);
  font-size: 13px;
}
.motion-row:last-child { border-bottom: none; }
.motion-row .avatar { width: 26px; height: 26px; font-size: 10px; }
.m-meta { flex: 1; min-width: 0; }
.m-title { font-weight: 620; font-size: 13px; letter-spacing: -0.1px; }
.m-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.m-sub b { color: var(--text); font-weight: 600; }
.m-state { font-size: 11px; color: var(--faint); display: flex; align-items: center; gap: 6px; flex: none; }
.m-state.live { color: var(--green); font-weight: 640; }
.m-state.live i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  animation: breathe 1.8s ease-in-out infinite;
}
.m-state .tick {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 8px;
}

/* property cards */
.prop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.prop-card {
  border: 0.5px solid var(--line);
  background: var(--surface-strong);
  border-radius: 13px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(40,30,20,0.04);
}
.prop-name { font-size: 13px; font-weight: 670; letter-spacing: -0.1px; display: flex; align-items: center; gap: 7px; }
.prop-name .pd { width: 7px; height: 7px; border-radius: 2.5px; background: linear-gradient(150deg,#ff9d2e,var(--ember)); }
.prop-line { font-size: 11.5px; color: var(--muted); margin-top: 7px; line-height: 1.5; }
.prop-line b { color: var(--text); font-weight: 620; }
.prop-chip {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 10px;
  font-size: 10px; font-weight: 650;
  padding: 3px 9px; border-radius: 999px;
}
.pc-green { background: var(--green-soft); color: var(--green); }
.pc-amber { background: var(--amber-soft); color: var(--amber); }
.pc-grey { background: #f1efec; color: var(--faint); }

/* composer — on the page, the way in */
.ask-wrap { flex: none; padding: 14px 40px 26px; }
.ask-inner { max-width: 860px; margin: 0 auto; }
.ask {
  display: flex; align-items: center; gap: 12px;
  border: 0.5px solid var(--line-strong);
  background: var(--surface-strong);
  border-radius: 15px;
  padding: 15px 19px;
  box-shadow: 0 2px 6px rgba(40,30,20,0.05), 0 10px 30px rgba(40,30,20,0.07);
}
.ask .hint { color: var(--faint); font-size: 13.5px; flex: 1; }
.ask input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-family: var(--ui); font-size: 13.5px; color: var(--text);
}
.ask input::placeholder { color: var(--faint); }
.ask .ic { color: var(--faint); font-size: 13px; }
.ask .send {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(150deg, #f0620d, var(--ember-deep));
  color: #fff; display: grid; place-items: center; font-size: 13px;
  box-shadow: 0 2px 7px var(--ember-glow);
  cursor: pointer; flex: none;
}

/* ================= THREADS ================= */

.spine { margin-top: 8px; }

.day-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 0 18px; color: var(--faint);
  font-size: 10px; font-weight: 650; letter-spacing: 1px; text-transform: uppercase;
}
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 0.5px; background: var(--line); }

.msg { display: flex; gap: 12px; margin-bottom: 4px; }
.msg > .avatar { width: 31px; height: 31px; font-size: 12.5px; margin-top: 2px; }
.msg-body { min-width: 0; flex: 1; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-size: 13px; font-weight: 670; letter-spacing: -0.1px; }
.msg-role { font-size: 10px; color: var(--faint); font-weight: 560; letter-spacing: 0.3px; text-transform: uppercase; }
.msg-time { font-size: 10.5px; color: var(--faint); }
.msg-text { font-size: 13.5px; line-height: 1.55; margin-top: 2.5px; }
.msg-text b { font-weight: 640; }

.gap { height: 4px; }

/* Threads — the hero element. Colored rail = who owns the work. */
.thread {
  margin: 10px 0 4px;
  background: var(--surface-strong);
  border: 0.5px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 3px rgba(40,30,20,0.04);
}
.thread::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.thread.by-violet::before { background: linear-gradient(180deg, #a78bfa, #6d28d9); }
.thread.by-cyan::before   { background: linear-gradient(180deg, #22d3ee, #0e7490); }
.thread.by-moss::before   { background: linear-gradient(180deg, #a3e635, #4d7c0f); }
.thread.by-slate::before  { background: linear-gradient(180deg, #a8b0ba, #5f6b78); }

.thread-head {
  display: flex; align-items: center; gap: 9px;
  padding: 8.5px 14px 8.5px 16px;
  background: var(--surface-soft);
  border-bottom: 0.5px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.thread-head .tname { font-weight: 650; color: var(--text); letter-spacing: -0.1px; }
.thread-head .spacer { flex: 1; }

.env {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 650; letter-spacing: 0.3px;
  padding: 2.5px 8px; border-radius: 999px;
  background: #f1efec; color: var(--faint);
}
.env.write { background: var(--amber-soft); color: var(--amber); }
.env.build { background: var(--green-soft); color: var(--green); }

.resolved {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--green); font-weight: 620;
}
.resolved .tick {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 8px;
}
.replies { font-size: 10.5px; color: var(--faint); }

@keyframes livepulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--green); font-weight: 650;
}
.live-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: livepulse 1.6s ease-in-out infinite;
}

.thread-msgs { padding: 11px 14px 5px 16px; }
.tmsg { display: flex; gap: 9px; margin-bottom: 11px; }
.tmsg > .avatar { width: 22px; height: 22px; font-size: 9px; margin-top: 1px; }
.tmsg .msg-author { font-size: 12px; }
.tmsg .msg-text { font-size: 12.5px; margin-top: 1px; }

.activity {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--faint);
  padding: 0 0 11px 31px;
}
.activity .ic {
  width: 16px; height: 16px; border-radius: 5px; flex: none;
  background: var(--surface-soft); border: 0.5px solid var(--line);
  display: grid; place-items: center; font-size: 9px;
}
.activity b { color: var(--muted); font-weight: 620; }
.activity.referral { color: var(--amber); }
.activity.referral .ic { background: var(--amber-soft); border-color: var(--amber); }
.activity.referral b { color: var(--amber); }
.activity .cap {
  font-family: var(--mono); font-size: 10px;
  background: var(--surface-soft); border: 0.5px solid var(--line);
  padding: 1px 6px; border-radius: 5px; color: var(--muted);
}

.figures {
  margin-top: 8px; border: 0.5px solid var(--line);
  border-radius: 10px; overflow: hidden; max-width: 440px;
  font-size: 12px;
}
.figures .frow { display: flex; justify-content: space-between; align-items: center; padding: 6.5px 13px; border-bottom: 0.5px solid var(--line); }
.figures .frow:last-child { border-bottom: none; background: var(--surface-soft); font-weight: 660; }
.figures .fval { font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.figures .bar { height: 3px; border-radius: 2px; background: var(--ember-soft); position: relative; margin-top: 3px; }
.figures .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: linear-gradient(90deg, #ff9d2e, var(--ember)); }
.figures .fcell { flex: 1; padding-right: 24px; }

.resource-card {
  display: flex; align-items: center; gap: 12px;
  margin-top: 8px; max-width: 440px;
  border: 0.5px solid var(--line);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 10px 14px;
}
.resource-card .ric {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--surface-strong); border: 0.5px solid var(--line);
  display: grid; place-items: center; font-size: 14px;
}
.resource-card .rmeta { min-width: 0; flex: 1; }
.resource-card .rname { font-weight: 650; font-size: 12.5px; }
.resource-card .rurl { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.resource-card .rstate {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--green); font-weight: 620; margin-top: 3px;
}
.resource-card .rstate i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.resource-card .spacer { flex: 1; }

.collapsed-thread {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 8px;
  border: 0.5px solid var(--line);
  background: var(--surface-strong);
  border-radius: 10px;
  padding: 7px 13px;
  font-size: 12px; color: var(--muted);
  box-shadow: 0 1px 3px rgba(40,30,20,0.04);
}
.collapsed-thread .facepile { display: flex; }
.collapsed-thread .facepile .avatar { width: 18px; height: 18px; font-size: 7.5px; margin-left: -6px; border: 1.5px solid var(--surface-strong); }
.collapsed-thread .facepile .avatar:first-child { margin-left: 0; }
.collapsed-thread .link { color: var(--ember); font-weight: 620; font-size: 11.5px; }

/* Blazor default error UI, restyled minimally to fit the porcelain palette instead of Bootstrap. */
#blazor-error-ui {
  background: var(--surface-strong);
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
  font-family: var(--ui);
  color: var(--text);
}
#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

/* ---- Org settings stub (slice 3) ---- */
.settings-row {
  display: flex; align-items: center; gap: 13px;
  border: 0.5px solid var(--line);
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
}
.settings-row.disabled { opacity: 0.55; }
.settings-row .sr-glyph { width: 20px; text-align: center; font-size: 14px; color: var(--faint); }
.settings-row .sr-title { font-size: 13px; font-weight: 620; }
.settings-row .sr-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.settings-hint { font-size: 11.5px; color: var(--faint); margin-top: 10px; font-style: italic; }
