/* Intesols LeadOrbit — enterprise console.
   Direction: calm, neutral, precise. White working surfaces, hairline borders,
   Intesols terracotta used only where it carries meaning (primary action,
   selected navigation, the brand mark). Montserrat for structure, Inter for text. */

:root {
  --canvas: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e8e8eb;
  --border-strong: #d7d8dd;
  --ink: #171717;
  --muted: #737373;

  --accent: #c84529;
  --accent-hover: #ab3920;
  --accent-ink: #ffffff;
  --accent-text: #b03a1f;
  --accent-soft: #fdefea;
  --accent-strong: #8c2d16;
  --accent-border: #f0cdc0;

  --success: #1b7a4b;
  --success-ink: #ffffff;
  --success-soft: #edf6f1;
  --success-strong: #136038;
  --warning: #8a5a07;
  --warning-ink: #ffffff;
  --warning-soft: #fbf3e4;
  --warning-strong: #724a05;
  --danger: #b23024;
  --danger-ink: #ffffff;
  --danger-soft: #fbeeec;
  --danger-strong: #8f2419;

  --chart-1: #c84529;
  --chart-2: #251c47;
  --chart-3: #f2673a;
  --chart-4: #4b6b8a;
  --chart-5: #9aa0ab;
  --chart-6: #1b7a4b;

  --font-display: "Montserrat", "Inter Variable", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", "Inter Variable", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Inter", "Inter Variable", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display-weight: 600;
  --display-tracking: -0.02em;
  --eyebrow-tracking: 0.08em;
  --caps-tracking: 0.07em;
  --btn-weight: 500;

  --radius-card: 8px;
  --radius-btn: 6px;
  --radius-input: 6px;
  --border-w: 1px;
  --shadow-card: 0 1px 2px rgba(17, 17, 20, 0.04);
  --shadow-raised: 0 12px 32px rgba(17, 17, 20, 0.12), 0 2px 6px rgba(17, 17, 20, 0.06);
  --card-pad: 1.1rem;

  /* Product chrome — a light Slack-style rail, hairline separated */
  --x-nav: #fafafb;
  --x-nav-2: #f3f4f6;
  --x-nav-ink: #171717;
  --x-nav-muted: #6f7178;
  --x-nav-border: #e8e8eb;
  --x-nav-active: #ffffff;
  --x-brand-navy: #251c47;
  --x-on-brand: #ffffff;
  --x-on-brand-dim: #c9c6d6;
  --gradient-brand: linear-gradient(135deg, #f2673a 0%, #c84529 100%);
  --gradient-navy: linear-gradient(160deg, #251c47 0%, #1a1a24 100%);
}

html[data-theme="dark"] {
  --canvas: #0e0f12;
  --surface: #141619;
  --surface-2: #1b1e22;
  --border: #272a30;
  --border-strong: #3a3e46;
  --ink: #eceef1;
  --muted: #9ba0a9;

  --accent: #d2502d;
  --accent-hover: #e45f3a;
  --accent-ink: #130a07;
  --accent-text: #ff9a76;
  --accent-soft: #2e1710;
  --accent-strong: #ffb79c;
  --accent-border: #452418;

  --success: #1f8a55;
  --success-ink: #ffffff;
  --success-soft: #132219;
  --success-strong: #74cba1;
  --warning: #9c6a0d;
  --warning-ink: #ffffff;
  --warning-soft: #241c10;
  --warning-strong: #e3ae5c;
  --danger: #be372a;
  --danger-ink: #ffffff;
  --danger-soft: #241312;
  --danger-strong: #f28d82;

  --chart-1: #f2673a;
  --chart-2: #9b8fd6;
  --chart-3: #e45f3a;
  --chart-4: #74a3cf;
  --chart-5: #8d9299;
  --chart-6: #46b47c;

  --x-nav: #111317;
  --x-nav-2: #181b20;
  --x-nav-ink: #eceef1;
  --x-nav-muted: #8f949d;
  --x-nav-border: #23262c;
  --x-nav-active: #1d2026;
  --x-on-brand-dim: #a9a6b8;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-raised: 0 14px 38px rgba(0, 0, 0, 0.6);
}

/* Intesols LeadOrbit — application chrome.
   A fixed light rail (Slack), a quiet workspace header (Apple), dense hairline
   data surfaces (Linear). Colour appears only where it means something. */

:root {
  --rail-w: 252px;
  --rail-w-collapsed: 64px;
  --x-hair: color-mix(in srgb, var(--ink) 6%, transparent);
}

/* ---------------------------------------------------------------- shell */

.app {
  min-height: 100vh;
  background: var(--canvas);
}

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  background: var(--x-nav);
  border-right: 1px solid var(--x-nav-border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 0.2s ease, width 0.16s ease;
}

.rail-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.85rem;
  height: 56px;
  flex: none;
  border-bottom: 1px solid var(--x-nav-border);
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  color: var(--x-nav-ink);
}
.rail-brand:hover { text-decoration: none; }

.rail-mark {
  height: 18px;
  width: auto;
  flex: none;
  display: block;
}
html[data-theme="dark"] .rail-mark,
.logo-chip {
  background: var(--x-on-brand);
  border-radius: 5px;
  padding: 3px 5px;
  box-sizing: content-box;
}

.rail-product {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--x-nav-ink);
  padding-left: 0.55rem;
  border-left: 1px solid var(--x-nav-border);
  line-height: 1.1;
  white-space: nowrap;
}

