/* ============================================================
   main.css — Symmetry AI · Global tokens, reset, layout shell
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

/* General Sans from Fontshare */
@import url('https://api.fontshare.com/v2/css?f[]=general-sans@600&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* Canvas */
  --color-canvas:        #111827;
  --color-card:          #1C2636;
  --color-paper:         #F8F9FB;

  /* Accent – Signal Red */
  --color-accent:        #C0354B;
  --color-accent-hover:  #D04A60;
  --color-accent-press:  #A02B3E;
  --color-accent-tint:   #FBECEF;

  /* Structural */
  --color-navy:          #3E5F85;

  /* Text */
  --color-text-primary:  #1F2A37;
  --color-text-secondary:#6B7280;
  --color-border:        #E5E7EB;

  /* Dark-surface text */
  --color-text-light:    #F8F9FB;
  --color-text-muted:    rgba(248, 249, 251, 0.55);
  --color-border-dark:   rgba(255, 255, 255, 0.08);

  /* Vertical tags */
  --color-tag-fund-acct: #2DD4BF;   /* teal */
  --color-tag-ta:        #60A5FA;   /* blue */
  --color-tag-ops:       #FBBF24;   /* amber */
  --color-tag-midoffice: #F97316;   /* rust */
  --color-tag-compliance:#C0354B;   /* signal red */

  /* Radii */
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    16px;
  --radius-pill:  999px;

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-base: 160ms ease-out;

  /* Typography */
  --font-display: 'General Sans', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Layout */
  --sidebar-width:       260px;
  --right-panel-width:   380px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  min-width: 1200px;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  background: var(--color-canvas);
  color: var(--color-text-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* ── App shell ──────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ── Left sidebar ───────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--color-card);
  border-right: 1px solid var(--color-border-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

/* ── Center panel ───────────────────────────────────────── */
#center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Right context panel ────────────────────────────────── */
#right-panel {
  width: var(--right-panel-width);
  min-width: var(--right-panel-width);
  height: 100%;
  background: var(--color-card);
  border-left: 1px solid var(--color-border-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-base), min-width var(--transition-base), opacity var(--transition-base);
}

#right-panel.collapsed {
  width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
}

/* ── Typography helpers ─────────────────────────────────── */
.font-display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.font-mono {
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* ── Utility ────────────────────────────────────────────── */
.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sidebar sections ───────────────────────────────────── */
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border-dark);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.sidebar-logo img,
.sidebar-logo svg {
  height: 28px;
  width: auto;
}

.logo-wordmark {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--color-text-light);
  letter-spacing: -0.02em;
}

/* Fund entity switcher */
.entity-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  cursor: pointer;
  width: 100%;
  color: var(--color-text-light);
  font-size: 12px;
  font-family: var(--font-body);
  transition: background var(--transition-fast);
  text-align: left;
}

.entity-switcher:hover {
  background: rgba(255,255,255,0.09);
}

.entity-switcher .entity-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-switcher .entity-sub {
  font-size: 10px;
  color: var(--color-text-muted);
}

.entity-switcher i {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Sidebar nav content */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section {
  padding: 16px 0 8px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0 16px;
  margin-bottom: 6px;
}

.sidebar-section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 6px;
}

.sidebar-section-label-row .sidebar-section-label {
  padding: 0;
  margin-bottom: 0;
}

/* Conversation items */
.conv-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition-fast);
  position: relative;
}

.conv-item:hover {
  background: rgba(255,255,255,0.05);
}

.conv-item.active {
  background: rgba(192, 53, 75, 0.12);
}

.conv-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--color-accent);
  border-radius: 0 2px 2px 0;
}

.conv-item-info {
  flex: 1;
  min-width: 0;
}

.conv-item-title {
  font-size: 13px;
  color: var(--color-text-light);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item.active .conv-item-title {
  color: var(--color-text-light);
}

.conv-item-date {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 1px;
}

.conv-item i {
  color: var(--color-text-muted);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* Memory items */
.memory-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--color-border-dark);
}

.memory-item:last-child {
  border-bottom: none;
}

.memory-item:hover {
  background: rgba(255,255,255,0.04);
}

.memory-item:first-child {
  border-top: 1px solid var(--color-border-dark);
}

