@import url("./css/mobile-first-styles.css");

/* Fortus Hub v2 — SaaS Design System */
/* Inspired by Linear, Notion, Vercel */
/* Brand: #008691 teal, #292556 navy */

/* Font import moved to layout.js for CSP compliance */

:root {
  /* Brand */
  --f-primary: #008691;
  --f-primary-hover: #006d76;
  --f-primary-light: #e6f5f6;
  --f-primary-10: rgba(0,134,145,.1);
  --f-navy: #292556;
  
  /* Neutrals */
  --f-bg: #fafafa;
  --f-bg-secondary: #f3f4f6;
  --f-surface: #ffffff;
  --f-surface-hover: #f9fafb;
  --f-border: #e5e7eb;
  --f-border-light: #f0f0f0;
  --f-text: #111827;
  --f-text-secondary: #6b7280;
  --f-text-tertiary: #9ca3af;
  
  /* Status */
  --f-green: #059669;
  --f-green-bg: #ecfdf5;
  --f-green-light: #d1fae5;
  --f-amber: #d97706;
  --f-amber-bg: #fffbeb;
  --f-amber-light: #fef3c7;
  --f-red: #dc2626;
  --f-red-bg: #fef2f2;
  --f-red-light: #fee2e2;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-xl: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  
  /* Radius */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 9999px;
  
  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Legacy compat */
  --fortus-teal: var(--f-primary);
  --fortus-dark-teal: var(--f-primary-hover);
  --fortus-navy: var(--f-navy);
  --fortus-card-dark: var(--f-surface);
  --fortus-border-dark: var(--f-border);
  --fortus-text: var(--f-text);
  --fortus-text-muted: var(--f-text-secondary);
  --fortus-dark-bg: var(--f-bg);
  --fortus-green: var(--f-green);
  --fortus-amber: var(--f-amber);
  --fortus-red: var(--f-red);
  --fortus-gold: #f0ad4e;
  --fortus-light-teal: var(--f-primary-light);
  --fortus-teal-glass: var(--f-primary-10);
  --fortus-text-dark: var(--f-text);
  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
  --radius-pill: var(--r-pill);
}

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

body {
  background: var(--f-bg);
  color: var(--f-text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--f-primary); text-decoration: none; }
a:hover { color: var(--f-primary-hover); }

/* ── Sidebar Nav ── */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  height: 48px;
  background: var(--f-surface);
  border-bottom: 1px solid var(--f-border);
  font-size: 13px;
  font-weight: 500;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav a {
  color: var(--f-text-secondary);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: all .15s;
  white-space: nowrap;
}
.nav a:hover {
  color: var(--f-text);
  background: var(--f-bg-secondary);
  text-decoration: none;
}
.nav a.active {
  color: var(--f-primary);
  background: var(--f-primary-light);
}
.nav-brand {
  font-weight: 700 !important;
  font-size: 14px !important;
  color: var(--f-text) !important;
  margin-right: 12px !important;
  letter-spacing: -0.3px;
}
.nav-sep {
  width: 1px;
  height: 20px;
  background: var(--f-border);
  margin: 0 8px;
}