.rail-icon-btn {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  color: var(--x-nav-muted);
  flex: none;
}
.rail-icon-btn:hover { background: var(--x-hair); color: var(--x-nav-ink); }

/* workspace + account selectors */

.rail-switch {
  padding: 0.7rem 0.7rem 0.55rem;
  border-bottom: 1px solid var(--x-nav-border);
  flex: none;
}

.rail-ws {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.4rem 0.45rem;
  border-radius: 7px;
  background: var(--x-nav-active);
  border: 1px solid var(--x-nav-border);
  min-width: 0;
}

.rail-ws-mark {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 5px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
}

.rail-ws-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--x-nav-ink);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-ws-sub {
  display: block;
  font-size: 0.66rem;
  color: var(--x-nav-muted);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-label {
  margin: 0.7rem 0 0.25rem;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--caps-tracking);
  color: var(--x-nav-muted);
}

select.rail-select {
  width: 100%;
  height: 2rem;
  font-size: 0.78rem;
  padding: 0 1.9rem 0 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--x-nav-border);
  background-color: var(--x-nav-active);
  color: var(--x-nav-ink);
}
select.rail-select:hover { border-color: var(--border-strong); }

.rail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0.55rem 1.75rem;
  scrollbar-width: thin;
}
.rail-scroll::-webkit-scrollbar { width: 6px; }
.rail-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

.rail-group {
  margin: 0.95rem 0 0.25rem;
  padding: 0 0.5rem;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: var(--caps-tracking);
  text-transform: uppercase;
  color: var(--x-nav-muted);
}
.rail-scroll > .rail-group:first-child { margin-top: 0.25rem; }

.rail-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.375rem 0.5rem;
  border-radius: 6px;
  color: var(--x-nav-muted);
  font-size: 0.815rem;
  line-height: 1.25;
  white-space: nowrap;
  position: relative;
}
.rail-link:hover { background: var(--x-hair); color: var(--x-nav-ink); text-decoration: none; }
.rail-link:focus-visible { outline: none; box-shadow: var(--ring); }
.rail-link[aria-current="page"] {
  background: var(--x-nav-active);
  box-shadow: inset 0 0 0 1px var(--x-nav-border);
  color: var(--x-nav-ink);
  font-weight: 500;
}
.rail-link[aria-current="page"] .icon { color: var(--accent); }
.rail-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -0.55rem;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.rail-link .icon { flex: none; width: 1rem; height: 1rem; opacity: 0.9; }
.rail-count {
  margin-left: auto;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  color: var(--x-nav-muted);
  background: var(--x-nav-2);
  border-radius: 99px;
  padding: 0.05rem 0.38rem;
}