.memory-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.memory-category-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  text-transform: capitalize;
}

.memory-category-tag.policy    { background: rgba(192,53,75,0.2);  color: #F08090; }
.memory-category-tag.decision  { background: rgba(62,95,133,0.3);  color: #7BA7D0; }
.memory-category-tag.convention{ background: rgba(45,212,191,0.15); color: #5EEAD4; }
.memory-category-tag.exception { background: rgba(251,191,36,0.15); color: #FCD34D; }

.memory-item-date {
  font-size: 10px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.memory-item-text {
  font-size: 12px;
  color: rgba(248,249,251,0.75);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Connector items */
.connector-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  transition: background var(--transition-fast);
}

.connector-item:hover {
  background: rgba(255,255,255,0.04);
}

.connector-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.connector-status-dot.connected { background: #34D399; box-shadow: 0 0 6px rgba(52,211,153,0.4); }
.connector-status-dot.degraded  { background: #FBBF24; box-shadow: 0 0 6px rgba(251,191,36,0.4); }
.connector-status-dot.error     { background: var(--color-accent); box-shadow: 0 0 6px rgba(192,53,75,0.4); }

.connector-name {
  flex: 1;
  font-size: 12px;
  color: rgba(248,249,251,0.8);
}

.connector-status-label {
  font-size: 10px;
  color: var(--color-text-muted);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border-dark);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-light);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 10px;
  color: var(--color-text-muted);
  background: rgba(62,95,133,0.25);
  border: 1px solid rgba(62,95,133,0.4);
  border-radius: var(--radius-pill);
  padding: 1px 6px;
  display: inline-block;
  margin-top: 2px;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover  { background: var(--color-accent-hover); }
.btn-primary:active { background: var(--color-accent-press); }

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--color-text-light);
  border: 1px solid var(--color-border-dark);
}

.btn-ghost:hover  { background: rgba(255,255,255,0.1); }
.btn-ghost:active { background: rgba(255,255,255,0.04); }

.btn-sm {
  font-size: 12px;
  padding: 5px 10px;
}

/* ── Status chips ────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
}

.chip-high     { background: rgba(192,53,75,0.2);   color: #F08090; }
.chip-medium   { background: rgba(251,191,36,0.15); color: #FCD34D; }
.chip-low      { background: rgba(52,211,153,0.15); color: #6EE7B7; }
.chip-pending  { background: rgba(251,191,36,0.15); color: #FCD34D; }
.chip-complete { background: rgba(52,211,153,0.15); color: #6EE7B7; }

/* ── Tables ──────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border-dark);
}

.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: rgba(248,249,251,0.85);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.data-table .mono {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--color-border-dark);
  margin: 0;
}

/* ── Overlay for mobile / collapse ──────────────────────── */
.panel-backdrop {
  display: none;
}

/* ── Notification badge ──────────────────────────────────── */
/* Req 11.2, 11.3 — pill badge on the topbar bell button */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-accent);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  pointer-events: none;
  border: 2px solid var(--color-card);
}

.notification-badge.hidden {
  display: none;
}

/* ── Role badge ──────────────────────────────────────────── */
/* Req 12.1 — active demo-role highlight, same pill shape as .user-role */
.role-badge {
  font-size: 10px;
  color: var(--color-text-muted);
  background: rgba(62,95,133,0.25);
  border: 1px solid rgba(62,95,133,0.4);
  border-radius: var(--radius-pill);
  padding: 1px 6px;
  display: inline-block;
  margin-top: 2px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.role-badge.active {
  background: var(--color-accent-tint);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.role-badge:hover:not(.active) {
  background: rgba(62,95,133,0.4);
}

/* ── Scheduled Tasks nav item ────────────────────────────── */
/* Req 1.1 — mirrors .conv-item layout for the sidebar entry */
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
}

.nav-item.active {
  background: rgba(192, 53, 75, 0.12);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--color-accent);
  border-radius: 0 2px 2px 0;
}

.nav-item i {
  color: var(--color-text-muted);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.nav-item-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.nav-item.active .nav-item-label {
  color: var(--color-text-light);
}

.nav-item.active i {
  color: rgba(248, 249, 251, 0.7);
}