/* ── Headers ── */
.header {
  padding: 32px 24px 16px;
}
.header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--f-text);
  letter-spacing: -0.5px;
}
.header p {
  color: var(--f-text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ── Cards ── */
.card {
  background: var(--f-surface);
  border: 1px solid var(--f-border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: box-shadow .2s, border-color .2s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--f-border);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  letter-spacing: 0.02em;
}
.badge.live, .b-live { background: var(--f-green-bg); color: var(--f-green); }
.badge.new, .b-new { background: var(--f-primary-light); color: var(--f-primary); }
.badge.concept, .b-concept { background: var(--f-amber-bg); color: var(--f-amber); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  border: 1px solid var(--f-border);
  background: var(--f-surface);
  color: var(--f-text);
}
.btn:hover {
  background: var(--f-bg-secondary);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.btn-primary {
  background: var(--f-primary);
  color: #fff;
  border-color: var(--f-primary);
}
.btn-primary:hover {
  background: var(--f-primary-hover);
  border-color: var(--f-primary-hover);
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Status dots ── */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.green { background: var(--f-green); }
.dot.amber { background: var(--f-amber); }
.dot.red { background: var(--f-red); }
.dot-lg { width: 12px; height: 12px; }

/* ── Status pills ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
}
.pill.green { background: var(--f-green-bg); color: var(--f-green); }
.pill.amber { background: var(--f-amber-bg); color: var(--f-amber); }
.pill.red { background: var(--f-red-bg); color: var(--f-red); }

/* ── Inputs ── */
input[type="text"], input[type="number"], input[type="email"], textarea, select {
  font-family: var(--font);
  font-size: 14px;
  color: var(--f-text);
  background: var(--f-surface);
  border: 1px solid var(--f-border);
  border-radius: var(--r-md);
  padding: 8px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--f-primary);
  box-shadow: 0 0 0 3px var(--f-primary-10);
}

/* ── Checkboxes ── */
.checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--f-border);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
  background: var(--f-surface);
}
.checkbox.done {
  background: var(--f-primary);
  border-color: var(--f-primary);
}
.checkbox.done::after {
  content: '✓';
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.checkbox:hover { border-color: var(--f-primary); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-weight: 600;
  color: var(--f-text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--f-border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--f-border-light);
  color: var(--f-text);
}
tr:hover td { background: var(--f-surface-hover); }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 20px 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--f-surface);
  border: 1px solid var(--f-border);
  border-radius: var(--r-xl);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: modalIn .2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--f-text);
  margin-bottom: 16px;
}
.modal-close {
  position: absolute; top: 16px; right: 20px;
  font-size: 18px; color: var(--f-text-tertiary);
  cursor: pointer; background: none; border: none;
  font-family: var(--font);
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--f-bg-secondary); color: var(--f-text); }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--f-text-tertiary);
  font-size: 12px;
}

/* ── Tags ── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--f-bg-secondary);
  color: var(--f-text-secondary);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--f-text-tertiary);
}
.empty-state p { font-size: 14px; margin-top: 8px; }

/* ── Live badge animation ── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--f-green-bg);
  color: var(--f-green);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--r-pill);
}
.live-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--f-green);
  animation: blink 2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Save indicator (toast) ── */
.save-indicator {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--f-surface);
  color: var(--f-green);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--f-green-bg);
  opacity: 0;
  transition: opacity .3s;
  z-index: 200;
  pointer-events: none;
}
.save-indicator.show { opacity: 1; }

/* ── Dark Theme ── */
body.dark {
  --f-bg: #0f1120;
  --f-bg-secondary: #1a1e38;
  --f-surface: #151830;
  --f-surface-hover: #1a1e38;
  --f-border: #292d4a;
  --f-border-light: #1e2246;
  --f-text: #e2e8f0;
  --f-text-secondary: #8892a8;
  --f-text-tertiary: #4a5068;
  --f-green-bg: #1f3d2e;
  --f-amber-bg: #3d3a1e;
  --f-red-bg: #3d1e1e;
  --f-primary-light: rgba(0,134,145,.15);
  --f-primary-10: rgba(0,134,145,.15);
}

