/* === Public Engagement Tracker — Styles === */
:root {
  --primary: #1B3A5C;
  --primary-light: #2a5580;
  --primary-lighter: #e8eef4;
  --green: #2E7D32;
  --green-light: #e8f5e9;
  --amber: #F9A825;
  --amber-light: #fff8e1;
  --red: #c62828;
  --red-light: #ffebee;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-500: #9e9e9e;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); color: var(--gray-900); background: var(--gray-100); line-height: 1.5; }
.hidden { display: none !important; }

/* Header */
header {
  background: var(--primary);
  color: #fff;
  padding: 1.2rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
header h1 { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; }
.subtitle { font-size: .85rem; opacity: .75; margin-top: .1rem; }
.header-actions { display: flex; gap: .5rem; }
.header-actions .btn-outline {
  border-color: rgba(255,255,255,.4);
  color: #fff;
  font-size: .8rem;
  cursor: pointer;
}
.header-actions .btn-outline:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.7);
}

/* Main */
main { max-width: 1400px; margin: 0 auto; padding: 1.5rem 2rem 3rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  font-family: var(--font);
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline { background: transparent; border-color: var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b71c1c; }
.btn-text { background: none; border: none; color: var(--primary); padding: .3rem .5rem; font-weight: 600; }
.btn-text:hover { color: var(--primary-light); text-decoration: underline; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-icon {
  background: none; border: none; padding: .25rem; cursor: pointer;
  color: var(--gray-500); font-size: 1rem; line-height: 1; border-radius: 4px;
}
.btn-icon:hover { color: var(--gray-800); background: var(--gray-200); }

/* Dashboard */
.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.dashboard-toolbar h2 { font-size: 1.25rem; color: var(--gray-800); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.project-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all .2s ease;
  border: 2px solid transparent;
  position: relative;
}
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-lighter); transform: translateY(-1px); }
.project-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .6rem; }
.project-card-header h3 { font-size: 1.05rem; color: var(--primary); }
.project-card .location { font-size: .85rem; color: var(--gray-600); margin-bottom: .75rem; }
.project-card-footer { display: flex; align-items: center; gap: 1rem; margin-top: .75rem; }
.project-card .card-actions {
  position: absolute; top: .75rem; right: .75rem;
  display: flex; gap: .25rem; opacity: 0; transition: opacity .15s;
}
.project-card:hover .card-actions { opacity: 1; }

