:root {
  /* RFI-derived palette: cream + navy + brown */
  --bg:          #f7f0e1;  /* pale cream page bg */
  --paper:       #eadfc6;  /* softer parchment */
  --card:        #fcfaf6;  /* off-white card */
  --card-hover:  #fdf9ee;
  --cream-band:  #d9c39a;  /* warm cream — hero/nav band */
  --accent:      #37628a;  /* RFI navy — primary */
  --accent-dark: #2a4a68;
  --brown:       #7a5c36;  /* RFI brown accent */
  --brown-soft:  #b99c6e;  /* muted olive-tan */
  --sky:         #aec6da;  /* pale sky-blue accent */
  --red:         #a63d3d;
  --amber:       #c98a2b;
  --green:       #4a7c59;
  --purple:      #6f5a8a;
  --text:        #1a1410;
  --text-dim:    #7a5c36;
  --text-mute:   #a08560;
  --white:       #fcfaf6;
  --border:      rgba(122, 92, 54, 0.22);
  --border-strong: rgba(122, 92, 54, 0.42);
  --shadow-soft: 0 2px 10px rgba(122, 92, 54, 0.10);
  --shadow-med:  0 4px 18px rgba(122, 92, 54, 0.16);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* NAV */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(247, 240, 225, 0.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-strong);
  padding: 0 30px;
  box-shadow: var(--shadow-soft);
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand .logo { font-size: 20px; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }
.topbar-brand .badge { background: var(--brown); color: var(--white); font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 10px; letter-spacing: 0.5px; }
.topbar-nav-desktop { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar-nav-desktop button {
  background: none; border: none; padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 500;
  color: var(--text-dim); cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.topbar-nav-desktop button:hover, .topbar-nav-desktop button.active { background: var(--paper); color: var(--accent); }
.topbar-nav-mobile {
  display: none; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 0 10px 0; gap: 6px; border-top: 1px solid var(--border);
}
.topbar-nav-mobile button {
  background: var(--card); border: 1px solid var(--border); padding: 10px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-dim); cursor: pointer; font-family: inherit;
  white-space: nowrap; flex-shrink: 0; transition: all 0.2s;
  -webkit-tap-highlight-color: rgba(55, 98, 138, 0.2);
  -webkit-appearance: none; appearance: none;
  touch-action: manipulation;
}
.topbar-nav-mobile button:active, .topbar-nav-mobile button.active { background: var(--accent); color: var(--white); border-color: var(--accent); }

/* LAYOUT */
main { margin-top: 60px; padding: 30px; max-width: 1400px; margin-left: auto; margin-right: auto; }
.section { display: none; }
.section.active { display: block; }

/* HERO */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: 16px; padding: 40px; margin-bottom: 30px; position: relative; overflow: hidden;
  border: 1px solid var(--accent-dark);
  box-shadow: var(--shadow-med);
}
.hero::after {
  content: ''; position: absolute; top: -50%; right: -10%; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(217, 195, 154, 0.18), transparent);
  border-radius: 50%;
}
.hero h1 { font-size: 28px; color: var(--white); margin-bottom: 6px; position: relative; }
.hero .subtitle { color: rgba(252, 250, 246, 0.75); font-size: 14px; margin-bottom: 20px; position: relative; }
.hero-stats { display: flex; gap: 20px; flex-wrap: wrap; position: relative; }
.hero-stat {
  background: rgba(252, 250, 246, 0.10);
  border: 1px solid rgba(252, 250, 246, 0.18);
  border-radius: 10px; padding: 14px 20px; min-width: 140px;
  backdrop-filter: blur(6px);
}
.hero-stat .label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(252, 250, 246, 0.65); }
.hero-stat .value { font-size: 22px; font-weight: 700; color: var(--cream-band); }
.hero-stat .sub { font-size: 11px; color: rgba(252, 250, 246, 0.65); }

