/* ============================================================
   PAR Intelligence — Nav redesign mockup
   Shared styles for home.html + intelligence-os.html
   Tokens approximate the PAR brand system:
   navy = structure/identity, orange = one deliberate accent only.
   ============================================================ */

:root {
  --navy: #3B3D6D;
  --navy-600: #32345c;
  --navy-tint: #EEF0F7;
  --navy-tint-strong: #E2E5F3;
  --orange: #F9921C;
  --orange-deep: #FF5719;

  --bg-base: #F4F4F6;
  --bg-sidebar: #F8F8FA;
  --bg-elevated: #FFFFFF;
  --border-hairline: #E6E6EB;

  --text-default: #1D1E23;
  --text-strong: #101114;
  --text-subtle: #6E6E78;
  --text-faint: #9A9AA3;

  --fill-hover: rgba(59, 61, 109, 0.06);
  --fill-active: rgba(59, 61, 109, 0.1);

  --radius-lg: 18px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(16, 17, 20, 0.04), 0 10px 28px rgba(16, 17, 20, 0.05);
  --shadow-composer: 0 1px 2px rgba(16, 17, 20, 0.05), 0 12px 30px rgba(16, 17, 20, 0.06);

  --font-sans: -apple-system, "SF Pro Text", "SF Pro Display", system-ui,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-default);
  background: var(--bg-sidebar);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100%;
  background: var(--bg-sidebar);
}

/* ---------- Primary sidebar ---------- */
.sidebar {
  width: 244px;
  flex: 0 0 244px;
  display: flex;
  flex-direction: column;
  padding-top: 9px;
  border-right: 1px solid transparent;
}
.sidebar-logo {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}
.sidebar-logo svg { height: 20px; width: auto; color: var(--navy); }

.sidebar-content { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  padding: 4px 12px;
  text-transform: none;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-default);
  cursor: pointer;
  transition: background-color 120ms ease;
}
.nav-item svg { width: 16px; height: 16px; flex: none; color: var(--text-subtle); }
.nav-item:hover { background: var(--fill-hover); }
.nav-item[data-active="true"] { background: var(--fill-active); color: var(--navy); }
.nav-item[data-active="true"] svg { color: var(--navy); }
.nav-item.is-static { cursor: default; opacity: 0.55; }

.sidebar-hr { height: 1px; background: var(--border-hairline); margin: 4px 12px; border: none; }

.sidebar-footer {
  height: 60px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}
.avatar {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--navy-tint); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; border: 1px solid var(--border-hairline);
  flex: none;
}
.footer-name { display: flex; flex-direction: column; min-width: 0; }
.footer-name strong { font-size: 13px; color: var(--text-strong); font-weight: 600; }
.footer-name span { font-size: 12px; color: var(--text-subtle); }

/* ---------- Main card ---------- */
.main-card {
  flex: 1;
  margin: 8px 8px 8px 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.main-header {
  height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-hairline);
}
.main-header h1 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
  margin: 0;
}
.header-toggle {
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-subtle);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.header-toggle:hover { background: var(--fill-hover); }
.header-spacer { flex: 1; }

/* ---------- Setup-mode banner (persistent, user-declared "done") ---------- */
.setup-banner {
  display: flex;
  align-items: center;
  gap: 8px;
}
.setup-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--navy-tint);
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
}
.setup-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--orange);
  flex: none;
}
.btn-done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--orange);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: filter 120ms ease;
}
.btn-done:hover { filter: brightness(0.95); }
.btn-done svg { width: 14px; height: 14px; }

/* ============================================================
   HOME
   ============================================================ */
.home-body {
  flex: 1;
  overflow-y: auto;
  padding: 48px 24px;
}
.home-inner { max-width: 880px; margin: 0 auto; }

.dash-toprow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}
.dash-toprow h2 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.2px; }
.dash-toprow p { margin: 4px 0 0; font-size: 13px; color: var(--text-subtle); }

/* --- empty state (no dashboard configured yet) --- */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 72px 24px;
  border: 1px dashed var(--border-hairline);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-sidebar));
}
body[data-dashboard="empty"] .empty-state { display: flex; }

.empty-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--navy-tint); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.empty-icon svg { width: 24px; height: 24px; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin: 0; color: var(--text-strong); }
.empty-state p { font-size: 13.5px; color: var(--text-subtle); max-width: 380px; margin: 0; line-height: 1.5; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--navy);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: filter 120ms ease;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary svg { width: 15px; height: 15px; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-hairline);
  cursor: pointer;
}
.btn-secondary:hover { background: var(--fill-hover); }

/* --- configured state (dashboard has widgets) --- */
.widget-grid {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
body[data-dashboard="configured"] .widget-grid { display: grid; }

.widget-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.widget-card.wide { grid-column: span 3; }
.widget-label { font-size: 12px; color: var(--text-subtle); font-weight: 500; }
.widget-value { font-size: 24px; font-weight: 600; color: var(--text-strong); margin-top: 6px; letter-spacing: -0.3px; }
.widget-delta { font-size: 12px; margin-top: 4px; color: #1a7f4b; }
.widget-delta.down { color: #b3331f; }
.widget-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--navy-tint); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.widget-icon svg { width: 15px; height: 15px; }

.widget-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.widget-list-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border-hairline);
}
.widget-list-row:last-child { border-bottom: none; }
.widget-list-row span:first-child { color: var(--text-default); }
.widget-list-row span:last-child { color: var(--text-subtle); font-weight: 500; }

