* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0B1320; color: #e1e8ed; min-height: 100vh; }

header { background: #0F2A45; padding: 1.5rem 2rem; border-bottom: 1px solid #7b3654; }
header h1 { font-size: 1.4rem; margin-bottom: 0.2rem; color: #fff; }
.subtitle { font-size: 0.85rem; color: #a0b4c8; margin-bottom: 1rem; }
nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.nav-btn { padding: 0.5rem 1.2rem; border: 1px solid #1E4E6A; background: transparent; color: #a0b4c8; border-radius: 6px; cursor: pointer; font-size: 0.9rem; transition: all 0.2s; }
.nav-btn:hover { border-color: #7b3654; color: #e1e8ed; }
.nav-btn.active { background: #7b3654; border-color: #7b3654; color: #fff; }

main { max-width: 1600px; margin: 0 auto; padding: 2rem; }
.view { display: none; }
.view.active { display: block; }

/* Scorecard */
.scorecard-header { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; padding: 1.5rem; background: #0F2A45; border-radius: 10px; position: relative; }
.scorecard-approval-badge { position: absolute; bottom: 1rem; right: 1.5rem; padding: 0.4rem 1rem; border-radius: 6px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.scorecard-approval-badge.approval-pending { background: rgba(214,158,46,0.25); color: #ecc94b; border: 1px solid #d69e2e; }
.scorecard-approval-badge.approval-approved { background: rgba(56,161,105,0.25); color: #68d391; border: 1px solid #38a169; }
.scorecard-approval-badge.approval-review { background: rgba(221,107,32,0.25); color: #ed8936; border: 1px solid #dd6b20; }
.field-group label { display: block; font-size: 0.75rem; color: #a0b4c8; margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.5px; }
.field-group input, .field-group select { width: 100%; padding: 0.5rem; background: #1E4E6A; border: 1px solid #1E4E6A; border-radius: 6px; color: #e1e8ed; font-size: 0.9rem; }
.field-group input:focus, .field-group select:focus { outline: none; border-color: #c87a94; }
.colead-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: #a0b4c8; margin-top: 0.4rem; cursor: pointer; }
.colead-label input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; }

.scorecard-grid { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 2rem; }
.scorecard-row { display: grid; grid-template-columns: 220px 1fr 280px; align-items: start; gap: 1.5rem; padding: 1rem 1.5rem; background: #0F2A45; border-radius: 8px; border: 1px solid #1E4E6A; overflow: visible; }
.category-info { overflow: visible; position: relative; }
.category-title-row { display: flex; align-items: center; gap: 0.4rem; position: relative; z-index: 10; }
.category-info strong { font-size: 0.95rem; color: #fff; }
.category-info small { display: block; font-size: 0.75rem; color: #a0b4c8; margin-top: 2px; }
.category-info .guide { display: block; font-size: 0.7rem; color: #c87a94; margin-top: 4px; font-family: monospace; }
.category-info .criteria-info { display: inline-flex; margin-left: 0; vertical-align: middle; }
.category-options { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Criteria column */
.category-criteria { display: flex; align-items: flex-start; gap: 0.5rem; padding-top: 0.2rem; }
.category-comment { font-size: 0.75rem; color: #e2e8f0; background: #1E4E6A; border: 1px solid #1E4E6A; border-radius: 4px; padding: 0.3rem 0.5rem; min-width: 180px; max-width: 260px; width: 100%; line-height: 1.4; outline: none; }
.category-comment:focus { border-color: #7b3654; }
.category-comment::placeholder { color: #718096; }
.criteria-text { font-size: 0.75rem; color: #718096; white-space: normal; word-wrap: break-word; min-width: 180px; max-width: 260px; line-height: 1.4; }
.criteria-info { cursor: pointer; font-size: 0.85rem; line-height: 1; flex-shrink: 0; display: inline-block; }
.criteria-info .criteria-tooltip { display: none; }
.criteria-info:hover .criteria-tooltip { display: block; position: fixed; background: #0F2A45; border: 1px solid #1E4E6A; border-radius: 8px; padding: 1.5rem; width: 360px; max-width: 90vw; z-index: 9999; box-shadow: 0 8px 24px rgba(0,0,0,0.6); }
.criteria-tooltip.show-tooltip { display: block; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #0F2A45; border: 1px solid #1E4E6A; border-radius: 8px; padding: 1.5rem; width: 360px; max-width: 90vw; z-index: 9999; box-shadow: 0 8px 24px rgba(0,0,0,0.6); }
.criteria-tooltip strong { display: block; color: #fff; font-size: 0.85rem; margin-bottom: 0.6rem; }
.ct-level { font-size: 0.78rem; color: #e1e8ed; margin-bottom: 0.4rem; line-height: 1.4; }
.ct-label { color: #c87a94; font-weight: 600; }
.ct-diff { font-size: 0.72rem; color: #f6e05e; font-style: italic; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid #1E4E6A; }

@media (max-width: 1024px) {
  .scorecard-row { grid-template-columns: 180px 1fr auto; gap: 1rem; }
  .criteria-text { display: none; }
  .criteria-info .criteria-tooltip { }
}
@media (max-width: 768px) {
  .scorecard-row { grid-template-columns: 1fr; }
  .criteria-text { display: none; }
}
.option-label { cursor: pointer; }
.option-label input { display: none; }
.option-chip { display: inline-block; padding: 0.4rem 0.8rem; background: #1E4E6A; border: 1px solid #1E4E6A; border-radius: 20px; font-size: 0.8rem; transition: all 0.2s; }
.option-chip small { opacity: 0.6; }
.option-label input:checked + .option-chip { background: #7b3654; border-color: #c87a94; color: #fff; }
.option-label:hover .option-chip { border-color: #c87a94; }

/* Results */
.scorecard-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.result-box { background: #0F2A45; padding: 1.2rem; border-radius: 10px; text-align: center; border: 1px solid #1E4E6A; }
.result-label { display: block; font-size: 0.75rem; color: #a0b4c8; text-transform: uppercase; margin-bottom: 0.5rem; }
.result-value { font-size: 1.4rem; font-weight: 700; }
.recommendation-box .result-value { font-size: 0.9rem; font-weight: 400; }

.level-essential { color: #68d391; }
.level-standard { color: #f6e05e; }
.level-enhanced { color: #fc8181; }

.scorecard-actions { display: flex; gap: 1rem; margin-bottom: 1rem; }
.btn-primary { padding: 0.7rem 1.5rem; background: #7b3654; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.btn-primary:hover { background: #9b4668; }
.btn-secondary { padding: 0.7rem 1.5rem; background: transparent; color: #a0b4c8; border: 1px solid #1E4E6A; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.btn-secondary:hover { border-color: #a0b4c8; color: #fff; }
.csv-import-group { display: flex; gap: 0.5rem; align-items: flex-end; }
.btn-approval { padding: 0.7rem 1.5rem; background: #d69e2e; color: #1a202c; border: none; border-radius: 6px; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.btn-approval:hover { background: #ecc94b; }
.btn-approve { padding: 0.7rem 1.5rem; background: #38a169; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.btn-approve:hover { background: #48bb78; }
.btn-review { padding: 0.7rem 1.5rem; background: #dd6b20; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.btn-review:hover { background: #ed8936; }
.approval-badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; }
.approval-pending { background: rgba(214,158,46,0.2); color: #ecc94b; }
.approval-approved { background: rgba(56,161,105,0.2); color: #68d391; }
.approval-review { background: rgba(221,107,32,0.2); color: #ed8936; }
.hint { font-size: 0.8rem; color: #718096; font-style: italic; }
.scoring-summary { margin-top: 0.5rem; }

/* Pipeline */
.pipeline-header { display: flex; align-items: center; gap: 2rem; margin-bottom: 1.5rem; padding: 1rem 1.5rem; background: #0F2A45; border-radius: 10px; flex-wrap: wrap; }
.capacity-summary { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.capacity-summary span { font-size: 0.9rem; color: #a0b4c8; }
.pipeline-table-wrap { overflow-x: auto; }
#pipeline-table { width: 100%; border-collapse: collapse; }
#pipeline-table th { text-align: left; padding: 0.8rem 1rem; background: #0F2A45; color: #a0b4c8; font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid #1E4E6A; }
#pipeline-table td { padding: 0.8rem 1rem; border-bottom: 1px solid #0F2A45; font-size: 0.85rem; }
#pipeline-table tbody tr:hover { background: #0F2A45; }
.recommendation-cell { max-width: 200px; font-size: 0.75rem; color: #a0b4c8; }
.btn-delete { background: transparent; border: 1px solid #fc8181; color: #fc8181; border-radius: 4px; cursor: pointer; padding: 0.2rem 0.5rem; }
.btn-delete:hover { background: #fc8181; color: #0F2A45; }

.badge { padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge.level-essential { background: rgba(104,211,145,0.15); color: #68d391; }
.badge.level-standard { background: rgba(246,224,94,0.15); color: #f6e05e; }
.badge.level-enhanced { background: rgba(252,129,129,0.15); color: #fc8181; }
.badge.level-unscored { background: rgba(160,174,192,0.15); color: #a0b4c8; }

.status-healthy { color: #68d391; }
.status-tight { color: #f6e05e; }
.status-overload { color: #f56565; }

/* Overview */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.overview-card { background: #0F2A45; border-radius: 10px; padding: 1.5rem; border: 1px solid #1E4E6A; display: flex; flex-direction: column; }
.overview-card h3 { margin-bottom: 1rem; color: #fff; }
.overview-card h3 small { color: #a0b4c8; font-weight: 400; }
.capacity-bar-wrap { height: 8px; background: #1E4E6A; border-radius: 4px; overflow: hidden; margin-bottom: 1rem; }
.capacity-bar { height: 100%; border-radius: 4px; transition: width 0.3s; }
.capacity-bar.status-healthy { background: #68d391; }
.capacity-bar.status-tight { background: #f6e05e; }
.capacity-bar.status-overload { background: #f56565; }
.overview-stats { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; color: #a0b4c8; margin-bottom: 0.75rem; }
.overview-capacity-indicators { display: flex; gap: 1rem; font-size: 0.7rem; color: #718096; margin-bottom: 1rem; }
.capacity-indicator { white-space: nowrap; }
.overview-projects { list-style: none; }
.overview-projects li { padding: 0.4rem 0; font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; }
.overview-project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.overview-project-units { flex-shrink: 0; color: #718096; font-size: 0.8rem; }
.secondary-tag { display: inline-block; background: rgba(159,122,234,0.2); color: #9f7aea; font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: 8px; font-weight: 600; }
.overview-territories { display: flex; gap: 1rem; justify-content: space-around; margin-top: auto; padding-top: 1.5rem; border-top: 1px solid #1E4E6A; }
.territory-tag { font-size: 0.8rem; color: #a0b4c8; }

@media (max-width: 768px) {
  .pipeline-header { flex-direction: column; align-items: flex-start; }
}

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #0F2A45; border: 1px solid #1E4E6A; border-radius: 12px; padding: 2rem; width: 90%; max-width: 400px; }
.modal h3 { margin-bottom: 1.5rem; color: #fff; }
.modal .field-group { margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

/* Wrap button */
.btn-wrap { background: transparent; border: 1px solid #f6e05e; color: #f6e05e; border-radius: 4px; cursor: pointer; padding: 0.2rem 0.5rem; font-size: 0.75rem; margin-right: 0.3rem; }
.btn-wrap:hover { background: #f6e05e; color: #0F2A45; }

.section-title { font-size: 1.2rem; margin-bottom: 1.5rem; color: #fff; }

#manage-execs-btn { border-style: dashed; }

.status-select { background: #1E4E6A; border: 1px solid #1E4E6A; color: #e1e8ed; border-radius: 4px; padding: 0.3rem 0.4rem; font-size: 0.75rem; cursor: pointer; max-width: 260px; }
.status-select:focus { outline: none; border-color: #c87a94; }

/* Clickable project link */
.project-link { cursor: pointer; color: #c87a94; }
.project-link:hover { text-decoration: underline; }

/* History table */
#history-table th, #history-table td { padding: 0.9rem 1.5rem; }
#history-table th { text-align: left; background: #0F2A45; color: #a0b4c8; font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid #1E4E6A; letter-spacing: 0.5px; }
#history-table td { border-bottom: 1px solid #0F2A45; font-size: 0.85rem; }
#history-table { width: 100%; border-collapse: collapse; }

/* Admin Panel */
.admin-login { max-width: 400px; padding: 2rem; }
.admin-error { color: #fc8181; font-size: 0.85rem; margin-top: 0.5rem; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.admin-header h2 { color: #fff; }
.admin-section { background: #0F2A45; border: 1px solid #1E4E6A; border-radius: 10px; padding: 1.5rem; margin-bottom: 1.5rem; }
.admin-section h3 { color: #fff; margin-bottom: 0.5rem; }
.admin-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.admin-table th { text-align: left; padding: 0.5rem 0.4rem; color: #a0b4c8; font-size: 0.7rem; text-transform: uppercase; border-bottom: 1px solid #1E4E6A; }
.admin-table td { padding: 0.4rem 0.3rem; border-bottom: 1px solid #0F2A45; }
.at-input { background: #1E4E6A; border: 1px solid #1E4E6A; color: #e1e8ed; border-radius: 4px; padding: 0.35rem 0.5rem; font-size: 0.8rem; width: 100%; }
.at-input:focus { outline: none; border-color: #c87a94; }
.at-sm { max-width: 150px; }
.at-xs { max-width: 70px; }
.admin-form-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1rem 0; }
.admin-form-row .field-group { min-width: 150px; }
.admin-timestamp { display: block; color: #718096; font-size: 0.7rem; margin-top: 0.75rem; }
.admin-footer { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.admin-toast { position: fixed; bottom: 2rem; right: 2rem; background: #68d391; color: #0F2A45; padding: 0.75rem 1.5rem; border-radius: 8px; font-size: 0.85rem; font-weight: 600; z-index: 9999; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Scorecard Comments */
.scorecard-comments { margin-bottom: 1.5rem; padding: 1rem 1.5rem; background: #0F2A45; border-radius: 8px; border: 1px solid #1E4E6A; }
.scorecard-comments label { display: block; font-size: 0.75rem; color: #a0b4c8; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.scorecard-comments textarea { width: 100%; padding: 0.6rem; background: #1E4E6A; border: 1px solid #1E4E6A; border-radius: 6px; color: #e1e8ed; font-size: 0.85rem; resize: vertical; font-family: inherit; line-height: 1.5; }
.scorecard-comments textarea:focus { outline: none; border-color: #c87a94; }

/* Pipeline Comment Button & Popover */
.actions-cell { white-space: nowrap; }
.comment-btn-wrap { display: inline-block; position: relative; }
.btn-comment { background: transparent; border: 1px solid #1E4E6A; color: #718096; border-radius: 4px; cursor: pointer; padding: 0.2rem 0.45rem; font-size: 0.8rem; margin-right: 0.3rem; transition: all 0.2s; }
.btn-comment:hover { border-color: #c87a94; color: #c87a94; }
.btn-comment.has-comment { border-color: #9f7aea; color: #9f7aea; }
.btn-comment.has-comment:hover { border-color: #b794f4; color: #b794f4; }

.comment-popover { display: none; position: absolute; bottom: 100%; right: 0; margin-bottom: 0.5rem; background: #0F2A45; border: 1px solid #1E4E6A; border-radius: 8px; padding: 1rem; width: 320px; max-height: 300px; overflow-y: auto; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.comment-btn-wrap:hover .comment-popover { display: block; }
.comment-popover-header { font-size: 0.8rem; font-weight: 600; color: #fff; margin-bottom: 0.5rem; border-bottom: 1px solid #1E4E6A; padding-bottom: 0.4rem; }
.comment-popover-current { font-size: 0.78rem; color: #e1e8ed; line-height: 1.4; margin-bottom: 0.75rem; }
.comment-popover-current strong { color: #68d391; }
.comment-popover-empty { font-size: 0.75rem; color: #718096; font-style: italic; }
.comment-popover-history-header { font-size: 0.7rem; color: #a0b4c8; text-transform: uppercase; margin-bottom: 0.4rem; border-top: 1px solid #1E4E6A; padding-top: 0.5rem; }
.comment-history-entry { font-size: 0.72rem; margin-bottom: 0.6rem; padding-bottom: 0.5rem; border-bottom: 1px solid #0F2A45; }
.comment-history-meta { color: #718096; font-size: 0.65rem; margin-bottom: 0.2rem; }
.comment-history-old { color: #fc8181; }
.comment-history-new { color: #68d391; }

/* Admin Scoring Categories */
.admin-cat-block { background: #0f1419; border: 1px solid #1E4E6A; border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.admin-cat-header { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.admin-cat-header .at-input { flex: 1; min-width: 120px; }
.admin-cat-options-table { font-size: 0.8rem; }
.admin-cat-options-table th { font-size: 0.65rem; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.75rem; }