.rail-foot {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-top: 1px solid var(--x-nav-border);
  padding: 0.6rem 0.7rem;
  flex: none;
}
.rail-foot-meta { min-width: 0; line-height: 1.2; }
.rail-foot-name {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--x-nav-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-foot-role {
  display: block;
  font-size: 0.66rem;
  color: var(--x-nav-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main { min-width: 0; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 56px;
  padding: 0.5rem 1rem;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumbs .sep { opacity: 0.55; }

.topbar-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-top: 0.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

select.topbar-select {
  height: 2rem;
  font-size: 0.78rem;
  padding: 0 1.9rem 0 0.6rem;
  border-radius: 6px;
  border-color: var(--border);
  background-color: var(--surface);
}
select.topbar-select:hover { border-color: var(--border-strong); }

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.72rem;
  color: var(--muted);
}

@media (min-width: 768px) {
  .topbar-row { padding-inline: 1.5rem; }
  .topbar-meta { padding-inline: 1.5rem; }
}

.scrim {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  z-index: 55;
  display: none;
}

body.nav-open .rail { transform: translateX(0); }
body.nav-open .scrim { display: block; }

@media (min-width: 1024px) {
  .rail { transform: translateX(0); }
  .main { margin-left: var(--rail-w); }
  .scrim { display: none !important; }
  body.rail-collapsed .rail { width: var(--rail-w-collapsed); }
  body.rail-collapsed .main { margin-left: var(--rail-w-collapsed); }
  body.rail-collapsed .rail-product,
  body.rail-collapsed .rail-group,
  body.rail-collapsed .rail-switch,
  body.rail-collapsed .rail-link span,
  body.rail-collapsed .rail-count,
  body.rail-collapsed .rail-foot-meta,
  body.rail-collapsed .rail-icon-btn { display: none; }
  body.rail-collapsed .rail-link { justify-content: center; padding-inline: 0; }
  body.rail-collapsed .rail-link::before { display: none; }
  body.rail-collapsed .rail-head { justify-content: center; padding-inline: 0; }
  body.rail-collapsed .rail-foot { justify-content: center; }
}

/* ---------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.panel-body { padding: 1rem; }

.eyebrow {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: var(--caps-tracking);
  text-transform: uppercase;
  color: var(--muted);
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}

.metric {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4.4vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric-sm { font-size: clamp(1rem, 3.6vw, 1.2rem); }

/* Nothing may force the page wider than the viewport. */
.main,
.panel,
.panel-body,
.scroll-x,
.thread { min-width: 0; }
.scroll-x { max-width: 100%; width: 100%; }

/* An IMPLICIT grid column is `auto`, which sizes to max-content — on a phone a
   wide table inside a panel would stretch that column and scroll the whole
   page sideways. Implicit columns fill the container instead, so the table
   scrolls inside its own box. */
.grid { grid-auto-columns: minmax(0, 1fr); }

.divider {
  display: inline-block;
  width: 1px;
  height: 0.75rem;
  background: var(--border-strong);
  vertical-align: middle;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.72rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.delta-up { color: var(--success-strong); }
.delta-down { color: var(--danger-strong); }
.delta-flat { color: var(--muted); }

/* ----------------------------------------------------------------- data */

.scroll-x { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
table.data th {
  text-align: left;
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.data td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.mono { font-family: var(--font-mono); font-size: 0.74rem; }

.avatar {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 600;
  flex: none;
}

.bar-track { height: 0.32rem; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); }
.bar-fill.alt { background: var(--chart-2); }
.bar-fill.warn { background: var(--warning); }

.chart-box { position: relative; height: 252px; }
.chart-box.sm { height: 186px; }
.chart-box.xs { height: 146px; }

.score-ring {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface-2);
}

.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0.33rem;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 1px;
  background: var(--border);
}
.timeline-item { position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 0.35rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 99px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
}
.timeline-item:first-child::before { border-color: var(--accent); }

.thread {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.3rem;
}
.bubble {
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.bubble.out {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-strong);
}

.kanban { display: flex; gap: 0.85rem; min-width: 940px; }
.kanban-col { width: 220px; flex: none; }

.step-line { position: relative; padding-left: 1.35rem; }
.step-line::before {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1px;
  background: var(--border);
}
.step-dot { position: relative; }
.step-dot::before {
  content: "";
  position: absolute;
  left: -1.35rem;
  top: 0.4rem;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 99px;
  background: var(--border-strong);
}