/* ============================================================
   INTELLIGENCE OS
   ============================================================ */
.os-body { flex: 1; display: flex; min-height: 0; }

/* --- sub sidebar --- */
.chat-sidebar {
  width: 264px; flex: none;
  border-right: 1px solid var(--border-hairline);
  background: var(--bg-base);
  display: flex; flex-direction: column;
}
.chat-sidebar-header {
  height: 44px; flex: none; display: flex; align-items: center;
  padding: 0 14px; border-bottom: 1px solid var(--border-hairline);
  font-size: 13px; font-weight: 500; color: var(--text-strong);
}
.chat-sidebar-nav { padding: 8px 8px 4px; }
.chat-sidebar-nav .nav-item { font-weight: 500; }

.recents-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.recents-group-label {
  font-size: 11px; font-weight: 500; color: var(--text-faint);
  padding: 10px 8px 4px;
}
.recent-row {
  display: block;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-default);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent-row:hover { background: var(--fill-hover); }
.recent-row[data-active="true"] { background: var(--fill-active); color: var(--navy); font-weight: 500; }
.recent-row.setup-row { display: flex; align-items: center; gap: 6px; }
.recent-row.setup-row .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--orange); flex: none; }

/* --- chat canvas --- */
.chat-canvas { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 28px 24px 12px; }
.chat-thread { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

.msg { display: flex; flex-direction: column; gap: 4px; max-width: 82%; }
.msg.from-user { align-self: flex-end; align-items: flex-end; }
.msg.from-assistant { align-self: flex-start; align-items: flex-start; }
.msg-bubble {
  font-size: 14px; line-height: 1.5; padding: 10px 14px; border-radius: 14px;
}
.msg.from-user .msg-bubble { background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.msg.from-assistant .msg-bubble { background: var(--bg-sidebar); color: var(--text-default); border: 1px solid var(--border-hairline); border-bottom-left-radius: 4px; }
.msg-meta { font-size: 11px; color: var(--text-faint); padding: 0 4px; }

.setup-note {
  align-self: center;
  max-width: 640px;
  margin: 0 auto 4px;
  font-size: 12px;
  color: var(--text-subtle);
  background: var(--navy-tint);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  text-align: center;
  line-height: 1.5;
}
.setup-note strong { color: var(--navy); }

/* --- composer --- */
.composer-area { flex: none; padding: 12px 24px 20px; }
.composer-inner { max-width: 640px; margin: 0 auto; }

.pill-row { display: none; flex-wrap: wrap; gap: 6px; justify-content: center; padding-bottom: 10px; }
.pill-row.is-visible { display: flex; }
.starter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background: var(--bg-elevated);
  font-size: 12.5px; font-weight: 500; color: var(--text-default);
  cursor: pointer;
}
.starter-pill:hover { border-color: var(--navy); background: var(--navy-tint); }
.starter-pill svg { width: 13px; height: 13px; opacity: 0.8; }

.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: 22px;
  padding: 10px 10px 10px 16px;
  box-shadow: var(--shadow-composer);
}
.composer-box input {
  flex: 1; border: none; outline: none; font-size: 14.5px;
  font-family: inherit; color: var(--text-default); background: transparent;
}
.composer-box input::placeholder { color: var(--text-faint); }
.send-btn {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--navy); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.send-btn svg { width: 15px; height: 15px; }
.composer-disclaimer { text-align: center; font-size: 11px; color: var(--text-faint); margin-top: 8px; }

/* ============================================================
   OPTION B additions — dashboard tab hosts its own dedicated,
   always-visible assistant panel. Separate engine, separate
   history from Intelligence OS's general chat.
   ============================================================ */

.home-split { display: flex; flex: 1; min-height: 0; }

.dashboard-pane { flex: 1; overflow-y: auto; padding: 40px 24px; min-width: 0; }
.dashboard-pane .home-inner { max-width: 640px; margin: 0 auto; }

.assistant-dock {
  width: 340px; flex: none;
  border-left: 1px solid var(--border-hairline);
  background: var(--bg-base);
  display: flex; flex-direction: column;
}
.assistant-dock-header {
  height: 44px; flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px; border-bottom: 1px solid var(--border-hairline);
}
.assistant-dock-header strong { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.assistant-dock-header .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); flex: none; }
.assistant-dock-header span.tag {
  font-size: 11px; color: var(--text-subtle); margin-left: auto;
}

.assistant-thread-scroll { flex: 1; overflow-y: auto; padding: 16px 14px; }
.assistant-thread { display: flex; flex-direction: column; gap: 14px; }
.assistant-dock .msg { max-width: 100%; }
.assistant-dock .msg-bubble { font-size: 13px; }

.applied-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: #1a7f4b;
  background: rgba(26, 127, 75, 0.08);
  padding: 3px 9px; border-radius: 999px; margin-top: 6px;
}

.assistant-composer { flex: none; padding: 10px 12px 14px; }
.assistant-composer .pill-row { justify-content: flex-start; padding-bottom: 8px; }
.assistant-composer .starter-pill { font-size: 12px; padding: 5px 10px; }
.assistant-composer .composer-box { border-radius: 18px; padding: 8px 8px 8px 14px; }
.assistant-composer .composer-disclaimer { font-size: 10.5px; }