/* CARDS */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 30px; }
.card {
  background: var(--card); border-radius: 12px; padding: 24px;
  border: 1px solid var(--border); transition: all 0.2s;
  box-shadow: var(--shadow-soft);
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-med); }
.card h3 { color: var(--accent); font-size: 16px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.card .tag { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.tag-complex { background: rgba(166, 61, 61, 0.15); color: var(--red); }
.tag-moderate { background: rgba(201, 138, 43, 0.18); color: var(--amber); }
.tag-simple { background: rgba(74, 124, 89, 0.15); color: var(--green); }
.card .location { color: var(--text-dim); font-size: 12px; margin-bottom: 12px; }
.card ul { list-style: none; padding: 0; }
.card li {
  padding: 6px 0; font-size: 13px; color: var(--text);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 8px;
}
.card li:last-child { border: none; }
.card li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brown); flex-shrink: 0; margin-top: 7px; }
.card .elevations { margin-top: 12px; background: var(--paper); border-radius: 8px; padding: 10px 14px; font-size: 11px; color: var(--brown); }
.card .elevations strong { color: var(--amber); }

/* GANTT */
.gantt-wrapper { overflow-x: auto; background: var(--card); border-radius: 12px; padding: 20px; border: 1px solid var(--border); box-shadow: var(--shadow-soft); }
.gantt-wrapper table { border-collapse: collapse; width: 100%; min-width: 900px; table-layout: fixed; }
.gantt-wrapper thead th {
  position: sticky; top: 0; background: var(--accent); color: var(--white);
  padding: 6px 3px; font-size: 10px; text-align: center; border: 1px solid var(--accent-dark);
}
.gantt-wrapper thead th:first-child { text-align: left; padding-left: 10px; width: 200px; position: sticky; left: 0; z-index: 2; }
.gantt-wrapper thead th:nth-child(2) { width: 40px; }
.gantt-wrapper tbody td {
  padding: 4px 2px; border: 1px solid var(--border); text-align: center; font-size: 11px; height: 32px; width: 28px;
  background: var(--card);
}
.gantt-wrapper tbody td:first-child { text-align: left; padding-left: 10px; font-size: 11px; position: sticky; left: 0; background: var(--card); z-index: 1; white-space: nowrap; color: var(--text); width: 200px; }
.gantt-wrapper tbody td:nth-child(2) { font-weight: 600; color: var(--brown); font-size: 10px; width: 40px; }
.phase-row td { background: var(--paper) !important; font-weight: 700; color: var(--accent); font-size: 12px; }
.b { border-radius: 4px; height: 20px; width: 22px; margin: 0 auto; }
.b-mob { background: var(--red); }
.b-ero { background: var(--amber); }
.b-dem { background: #c85450; }
.b-drn { background: var(--accent); }
.b-grd { background: var(--purple); }
.b-con { background: #5978a8; }
.b-pav { background: #3a5c6d; }
.b-sea { background: #6b6151; }
.b-stp { background: #d4a94a; }
.b-cra { background: #9b6e2a; }
.b-cln { background: var(--green); }
.b-ins { background: #b878a0; }
.b-pun { background: #cd8547; }
.legend-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; justify-content: center; }
.legend-bar .item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-dim); }
.legend-bar .swatch { width: 14px; height: 10px; border-radius: 2px; }

/* PROGRESS */
.progress-update {
  background: var(--card); border-radius: 12px; padding: 24px;
  border: 1px solid var(--border); margin-bottom: 20px; box-shadow: var(--shadow-soft);
}
.progress-update .update-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.progress-update .update-date { font-size: 12px; color: var(--accent); font-weight: 700; }
.progress-update .update-area { font-size: 10px; padding: 3px 10px; border-radius: 10px; background: var(--paper); color: var(--brown); font-weight: 700; letter-spacing: 0.5px; }
.progress-update .update-title { font-size: 16px; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.progress-update .update-body { font-size: 13px; color: var(--text); line-height: 1.7; }
.progress-update .update-photos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.progress-update .update-photos img { width: 180px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; transition: transform 0.2s; }
.progress-update .update-photos img:hover { transform: scale(1.05); border-color: var(--accent); }
.progress-bar-track { background: var(--paper); border-radius: 10px; height: 12px; overflow: hidden; margin-top: 6px; border: 1px solid var(--border); }
.progress-bar-fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--accent), var(--brown)); transition: width 0.5s; }
.overall-progress-wrap { margin-bottom: 30px; }
.overall-progress-wrap .progress-label { display: flex; justify-content: space-between; margin-bottom: 6px; }
.overall-progress-wrap .progress-label span { font-size: 13px; color: var(--text-dim); }
.overall-progress-wrap .progress-label strong { color: var(--accent); font-size: 16px; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: var(--brown); margin-bottom: 8px; }

/* NOTES */
.notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.note-card {
  background: var(--card); border-radius: 12px; padding: 20px;
  border: 1px solid var(--border); position: relative; box-shadow: var(--shadow-soft);
}
.note-card h4 { color: var(--accent); font-size: 14px; margin-bottom: 10px; }
.note-card p { font-size: 13px; color: var(--text); margin-bottom: 6px; }
.note-card .note-title { color: var(--brown); font-weight: 700; margin-bottom: 8px; }
.note-card .note-body { color: var(--text); line-height: 1.6; }

/* DOCUMENTS */
.doc-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.doc-filter-btn {
  background: var(--card); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 16px; font-size: 12px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.doc-filter-btn:hover { color: var(--accent); border-color: var(--accent); }
.doc-filter-btn.active { background: var(--accent); color: var(--white); border-color: var(--accent); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.doc-card {
  background: var(--card); border-radius: 12px; padding: 18px;
  border: 1px solid var(--border); transition: all 0.2s;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-soft);
}
.doc-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-med); }
.doc-card-head { display: flex; align-items: flex-start; gap: 12px; }
.doc-icon {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; letter-spacing: 0.5px;
  color: var(--white);
}
.doc-icon-signin     { background: var(--accent); }
.doc-icon-safety     { background: var(--amber); }
.doc-icon-swppp      { background: var(--green); }
.doc-icon-compliance { background: var(--purple); }
.doc-icon-other      { background: var(--brown); }
.doc-meta { flex: 1; min-width: 0; }
.doc-title { color: var(--accent); font-weight: 700; font-size: 14px; line-height: 1.3; margin-bottom: 4px; word-break: break-word; }
.doc-cat { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--paper); color: var(--brown); font-weight: 700; display: inline-block; }
.doc-info { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-dim); padding-top: 8px; border-top: 1px solid var(--border); }
.doc-actions { display: flex; gap: 8px; }
.doc-download {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  flex: 1; padding: 10px 14px; background: var(--accent);
  color: var(--white); border: 1px solid var(--accent);
  border-radius: 8px; font-size: 13px; font-weight: 600;
  text-decoration: none; transition: all 0.15s;
}
.doc-download:hover { background: var(--accent-dark); text-decoration: none; }
.doc-delete {
  padding: 10px 12px; background: transparent; color: var(--red);
  border: 1px solid var(--red); border-radius: 8px; font-size: 12px;
  font-weight: 600; cursor: pointer; font-family: inherit;
}
.doc-delete:hover { background: var(--red); color: var(--white); }

