:root {
  --navy: #1F3864;
  --teal: #0F6B6B;
  --gold: #B8860B;
  --grey: #595959;
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --border: #E1E5EA;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: #222;
}

.topbar {
  background: var(--navy);
  color: white;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  background: var(--gold);
  color: white;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
}
.brand-title { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 12px; opacity: 0.8; }

.tabs { display: flex; gap: 8px; }
.tab-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.tab-btn.active { background: var(--teal); border-color: var(--teal); }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

h1 { color: var(--navy); font-size: 22px; margin-bottom: 4px; }
h2 { color: var(--teal); font-size: 17px; margin-top: 32px; }
h3 { color: var(--teal); font-size: 15px; margin-top: 0; }
.muted { color: var(--grey); font-size: 13px; }

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 20px;
}
@media (max-width: 900px) { .stepper { grid-template-columns: 1fr 1fr; } }

.step-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.step-card.resolved { background: #FFF9E8; border-color: #EEDDA0; }
.step-label {
  display: inline-block;
  background: var(--navy);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.step-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; }

select, input[type="text"] {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 6px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.resolved-box { font-size: 13px; line-height: 1.5; }
.resolved-box .url { font-family: monospace; color: var(--navy); word-break: break-all; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}
.badge.open { background: #E2EFDA; color: #2E7D32; }
.badge.login_gated { background: #FCE4D6; color: #B84A00; }
.badge.marketplace { background: #DCE6F1; color: var(--navy); }
.badge.unknown { background: #E5E5E5; color: var(--grey); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.dept-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
}
.dept-card strong { color: var(--navy); }

.admin-layout {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  align-items: flex-start;
}
@media (max-width: 800px) { .admin-layout { flex-direction: column; } }

.admin-subnav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 210px;
  flex-shrink: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  position: sticky;
  top: 16px;
}
@media (max-width: 800px) {
  .admin-subnav { flex-direction: row; flex-wrap: wrap; width: 100%; position: static; }
}
.admin-subnav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  font-weight: 500;
}
.admin-subnav-btn:hover { background: #F0F2F5; }
.admin-subnav-btn.active { background: var(--navy); color: white; }
.subnav-icon { font-size: 14px; }

.admin-content {
  flex: 1;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  min-width: 0;
}
.admin-subpanel { display: none; }
.admin-subpanel.active { display: block; }
.admin-subpanel h2 { color: var(--navy); font-size: 17px; margin: 0 0 4px 0; }
.admin-subpanel > p.muted { margin-top: 0; margin-bottom: 16px; }

.card-form {
  background: #FAFBFC;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}
.card-form button[type="submit"] { margin-top: 4px; align-self: flex-start; }

.field-label { font-size: 12px; font-weight: 600; color: #333; margin-top: 8px; margin-bottom: 3px; display: block; }
.field-label .req { color: #B3261E; font-weight: 700; }
.field-label .opt { color: var(--grey); font-weight: 400; font-size: 11px; }
.field-row { display: flex; gap: 12px; }
.field-row > div, .field-row > select { flex: 1; }
.field-row select { width: auto; }
#targeted .card-form { max-width: 640px; }
#targeted .card-form input, #targeted .card-form select { margin-bottom: 4px; }

.inline-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.inline-form button {
  background: var(--teal);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  align-self: flex-start;
}
.inline-form button:hover { opacity: 0.9; }

.checkbox-row { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; margin-bottom: 6px; }
.checkbox-row label { display: flex; align-items: center; gap: 4px; background: #F0F2F5; padding: 4px 8px; border-radius: 12px; }

.admin-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.admin-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.admin-list li:last-child { border-bottom: none; }
.admin-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.delete-btn {
  background: #FBEAEA;
  color: #B3261E;
  border: 1px solid #F3C6C6;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.delete-btn:hover { background: #F6D5D5; }
.tag {
  display: inline-block;
  background: #EEF1F5;
  color: var(--grey);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
}

.team-block { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; }

.hierarchy-section { font-size: 13px; }
.hierarchy-header { font-weight: 600; font-size: 12px; color: var(--navy); margin-bottom: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.hierarchy-role-list select { margin-bottom: 6px; }
.hierarchy-role-list .inline-form { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; margin-bottom: 4px; }
.hierarchy-role-list .inline-form select { flex: 1; min-width: 160px; margin-bottom: 0; }
.hierarchy-role-list .inline-form button { margin-top: 0; padding: 6px 10px; font-size: 12px; }
.team-block .checkbox-row { margin-top: 6px; }

.targeted-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.targeted-form input[type="text"] { flex: 1; min-width: 260px; margin-bottom: 0; }
.targeted-form select { width: auto; margin-bottom: 0; }
.targeted-form button {
  background: var(--teal);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.result-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-top: 14px;
}
.field-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.field-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.field-table td:first-child { color: var(--grey); width: 45%; }
.error-box {
  background: #FBEAEA;
  border: 1px solid #F3C6C6;
  color: #B3261E;
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 13px;
}

.pager-wrap { margin-top: 10px; font-size: 12px; }
.pager { display: flex; align-items: center; gap: 10px; color: var(--grey); }
.pager button {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
  color: var(--navy);
}
.pager button:hover:not(:disabled) { background: #F0F2F5; }
.pager button:disabled { opacity: 0.4; cursor: default; }

.suggestion-box {
  background: #F7FBFA;
  border: 1px solid #CFE6E3;
  border-radius: 8px;
  padding: 10px;
  margin: 4px 0 8px 0;
}
.suggestion-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 6px;
}
.suggestion-card:last-child { margin-bottom: 0; }
.suggestion-title { font-weight: 600; font-size: 12.5px; color: var(--navy); }
.suggestion-url { font-size: 11px; color: var(--teal); font-family: monospace; word-break: break-all; margin: 2px 0; }

.gem-result-card { padding: 12px; }
.gem-result-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--navy);
  text-decoration: none;
  display: block;
  line-height: 1.4;
}
.gem-result-title:hover { text-decoration: underline; }
.gem-result-desc { font-size: 12px; color: #444; margin-bottom: 6px; }
.gem-result-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.gem-meta-chip {
  font-size: 11px;
  background: #F0F4FA;
  color: var(--navy);
  padding: 3px 9px;
  border-radius: 10px;
  white-space: nowrap;
}
.use-suggestion-btn {
  background: var(--teal);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  margin-top: 4px;
}
.use-suggestion-btn:hover { opacity: 0.9; }
.scout-btn { background: var(--gold); }

/* ---- Login screen ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1F3864 0%, #0F6B6B 100%);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.login-card h2 { color: var(--navy); font-size: 17px; margin: 0 0 12px 0; }
.stack-form { display: flex; flex-direction: column; gap: 10px; }
.stack-form input {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}
.stack-form button[type="submit"] {
  background: var(--teal);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 4px;
}
.stack-form button[type="submit"]:hover { opacity: 0.9; }

/* ---- User badge in topbar ---- */
.user-badge { display: flex; align-items: center; gap: 12px; color: white; font-size: 12.5px; }

/* ---- Modal (account/change password) ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
}
.modal-card h3 { color: var(--navy); margin-top: 0; font-size: 15px; }
.cancel-btn {
  background: white;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}



.tenders-filter { margin: 14px 0; }
.tenders-filter select { width: auto; min-width: 220px; }

.tenders-list { display: flex; flex-direction: column; gap: 10px; }
.tender-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.tender-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
  color: #333;
}
.tender-card-meta { font-size: 12px; margin-top: 6px; }
.tender-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tender-action-btn {
  background: white;
  border: 1px solid var(--border);
  color: var(--navy);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
}
.tender-action-btn:hover { background: #F0F2F5; }
.tender-action-btn.reject { color: #B3261E; border-color: #F3C6C6; }
.tender-action-btn.download { color: var(--gold); border-color: #EEDDA0; }
.tender-action-btn.send-mgmt { color: var(--navy); border-color: #B8C4DA; background: #F0F4FA; }
.tender-action-btn.endorse { color: #7A4F01; border-color: #EEDDA0; background: #FFF9E8; font-weight: 600; }

/* ---- Help tab accordion ---- */
.help-accordion { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.help-section { background: white; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.help-toggle {
  width: 100%;
  text-align: left;
  background: #F7F8FA;
  border: none;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.help-toggle:hover { background: #EEF1F5; }
.help-arrow { transition: transform 0.15s; font-size: 12px; color: var(--grey); }
.help-section.open .help-arrow { transform: rotate(90deg); }
.help-content { display: none; padding: 4px 16px 16px 16px; font-size: 13.5px; line-height: 1.6; color: #333; }
.help-section.open .help-content { display: block; }
.help-content p { margin: 8px 0; }
.help-steps { margin: 8px 0; padding-left: 22px; }
.help-steps li { margin-bottom: 8px; }
.help-lifecycle {
  background: #F0F4FA;
  color: var(--navy);
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  margin: 10px 0;
}

/* ---- Guided tour ---- */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 500;
}
.tour-spotlight {
  position: fixed;
  border-radius: 8px;
  box-shadow: 0 0 0 4px var(--gold), 0 0 0 9999px rgba(0, 0, 0, 0.55);
  z-index: 501;
  pointer-events: none;
  transition: all 0.2s ease;
}
.tour-tooltip {
  position: fixed;
  background: white;
  border-radius: 10px;
  padding: 18px;
  max-width: 320px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  z-index: 502;
  transition: all 0.2s ease;
}
.tour-tooltip.tour-centered {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 380px;
  text-align: center;
}
.tour-tooltip h3 { color: var(--navy); font-size: 15px; margin: 0 0 8px 0; }
.tour-tooltip p { font-size: 13px; color: #333; line-height: 1.5; margin: 0 0 14px 0; }
.tour-footer { display: flex; justify-content: space-between; align-items: center; }
.tour-progress { font-size: 11px; color: var(--grey); }
.tour-buttons { display: flex; gap: 8px; }
.tour-buttons button {
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  cursor: pointer;
}
.tour-skip { background: transparent; color: var(--grey); }
.tour-back { background: #EEF1F5; color: var(--navy); }
.tour-next { background: var(--teal); color: white; font-weight: 600; }
