:root {
  --primary: #3E0456;
  --accent: #C4873B;
  --bg: #f8f7fc;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --gold: #C4873B;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Login */
.login-container {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #2D0050, #1e1b4b, #0f172a);
}
.login-box {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  padding: 48px;
  border-radius: 16px;
  width: 100%; max-width: 400px;
  border: 1px solid rgba(255,255,255,0.1);
}
.login-box .logo { font-size: 1.5rem; color: var(--gold); margin-bottom: 8px; text-align: center; }
.login-box .subtitle { color: rgba(255,255,255,0.6); text-align: center; margin-bottom: 32px; font-size: 0.95rem; }
.login-box label { color: rgba(255,255,255,0.8); display: block; margin-bottom: 8px; font-size: 0.9rem; }
.login-box input {
  width: 100%; padding: 12px 16px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: white; font-size: 1rem;
  margin-bottom: 16px;
}
.login-box input:focus { outline: none; border-color: var(--gold); }
.error { color: #fca5a5; font-size: 0.85rem; margin-bottom: 12px; min-height: 20px; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #a06a1e);
  color: white; border: none; padding: 12px 24px;
  border-radius: 8px; font-size: 1rem; font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }

.btn-small {
  background: var(--primary); color: white; border: none;
  padding: 6px 14px; border-radius: 6px; font-size: 0.8rem;
  cursor: pointer; font-weight: 500;
}
.btn-small:hover { opacity: 0.85; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }

/* Top Nav */
.topnav {
  background: linear-gradient(135deg, #2D0050, #1e1b4b);
  padding: 12px 24px;
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { color: var(--gold); font-size: 1.2rem; font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-right span { color: rgba(255,255,255,0.7); font-size: 0.9rem; }
.nav-right .btn-small { background: rgba(255,255,255,0.1); }
.nav-right .btn-small:hover { background: rgba(255,255,255,0.2); }
.nav-right .btn-outline { border-color: rgba(255,255,255,0.3); color: rgba(255,255,255,0.8); }

/* Layout */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 56px);
}

/* Sidebar */
.sidebar {
  background: white;
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  overflow-y: auto;
}
.sidebar h3 { font-size: 0.85rem; text-transform: uppercase; color: var(--text-light); margin-bottom: 12px; letter-spacing: 0.5px; }
.sidebar section { margin-bottom: 24px; }
#topicDisplay { font-size: 0.9rem; margin-bottom: 12px; line-height: 1.5; color: var(--text); }

.session-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.2s;
}
.session-item:hover { background: var(--bg); }
.session-item.active { background: #f0e6ff; }
.session-title { font-size: 0.9rem; font-weight: 500; }
.session-meta { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }

/* Main Content */
.main-content {
  padding: 32px;
  overflow-y: auto;
}
.main-content h2 { font-size: 1.5rem; margin-bottom: 8px; }
.main-content > p { color: var(--text-light); margin-bottom: 24px; }

.steps {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 24px;
}
.step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 0.95rem;
  color: var(--text-light);
}

.session-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.session-header h2 { margin-bottom: 0; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
  background: #d1fae5; color: #065f46;
}

.note-input-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

/* Analysis Results */
.analysis-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.analysis-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; font-size: 0.85rem; color: var(--text-light);
}
.analysis-section {
  margin-bottom: 20px;
}
.analysis-section h4 {
  font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-light); margin-bottom: 12px;
}

.rec-item {
  background: var(--bg);
  border-left: 3px solid var(--gold);
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.rec-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.rec-item.rec-high { border-left-color: var(--danger); }
.rec-item.rec-medium { border-left-color: var(--warning); }
.rec-item.rec-low { border-left-color: var(--success); }
.rec-area { font-weight: 600; margin-bottom: 4px; }
.rec-suggestion { font-size: 0.9rem; color: var(--text); margin-bottom: 4px; }
.rec-rationale { font-size: 0.85rem; color: var(--text-light); margin-bottom: 4px; }
.rec-priority { font-size: 0.75rem; color: var(--text-light); text-transform: uppercase; }

.gap-item, .connection-item {
  background: var(--bg);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.gap-item p, .connection-item p { color: var(--text-light); margin-top: 4px; font-size: 0.85rem; }
.relevance { color: var(--primary); font-weight: 500; }

.analysis-section ul { padding-left: 20px; }
.analysis-section ul li { margin-bottom: 6px; color: var(--text); font-size: 0.9rem; }

.analysis-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 16px; border-top: 1px solid var(--border);
  margin-top: 16px;
}
.council-minutes { font-size: 0.8rem; color: var(--text-light); font-style: italic; }

.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-light); font-size: 1.1rem;
}

/* Spinner */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Debate Panel */
.debate-panel {
  background: white;
  border-left: 1px solid var(--border);
  display: none;
  flex-direction: column;
  height: calc(100vh - 56px);
  position: sticky; top: 56px;
}
.debate-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.debate-history {
  flex: 1; overflow-y: auto; padding: 16px 20px;
}
.debate-entry {
  margin-bottom: 16px;
}
.debate-entry strong { display: block; margin-bottom: 4px; font-size: 0.85rem; }
.debate-entry p, .debate-entry ul, .debate-entry li { font-size: 0.9rem; line-height: 1.5; color: var(--text); }
.user-entry { padding: 10px 14px; background: #eef2ff; border-radius: 8px; }
.council-entry { padding: 10px 14px; background: var(--bg); border-radius: 8px; border-left: 3px solid var(--gold); }
.debate-input {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .debate-panel { position: fixed; top: 56px; right: 0; width: 100%; max-width: 400px; z-index: 50; }
}
