/* CFP Component Library */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--content-bg); line-height: 1.5; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); position: fixed; top: 0; left: 0; bottom: 0; display: flex; flex-direction: column; z-index: 100; overflow-y: auto; }
.sidebar-brand { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-brand .foundation-name { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 17px; font-weight: 600; color: var(--white); line-height: 1.2; display: block; }
.sidebar-brand .school-name { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; display: block; text-transform: uppercase; letter-spacing: 0.05em; }
.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.35); padding: 12px 20px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: var(--sidebar-text); text-decoration: none; font-size: 13.5px; transition: background 0.15s, color 0.15s; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-item.active { background: rgba(201,168,76,0.18); color: var(--gold-light); font-weight: 500; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; color: rgba(255,255,255,0.45); }
.main-wrap { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: var(--topbar-h); background: var(--topbar-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 20px; font-weight: 600; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-muted); }
.topbar-user { font-weight: 500; color: var(--text); }
.page-content { padding: 28px; flex: 1; }

.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.kpi-tile { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.kpi-label { font-size: 11.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.kpi-tile.gold .kpi-value { color: var(--gold-muted); }
.kpi-tile.green .kpi-value { color: var(--green); }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 26px; font-weight: 600; color: var(--navy); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; line-height: 1; }
.btn-primary { background: var(--navy); color: var(--white); border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-light); }
.btn-gold { background: var(--gold); color: var(--navy-dark); border-color: var(--gold); font-weight: 600; }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--grey-50); border-color: var(--grey-300); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: #b91c1c; }

.form-group { margin-bottom: 18px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--grey-700); margin-bottom: 5px; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--grey-300); border-radius: var(--radius); font-size: 13.5px; color: var(--text); background: var(--white); transition: border-color 0.15s, box-shadow 0.15s; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--focus-ring); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--grey-100); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--grey-50); }
td a { color: var(--navy); text-decoration: none; font-weight: 500; }
td a:hover { color: var(--gold-muted); }

.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge-navy   { background: rgba(26,39,68,0.1);  color: var(--navy); }
.badge-gold   { background: rgba(201,168,76,0.15); color: var(--gold-muted); }
.badge-green  { background: rgba(22,163,74,0.1);  color: var(--green); }
.badge-grey   { background: var(--grey-100);       color: var(--grey-700); }
.badge-amber  { background: rgba(217,119,6,0.1);  color: var(--amber); }

.search-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar .form-control { max-width: 300px; }

.pipeline-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.pipeline-col { flex: 0 0 220px; background: var(--grey-100); border-radius: var(--radius-lg); padding: 12px; min-height: 200px; }
.pipeline-col-header { margin-bottom: 10px; }
.pipeline-col-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 2px; }
.pipeline-col-value { font-size: 13px; font-weight: 600; color: var(--navy); font-family: 'JetBrains Mono', monospace; }
.pipeline-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.pipeline-card-name { font-weight: 600; font-size: 13px; color: var(--navy); margin-bottom: 4px; }
.pipeline-card-meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; }
.pipeline-card-amount { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--gold-muted); font-weight: 600; }
.pipeline-move-form select { font-size: 11px; padding: 3px 6px; border-radius: 4px; border: 1px solid var(--grey-300); width: 100%; margin-top: 6px; cursor: pointer; }

.flash-list { list-style: none; margin-bottom: 16px; }
.flash { padding: 10px 16px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 8px; border: 1px solid transparent; }
.flash-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

.comms-log { list-style: none; }
.comm-entry { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--grey-100); }
.comm-entry:last-child { border-bottom: none; }
.comm-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--grey-100); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.comm-body { flex: 1; }
.comm-summary { font-size: 13.5px; color: var(--text); margin-bottom: 3px; }
.comm-meta { font-size: 11.5px; color: var(--text-muted); }
.comm-next-action { font-size: 12px; color: var(--amber); margin-top: 4px; font-weight: 500; }

.contact-hero { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.contact-avatar { width: 60px; height: 60px; border-radius: 50%; background: var(--navy); color: var(--white); font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.contact-hero-name { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 28px; font-weight: 600; color: var(--navy); line-height: 1.1; }
.contact-hero-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--white); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,0.2); width: 100%; max-width: 500px; margin: 20px; }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-weight: 600; font-size: 15px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 20px; line-height: 1; padding: 0; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.settings-section { margin-bottom: 32px; }
.settings-section-title { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 600; color: var(--navy); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--gold); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); } .text-sm { font-size: 12px; } .text-right { text-align: right; }
.d-flex { display: flex; } .align-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .w-100 { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state p { margin-bottom: 16px; font-size: 15px; }

@media (max-width: 720px) { .grid-2, .grid-3, .form-row { grid-template-columns: 1fr; } .sidebar { display: none; } .main-wrap { margin-left: 0; } }