/* Status badge */
.badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.badge-planning { background: #e3f2fd; color: #1565c0; }
.badge-active { background: var(--amber-light); color: #f57f17; }
.badge-complete { background: var(--green-light); color: var(--green); }

/* Stat chip on cards */
.stat-chip {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  color: var(--gray-600);
}
.stat-chip strong { color: var(--gray-800); }

/* Mini score ring on card */
.mini-ring {
  width: 42px; height: 42px;
  position: relative;
  flex-shrink: 0;
}
.mini-ring svg { transform: rotate(-90deg); }
.mini-ring .ring-bg { fill: none; stroke: var(--gray-200); stroke-width: 4; }
.mini-ring .ring-fg { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.mini-ring .ring-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700; color: var(--gray-700);
}

/* Detail View */
#btn-back { margin-bottom: 1rem; }
.detail-header {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.detail-header h2 { font-size: 1.4rem; color: var(--primary); margin-bottom: .25rem; }
.detail-header .meta { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: .85rem; color: var(--gray-600); margin-top: .5rem; }
.detail-header .meta span { display: flex; align-items: center; gap: .3rem; }
.detail-header .desc { margin-top: .75rem; color: var(--gray-700); font-size: .9rem; }
.detail-header-top { display: flex; justify-content: space-between; align-items: flex-start; }
.detail-header-actions { display: flex; gap: .5rem; }

.detail-body { display: grid; grid-template-columns: 1fr 380px; gap: 1.25rem; align-items: start; }
.detail-main { min-width: 0; }
.detail-sidebar { display: flex; flex-direction: column; gap: 1rem; }

/* Panels */
.panel {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}
.panel-header h3 { font-size: 1rem; color: var(--gray-800); }

/* Activity table */
.activity-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.activity-table th {
  text-align: left; padding: .6rem 1rem;
  background: var(--gray-50); color: var(--gray-600);
  font-weight: 600; font-size: .75rem; text-transform: uppercase;
  letter-spacing: .03em; border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0;
}
.activity-table td { padding: .6rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.activity-table tr:hover td { background: var(--gray-50); }
.activity-table .type-badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--primary-lighter);
  color: var(--primary);
  white-space: nowrap;
}
.activity-table .act-actions { white-space: nowrap; }
.activity-empty {
  text-align: center; padding: 3rem 1rem; color: var(--gray-500);
}
.activity-table-wrap { max-height: 500px; overflow-y: auto; }

/* Score ring (large) */
.score-panel { text-align: center; padding: 1.5rem; }
.score-panel h3 { font-size: .9rem; color: var(--gray-600); margin-bottom: 1rem; text-transform: uppercase; letter-spacing: .05em; }
.score-ring {
  width: 140px; height: 140px;
  margin: 0 auto 1rem;
  position: relative;
}
.score-ring svg { transform: rotate(-90deg); }
.score-ring .ring-bg { fill: none; stroke: var(--gray-200); stroke-width: 8; }
.score-ring .ring-fg { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.score-ring .ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.score-ring .score-value { font-size: 2rem; font-weight: 800; color: var(--gray-800); line-height: 1; }
.score-ring .score-unit { font-size: .75rem; color: var(--gray-500); margin-top: .15rem; }
.score-breakdown { text-align: left; padding: 0 .5rem; }
.score-breakdown-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: .35rem 0; font-size: .8rem; color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
}
.score-breakdown-item:last-child { border-bottom: none; }
.score-breakdown-item .sb-bar {
  width: 60px; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; margin-left: .5rem;
}
.score-breakdown-item .sb-fill { height: 100%; border-radius: 3px; transition: width .5s ease; }

/* Metrics panel */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--gray-200);
}
.metric-cell {
  background: #fff;
  padding: 1rem;
  text-align: center;
}
.metric-cell .metric-value { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.metric-cell .metric-label { font-size: .7rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; margin-top: .15rem; }

/* Bar chart (CSS) */
.bar-chart { padding: 1rem 1.25rem; }
.bar-chart h4 { font-size: .85rem; color: var(--gray-700); margin-bottom: .75rem; }
.bar-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; font-size: .75rem; }
.bar-label { width: 130px; text-align: right; color: var(--gray-600); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 18px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .5s ease; min-width: 0; }
.bar-value { width: 28px; text-align: right; color: var(--gray-700); font-weight: 600; flex-shrink: 0; }

/* Timeline */
.timeline-chart { padding: 1rem 1.25rem; }
.timeline-chart h4 { font-size: .85rem; color: var(--gray-700); margin-bottom: .75rem; }
.timeline-months { display: flex; gap: 2px; align-items: flex-end; height: 80px; }
.timeline-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; height: 100%; justify-content: flex-end; }
.timeline-bar { width: 100%; background: var(--primary); border-radius: 2px 2px 0 0; min-height: 0; transition: height .4s ease; }
.timeline-label { font-size: .55rem; color: var(--gray-500); text-align: center; writing-mode: horizontal-tb; }
.timeline-empty { color: var(--gray-400); font-size: .8rem; text-align: center; padding: 1rem; }

