/* =====================================================================
   AI UNIT TASKS — STYLES
   Palette: white / blue / navy / light-blue, inspired by the AI Unit logo
   ===================================================================== */

:root {
  --navy: #1B3A57;
  --navy-soft: #24476A;
  --blue: #2C5F87;
  --blue-dark: #1F4B6D;
  --sky: #6FA0BE;
  --light-blue: #EAF1F6;
  --light-blue-2: #F4F8FA;
  --green: #3E7A40;
  --green-dark: #2F5F31;
  --white: #FFFFFF;
  --border: #E1E8ED;
  --text: #1C2B3A;
  --muted: #64748B;
  --success: #3E7A40;
  --success-bg: #EAF5EA;
  --danger: #C0392B;
  --danger-bg: #FBEAE8;
  --warning: #B4791F;
  --warning-bg: #FBF3E6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 58, 0.06);
  --shadow-md: 0 8px 24px rgba(11, 31, 58, 0.08);
  --shadow-lg: 0 20px 48px rgba(11, 31, 58, 0.16);
  --font-display: "Manrope", "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--light-blue-2);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--navy); margin: 0; }

button, input, select, textarea { font-family: inherit; }

.hidden { display: none !important; }

/* ---------- View switching ---------- */
.view { display: none; min-height: 100vh; }
.view.active { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { background: #93B4F5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--light-blue); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--navy); padding: 6px; }

/* ---------- Inputs ---------- */
.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 14.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
textarea.input { resize: vertical; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin: 14px 0 6px; }
.field-hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.field-error {
  background: var(--danger-bg); color: var(--danger); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13.5px; margin: 14px 0 0; font-weight: 500;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.password-field { position: relative; }
.toggle-password {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--blue); font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 8px;
}
.search-input { max-width: 340px; margin-bottom: 18px; }

/* ---------- Welcome ---------- */
.welcome-wrap {
  max-width: 640px; margin: 0 auto; padding: 90px 24px 60px;
  text-align: center; display: flex; flex-direction: column; align-items: center;
}
.welcome-logo { width: 92px; height: 92px; object-fit: contain; margin-bottom: 22px; }
.welcome-wrap h1 { font-size: 32px; }
.subtitle { color: var(--muted); font-size: 15.5px; margin: 10px 0 40px; }

.entry-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; }
.entry-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.entry-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--sky); }
.entry-icon {
  width: 56px; height: 56px; border-radius: 50%; background: var(--light-blue);
  color: var(--blue); display: flex; align-items: center; justify-content: center;
}
.entry-icon svg { width: 26px; height: 26px; }
.entry-card:nth-child(2) .entry-icon { background: var(--success-bg); color: var(--green); }
.entry-title { font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--navy); }
.entry-desc { color: var(--muted); font-size: 13.5px; }

