:root {
  --brand: #1f4e79;
  --accent: #c8932a;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #6b7785;
  --border: #e3e7ec;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header / nav ---- */
header {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}
#main-nav {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.brand { color: #fff; display: flex; flex-direction: column; line-height: 1.1; }
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 700; font-size: 1.15rem; }
.brand-tag { font-size: 0.72rem; opacity: 0.8; letter-spacing: 0.04em; text-transform: uppercase; }
.nav-links { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.nav-links a { color: #fff; font-size: 0.95rem; opacity: 0.92; }
.nav-links a:hover { opacity: 1; text-decoration: none; }
.btn-link {
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 5px 14px;
  border-radius: 6px;
}

/* ---- Layout ---- */
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}
.narrow { max-width: 520px; }

h1 { font-size: 1.9rem; margin: 0 0 0.4em; }
h2 { font-size: 1.3rem; margin: 1.5em 0 0.5em; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, var(--brand), #16385a);
  color: #fff;
  border-radius: var(--radius);
  padding: 56px 32px;
  text-align: center;
}
.hero h1 { font-size: 2.4rem; color: #fff; }
.hero p { font-size: 1.1rem; opacity: 0.9; max-width: 560px; margin: 0 auto 24px; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.7); }
.btn.danger { background: #b3261e; }
.btn:disabled { opacity: 0.6; cursor: default; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: 0.9rem; margin: 14px 0 5px; }
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.97rem;
  font-family: inherit;
  background: #fff;
}
textarea { resize: vertical; min-height: 90px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 400; }
.checkbox-row input { width: auto; }
.field-hint { font-size: 0.82rem; color: var(--muted); margin-top: 3px; }

/* ---- Messages ---- */
.msg { padding: 10px 14px; border-radius: 8px; margin: 14px 0; font-size: 0.92rem; }
.msg.error { background: #fdeceb; color: #8a1c16; }
.msg.ok { background: #e7f5ec; color: #176a3a; }

/* ---- Directory grid ---- */
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  align-items: center;
}
.toolbar input, .toolbar select { width: auto; flex: 1 1 160px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.member {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  min-height: 250px; /* uniform tiles; grid stretches rows to match */
}
.member .job {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;      /* trim long titles to 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.member .employer {
  color: var(--brand);
  font-weight: 700;
  font-size: 0.88rem;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-foot { margin-top: auto; padding-top: 10px; }
.member .loc { color: var(--muted); font-size: 0.82rem; }
.avatar {
  width: 84px; height: 84px;
  border-radius: 50%;
  object-fit: cover;
  background: #dfe4ea;
  margin: 0 auto 12px;
  display: block;
}
.avatar.lg { width: 130px; height: 130px; }
.member .name { font-weight: 700; }
.member .promo { color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.member .role { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }

.tag {
  display: inline-block;
  background: #eef1f5;
  color: var(--brand);
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 20px;
  margin: 3px 3px 0 0;
}

/* ---- Profile detail ---- */
.profile-head { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.kv { margin: 4px 0; }
.kv b { color: var(--muted); font-weight: 600; margin-right: 6px; }

/* ---- Profile page (redesigned) ---- */
.profile-card { padding: 0; overflow: hidden; }
.profile-banner {
  height: 110px;
  background: linear-gradient(135deg, var(--brand), #16385a 60%, var(--accent) 160%);
}
.profile-body { padding: 0 32px 32px; }
.profile-avatar {
  width: 132px; height: 132px;
  border-radius: 50%;
  object-fit: cover;
  background: #dfe4ea;
  border: 4px solid #fff;
  box-shadow: var(--shadow);
  margin-top: -66px;
  display: block;
}
.profile-name { font-size: 1.7rem; margin: 14px 0 2px; }
.profile-promo {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 3px 12px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}
.profile-section { color: var(--muted); font-size: 0.92rem; margin-top: 6px; }
.profile-loc { color: var(--muted); font-size: 0.95rem; margin-top: 10px; }
.profile-bio {
  margin: 20px 0 4px;
  padding: 16px 18px;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 28px;
  margin-top: 22px;
}
.detail-item { border-top: 1px solid var(--border); padding-top: 10px; }
.detail-item .dt {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 3px;
}
.detail-item .dd { font-size: 0.95rem; }
@media (max-width: 520px) {
  .profile-body { padding: 0 20px 24px; }
  .profile-avatar { width: 104px; height: 104px; margin-top: -52px; }
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 30px 20px 50px;
}

.hidden { display: none !important; }

@media (max-width: 520px) {
  .hero { padding: 40px 20px; }
  .hero h1 { font-size: 1.8rem; }
}
