@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f4f4f4;
  color: #1f2937;
  font-size: 15px;
  line-height: 1.6;
}

/* NAV */
nav {
  background: #1f2937;
  color: #fff;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-weight: 600; font-size: 16px; color: #3b6ef5; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; font-size: 14px; }
.nav-links a { color: #ccc; text-decoration: none; }
.nav-links a:hover { color: #3b6ef5; }
.nav-links span { color: #888; }

/* MAIN */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* AUTH PAGE */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #1f2937;
}
.auth-box {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}
.auth-box .logo {
  font-size: 22px;
  font-weight: 600;
  color: #3b6ef5;
  margin-bottom: 1rem;
}
.auth-box h2 { margin-bottom: 1.25rem; font-size: 20px; }
.auth-box label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 4px; margin-top: 14px; }
.auth-box input { width: 100%; padding: 9px 12px; border: 1px solid #ddd; border-radius: 7px; font-size: 14px; font-family: inherit; }
.auth-box input:focus { outline: none; border-color: #3b6ef5; }
.auth-box button[type="submit"] { margin-top: 1.25rem; width: 100%; }
.auth-box p { margin-top: 1rem; font-size: 14px; }
.auth-box p a { color: #3b6ef5; }

/* BUTTONS */
.btn-primary {
  background: #3b6ef5;
  color: #000;
  border: none;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-primary:hover { background: #2d5bd1; }
.btn-secondary {
  background: transparent;
  color: #555;
  border: 1px solid #ddd;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger-sm {
  background: transparent;
  color: #c0392b;
  border: 1px solid #e8b4b0;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger-sm:hover { background: #fdf0ef; }

/* ALERTS */
.alert {
  padding: 10px 14px;
  border-radius: 7px;
  margin-bottom: 1rem;
  font-size: 14px;
}
.alert.error { background: #fdf0ef; color: #9f0000; border: 1px solid #f5c6c2; }
.alert.success { background: #f0faf3; color: #1a7a3a; border: 1px solid #b8e6c8; }

/* SECTION HEADER */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-header h2 { font-size: 18px; font-weight: 600; }

/* MEMBER CARDS */
.member-cards { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 1rem; }
.member-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 260px;
}
.member-card.has-overdue { border-left: 3px solid #e74c3c; }
.member-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #3b6ef5; color: #000;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.member-info { flex: 1; }
.member-info strong { display: block; font-size: 14px; }
.member-email { font-size: 12px; color: #888; }
.member-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: #888; }
.done-count { color: #27ae60; }

/* BADGES */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  text-transform: capitalize;
}
.badge.red, .badge.overdue { background: #fdf0ef; color: #9f0000; border: 1px solid #f5c6c2; }
.badge.high { background: #fff4e0; color: #8a5000; border: 1px solid #f5d891; }
.badge.urgent { background: #fdf0ef; color: #9f0000; border: 1px solid #f5c6c2; }
.badge.normal { background: #f4f4f4; color: #555; border: 1px solid #ddd; }
.badge.status-in_progress { background: #e8f4ff; color: #1a5fa8; border: 1px solid #b3d4f5; }
.badge.status-blocked { background: #fdf0ef; color: #9f0000; border: 1px solid #f5c6c2; }
.badge.status-done { background: #f0faf3; color: #1a7a3a; border: 1px solid #b8e6c8; }
.badge.status-pending { background: #f4f4f4; color: #555; border: 1px solid #ddd; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; border: 1px solid #e8e8e8; }
thead tr { background: #f9f9f9; }
th { padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid #e8e8e8; }
td { padding: 11px 12px; font-size: 13px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.row-overdue td { background: #fffaf9; }
.task-link { color: #1f2937; text-decoration: none; font-weight: 500; }
.task-link:hover { color: #3b6ef5; }
.note-preview { color: #888; font-size: 12px; }
.empty { color: #aaa; font-style: italic; text-align: center; padding: 2rem; }

/* TASK CARDS (member view) */
.task-grid { display: flex; flex-direction: column; gap: 14px; }
.task-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.task-card.card-overdue { border-left: 3px solid #e74c3c; }
.task-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 8px; }
.task-desc-sm { font-size: 13px; color: #666; margin-bottom: 8px; }
.last-note { font-size: 12px; color: #888; background: #f9f9f9; border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }
.update-form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 7px;
  font-family: inherit; font-size: 13px; resize: vertical; margin-bottom: 8px;
}
.update-form textarea:focus { outline: none; border-color: #3b6ef5; }
.update-row { display: flex; gap: 8px; align-items: center; }
.update-row select { flex: 1; padding: 7px 10px; border: 1px solid #ddd; border-radius: 7px; font-family: inherit; font-size: 13px; }
.update-row select:focus { outline: none; border-color: #3b6ef5; }

/* TASK DETAIL */
.back-link { font-size: 13px; color: #888; text-decoration: none; display: inline-block; margin-bottom: 1rem; }
.back-link:hover { color: #3b6ef5; }
.task-detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.task-detail-header h2 { font-size: 20px; }
.task-desc { color: #555; margin-bottom: 1rem; }
hr { border: none; border-top: 1px solid #eee; margin: 1.25rem 0; }
.update-card { background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; padding: 12px 16px; margin-bottom: 10px; }
.update-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.update-date { font-size: 12px; color: #aaa; margin-left: auto; }
.update-card p { font-size: 14px; color: #444; }

/* MODAL */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box h3 { font-size: 17px; margin-bottom: 1rem; }
.modal-box label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 4px; margin-top: 12px; }
.modal-box input, .modal-box select, .modal-box textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #ddd;
  border-radius: 7px; font-size: 14px; font-family: inherit;
}
.modal-box input:focus, .modal-box select:focus, .modal-box textarea:focus {
  outline: none; border-color: #3b6ef5;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.25rem; }
.modal-hint { font-size: 13px; color: #888; margin-bottom: 4px; }

.auth-box.wide { max-width: 520px; }
.welcome-sub { color: #555; font-size: 14px; margin-bottom: 1.25rem; }
.how-it-works {
  background: #fffbf0;
  border: 1px solid #f5d891;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.hiw-title { font-weight: 600; font-size: 13px; color: #8a5000; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.hiw-item { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; font-size: 13px; color: #444; }
.hiw-item:last-child { margin-bottom: 0; }
.hiw-num {
  background: #3b6ef5; color: #000;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0; margin-top: 1px;
}
.add-task-hint { font-size: 13px; color: #888; margin-bottom: 1rem; }

.empty-state { text-align: center; color: #aaa; padding: 3rem 1rem; font-style: italic; }

/* SUPER ADMIN - ORG CARDS */
.org-grid { display: flex; flex-direction: column; gap: 12px; }
.org-card { background: #fff; border: 1px solid #e8e8e8; border-radius: 10px; padding: 1rem 1.25rem; }
.org-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.org-card-header h3 { font-size: 16px; font-weight: 600; }
.org-card-stats { display: flex; gap: 14px; font-size: 13px; color: #888; margin-bottom: 6px; }
.org-card-admin { font-size: 13px; color: #555; }
