/* Marco/OS — NEXUS shell.
   Palette and metrics lifted from "Stage 0 - Design Directions.dc.html" (2a). */

:root {
  --bg: #0B0E11;
  --panel: #10141A;
  --panel-2: #12161B;
  --line: #1B1F24;
  --line-2: #212630;
  --line-3: #262C34;
  --text: #D7DBE0;
  --text-2: #C6CBD2;
  --muted: #8B929C;
  --dim: #6B727C;
  --faint: #4E5563;
  --bright: #E8E6E1;

  --car: #1E9E74;
  --mg: #17B0C4;
  --cam: #5B7FE0;
  --sc: #9B7BEB;
  --personal: #E05B5B;
  --notes: #E8E6E1;

  --ok: #7FBFA3;
  --warn: #D4A24E;
  --bad: #E08A8A;

  /* The base shell is neutral; entering a workspace floods --acc with that
     system's color. Every accented surface reads from this one variable. */
  --acc: #8FE3C0;

  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

/* Per-workspace tinting. Setting data-ws on the shell re-colors everything. */
.shell[data-ws="car"]      { --acc: var(--car); }
.shell[data-ws="mg"]       { --acc: var(--mg); }
.shell[data-ws="cam"]      { --acc: var(--cam); }
.shell[data-ws="sc"]       { --acc: var(--sc); }
.shell[data-ws="personal"] { --acc: var(--personal); }
.shell[data-ws="notes"]    { --acc: var(--notes); }

* { box-sizing: border-box; }

/* The UA's [hidden] rule is display:none at the lowest specificity, so any
   `display` we set on a class (.card, .view, .toast…) silently beats it and the
   element stays visible. Everything that toggles `hidden` needs this. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 13px;
  overflow: hidden;
}

.mono { font-family: var(--mono); }
.spacer { flex: 1; }
.dim { color: var(--muted); }
.faint { color: var(--faint); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.acc-fg { color: var(--acc); }
.acc-bg { background: var(--acc); }
.micro { font-size: 9.5px; }

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.gap6 { gap: 6px; }
.stack5 { display: flex; flex-direction: column; gap: 5px; }
.stack8 { display: flex; flex-direction: column; gap: 8px; }
.scroll { overflow-y: auto; min-height: 0; }

/* ── shell ─────────────────────────────────────────────────── */
.shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── header ────────────────────────────────────────────────── */
.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.wordmark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .08em;
}
.slash { color: var(--acc); transition: color .5s ease; }

.eq { display: flex; align-items: flex-end; gap: 3px; height: 20px; }
.eq span {
  width: 3px;
  height: 20px;
  background: var(--acc);
  transform-origin: bottom;
  animation: eq 1.1s ease-in-out infinite;
  transition: background .5s ease;
}
.eq span:nth-child(2) { animation-duration: 1.4s; animation-delay: -.3s; }
.eq span:nth-child(3) { animation-duration: .9s;  animation-delay: -.6s; }
.eq span:nth-child(4) { animation-duration: 1.6s; animation-delay: -.2s; }
.eq span:nth-child(5) { animation-duration: 1.2s; animation-delay: -.8s; }
.eq span:nth-child(6) { animation-duration: 1s;   animation-delay: -.45s; }

@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }

.pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--acc);
  animation: pulse 2s infinite;
  flex-shrink: 0;
  transition: background .5s ease;
}
.pulse-dot.sm { width: 6px; height: 6px; }
.pulse-dot.acc { background: var(--acc); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.35); }
  70%  { box-shadow: 0 0 0 9px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

/* ── run-a-job bar ─────────────────────────────────────────── */
.jobbar {
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.jobbar-input {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid #232830;
  border-radius: 10px;
  padding: 10px 16px;
  color: var(--dim);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color .18s ease;
}
.jobbar-input:hover { border-color: var(--acc); }
.chev { color: var(--acc); }
.jobbar-placeholder { color: var(--dim); }
.kbd {
  font-size: 10px;
  background: #1A1F26;
  border: 1px solid var(--line-3);
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--muted);
}

/* ── main / views ──────────────────────────────────────────── */
.main { flex: 1; min-height: 0; display: flex; }
.view { flex: 1; min-height: 0; }
.view[hidden] { display: none; }

.view-home { display: grid; grid-template-columns: 272px 1fr 296px; }
.view-ws, .view-notes { display: flex; flex-direction: column; }

/* ── rails ─────────────────────────────────────────────────── */
.rail {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  min-height: 0;
}
.rail-left { border-right: 1px solid var(--line); }
.rail-right { border-left: 1px solid var(--line); }

.rail-title {
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--dim);
  padding: 2px 2px 4px;
  flex-shrink: 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.card-warn { border-color: #2E2617; }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-body { font-size: 12px; line-height: 1.5; color: #B9BFC8; }

.label {
  font-size: 10px;
  letter-spacing: .15em;
  color: var(--muted);
}
.label.warn { color: var(--warn); }

.linkish {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--acc);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  align-self: flex-start;
}
.linkish:hover { text-decoration: underline; }

.stat-row { display: flex; align-items: baseline; gap: 8px; }
.stat { font-size: 22px; font-weight: 600; line-height: 1; }
.unit { font-size: 11px; color: var(--dim); }
.val { font-size: 12px; color: #B9BFC8; }

.meter { height: 5px; background: #1A2027; border-radius: 3px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }
.meter.thin { height: 4px; }
.meter.thin .meter-fill { opacity: .7; }

/* ── buttons ───────────────────────────────────────────────── */
.btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.btn-approve { flex: 1; background: #16241D; border: 1px solid var(--car); color: var(--ok); }
.btn-approve:hover { background: #1A2E24; }
.btn-ghost { background: none; border: 1px solid #2A2F37; color: var(--muted); }
.btn-ghost:hover { border-color: var(--faint); color: var(--bright); }
.btn-solid { background: var(--bright); color: var(--bg); border: none; padding: 8px 14px; font-size: 11px; }
.btn-solid:hover { background: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── schedule / due rows ───────────────────────────────────── */
.line-row { display: flex; gap: 9px; align-items: baseline; }
.line-row .time { font-family: var(--mono); font-size: 10.5px; color: var(--dim); width: 36px; flex-shrink: 0; }
.line-row .dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.line-row .txt { font-size: 12px; color: var(--text-2); }

/* ── the nexus ─────────────────────────────────────────────── */
.nexus {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 46%, #0E1620 0%, #0A0D11 72%);
  min-width: 0;
}
#nexusCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.grid-floor {
  position: absolute;
  left: -15%; right: -15%; bottom: -60px;
  height: 280px;
  background-image:
    repeating-linear-gradient(90deg, rgba(94,196,212,.16) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg,  rgba(94,196,212,.16) 0 1px, transparent 1px 44px);
  transform: perspective(420px) rotateX(63deg);
  mask-image: linear-gradient(to top, rgba(0,0,0,.75), transparent 88%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.75), transparent 88%);
  pointer-events: none;
}

.nexus-hud {
  position: absolute;
  left: 0; right: 0; top: 16px;
  display: flex;
  justify-content: center;
  gap: 34px;
  font-size: 10px;
  letter-spacing: .22em;
  color: #5E8A96;
  pointer-events: none;
}
.hud-live { color: #7FDCE8; }

.nexus-foot {
  position: absolute;
  left: 50%; bottom: 14px;
  transform: translateX(-50%);
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: .1em;
  white-space: nowrap;
  pointer-events: none;
}

/* HUD callouts — positioned as a % of the nexus so they hold together
   at viewport sizes other than the mockup's fixed 1400x960. */
.callout { position: absolute; }
.callout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(11,14,17,.9);
  border: 1px solid var(--c);
  border-radius: 4px;
  padding: 9px 13px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background .18s ease;
}
.callout-btn:hover { background: var(--c-dim); }
.callout-diamond { width: 7px; height: 7px; background: var(--c); transform: rotate(45deg); flex-shrink: 0; }
.callout-labels { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.callout-name { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .2em; }
.callout-sub { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; color: var(--c-text); }
.callout-eq { display: flex; align-items: flex-end; gap: 2px; height: 14px; margin-left: 6px; }
.callout-eq span {
  width: 3px; height: 14px;
  background: var(--c);
  opacity: .75;
  transform-origin: bottom;
  animation: eq 1.2s ease-in-out infinite;
}
.callout-eq span:nth-child(2) { animation-duration: 1.5s; animation-delay: -.4s; }
.callout-eq span:nth-child(3) { animation-duration: .95s; animation-delay: -.7s; }
.callout-eq span:nth-child(4) { animation-duration: 1.35s; animation-delay: -.2s; }

/* leader lines from each callout back toward the core */
.callout .lead-h, .callout .lead-v { position: absolute; background: var(--c); opacity: .4; }
.callout .lead-h { top: 50%; width: 54px; height: 1px; }
.callout .lead-v { width: 1px; height: 52px; }

/* ── workspace view ────────────────────────────────────────── */
.ws-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.ws-title { font-size: 17px; font-weight: 600; }
.ws-grid { flex: 1; display: grid; grid-template-columns: 300px 1fr 320px; min-height: 0; }
.ws-center { display: grid; grid-template-rows: 1fr 1fr; min-height: 0; }
.ws-pane {
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.ws-pane:first-child { border-bottom: 1px solid var(--line); }

.agent-btn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid #20252C;
  border-radius: 9px;
  padding: 11px 13px;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .18s ease;
  flex-shrink: 0;
}
.agent-btn:hover { border-color: var(--acc); }
.agent-top { display: flex; align-items: center; gap: 9px; width: 100%; }
.agent-name { font-size: 12.5px; font-weight: 500; flex: 1; }
.agent-status { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; }
.agent-last { font-family: var(--mono); font-size: 9.5px; color: var(--dim); letter-spacing: .04em; }
.agent-jobs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.job-chip {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
  background: #171C22;
  border: 1px solid var(--line-3);
  border-radius: 4px;
  padding: 3px 7px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease;
}
.job-chip:hover { border-color: var(--acc); color: var(--bright); }
.job-chip:disabled { opacity: .45; cursor: not-allowed; }

.feed-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 13px;
  background: #0E1216;
  border: 1px solid #1B2026;
  border-radius: 9px;
  flex-shrink: 0;
}
.feed-time { font-family: var(--mono); font-size: 11px; color: var(--dim); width: 38px; flex-shrink: 0; }
.feed-text { font-size: 13px; color: var(--text-2); line-height: 1.45; }

.task-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid #20252C;
  border-radius: 8px;
  padding: 10px 13px;
  flex-shrink: 0;
}
.task-title { font-size: 12.5px; color: var(--text-2); }
.task-status {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.task-status:hover { text-decoration: underline; }

/* ── notes whiteboard ──────────────────────────────────────── */
.whiteboard {
  flex: 1;
  position: relative;
  margin: 18px 22px;
  background: #0E1216;
  border: 1px solid #1B2026;
  border-radius: 10px;
  background-image: radial-gradient(#1D242C 1px, transparent 1px);
  background-size: 26px 26px;
  overflow: hidden;
  min-height: 0;
}
.sticky {
  position: absolute;
  width: 210px;
  padding: 13px 15px 11px;
  background: rgba(14,18,32,.9);
  border: 1px solid var(--c);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: grab;
  user-select: none;
}
.sticky.dragging { cursor: grabbing; z-index: 10; }
.sticky-text { font-size: 13px; line-height: 1.5; color: var(--text-2); }
.sticky-meta { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; color: var(--c-text); }
.whiteboard-foot {
  position: absolute;
  right: 26px; bottom: 18px;
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--faint);
  pointer-events: none;
}

/* ── ticker ────────────────────────────────────────────────── */
.ticker {
  height: 38px;
  border-top: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.ticker-track {
  display: flex;
  white-space: nowrap;
  animation: marq 32s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
@keyframes marq { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker-seg { font-family: var(--mono); font-size: 11px; color: var(--muted); padding-right: 0; }
.ticker-item { margin-right: 28px; }

/* ── command palette ───────────────────────────────────────── */
.palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5,7,9,.72);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  z-index: 50;
}
.palette-backdrop[hidden] { display: none; }
.palette {
  width: 620px;
  max-width: 92vw;
  background: #0E1216;
  border: 1px solid var(--line-3);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
}
.palette-input {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  color: var(--bright);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.palette-list { max-height: 320px; overflow-y: auto; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 18px;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.palette-item[aria-selected="true"] { background: #141A21; border-left-color: var(--c, var(--acc)); }
.palette-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--acc)); flex-shrink: 0; }
.palette-label { font-size: 13px; color: var(--text-2); }
.palette-meta { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; color: var(--dim); margin-left: auto; }
.palette-empty { padding: 22px 18px; color: var(--dim); font-size: 13px; }
.palette-foot {
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  font-size: 9.5px;
  letter-spacing: .12em;
  color: var(--faint);
}

/* ── toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%; bottom: 58px;
  transform: translateX(-50%);
  background: #12181F;
  border: 1px solid var(--line-3);
  border-left: 2px solid var(--acc);
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 12.5px;
  color: var(--text-2);
  z-index: 60;
  max-width: 70vw;
}
.toast[hidden] { display: none; }
.toast.bad { border-left-color: var(--bad); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
