/* OCAP Workspace shell — chrome only. Tokens mirror the CRM (oc-crm/web) so
   the workspace and its apps feel like one product. */
:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 12%;
  --card: 0 0% 100%;
  --muted: 0 0% 96%;
  --muted-foreground: 0 0% 40%;
  --accent: 152 55% 94%;
  --accent-foreground: 160 84% 22%;
  --primary: 160 84% 30%;
  --primary-foreground: 0 0% 100%;
  --border: 0 0% 90%;
  --ok: 152 60% 42%;
  --down: 0 72% 50%;
  --radius: 0.5rem;
}
html.dark {
  --background: 0 0% 7%;
  --foreground: 0 0% 83%;
  --card: 0 0% 10%;
  --muted: 0 0% 14%;
  --muted-foreground: 0 0% 56%;
  --accent: 0 0% 17%;
  --accent-foreground: 0 0% 92%;
  --primary: 152 76% 67%;
  --primary-foreground: 0 0% 7%;
  --border: 0 0% 18%;
  --ok: 152 60% 55%;
  --down: 0 70% 60%;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ── Left rail ─────────────────────────────────────────────────────────── */
.rail {
  display: flex;
  flex-direction: column;
  width: 224px;
  flex-shrink: 0;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.4);
  padding: 6px;
}
.ws-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
}
.ws-logo {
  display: grid;
  place-items: center;
  height: 28px;
  width: 28px;
  border-radius: 999px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 600;
}
.ws-name { font-weight: 600; }
.rail-section-label {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: hsl(var(--muted-foreground));
}
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--muted-foreground));
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: hsl(var(--accent) / 0.6); color: hsl(var(--foreground)); }
.nav-item.active { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); font-weight: 500; }
.nav-item .icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item.active .icon { color: hsl(var(--primary)); }
.nav-item .label { flex: 1; }
.dot { width: 7px; height: 7px; border-radius: 999px; background: hsl(var(--muted-foreground) / 0.5); }
.dot.ok { background: hsl(var(--ok)); }
.dot.down { background: hsl(var(--down)); }
.rail-spacer { flex: 1; }
.rail-footer { padding: 10px; font-size: 11px; color: hsl(var(--muted-foreground)); border-top: 1px solid hsl(var(--border)); }

/* ── Content ───────────────────────────────────────────────────────────── */
.content { position: relative; flex: 1; min-width: 0; }
.view, .pane { position: absolute; inset: 0; display: none; }
.view.active, .pane.active { display: block; }

/* Home */
.home { max-width: 720px; margin: 0 auto; padding: 72px 32px; }
.home-title { font-size: 28px; font-weight: 600; margin: 0 0 6px; }
.home-sub { color: hsl(var(--muted-foreground)); margin: 0 0 28px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px; border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(var(--card)); cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.card:hover { border-color: hsl(var(--primary) / 0.5); }
.card.soon { cursor: default; opacity: 0.6; }
.card-top { display: flex; align-items: center; gap: 10px; }
.card-icon { display: grid; place-items: center; height: 32px; width: 32px; border-radius: var(--radius); background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.card-name { font-weight: 600; }
.card-desc { font-size: 13px; color: hsl(var(--muted-foreground)); }

/* App panes (iframes) */
.pane iframe { width: 100%; height: 100%; border: 0; display: block; }
.pane-fallback {
  position: absolute; inset: 0; display: none; place-items: center;
  background: hsl(var(--background));
}
.pane-fallback.show { display: grid; }
.fallback-box { text-align: center; color: hsl(var(--muted-foreground)); }
.fallback-box h2 { color: hsl(var(--foreground)); font-weight: 600; margin: 0 0 6px; }
.retry {
  margin-top: 12px; padding: 8px 16px; border: 0; border-radius: var(--radius);
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); font: inherit; font-weight: 500; cursor: pointer;
}
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: hsl(var(--muted-foreground)); }
.loading.hide { display: none; }
