/* Team Command Center — demo styling.
   Brand tokens borrowed from the Chillguy portfolio so the demo reads as
   part of the same family, tuned denser for dashboard use. */

:root {
  --bg: #f7f9fc;
  --bg-card: #ffffff;
  --surface: #eef3f9;
  --border: #dbe4f0;
  --border-light: #c8d5e6;
  --text: #182230;
  --text-muted: #576477;
  --text-dim: #8190a5;
  --accent: #3369f0;
  --accent-light: #5f8dff;
  --accent-glow: rgba(51, 105, 240, 0.12);
  --accent-2: #52b9d8;

  --core: #3369f0;
  --support: #f0803c;
  --engineering: #7c6cf0;
  --discovery: #52b9d8;
  --tooling: #48b98a;

  --good: #2f9e6b;
  --warn: #d9992b;
  --bad: #d9534f;

  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font); margin: 0; font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- demo banner ---------- */

.demo-banner {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  text-align: center;
  padding: 7px 16px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.demo-banner strong { font-weight: 700; }
.demo-banner a { color: #fff; text-decoration: underline; }

/* ---------- app bar ---------- */

.appbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.appbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 58px;
}
.appbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text);
  white-space: nowrap;
}
.appbar-brand:hover { text-decoration: none; }
.appbar-brand .mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: #fff; font-size: 0.95rem;
}
.appbar-nav { display: flex; gap: 4px; flex: 1; }
.appbar-nav a {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.87rem;
}
.appbar-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.appbar-nav a.active { background: var(--accent-glow); color: var(--accent); }
.appbar-right { display: flex; align-items: center; gap: 12px; }
.appbar-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.appbar-meta strong { color: var(--text); font-weight: 600; }

