/* DealSage App Styles — matches landing page design tokens */

:root {
  --bg: #0a0a0f;
  --bg-elevated: #12121a;
  --bg-card: #16161f;
  --fg: #e8e6e1;
  --fg-muted: #8a8880;
  --fg-dim: #5a5850;
  --accent: #d4a853;
  --accent-glow: rgba(212, 168, 83, 0.15);
  --accent-subtle: rgba(212, 168, 83, 0.08);
  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(212, 168, 83, 0.25);
  --radius: 12px;
  --success: #3ecf8e;
  --danger: #e87050;
  --info: #6ea8fe;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Nav ─── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  width: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
}

.logo-mark { font-size: 18px; color: var(--accent); }

.logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.nav-right { display: flex; align-items: center; gap: 12px; }

.nav-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

.nav-badge.connected {
  border-color: var(--success);
  color: var(--success);
}

/* ─── Layout ─── */
.app-layout {
  display: flex;
  padding-top: 56px;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  overflow-y: auto;
}

.sidebar-section { padding: 0 12px 20px; }

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 8px 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.sidebar-item:hover { background: var(--bg-card); color: var(--fg); text-decoration: none; }

.sidebar-item.active { background: var(--accent-subtle); color: var(--accent); }

.sidebar-bottom {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.org-badge {
  font-size: 11px;
  color: var(--fg-dim);
  word-break: break-all;
}

.org-badge span { color: var(--fg-muted); }

/* ─── Main Content ─── */
.main-content {
  flex: 1;
  margin-left: 220px;
  padding: 24px;
  min-height: calc(100vh - 56px);
}

/* ─── Flash Messages ─── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid;
}

.flash-success { background: rgba(62, 207, 142, 0.08); border-color: rgba(62, 207, 142, 0.25); color: var(--success); }
.flash-error { background: rgba(232, 112, 80, 0.08); border-color: rgba(232, 112, 80, 0.25); color: var(--danger); }
.flash-info { background: rgba(110, 168, 254, 0.08); border-color: rgba(110, 168, 254, 0.25); color: var(--info); }

/* ─── Connect State ─── */
.connect-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
}

.connect-card {
  text-align: center;
  max-width: 440px;
  padding: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.connect-icon {
  font-size: 48px;
  margin-bottom: 20px;
  opacity: 0.6;
}

.connect-card h2 { font-size: 24px; margin-bottom: 12px; }

.connect-card p {
  color: var(--fg-muted);
  margin-bottom: 28px;
  line-height: 1.65;
}

.connect-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--fg-dim);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}

.btn-primary:hover { background: #e0b860; text-decoration: none; color: #0a0a0f; }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { border-color: var(--fg-dim); color: var(--fg); background: var(--bg-elevated); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

/* ─── App View ─── */
#app-view {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* ─── Panels ─── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 { font-size: 16px; color: var(--fg); }

/* ─── Loading & Error States ─── */
.loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--fg-muted);
  font-size: 14px;
}

.error-state {
  padding: 20px;
  color: var(--danger);
  font-size: 14px;
  background: rgba(232, 112, 80, 0.05);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Deal List ─── */
.deal-row {
  display: grid;
  grid-template-columns: 1fr 140px 110px 90px 80px;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.deal-row:last-child { border-bottom: none; }
.deal-row:hover { background: rgba(255,255,255,0.02); }

.deal-row-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: default;
}

.deal-row-header:hover { background: transparent; }

.deal-name {
  font-weight: 500;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.deal-account { color: var(--fg-muted); font-size: 12px; margin-top: 2px; }
.deal-cell { color: var(--fg-muted); font-size: 13px; }

.stage-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid var(--border-accent);
}

.summary-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  title: 'Summary available';
}

/* ─── Deal Detail ─── */
.deal-detail { padding: 24px; }

.deal-detail-header { margin-bottom: 24px; }
.deal-detail-header h2 { font-size: 22px; margin-bottom: 4px; }
.deal-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }

.meta-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-chip .label {
  font-size: 10px;
  color: var(--fg-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meta-chip .value {
  font-size: 14px;
  color: var(--fg);
  font-weight: 500;
}

.summary-sections { display: grid; gap: 16px; margin-top: 20px; }

.summary-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.summary-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.summary-card-title.title-summary { color: var(--accent); }
.summary-card-title.title-steps { color: var(--success); }
.summary-card-title.title-risk { color: var(--danger); }

.summary-card-body {
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.deal-contacts { margin-top: 20px; }

.contact-list { display: grid; gap: 8px; margin-top: 10px; }

.contact-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}

.contact-name { font-weight: 600; color: var(--fg); }
.contact-sub { color: var(--fg-muted); margin-top: 2px; }

.cached-note {
  font-size: 11px;
  color: var(--fg-dim);
  margin-top: 12px;
  text-align: right;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .deal-row { grid-template-columns: 1fr 80px 70px; }
  .deal-row > :nth-child(4),
  .deal-row > :nth-child(5) { display: none; }
}