/* ---------- Auth screens ---------- */
.auth-wrap, .list-wrap {
  max-width: 420px; margin: 0 auto; padding: 40px 24px 60px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.list-wrap { max-width: 760px; }
.back-btn {
  align-self: flex-start; background: none; border: none; color: var(--blue);
  font-weight: 600; font-size: 14px; cursor: pointer; margin-bottom: 20px; padding: 4px 0;
}
.auth-logo, .list-logo { width: 84px; height: 84px; object-fit: contain; margin-bottom: 16px; }
.auth-icon {
  width: 48px; height: 48px; border-radius: 50%; background: var(--light-blue); color: var(--blue);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.auth-icon svg { width: 22px; height: 22px; }
.member-login-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin-bottom: 14px; border: 3px solid var(--light-blue); }
.auth-form { width: 100%; text-align: left; margin-top: 8px; }

/* ---------- Members grid (welcome flow) ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; width: 100%; margin-top: 10px; }
.profile-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.profile-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--light-blue); }
.profile-name { font-weight: 700; font-size: 14.5px; color: var(--navy); text-align: center; }

/* ---------- App shell (dashboards) ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  height: 64px; background: var(--navy); color: #fff; display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow-sm);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { width: 28px; height: 28px; object-fit: contain; }
.header-title { font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-badge { background: var(--blue); font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.header-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.mobile-only { display: none; }
.app-header .btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.35); color: #fff; }
.app-header .btn-ghost:hover { background: rgba(255,255,255,0.1); }

.app-body { flex: 1; display: flex; }
.sidebar {
  width: 220px; background: #fff; border-right: 1px solid var(--border);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  text-align: left; background: none; border: none; padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 600; font-size: 14.5px; cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: var(--light-blue-2); color: var(--navy); }
.nav-item.active { background: var(--light-blue); color: var(--blue); }

.main-content { flex: 1; padding: 28px 32px 60px; max-width: 1200px; }
.member-main { max-width: 800px; margin: 0 auto; width: 100%; }

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

.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.welcome-heading { font-size: 24px; margin-bottom: 22px; }
.section-heading { font-size: 17px; margin: 30px 0 14px; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: var(--navy); }

/* ---------- Performance rows ---------- */
.performance-list { display: flex; flex-direction: column; gap: 12px; }
.performance-row {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
}
.performance-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--light-blue); }
.performance-info { flex: 1; min-width: 0; }
.performance-name { font-weight: 700; color: var(--navy); font-size: 14.5px; }
.performance-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.progress-track { height: 7px; background: var(--light-blue); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 999px; }
.performance-pct { font-weight: 800; color: var(--navy); font-size: 15px; min-width: 52px; text-align: right; }
.report-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }

/* ---------- Members cards (admin) ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.member-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.member-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.member-card-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--light-blue); }
.member-card-name { font-weight: 700; color: var(--navy); font-size: 15px; }
.member-card-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.member-card-stats b { color: var(--navy); }
.member-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tasks ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-bar .input { width: auto; min-width: 150px; }
.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; align-items: flex-start; gap: 14px;
}
.task-check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; margin-top: 2px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; background: #fff; transition: all 0.15s ease;
}
.task-check svg { width: 13px; height: 13px; opacity: 0; }
.task-check.completed { background: var(--success); border-color: var(--success); }
.task-check.completed svg { opacity: 1; color: #fff; }
.task-check:not(.clickable) { cursor: default; }
.task-body { flex: 1; min-width: 0; }
.task-top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.task-title { font-weight: 700; color: var(--navy); font-size: 15px; }
.task-title.completed { text-decoration: line-through; color: var(--muted); }
.task-desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.badge { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: capitalize; }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-low { background: #F1F5F9; color: #475569; }
.badge-medium { background: var(--light-blue); color: var(--blue); }
.badge-high { background: #FFF0E6; color: #C2410C; }
.badge-urgent { background: var(--danger-bg); color: var(--danger); }
.task-assignee { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.task-assignee img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.task-actions { display: flex; gap: 6px; flex-shrink: 0; }

.settings-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.settings-card h3 { font-size: 15px; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 14px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state h3 { color: var(--navy); margin-bottom: 6px; font-size: 16px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11, 31, 58, 0.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 26px; width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
}
.modal-sm { max-width: 380px; }
.modal-subtext { color: var(--muted); font-size: 14px; margin-top: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.avatar-upload { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.avatar-preview { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--light-blue); border: 1px solid var(--border); }

/* ---------- Toast ---------- */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); max-width: 320px; animation: toast-in 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Loading ---------- */
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .report-columns { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -240px; top: 64px; bottom: 0; z-index: 30; transition: left 0.2s ease;
    box-shadow: var(--shadow-lg); width: 220px;
  }
  .sidebar.open { left: 0; }
  .mobile-only { display: inline-flex; }
  .main-content { padding: 20px 16px 50px; }
}

@media (max-width: 560px) {
  .entry-cards { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .welcome-wrap { padding: 60px 18px 40px; }
  .welcome-wrap h1 { font-size: 26px; }
  .panel-header { flex-direction: column; align-items: flex-start; }
}