/* ADMIN */
.admin-section {
  background: var(--card); border-radius: 12px; padding: 30px;
  border: 1px solid var(--border); margin-bottom: 24px; box-shadow: var(--shadow-soft);
}
.admin-section h3 { color: var(--accent); font-size: 18px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.admin-section h3 .admin-icon { color: var(--brown); }
.admin-back-bar { margin-bottom: 20px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; color: var(--brown); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 12px 16px; background: var(--white); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit; transition: border-color 0.2s;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-mute); }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--accent); }
.form-group textarea { min-height: 120px; resize: vertical; }
.form-group select option { background: var(--white); color: var(--text); }

/* BUTTONS */
.btn { padding: 12px 28px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #8a3232; }
.btn-back { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-back:hover { color: var(--accent); border-color: var(--accent); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-edit { background: rgba(55, 98, 138, 0.12); color: var(--accent); border: 1px solid var(--accent); }
.btn-edit:hover { background: rgba(55, 98, 138, 0.22); }

/* PHOTO UPLOAD */
.photo-upload-area {
  border: 2px dashed var(--border-strong); border-radius: 12px; padding: 30px;
  text-align: center; cursor: pointer; transition: all 0.2s; position: relative;
  background: var(--paper);
}
.photo-upload-area:hover { border-color: var(--accent); background: var(--card-hover); }
.photo-upload-area input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-upload-area .upload-icon { font-size: 36px; color: var(--brown); margin-bottom: 8px; }
.photo-upload-area p { font-size: 13px; color: var(--text-dim); }
.photo-preview-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.photo-preview { width: 100px; height: 80px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }
.photo-preview-wrap { position: relative; display: inline-block; }
.photo-preview-wrap .remove-photo {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--red); color: white; border: none; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* ADMIN UPDATE LIST */
.admin-update-item {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 16px;
  background: var(--paper); border-radius: 8px; margin-bottom: 8px; border: 1px solid var(--border);
}
.admin-update-item .item-info { flex: 1; }
.admin-update-item .item-title { color: var(--accent); font-size: 14px; font-weight: 700; }
.admin-update-item .item-date { color: var(--text-dim); font-size: 11px; }
.admin-update-item .item-actions { display: flex; gap: 8px; }

/* LOGIN OVERLAY */
.login-overlay {
  display: none; position: fixed; inset: 0; background: rgba(26, 20, 16, 0.72); z-index: 200;
  justify-content: center; align-items: center;
  backdrop-filter: blur(4px);
}
.login-overlay.show { display: flex; }
.login-box {
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 16px;
  padding: 40px; width: 380px; max-width: 90%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}
.login-box h3 { color: var(--accent); text-align: center; margin-bottom: 8px; font-size: 20px; }
.login-box .login-sub { color: var(--text-dim); font-size: 12px; text-align: center; margin-bottom: 20px; }
.login-box .error-msg { color: var(--red); font-size: 12px; text-align: center; margin-top: 8px; display: none; }
.login-box .back-link { display: block; text-align: center; margin-top: 16px; color: var(--text-dim); font-size: 13px; cursor: pointer; transition: color 0.2s; }
.login-box .back-link:hover { color: var(--accent); text-decoration: none; }

/* LIGHTBOX */
.lightbox {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 300;
  justify-content: center; align-items: center; cursor: pointer;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 90%; max-height: 90%; border-radius: 8px; }

/* TOAST */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; padding: 0.85rem 1.25rem;
  background: var(--accent); color: var(--white); border-radius: 8px; font-size: 0.9rem;
  font-weight: 600; box-shadow: 0 4px 12px rgba(26,20,16,0.28); z-index: 9999;
  transform: translateY(100px); opacity: 0; transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* PRELIM BANNER (pre-award notice) */
.prelim-banner {
  background: linear-gradient(135deg, var(--brown), var(--accent));
  color: var(--white);
  padding: 14px 20px; border-radius: 10px; margin-bottom: 24px;
  font-size: 13px; line-height: 1.5;
  border: 1px solid var(--accent-dark);
  box-shadow: var(--shadow-soft);
}
.prelim-banner strong { color: var(--cream-band); letter-spacing: 0.5px; }

/* COMPLIANCE PILL ROW */
.compliance-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.compliance-pills .pill {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 4px 10px; border-radius: 12px;
  background: var(--paper); color: var(--brown);
  border: 1px solid var(--border);
}

/* MOBILE */
@media (max-width: 768px) {
  .topbar { padding: 0 15px; }
  .topbar-nav-desktop { display: none !important; }
  .topbar-nav-mobile { display: flex !important; }
  main { margin-top: 110px; padding: 15px; }
  .hero { padding: 24px; }
  .hero h1 { font-size: 22px; }
  .hero-stats { flex-direction: column; }
  .card-grid { grid-template-columns: 1fr; }
  .notes-grid { grid-template-columns: 1fr; }
  .progress-update .update-photos img { width: 120px; height: 80px; }
  .gantt-wrapper { padding: 12px; }
  .doc-grid { grid-template-columns: 1fr; }
}