/* Checklist */
.checklist { padding: 1rem 1.25rem; }
.checklist h4 { font-size: .85rem; color: var(--gray-700); margin-bottom: .75rem; }
.checklist-item {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .35rem 0; font-size: .8rem; color: var(--gray-600);
}
.checklist-item.checked { color: var(--green); }
.checklist-icon {
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; flex-shrink: 0; margin-top: 1px;
  border: 2px solid var(--gray-300); color: transparent;
}
.checklist-item.checked .checklist-icon {
  background: var(--green); border-color: var(--green); color: #fff;
}
.checklist-progress { margin-top: .75rem; }
.checklist-progress-bar {
  height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden;
}
.checklist-progress-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width .5s ease; }
.checklist-progress-label { font-size: .7rem; color: var(--gray-500); margin-top: .25rem; text-align: right; }
.checklist-item.manual:hover { background: var(--gray-50); border-radius: 4px; margin: 0 -.25rem; padding: .35rem .25rem; }
.manual-hint { font-size: .65rem; color: var(--gray-400); font-style: italic; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-sm { width: 400px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--gray-500); line-height: 1; padding: .25rem;
}
.modal-close:hover { color: var(--gray-800); }

/* Forms */
form { padding: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; color: var(--gray-700); margin-bottom: .3rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: .9rem; font-family: var(--font);
  transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,58,92,.12);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; padding-top: .5rem; }
.checkbox-label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; color: var(--gray-700); cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: auto; margin: 0; }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--gray-500); }
.empty-state h3 { font-size: 1.1rem; color: var(--gray-600); margin-bottom: .5rem; }

/* Quality badges */
.quality-badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
}
.quality-badge.q1 { background: #fce4ec; color: #c62828; }
.quality-badge.q2 { background: #fff3e0; color: #e65100; }
.quality-badge.q3 { background: #fff8e1; color: #f57f17; }
.quality-badge.q4 { background: #e8f5e9; color: #2e7d32; }
.quality-badge.q5 { background: #e3f2fd; color: #1565c0; }
.quality-none { color: var(--gray-400); font-size: .8rem; }

/* Quality panel */
.quality-panel { padding: 1rem 1.25rem; }
.quality-panel h4 { font-size: .85rem; color: var(--gray-700); margin-bottom: .75rem; }
.quality-panel .quality-empty { color: var(--gray-400); font-size: .8rem; }
.quality-avg { text-align: center; margin-bottom: 1rem; }
.quality-avg-num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.quality-avg-label { display: block; font-size: .7rem; color: var(--gray-500); margin-top: .15rem; }
.quality-scale { display: flex; flex-direction: column; gap: .3rem; }
.quality-row {
  display: grid;
  grid-template-columns: 20px 1fr 24px 70px;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
}
.quality-level { font-weight: 700; color: var(--gray-600); text-align: center; }
.quality-bar-track { height: 14px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.quality-bar-fill { height: 100%; border-radius: 3px; transition: width .5s ease; }
.quality-bar-fill.q1 { background: #ef9a9a; }
.quality-bar-fill.q2 { background: #ffcc80; }
.quality-bar-fill.q3 { background: #fff176; }
.quality-bar-fill.q4 { background: #a5d6a7; }
.quality-bar-fill.q5 { background: #90caf9; }
.quality-count { font-weight: 600; color: var(--gray-700); text-align: right; }
.quality-label-text { color: var(--gray-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Contact cards */
.contact-cards { padding: .75rem 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.contact-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  position: relative;
  transition: border-color .15s;
}
.contact-card:hover { border-color: var(--gray-300); }
.contact-card-actions {
  position: absolute; top: .5rem; right: .5rem;
  display: flex; gap: .2rem; opacity: 0; transition: opacity .15s;
}
.contact-card:hover .contact-card-actions { opacity: 1; }
.contact-name { font-weight: 700; color: var(--gray-800); font-size: .9rem; }
.contact-role { font-size: .75rem; color: var(--gray-500); }
.contact-venue { font-size: .85rem; color: var(--primary); font-weight: 600; margin-top: .25rem; }
.contact-details { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.contact-detail { font-size: .75rem; color: var(--gray-600); }
.contact-notes { font-size: .75rem; color: var(--gray-500); margin-top: .35rem; font-style: italic; }

/* Responsive */
@media (max-width: 1024px) {
  .detail-body { grid-template-columns: 1fr; }
  .detail-sidebar { order: -1; }
}
@media (max-width: 768px) {
  header { flex-direction: column; gap: .75rem; text-align: center; padding: 1rem; }
  main { padding: 1rem; }
  .project-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr; }
}