.select {
  appearance: none;
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23576477' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 30px 7px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.select:hover { border-color: var(--border-light); }

/* ---------- layout ---------- */

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px 24px 64px;
}
.page-head { margin-bottom: 20px; }
.page-title { font-size: 1.6rem; letter-spacing: -0.02em; }
.subtitle { color: var(--text-muted); margin: 4px 0 0; font-size: 0.9rem; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { font-size: 1.02rem; }
.hint { color: var(--text-dim); font-weight: 400; font-size: 0.82rem; margin-left: 7px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }

/* ---------- KPI tiles ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 17px;
}
.kpi-label {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 7px;
}
.kpi-value {
  font-family: var(--font);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.kpi-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; }
.kpi.is-bad .kpi-value { color: var(--bad); }
.kpi.is-good .kpi-value { color: var(--good); }

/* ---------- today band ---------- */

.today-band {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}
.tb-item { display: flex; flex-direction: column; gap: 2px; }
.tb-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); font-weight: 600;
}
.tb-value { font-family: var(--font); font-weight: 600; font-size: 0.98rem; }
.tb-sep { width: 1px; align-self: stretch; background: var(--border); }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
thead th {
  text-align: left;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0 10px 9px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 9px 10px; border-bottom: 1px solid var(--surface); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.person { font-weight: 600; }
.role { color: var(--text-dim); font-size: 0.78rem; }

/* ---------- bars & meters ---------- */

.meter {
  position: relative;
  height: 7px;
  background: var(--surface);
  border-radius: 99px;
  overflow: hidden;
  min-width: 90px;
}
.meter span {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 99px;
}
.meter.over span { background: var(--bad); }
.meter.warn span { background: var(--warn); }

.util { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.util b { font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }
.util.over b { color: var(--bad); }
.util.warn b { color: var(--warn); }

.progress-bar {
  display: flex;
  height: 11px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 11px;
}
.progress-bar i { display: block; height: 100%; }
.progress-legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 0.8rem; color: var(--text-muted);
}
.progress-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- work type chips ---------- */

.wt-list { display: flex; flex-direction: column; gap: 11px; }
.wt-row { display: grid; grid-template-columns: 150px 1fr 84px; align-items: center; gap: 12px; }
.wt-name { font-size: 0.85rem; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.wt-val { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--text-muted); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge.core { background: rgba(51,105,240,0.12); color: var(--core); }
.badge.support { background: rgba(240,128,60,0.14); color: #c9631f; }
.badge.warn { background: rgba(217,153,43,0.14); color: #a8760f; }
.badge.good { background: rgba(47,158,107,0.13); color: var(--good); }
.badge.bad { background: rgba(217,83,79,0.13); color: var(--bad); }

/* ---------- activities & rules of credit ---------- */

.activity { padding: 14px 0; border-bottom: 1px solid var(--surface); }
.activity:last-child { border-bottom: none; padding-bottom: 0; }

.activity-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; margin-bottom: 10px; flex-wrap: wrap;
}
.activity-code {
  font-family: var(--font); font-size: 0.75rem; font-weight: 600;
  color: var(--text-dim); margin-right: 9px;
}
.activity-name { font-weight: 600; font-size: 0.9rem; }
.activity-qty {
  font-size: 0.82rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.activity-qty b {
  margin-left: 12px; color: var(--text);
  font-family: var(--font); font-size: 0.9rem;
}

.credit-steps { display: flex; gap: 6px; }
.credit-step { min-width: 0; }
.credit-bar {
  height: 6px; background: var(--surface);
  border-radius: 99px; overflow: hidden; margin-bottom: 6px;
}
.credit-bar span {
  display: block; height: 100%;
  background: var(--accent); border-radius: 99px;
}
.credit-label {
  font-size: 0.7rem; color: var(--text-muted); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.credit-label em { display: block; color: var(--text-dim); font-style: normal; font-size: 0.66rem; }

/* ---------- charts ---------- */

.chart-wrap { position: relative; height: 260px; }
.chart-wrap.tall { height: 320px; }

/* ---------- legend note under charts ---------- */

.legend-note {
  display: flex; gap: 20px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--surface);
  font-size: 0.78rem; color: var(--text-muted);
}
.legend-note span { display: inline-flex; align-items: center; gap: 7px; }
.swatch {
  width: 14px; height: 10px; border-radius: 3px; display: inline-block;
}

/* ---------- callout ---------- */

.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-glow);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.87rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.callout strong { color: var(--text); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-light); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- classifier rules ---------- */

.rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.rule {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.rule code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 8px;
  color: var(--accent);
  white-space: nowrap;
}
.rule-arrow { color: var(--text-dim); }
.rule-type { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.rule-fallback code { color: var(--text-muted); }

.cal-head {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); margin: 0 0 9px;
}
.cal-head + table { margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip-static {
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- assistant ---------- */

.container-narrow { max-width: 880px; }

.chat-card { padding: 0; overflow: hidden; }

.chat-log {
  padding: 20px;
  max-height: 62vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bubble {
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  max-width: 92%;
}
.bubble p { margin: 0 0 9px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble.bot {
  align-self: flex-start;
  background: var(--surface);
  border-bottom-left-radius: 4px;
  min-width: 60%;
}
.bubble.bot h3 { font-size: 1rem; margin: 4px 0 8px; }
.bubble.bot h4 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); margin: 14px 0 6px;
}
.bubble.bot ul { margin: 0 0 9px; padding-left: 20px; }
.bubble.bot li { margin-bottom: 4px; }
.bubble.bot table { background: var(--bg-card); border-radius: var(--radius-sm); margin: 4px 0 10px; }
.bubble.bot thead th { padding: 8px 10px; }
.bubble.bot tbody td { padding: 7px 10px; }
.bubble.bot tbody tr:hover { background: transparent; }

.thinking { color: var(--text-dim); font-style: italic; }

.chat-suggest {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chip {
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

.chat-input {
  display: flex; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-input input {
  flex: 1;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: var(--font-body);
  font-size: 0.87rem;
  color: var(--text);
}
.chat-input input:focus { outline: none; border-color: var(--accent); }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .appbar-inner { gap: 14px; overflow-x: auto; }
  .container { padding: 18px 14px 48px; }
  .wt-row { grid-template-columns: 110px 1fr 70px; }
  .table-scroll { overflow-x: auto; }
}
