:root {
  --navy: #1e2761;
  --navy-light: #24316e;
  --ice: #cadcfc;
  --mint: #02c39a;
  --bg: #f7f8fb;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border: #e2e6ee;
  --danger: #e0555c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Calibri, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

/* ---------- LOGIN VIEW ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2.2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.login-card h1 {
  font-size: 1.3rem;
  margin: 0 0 0.3rem;
  color: var(--navy);
}

.login-card p.sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 1.4rem;
}

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text-main);
}
.field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}

.btn-primary {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn-primary:hover { background: var(--navy-light); }

.btn-accent {
  background: var(--mint);
  color: var(--navy);
}

.error-msg {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 0.5rem;
  display: none;
}

/* ---------- APP SHELL ---------- */
.app-shell { display: none; min-height: 100vh; }
.app-shell.visible { display: flex; }

.sidebar {
  width: 220px;
  background: var(--navy);
  color: white;
  padding: 1.4rem 0.9rem;
  flex-shrink: 0;
}
.sidebar .brand {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 1.6rem;
  padding-left: 0.3rem;
}
.nav-item {
  display: block;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  color: var(--ice);
  cursor: pointer;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
}
.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-item.active { background: var(--mint); color: var(--navy); font-weight: 600; }

.main {
  flex: 1;
  padding: 1.8rem 2rem;
  max-width: 980px;
}

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

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 0.3rem;
}
.page-sub { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.4rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
}

.status-pill {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-active { background: #e5f9f2; color: #02866a; }
.status-inactive { background: #fdeceb; color: #c0392b; }

.progress-track {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.progress-fill {
  height: 100%;
  background: var(--mint);
}

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.team-row:last-child { border-bottom: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

@media (max-width: 720px) {
  .app-shell.visible { flex-direction: column; }
  .sidebar { width: 100%; display: flex; overflow-x: auto; gap: 0.3rem; }
  .sidebar .brand { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- PART 2 ---------- */
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.8rem; }
.row input, .row select { padding: 0.55rem 0.65rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.88rem; flex: 1; min-width: 110px; }
.field select { width: 100%; padding: 0.65rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; }
.btn-sm { padding: 0.55rem 0.9rem; border: none; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 600; cursor: pointer; font-size: 0.85rem; text-decoration: none; display: inline-block; }
.btn-sm:hover { background: var(--navy-light); }
.card-h { font-weight: 600; margin-bottom: 0.6rem; }
.big { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.lbl { font-size: 0.8rem; color: var(--text-muted); }
.tag { background: #eef1fb; color: var(--navy); border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.72rem; font-weight: 600; margin-left: 0.4rem; }
.locked { opacity: 0.55; }

/* ---------- STAFF PANEL ---------- */
.row label { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; white-space: nowrap; }

/* ---------- PART 18: COMMUNITY + PROFILE ---------- */
.field textarea, .comm-textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}
.comm-textarea { margin-bottom: 0.6rem; }
.field input[readonly] { background: #f1f3f8; color: var(--text-muted); }

.post-head { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.6rem; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: #fff; flex-shrink: 0;
  border: none; cursor: pointer; padding: 0;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; cursor: default; }
.post-name { font-weight: 600; background: none; border: none; padding: 0; cursor: pointer; font-size: 0.95rem; color: var(--text-main); text-align: left; }
.post-name:hover { text-decoration: underline; }
.post-body { font-size: 0.93rem; line-height: 1.5; word-break: break-word; margin-bottom: 0.6rem; }
.post-body a { color: var(--navy); }
.post-img { max-width: 100%; max-height: 360px; border-radius: 8px; margin-bottom: 0.6rem; display: block; }
.post-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 0.5rem; }
.act-btn {
  background: none; border: none; cursor: pointer; font-size: 0.82rem; color: var(--text-muted);
  padding: 0.3rem 0.55rem; border-radius: 6px;
}
.act-btn:hover { background: #eef1fb; color: var(--navy); }
.act-btn.on { color: var(--navy); font-weight: 700; }
.act-btn.danger:hover { background: #fdecec; color: var(--danger); }
.post-card.pinned { border-color: var(--mint); }
.post-card.hidden-post { opacity: 0.6; border-style: dashed; }
.pin-badge { color: #02866a; font-size: 0.72rem; font-weight: 700; }
.type-tag { background: #eef1fb; color: var(--navy); border-radius: 999px; padding: 0.1rem 0.55rem; font-size: 0.7rem; font-weight: 600; margin-left: 0.4rem; }
.type-tag.announcement { background: #fff3dc; color: #8a5a00; }
.type-tag.win { background: #e0f8f1; color: #02866a; }
.comment-box { margin-top: 0.6rem; border-top: 1px solid var(--border); padding-top: 0.6rem; }
.comment-item { display: flex; gap: 0.5rem; margin-bottom: 0.55rem; font-size: 0.88rem; }
.comment-item .avatar { width: 28px; height: 28px; font-size: 0.7rem; }
.comment-bubble { background: #f1f3f8; border-radius: 10px; padding: 0.4rem 0.7rem; flex: 1; min-width: 0; word-break: break-word; }
.comment-bubble.hidden-post { opacity: 0.6; }
.profile-card { display: flex; gap: 1rem; align-items: flex-start; }
.profile-card .bio { font-size: 0.9rem; margin-top: 0.4rem; white-space: pre-wrap; word-break: break-word; }
.feed-empty { text-align: center; color: var(--text-muted); padding: 1.5rem 0; }
