﻿:root {
  --primary: #005A9C;
  --primary-hover: #004578;
  --secondary: #55c9da;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --error: #ef4444;
  --success: #10b981;
  --font-sans: system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); background: var(--bg); color: var(--text); overflow-y: auto; }

/* Login Access Story */
.access-page { display: flex; min-height: 100vh; }
.access-story { flex: 1; background: var(--primary); color: white; padding: 4rem; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; }
.story-masthead { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: 600; letter-spacing: 1px; color: rgba(255,255,255,0.7); border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 1rem; }
.access-kicker { display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 1px; margin-bottom: 1rem; color: var(--secondary); }
.access-story-body { max-width: 600px; z-index: 2; margin-top: auto; margin-bottom: auto; }
.access-story-body h1 { font-size: 3.5rem; line-height: 1.1; margin: 0 0 1.5rem; }
.access-story-body h1 span { color: var(--secondary); }
.access-story-body p { font-size: 1.1rem; line-height: 1.6; color: rgba(255,255,255,0.9); margin-bottom: 3rem; }
.collaboration { background: rgba(0,0,0,0.2); padding: 1.5rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); margin-bottom: 2rem; backdrop-filter: blur(10px); }
.collaboration-label { display: block; font-size: 0.75rem; font-weight: 600; letter-spacing: 1px; margin-bottom: 1rem; color: rgba(255,255,255,0.7); }
.perspective-buttons { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.perspective-buttons button { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; padding: 0.5rem 1rem; border-radius: 20px; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; }
.perspective-buttons button[aria-pressed="true"] { background: var(--secondary); color: var(--primary); border-color: var(--secondary); font-weight: 600; }
#perspectiveCopy { font-size: 0.95rem; margin: 0; color: rgba(255,255,255,0.8); }
.agent-network { position: absolute; right: -50px; bottom: 10%; width: 600px; opacity: 0.5; z-index: 1; pointer-events: none; }
.agent-network svg { width: 100%; height: auto; }
.network-lines path { fill: none; stroke: rgba(255,255,255,0.2); stroke-width: 1; }
.network-signals path { fill: none; stroke: url(#signal); stroke-width: 2; stroke-dasharray: 4 8; animation: flow 20s linear infinite; }
.network-nodes circle { fill: white; }
.network-nodes .network-core { fill: none; stroke: var(--secondary); stroke-width: 2; }
.network-labels text { fill: white; font-size: 10px; font-weight: 600; letter-spacing: 1px; font-family: var(--font-sans); }
@keyframes flow { to { stroke-dashoffset: -200; } }

.access-entry { width: 480px; background: var(--surface); padding: 4rem; display: flex; flex-direction: column; z-index: 10; overflow-y: auto; }
.access-brand { display: flex; flex-direction: column; gap: 0.5rem; text-decoration: none; color: inherit; margin-bottom: 3rem; }
.access-brand span { font-size: 0.75rem; letter-spacing: 1px; color: var(--text-muted); }
.environment-label { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; font-weight: 700; color: #854d0e; background: #fef08a; padding: 4px 8px; border-radius: 4px; margin-bottom: 2rem; width: fit-content; }
.environment-label i { width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.access-icon { width: 48px; height: 48px; background: var(--bg); border: 1px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--primary); margin-bottom: 1.5rem; }
.access-form-wrap { flex: 1; }
.access-form-wrap h2 { font-size: 2rem; margin: 0 0 1rem; color: var(--primary); line-height: 1.2; }
.access-form-wrap form { display: flex; flex-direction: column; gap: 1rem; margin-top: 2rem; }
.access-form-wrap label { font-size: 0.875rem; font-weight: 500; }
.access-form-wrap input { padding: 0.75rem; border: 1px solid var(--border); border-radius: 4px; font-size: 1rem; }
.access-submit { background: var(--primary); color: white; padding: 1rem; border: none; border-radius: 4px; font-size: 1rem; cursor: pointer; transition: background 0.2s; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.access-submit:hover:not(:disabled) { background: var(--primary-hover); }
.access-submit:disabled { opacity: 0.7; cursor: not-allowed; }
.password-field { display: flex; gap: 0.5rem; }
.password-field input { flex: 1; }
.password-field button { padding: 0 1rem; border: 1px solid var(--border); background: var(--surface); border-radius: 4px; cursor: pointer; }
.captcha-widget { margin-top: 0.5rem; }
.captcha-status { font-size: 0.8rem; color: var(--text-muted); }
.access-restricted { margin-top: 2rem; font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }
.institution-link { display: inline-block; margin-top: 1rem; color: var(--primary); text-decoration: none; font-size: 0.875rem; font-weight: 600; }
.error-text, #loginError { color: var(--error); font-size: 0.85rem; }

/* Workspace Layout: RIGHT SIDEBAR */
.workspace-layout { display: flex; flex-direction: row; height: 100vh; overflow: hidden; background: var(--bg); }
.workspace-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Right Sidebar */
.right-sidebar { width: 280px; background: #f1f5f9; border-left: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--border); }
.sidebar-search { padding: 1rem; border-bottom: 1px solid var(--border); }
.sidebar-search input { width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.85rem; }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.15rem; }
.nav-btn { display: flex; align-items: center; width: 100%; padding: 0.6rem 1.5rem; border: none; background: transparent; text-align: left; cursor: pointer; color: var(--text-muted); font-size: 0.9rem; transition: all 0.2s; border-right: 3px solid transparent; }
.nav-btn:hover { background: #e2e8f0; color: var(--text); }
.nav-btn.active { background: #e0f2fe; color: var(--primary); border-left: 3px solid var(--primary); border-right: none; font-weight: 500; }
.sidebar-divider { font-size: 0.7rem; font-weight: 700; color: #94a3b8; padding: 1rem 1.5rem 0.5rem; letter-spacing: 1px; }
.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1rem; }
.owner-info b { display: block; font-size: 0.85rem; }
.owner-info small { color: var(--text-muted); font-size: 0.75rem; }
.logout-btn { color: var(--text-muted); background: none; border: none; text-align: left; padding: 0; cursor: pointer; font-size: 0.85rem; }
.logout-btn:hover { color: var(--error); }
.mobile-close-btn { display: none; }

/* Main Area */
.workspace-header { height: 64px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; background: var(--surface); flex-shrink: 0; }
.header-context { display: flex; align-items: center; gap: 1rem; }
.header-context h1 { margin: 0; font-size: 1.125rem; font-weight: 600; }
.status-badge { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 12px; background: #e2e8f0; color: #475569; }
.status-verde { background: #dcfce7; color: #166534; }
.status-amarillo { background: #fef08a; color: #854d0e; }
.status-rojo { background: #fee2e2; color: #991b1b; }
.header-actions { display: flex; align-items: center; gap: 1rem; }
.shortcut-hint { font-size: 0.8rem; color: var(--text-muted); background: #f1f5f9; padding: 4px 8px; border-radius: 4px; }
.mobile-menu-btn { display: none; }

.workspace-content { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; }
.view-section { padding: 2rem; max-width: 1200px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; }
.view-heading { margin-bottom: 2rem; }
.workspace-kicker { font-size: 0.75rem; font-weight: 700; color: var(--primary); letter-spacing: 1px; }
.view-heading h2 { font-size: 2rem; margin: 0.5rem 0; color: var(--text); }
.view-heading p { color: var(--text-muted); margin: 0; }

/* Dashboard Grids */
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.dashboard-panel { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }
.panel-heading { font-size: 1rem; font-weight: 600; margin: 0 0 1rem; color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }

/* Buttons */
.primary-button { background: var(--primary); color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 4px; font-weight: 500; cursor: pointer; transition: background 0.2s; }
.primary-button:hover { background: var(--primary-hover); }
.primary-button:disabled { opacity: 0.5; cursor: not-allowed; }
.outline-button { background: transparent; border: 1px solid var(--border); padding: 0.5rem 1rem; border-radius: 4px; font-size: 0.85rem; cursor: pointer; color: var(--text); }
.outline-button:hover { background: #f1f5f9; }

/* Chat Module Layout */
.chat-layout { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; flex: 1; min-height: 0; }
.chat-column { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; overflow: hidden; position: relative; min-height: 0; }
.chat-history { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.agent-intro { text-align: center; margin-bottom: 2rem; padding: 2rem 1rem; color: var(--text-muted); }
.agent-avatar { width: 48px; height: 48px; background: var(--secondary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: bold; margin: 0 auto 1rem; }
.message { max-width: 85%; padding: 1rem; border-radius: 8px; line-height: 1.5; font-size: 0.95rem; }
.message-user { align-self: flex-end; background: var(--primary); color: white; border-bottom-right-radius: 2px; }
.message-agent { align-self: flex-start; background: white; border: 1px solid var(--border); border-bottom-left-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.message b { display: block; margin-bottom: 0.25rem; font-size: 0.8rem; opacity: 0.8; }
.message-content p { margin: 0 0 0.5rem 0; }
.message-content p:last-child { margin: 0; }
.chat-status-bar { padding: 0.5rem 1.5rem; font-size: 0.85rem; color: var(--text-muted); background: white; border-top: 1px solid var(--border); }
.scroll-bottom-btn { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); background: var(--primary); color: white; border: none; border-radius: 20px; padding: 0.5rem 1rem; font-size: 0.85rem; cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.1); z-index: 10; }
.chat-input-area { background: white; border-top: 1px solid var(--border); padding: 1rem 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; flex-shrink: 0; }
.chat-form { display: flex; gap: 0.5rem; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; padding: 0.75rem; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 0.95rem; max-height: 120px; outline: none; }
.chat-form textarea:focus { border-color: var(--primary); }
.chat-form button { background: var(--primary); color: white; border: none; border-radius: 4px; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.chat-form button:disabled { opacity: 0.6; cursor: not-allowed; }
.chat-evidence { font-size: 0.75rem; color: var(--text-muted); }

/* Right col: Context */
.context-column { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; overflow-y: auto; }
.panel-sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.4; }
.panel-subheading { font-size: 0.9rem; font-weight: 600; margin: 1.5rem 0 1rem; color: var(--text); }
.stack-mini { display: flex; flex-direction: column; gap: 0.75rem; }
.process-card { background: #f8fafc; border: 1px solid var(--border); padding: 0.75rem; border-radius: 4px; text-align: left; cursor: pointer; transition: background 0.2s; display: flex; align-items: center; gap: 0.5rem; width: 100%; color: var(--text); }
.process-card:hover { background: #e2e8f0; }
.process-card span { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; }
.process-card b { flex: 1; font-size: 0.85rem; }
.process-selected { border-color: var(--primary); background: #f0f9ff; }
.tools-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tool-chip { background: #e2e8f0; color: #475569; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; }

/* Request Issue Cards */
.issue-card { background: white; border: 1px solid var(--border); padding: 0.75rem; border-radius: 4px; font-size: 0.85rem; border-left: 3px solid var(--error); }
.issue-title { font-weight: 600; margin-bottom: 0.25rem; }
.issue-meta { color: var(--text-muted); font-size: 0.75rem; margin-bottom: 0.5rem; }

/* Metrics Mini */
.metrics-mini { display: flex; flex-direction: column; gap: 0.5rem; }
.metric { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 0.5rem; background: #f8fafc; border-radius: 4px; border: 1px solid var(--border); }
.metric-value { font-weight: 600; }
.block-card { background: white; border: 1px solid var(--border); padding: 1rem; border-radius: 4px; margin-bottom: 0.5rem; }

/* Audit */
.audit-scroll { overflow-x: auto; margin-top: 1rem; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; text-align: left; }
.audit-table th, .audit-table td { padding: 0.75rem; border-bottom: 1px solid var(--border); }
.audit-table th { font-weight: 600; color: var(--text-muted); background: #f8fafc; }

/* Dialogs */
.request-dialog { border: none; border-radius: 8px; padding: 2rem; width: 600px; max-width: 90vw; }
.request-dialog::backdrop { background: rgba(0,0,0,0.5); }
.request-dialog form { display: flex; flex-direction: column; gap: 1rem; }
.request-dialog h2 { margin: 0.5rem 0; }
.request-dialog input, .request-dialog textarea, .request-dialog select { padding: 0.75rem; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 1rem; width: 100%; }
.request-dialog textarea { resize: vertical; min-height: 80px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 1rem; }

.command-palette { padding: 0; border: none; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); max-width: 500px; width: 100%; margin: 10vh auto; background: white; }
.command-palette::backdrop { background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(2px); }
.palette-container { display: flex; flex-direction: column; }
.palette-container input { padding: 1.25rem; font-size: 1.1rem; border: none; border-bottom: 1px solid var(--border); outline: none; width: 100%; border-radius: 8px 8px 0 0; }
.palette-options { display: flex; flex-direction: column; padding: 0.5rem; max-height: 300px; overflow-y: auto; }
.palette-options button { text-align: left; padding: 0.75rem 1rem; background: transparent; border: none; cursor: pointer; font-size: 0.95rem; border-radius: 4px; }
.palette-options button:hover { background: #f1f5f9; outline: none; }

@media (max-width: 768px) {
  .workspace-layout { flex-direction: column; }
  .right-sidebar { position: fixed; right: 0; transform: translateX(100%); z-index: 50; height: 100vh; transition: transform 0.3s; box-shadow: -4px 0 15px rgba(0,0,0,0.1); }
  .right-sidebar.open { transform: translateX(0); }
  .mobile-close-btn { display: block; background: none; border: none; padding: 1rem; text-align: right; color: var(--text-muted); cursor: pointer; }
  .mobile-menu-btn { display: block; background: transparent; border: 1px solid var(--border); padding: 0.25rem 0.5rem; border-radius: 4px; }
  .shortcut-hint { display: none; }
  .chat-layout { grid-template-columns: 1fr; display: flex; flex-direction: column; overflow-y: auto; min-height: 0; }
  .chat-column { height: 600px; flex: none; }
  .context-column { flex: none; }
  .access-entry { width: 100%; padding: 2rem; }
  .access-story { display: none; }
  .view-section { padding: 1rem; height: auto; }
}