/* ── Page Help ── */
.page-help{margin:0 20px 0;max-width:1100px}
.page-help summary{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--f-text-secondary);cursor:pointer;padding:10px 0;list-style:none;user-select:none;min-height:44px}
.page-help summary::-webkit-details-marker{display:none}
.page-help summary::before{content:'ℹ️';font-size:14px}
.page-help summary::after{content:'▸';font-size:10px;transition:transform .2s;margin-left:auto}
.page-help[open] summary::after{transform:rotate(90deg)}
.page-help .help-content{background:var(--f-surface);border:1px solid var(--f-border);border-radius:var(--r-lg);padding:16px 20px;margin-bottom:16px;font-size:13px;line-height:1.7;color:var(--f-text-secondary);animation:fadeHelp .2s}
@keyframes fadeHelp{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
.page-help .help-content h4{font-size:13px;font-weight:700;color:var(--f-text);margin:12px 0 4px}
.page-help .help-content h4:first-child{margin-top:0}
.page-help .help-content ul{margin:4px 0 8px;padding-left:20px}
.page-help .help-content li{margin:2px 0}
.page-help .help-content kbd{background:var(--f-bg-secondary);border:1px solid var(--f-border);border-radius:3px;padding:1px 5px;font-size:11px;font-family:var(--font)}
.page-help .help-content .tip{background:var(--f-primary-10,#e6f4f5);border-left:3px solid var(--f-primary);padding:8px 12px;border-radius:0 var(--r-sm) var(--r-sm) 0;margin:8px 0;font-size:12px}

/* ── Mobile ── */
@media (max-width: 768px) {
  .header h1 { font-size: 20px; }
  .nav {
    gap: 2px;
    padding: 0 10px;
    height: auto;
    min-height: 44px;
    padding-top: 6px;
    padding-bottom: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav a { padding: 4px 8px; font-size: 12px; white-space: nowrap; }
  .top-nav .nav-links { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .top-nav .nav-links a { white-space: nowrap; }
  .modal { padding: 20px; }
  .card { padding: 16px; }
  .page-container { padding: 16px; padding-bottom: 90px; }
  .rock-grid { grid-template-columns: 1fr !important; }
  .domain-grid { grid-template-columns: 1fr !important; }
  .card-grid { grid-template-columns: 1fr !important; }
}

/* Deal stage badges */
.stage-badge{display:inline-block;padding:2px 8px;border-radius:6px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.3px}
.stage-intake,.stage-badge.stage-intake{background:#EFF6FF;color:#3B82F6}
.stage-analysis,.stage-badge.stage-analysis{background:#FFF7ED;color:#F59E0B}
.stage-proposal,.stage-badge.stage-proposal{background:#FFFBEB;color:#D97706}
.stage-negotiation,.stage-badge.stage-negotiation{background:#FEF3C7;color:#92400E}
.stage-pre_closing,.stage-badge.stage-pre_closing{background:#ECFDF5;color:#059669}
.stage-post_closing,.stage-badge.stage-post_closing{background:#D1FAE5;color:#047857}
.stage-management,.stage-badge.stage-management{background:#E0F2FE;color:#0284C7}
.stage-won,.stage-badge.stage-won{background:#D1FAE5;color:#047857}
.stage-lost,.stage-badge.stage-lost{background:#FEE2E2;color:#DC2626}

/* Priority badges */
.pill.critical{background:#FEE2E2;color:#DC2626}
.pill.high{background:#FFF7ED;color:#EA580C}
.pill.medium{background:#FFF7ED;color:#D97706}
.pill.low{background:#F0FDF4;color:#16A34A}

/* Status badges */
.pill.done,.pill.resolved,.pill.completed{background:#D1FAE5;color:#047857}
.pill.in_progress{background:#DBEAFE;color:#2563EB}
.pill.planned,.pill.todo,.pill.backlog{background:#F3F4F6;color:#6B7280}

/* Top Nav (v3+ pages) */
.top-nav{display:flex;align-items:center;gap:16px;padding:0 20px;height:52px;border-bottom:1px solid var(--f-border);background:var(--f-surface);position:sticky;top:0;z-index:100}
.top-nav .nav-logo{font-weight:800;font-size:16px;color:var(--f-primary);text-decoration:none;white-space:nowrap}
.top-nav .nav-links{display:flex;gap:4px;overflow-x:auto;-webkit-overflow-scrolling:touch}
.top-nav .nav-links a{padding:6px 10px;font-size:13px;color:var(--f-text-secondary);text-decoration:none;border-radius:6px;white-space:nowrap;font-weight:500}
.top-nav .nav-links a:hover{background:var(--f-bg-secondary)}
.top-nav .nav-links a.active{color:var(--f-primary);background:rgba(0,134,145,.08)}

/* Loading states */
.loading{text-align:center;padding:40px;color:var(--f-text-tertiary);font-size:14px}
.loading::before{content:'';display:block;width:24px;height:24px;border:2px solid var(--f-border);border-top-color:var(--f-primary);border-radius:50%;animation:spin .6s linear infinite;margin:0 auto 12px}
@keyframes spin{to{transform:rotate(360deg)}}
.empty-state{text-align:center;padding:40px;color:var(--f-text-tertiary)}
.empty-state .emoji{font-size:32px;margin-bottom:8px}
.empty-state p{font-size:14px;margin:4px 0}

/* Risk Labels */
.risk-badge { display:inline-block; padding:2px 8px; border-radius:4px; font-weight:600; font-size:12px; cursor:pointer; }
.risk-KO { background:#1a1a1a; color:#ff4444; }
.risk-G { background:#e8f5e9; color:#2e7d32; }
.risk-O { background:#fff3e0; color:#e65100; }
.risk-R { background:#ffebee; color:#c62828; }
.risk-none { background:#f3f4f6; color:#6b7280; }

/* CP/CS Conditions */
.condition-item { display:flex; align-items:center; gap:12px; padding:12px; border-bottom:1px solid var(--f-border); }
.condition-status { font-size:12px; padding:2px 8px; border-radius:4px; font-weight:600; }
.condition-open { background:#fff3e0; color:#e65100; }
.condition-done { background:#e8f5e9; color:#2e7d32; }
.condition-waived { background:#e3f2fd; color:#1565c0; }
.condition-overdue { background:#ffebee; color:#c62828; }
.condition-progress { font-size:14px; font-weight:600; color:var(--f-muted); }

/* Actions / Stoplicht */
.traffic-light { display:inline-block; width:12px; height:12px; border-radius:50%; }
.traffic-light.lg { width:16px; height:16px; }
.traffic-groen { background:#4caf50; }
.traffic-oranje { background:#ff9800; }
.traffic-rood { background:#f44336; }
.action-card { display:flex; align-items:center; gap:12px; padding:16px; border-bottom:1px solid var(--border); cursor:pointer; }
.action-card:active { background:var(--bg-secondary); }
.action-type { font-size:11px; padding:2px 6px; border-radius:4px; background:var(--bg-secondary); color:var(--f-muted); }

/* ── Empty States ── */
.empty-state{text-align:center;padding:40px 20px;color:var(--f-text-secondary)}
.empty-state .empty-title{font-size:16px;font-weight:600;margin-bottom:8px}
.empty-state .empty-desc{font-size:14px}

/* ══════════════════════════════════════════════════════════════
   Framework Components — added by framework-test build
   ══════════════════════════════════════════════════════════════ */

/* Skip navigation */
.skip-nav { position: absolute; top: -100%; left: 16px; z-index: 10000; padding: 8px 16px; background: var(--f-primary); color: #fff; border-radius: 4px; text-decoration: none; }
.skip-nav:focus { top: 16px; }

/* Pagination */
.ff-pagination { display: flex; gap: 4px; align-items: center; margin-top: 16px; }
.ff-pagination button { padding: 6px 12px; border: 1px solid var(--f-border); background: #fff; border-radius: 4px; cursor: pointer; }
.ff-pagination button.active { background: var(--f-primary); color: #fff; border-color: var(--f-primary); }
.ff-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Badges */
.ff-badge-green { background: #dcfce7; color: #166534; }
.ff-badge-amber { background: #fef3c7; color: #92400e; }
.ff-badge-red { background: #fee2e2; color: #991b1b; }
.ff-badge-gray { background: #f3f4f6; color: #374151; }

/* Empty state */
.ff-empty { text-align: center; padding: 48px 24px; color: var(--f-text-secondary); }
.ff-empty-icon { font-size: 48px; margin-bottom: 16px; display: block; }

/* Error state */
.ff-error { text-align: center; padding: 32px; background: #fef2f2; border-radius: 8px; }
.ff-error button { margin-top: 12px; }

/* Loading skeleton */
.ff-skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: ff-shimmer 1.5s infinite; border-radius: 4px; }
@keyframes ff-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Simple charts */
.ff-chart { padding: 16px; }
.ff-bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 200px; }
.ff-bar { background: var(--f-primary); border-radius: 4px 4px 0 0; min-width: 32px; transition: height 0.3s; }
.ff-donut-chart { width: 200px; height: 200px; margin: 0 auto; }

/* Modal */
.ff-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9000; display: flex; align-items: center; justify-content: center; }
.ff-modal { background: #fff; border-radius: 12px; padding: 24px; max-width: 480px; width: 90%; max-height: 80vh; overflow-y: auto; }

/* Mobile card view */
@media (max-width: 768px) {
  .ff-table-container table { display: none; }
  .ff-mobile-cards { display: block !important; }
  .ff-mobile-card { background: #fff; border: 1px solid var(--f-border); border-radius: 8px; padding: 16px; margin-bottom: 8px; }
}
@media (min-width: 769px) {
  .ff-mobile-cards { display: none !important; }
}
