
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --success: #0f9d58;
  --success-light: #e6f4ea;
  --danger: #ea4335;
  --danger-light: #fce8e6;
  --warning: #f9ab00;
  --warning-light: #fef7e0;
  --purple: #7c3aed;
  --purple-light: #f3e8ff;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #3b82f6;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 12px;
  --chart-green: #22c55e;
  --chart-red: #ef4444;
  --chart-blue: #3b82f6;
  --chart-orange: #f97316;
  --chart-purple: #8b5cf6;
  --gold: #eab308;
  --silver: #94a3b8;
  --bronze: #d97706;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
  top: -200px; right: -100px;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(34,197,94,0.1) 0%, transparent 70%);
  bottom: -100px; left: -50px;
}
.login-container {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 48px;
  width: 440px;
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo .eagle-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--success));
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(59,130,246,0.3);
}
.login-logo h1 {
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.login-logo p {
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  margin-top: 4px;
}
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}
.form-group input, .form-group select {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
}
.form-group input::placeholder { color: rgba(255,255,255,0.3); }
.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
.form-group select option { background: #1e293b; color: #fff; }
.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(59,130,246,0.4);
}
.demo-hint {
  text-align: center;
  margin-top: 24px;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
}

/* Each role has real routed pages, so the shell is always visible. */
.app { display: flex; height: 100vh; }

.sidebar {
  width: 260px;
  /* Dark on the left flowing into a lighter mid-navy on the right, so the
     wordmark side of the logo (the "EAGLE LEARNING CLUB" text on the right
     half of the artwork) sits over a lighter surface and stays readable. */
  background:
    radial-gradient(70% 120% at 100% 40%, rgba(59, 130, 246, .28), transparent 65%),
    linear-gradient(90deg, #0f172a 0%, #1e3a5f 60%, #2c5490 100%);
  background-color: var(--sidebar-bg);
  background-attachment: local;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-header .brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--success));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
}
.sidebar-header .brand-text h2 {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.sidebar-header .brand-text span {
  color: var(--sidebar-text);
  font-size: 11px;
}
.panel-toggle { padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.panel-toggle a {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 10px 14px; border-radius: 8px; box-sizing: border-box;
  background: var(--sidebar-active); color: #fff; font-size: 13px; font-weight: 700;
  text-decoration: none; transition: background 0.15s;
}
.panel-toggle a:hover { background: var(--primary-dark); }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section {
  padding: 8px 20px 4px;
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}
.nav-item.active {
  background: rgba(59,130,246,0.1);
  color: #fff;
  border-left-color: var(--sidebar-active);
}
.nav-item .icon { width: 20px; text-align: center; font-size: 14px; }
.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.user-details h4 { color: #fff; font-size: 13px; }
.user-details span { color: var(--sidebar-text); font-size: 11px; }

/* Top-bar user chip: name only, dark text on the white top bar. */
.top-bar-actions .user-name {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.logout-btn {
  margin-top: 12px;
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.logout-btn:hover { background: rgba(234,67,53,0.15); color: var(--danger); border-color: var(--danger); }

.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}
.top-bar {
  background: var(--card);
  color: #0f172a;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.top-bar h1 { font-size: 20px; font-weight: 700; color: #0f172a; }
.top-bar .tiny { color: #475569; }
.top-bar-actions { display: flex; align-items: center; gap: 12px; }
.top-bar-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--card);
  color: #0f172a;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.top-bar-btn:hover { border-color: var(--primary); color: var(--primary); }
.notif-btn { position: relative; }
.notif-btn .dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--card);
}

.page-content { padding: 24px 32px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-header h3 { font-size: 16px; font-weight: 700; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-info h4 { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.stat-info .value { font-size: 28px; font-weight: 800; margin: 4px 0; letter-spacing: -1px; }
.stat-info .change {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
}
.stat-info .change.up { background: var(--success-light); color: var(--success); }
.stat-info .change.down { background: var(--danger-light); color: var(--danger); }

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.chart-container {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.chart-container h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.chart-container .chart-subtitle { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; }
.chart-container canvas { width: 100% !important; height: 250px !important; }
.chart-container.full { grid-column: 1 / -1; }
.chart-legend { display: flex; gap: 20px; margin-top: 12px; flex-wrap: wrap; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.chart-legend-item .dot { width: 10px; height: 10px; border-radius: 50%; }
.chart-price { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.chart-price .price { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.chart-price .price-change { font-size: 14px; font-weight: 600; padding: 4px 10px; border-radius: 8px; }
.chart-price .price-change.up { background: var(--success-light); color: var(--success); }
.chart-price .price-change.down { background: var(--danger-light); color: var(--danger); }
.chart-timeframe { display: flex; gap: 4px; margin-bottom: 16px; }
.chart-timeframe button {
  padding: 6px 14px; border: none; background: transparent; color: var(--text-secondary);
  border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.15s;
}
.chart-timeframe button.active { background: var(--primary); color: #fff; }
.chart-timeframe button:hover:not(.active) { background: var(--bg); }

.view-toggle { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg); border-radius: 8px; margin-bottom: 16px; }
.view-toggle a {
  padding: 6px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); text-decoration: none; transition: all 0.15s;
}
.view-toggle a.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.view-toggle a:hover:not(.active) { color: var(--text); }

.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--bg); }
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.status-badge.active, .status-badge.done, .status-badge.on-track, .status-badge.completed { background: var(--success-light); color: var(--success); }
.status-badge.inactive, .status-badge.overdue, .status-badge.not-done { background: var(--danger-light); color: var(--danger); }
.status-badge.pending, .status-badge.in-progress, .status-badge.partial { background: var(--warning-light); color: #b45309; }
.status-badge.draft { background: var(--primary-light); color: var(--primary); }

.progress-bar { width: 100%; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.progress-bar .fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-bar .fill.green { background: var(--success); }
.progress-bar .fill.blue { background: var(--primary); }
.progress-bar .fill.orange { background: var(--warning); }
.progress-bar .fill.red { background: var(--danger); }
.progress-bar .fill.purple { background: var(--purple); }
.progress-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.ranking-list { list-style: none; }
.ranking-item {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.ranking-item:last-child { border: none; }
.rank-pos {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.rank-pos.gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #78350f; }
.rank-pos.silver { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #334155; }
.rank-pos.bronze { background: linear-gradient(135deg, #fdba74, #f97316); color: #7c2d12; }
.rank-pos.other { background: var(--bg); color: var(--text-secondary); }
.rank-info { flex: 1; }
.rank-info h4 { font-size: 14px; font-weight: 600; }
.rank-info span { font-size: 12px; color: var(--text-secondary); }
.rank-points { font-size: 18px; font-weight: 800; color: var(--primary); }
.rank-points small { font-size: 11px; font-weight: 500; color: var(--text-secondary); }

.goals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.goal-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; border-left: 4px solid var(--primary);
}
.goal-card.health { border-left-color: var(--success); }
.goal-card.achievement { border-left-color: var(--warning); }
.goal-card.personal { border-left-color: var(--purple); }
.goal-card.learning { border-left-color: var(--chart-blue); }
.goal-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.goal-card .goal-category {
  font-size: 11px; color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 12px;
}
.goal-card .goal-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.goal-card .goal-meta span { font-size: 13px; color: var(--text-secondary); }
.goal-card .goal-meta strong { font-size: 14px; }

.notif-list { list-style: none; }
.notif-item {
  display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border: none; }
.notif-icon-wrap {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.notif-content h4 { font-size: 14px; font-weight: 600; }
.notif-content p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.notif-content .notif-time { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

.points-display { text-align: center; padding: 32px; }
.points-display .points-value {
  font-size: 64px; font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1;
}
.points-display .points-label { font-size: 14px; color: var(--text-secondary); margin-top: 8px; }
.points-breakdown { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.points-item { text-align: center; padding: 16px; background: var(--bg); border-radius: 10px; }
.points-item .pts-val { font-size: 24px; font-weight: 800; }
.points-item .pts-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.penalty-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.penalty-card {
  background: var(--danger-light); border: 1px solid rgba(234,67,53,0.2);
  border-radius: 10px; padding: 16px; text-align: center;
}
.penalty-card .penalty-val { font-size: 28px; font-weight: 800; color: var(--danger); }
.penalty-card .penalty-label { font-size: 12px; color: var(--danger); margin-top: 4px; }

.loan-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; border-top: 3px solid var(--warning);
}
.loan-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.loan-header h4 { font-size: 15px; font-weight: 700; }
.loan-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.loan-field label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.loan-field .val { font-size: 15px; font-weight: 600; margin-top: 2px; }

.btn {
  padding: 8px 20px; border: none; border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.attendance-dot { width:10px; height:10px; border-radius:50%; display:inline-block; }
.attendance-dot.present { background: var(--success); }
.attendance-dot.absent { background: var(--danger); }

.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.report-item { padding: 16px; background: var(--bg); border-radius: 10px; text-align: center; }
.report-item .rpt-val { font-size: 22px; font-weight: 800; }
.report-item .rpt-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.help-req-item {
  display: flex; gap: 16px; padding: 16px; background: var(--bg);
  border-radius: 10px; margin-bottom: 12px; align-items: flex-start;
}
.help-req-icon { font-size: 24px; flex-shrink: 0; }
.help-req-content { flex: 1; }
.help-req-content h4 { font-size: 14px; font-weight: 600; }
.help-req-content p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.help-req-meta { display: flex; gap: 16px; margin-top: 8px; }
.help-req-meta span { font-size: 11px; color: var(--text-secondary); }

.help-card {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer; transition: all 0.2s;
}
.help-card:hover { border-color: var(--primary); background: var(--primary-light); }
.help-card .help-icon { font-size: 48px; margin-bottom: 12px; color: var(--primary); }
.help-card h4 { font-size: 16px; margin-bottom: 4px; }
.help-card p { font-size: 13px; color: var(--text-secondary); }

.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 100; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--card); border-radius: 16px; padding: 32px;
  width: 500px; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 20px; margin-bottom: 24px; }
.modal .form-group { margin-bottom: 16px; }
.modal .form-group label { color: var(--text); font-weight: 600; font-size: 13px; margin-bottom: 6px; display: block; }
.modal .form-group input, .modal .form-group select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: var(--card); color: var(--text);
}
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 220px; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.page { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* =====================================================================
   Eagle Profit Growth System - additions on top of the prototype styles
   ===================================================================== */

a { color: inherit; text-decoration: none; }

/* --- Core values ticker in the top bar (admin-managed, shown to everyone) --- */
.core-values-bar {
  background: linear-gradient(90deg, #0f172a, #1e3a5f);
  color: #e2e8f0;
  padding: 9px 32px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
}
.core-values-bar .cv-label {
  font-weight: 700;
  color: #fbbf24;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.core-values-bar .cv-track {
  display: flex;
  gap: 28px;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.core-values-bar .cv-track::-webkit-scrollbar { display: none; }
.core-values-bar .cv-item { opacity: 0.9; }
.core-values-bar .cv-item strong { color: #fff; }

/* --- Flash messages --- */
.alert {
  padding: 13px 18px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-light); color: #0b6b3d; border-color: #a7dfc0; }
.alert-error   { background: var(--danger-light);  color: #a52318; border-color: #f2b7b1; }
.alert-warning { background: var(--warning-light); color: #8a5d00; border-color: #f3d68a; }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border-color: #b9d1f7; }
.alert ul { margin: 0; padding-left: 18px; }

/* --- Forms --- */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.field input[type=text], .field input[type=email], .field input[type=number],
.field input[type=date], .field input[type=password], .field input[type=tel],
.field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}
.field textarea { min-height: 84px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--text-secondary); margin-top: 5px; text-transform: none; letter-spacing: 0; }
.field .err { font-size: 12px; color: var(--danger); margin-top: 5px; }
.field.required label::after { content: ' *'; color: var(--danger); }

.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Achieved / Not achieved / Not applicable selector */
.status-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.status-choice label {
  flex: 1;
  min-width: 108px;
  text-align: center;
  padding: 10px 8px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-secondary);
  transition: all 0.15s;
  margin: 0;
}
.status-choice input { display: none; }
.status-choice input:checked + span { display: block; }
.status-choice label:hover { border-color: var(--primary); }
.status-choice label.on-achieved:has(input:checked)      { background: var(--success-light); border-color: var(--success); color: #0b6b3d; }
.status-choice label.on-not-achieved:has(input:checked)  { background: var(--danger-light);  border-color: var(--danger);  color: #a52318; }
.status-choice label.on-na:has(input:checked)            { background: #eef1f5; border-color: var(--silver); color: var(--text-secondary); }

/* --- Tables --- */
.table-container { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left;
  padding: 11px 14px;
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafbfc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-alert { background: #fff7f6 !important; }
.row-alert:hover { background: #ffeeec !important; }

/* --- Badges and pills --- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.pill-success { background: var(--success-light); color: #0b6b3d; }
.pill-danger  { background: var(--danger-light);  color: #a52318; }
.pill-warning { background: var(--warning-light); color: #8a5d00; }
.pill-info    { background: var(--primary-light); color: var(--primary-dark); }
.pill-muted   { background: #eef1f5; color: var(--text-secondary); }
.pill-purple  { background: var(--purple-light); color: var(--purple); }

.role-badge { font-size: 10.5px; padding: 3px 9px; border-radius: 6px; font-weight: 700; letter-spacing: 0.3px; }
.role-super_admin { background: #fee2e2; color: #b91c1c; }
.role-admin { background: var(--purple-light); color: var(--purple); }
.role-captain { background: var(--warning-light); color: #8a5d00; }
.role-user { background: var(--primary-light); color: var(--primary-dark); }

/* --- Progress bars (used instead of charts throughout) --- */
.bar { height: 9px; background: #e8ecf1; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width 0.4s; }
.bar.lg { height: 13px; }
.bar > span.green { background: var(--chart-green); }
.bar > span.red { background: var(--chart-red); }
.bar > span.orange { background: var(--chart-orange); }
.bar > span.purple { background: var(--chart-purple); }
.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.bar-label b { color: var(--text); font-size: 13px; }

.metric-block { margin-bottom: 18px; }
.metric-block:last-child { margin-bottom: 0; }

/* --- Layout helpers --- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }
.mb { margin-bottom: 16px; }
.muted { color: var(--text-secondary); font-size: 13px; }
.tiny { font-size: 11.5px; color: var(--text-secondary); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.strong-num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos { color: var(--success); }
.neg { color: var(--danger); }

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-secondary);
}
.empty i { font-size: 34px; opacity: 0.35; display: block; margin-bottom: 12px; }

/* --- Week navigator --- */
.week-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.week-nav .range { font-weight: 700; font-size: 14px; }
.week-nav form { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.week-nav input[type=date] {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
}

/* --- Deadline banner --- */
.deadline {
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13.5px;
  border-left: 4px solid;
}
.deadline.open   { background: var(--success-light); border-color: var(--success); color: #0b6b3d; }
.deadline.grace  { background: var(--warning-light); border-color: var(--warning); color: #8a5d00; }
.deadline.closed { background: var(--danger-light);  border-color: var(--danger);  color: #a52318; }
.deadline b { display: block; margin-bottom: 3px; font-size: 14px; }

/* --- Modal (used for add/edit forms) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: 880px; }
.modal h3 { font-size: 17px; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* --- Buttons --- */
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
  background: #eef1f5;
  color: var(--text);
}
.btn:hover { filter: brightness(0.96); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-icon { padding: 7px 10px; }

/* --- Rankings --- */
.rank-pos.gold   { background: #fef3c7; color: #a16207; }
.rank-pos.silver { background: #f1f5f9; color: #475569; }
.rank-pos.bronze { background: #ffedd5; color: #b45309; }

/* --- Tabs --- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* --- Pagination --- */
.pagination {
  display: flex;
  gap: 5px;
  list-style: none;
  padding: 16px 0 0;
  flex-wrap: wrap;
  align-items: center;
}
.pagination li span, .pagination li a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  background: var(--card);
  color: var(--text);
  transition: all 0.15s;
}
.pagination li a:hover { border-color: var(--primary); color: var(--primary); }
.pagination li .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination li .disabled { color: var(--text-secondary); background: #f1f3f5; cursor: not-allowed; opacity: 0.65; }
/* The paginator's arrows are icon fonts, never full-size SVGs. */
.pagination i { font-size: 10px; }
.pagination svg { width: 14px; height: 14px; }

/* --- Sidebar sub-role badge --- */
.sidebar-header .role-tag {
  font-size: 10.5px;
  color: #94a3b8;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-top: 2px;
}
.nav-item { text-decoration: none; }
.nav-item .count {
  margin-left: auto;
  background: rgba(255,255,255,0.14);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
}
.nav-item.active .count { background: rgba(255,255,255,0.28); }

/* --- Notification dropdown --- */
.notif-panel {
  position: absolute;
  right: 0;
  top: 46px;
  width: 380px;
  max-height: 460px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  display: none;
}
.notif-panel.open { display: block; }
.notif-panel .head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notif-panel .row { padding: 12px 16px; border-bottom: 1px solid #f1f3f5; font-size: 13px; }
.notif-panel .row:hover { background: #fafbfc; }
.notif-panel .row.unread { background: var(--primary-light); }
.notif-panel .row .t { font-weight: 600; margin-bottom: 2px; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; transition: left 0.25s; z-index: 100; height: 100vh; }
  .sidebar.open { left: 0; }
  .main-content { margin-left: 0; }
  .top-bar, .page-content, .core-values-bar { padding-left: 16px; padding-right: 16px; }
}

/* --- Brand logo ---------------------------------------------------------
   The client's artwork is a horizontal composition (~2:1 aspect: navy circle
   mark + gold + navy wordmark). No inversion - the file has its own colors.
   Width fixes the size; height:auto keeps the aspect ratio. */
.brand-logo {
  display: block;
  width: 180px;
  height: auto;
  max-width: 100%;
  margin: 0 auto 10px;
}
.brand-logo.lg { width: 260px; margin-bottom: 18px; }

/* Legacy hook kept for pages that still pass this class - no-op today. */
.brand-logo.dark-ink { filter: none; }

.sidebar-header { text-align: center; }
.sidebar-header h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #cbd5e1;
  display: block;
}

/* --- Off-canvas sidebar for tablet and mobile ---------------------------
   Below 900px the sidebar slides away, so a toggle and a backdrop are
   needed to reach the menu at all. */
.top-bar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.sidebar-toggle {
  display: none;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 9px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
}
.sidebar-toggle:hover { border-color: var(--primary); color: var(--primary); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 99;
}
.sidebar-backdrop.open { display: block; }

@media (max-width: 900px) {
  .sidebar-toggle { display: inline-flex; }
  .top-bar h1 { font-size: 17px; }
  .top-bar-actions .user-details,
  .top-bar-actions .user-name { display: none; }
}

/* =====================================================================
   Community feed
   ===================================================================== */

.feed { max-width: 720px; margin: 0 auto; }

/* --- Composer --- */
.composer-top { display: flex; gap: 12px; align-items: flex-start; }
.composer textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  resize: vertical;
  min-height: 76px;
  color: var(--text);
  background: #fff;
}
.composer textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* --- Mention autocomplete --- */
.mention-menu {
  display: none;
  position: absolute;
  z-index: 40;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  min-width: 260px;
  max-width: 340px;
  margin-top: 4px;
}
.mention-menu.open { display: block; position: relative; }
.mention-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 13px;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  border-bottom: 1px solid #f1f3f5;
}
.mention-menu button:last-child { border-bottom: 0; }
.mention-menu button:hover { background: var(--primary-light); }
.mention-menu button strong { color: var(--text); }
.mention-menu button span { color: var(--primary); margin-left: 5px; }
.mention-menu button em { display: block; color: var(--text-secondary); font-style: normal; font-size: 11.5px; margin-top: 1px; }

/* --- A post --- */
.post { padding: 18px 20px; }
.post-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.post-author { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.post-author .handle { font-weight: 500; font-size: 12.5px; color: var(--text-secondary); }
.post-body { font-size: 14.5px; line-height: 1.62; color: var(--text); word-break: break-word; }
.post-tagged { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--border); }

.mention {
  color: var(--primary);
  background: var(--primary-light);
  padding: 1px 5px;
  border-radius: 5px;
  font-weight: 600;
  white-space: nowrap;
}

/* --- Reactions --- */
.reaction-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}
.react-tally { display: inline-flex; align-items: center; gap: 7px; }

/* The comment count doubles as the open/close control for the thread. */
.comment-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.14s, color 0.14s;
}
.comment-toggle:hover { background: #f1f3f5; color: var(--primary); }
.comment-toggle .chev { font-size: 9px; transition: transform 0.18s; }
.comment-toggle.open { color: var(--primary); }
.comment-toggle.open .chev { transform: rotate(180deg); }
.post.is-request .comment-toggle:hover { background: #fdf2da; }
/* Overlapping icon chips summarising which reactions a post has. */
.icon-stack { display: inline-flex; align-items: center; }
.icon-stack .react-chip {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: -6px;
  background: var(--card);
  border: 1.5px solid var(--card);
  border-radius: 50%;
  font-size: 10.5px;
  box-shadow: 0 1px 2px rgba(16, 32, 44, 0.12);
}
.icon-stack .react-chip:last-child { margin-right: 2px; }
.post.is-request .icon-stack .react-chip { background: #fff9ec; border-color: #fff9ec; }

.reaction-bar {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.react-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.react-btn:hover { background: #f1f3f5; }
.react-btn .emo {
  font-size: 14px;
  line-height: 1;
  width: 16px;
  text-align: center;
  color: var(--react-colour, var(--text-secondary));
  transition: transform 0.14s;
}
.react-btn:hover .emo { transform: scale(1.15); }
.react-btn .cnt {
  background: #eef1f5;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
}
.react-btn.on {
  color: var(--react-colour, var(--primary));
  background: color-mix(in srgb, var(--react-colour, var(--primary)) 12%, transparent);
  border-color: color-mix(in srgb, var(--react-colour, var(--primary)) 40%, transparent);
}
.react-btn.on .emo { color: var(--react-colour, var(--primary)); }
.react-btn.on .cnt {
  background: color-mix(in srgb, var(--react-colour, var(--primary)) 20%, transparent);
  color: var(--react-colour, var(--primary-dark));
}

/* --- Comments --- */
.comment-area[hidden] { display: none; }
.comment-list {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment .bubble {
  background: #f2f4f7;
  border-radius: 14px;
  padding: 9px 13px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}
.comment-author { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.comment-author .handle { font-weight: 500; color: var(--text-secondary); font-size: 11.5px; margin-left: 4px; }
.comment-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; padding-left: 4px; flex-wrap: wrap; }

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.link-btn:hover { color: var(--primary); text-decoration: underline; }
.link-btn.on { color: var(--primary); }

.comment-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.comment-form input[type=text] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 15px;
  font-family: inherit;
  font-size: 13.5px;
  background: #fff;
  color: var(--text);
}
.comment-form input[type=text]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}

.user-avatar.sm { width: 32px; height: 32px; font-size: 12px; flex-shrink: 0; }

@media (max-width: 700px) {
  .react-btn .lbl { display: none; }
  .react-btn { padding: 7px 9px; }
}

/* =====================================================================
   MODERN REFRESH  —  loaded last, so it refines everything above.
   Two goals: a cleaner contemporary surface treatment, and a layout that
   genuinely works down to 360px.
   ===================================================================== */

/* ---------- 1. Tokens ------------------------------------------------ */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e4e8ee;
  --border-strong: #d3dae3;
  --text: #16202c;
  --text-secondary: #64748b;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;

  /* Layered shadows read as depth rather than a grey smear. */
  --shadow: 0 1px 2px rgba(16, 32, 44, 0.04), 0 2px 6px rgba(16, 32, 44, 0.05);
  --shadow-md: 0 2px 4px rgba(16, 32, 44, 0.05), 0 6px 16px rgba(16, 32, 44, 0.07);
  --shadow-lg: 0 8px 28px rgba(16, 32, 44, 0.12), 0 2px 8px rgba(16, 32, 44, 0.06);

  --ring: 0 0 0 3px rgba(26, 115, 232, 0.16);
  --sidebar-bg: #101c2b;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
}

*, *::before, *::after { box-sizing: border-box; }

/* ---------- 2. Surfaces ---------------------------------------------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card-header { margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.card-header h3 { font-size: 15.5px; letter-spacing: -0.01em; }

.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  gap: 14px;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon { border-radius: 11px; width: 44px; height: 44px; font-size: 18px; }
.stat-info h3 {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.stat-info .value {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}
.stats-grid { gap: 14px; }

/* ---------- 3. Top bar ------------------------------------------------ */
.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 26px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.top-bar-left { order: 1; flex: 1 1 auto; min-width: 0; }
.page-actions  { order: 2; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.top-bar-actions { order: 3; gap: 9px; }

.top-bar-titles { min-width: 0; }
.top-bar h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  /* Never let a long page title shove the buttons off-screen. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-bar-titles .tiny {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46ch;
}

.top-bar-btn, .sidebar-toggle {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  min-height: 38px;
}
.top-bar-btn:hover { background: #f7f9fc; }

.user-info { gap: 9px; }
.user-avatar {
  border-radius: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Core values strip: quieter, and swipeable on small screens. */
.core-values-bar { padding: 8px 26px; font-size: 12.5px; }
.core-values-bar .cv-track { gap: 24px; }

/* ---------- 4. Sidebar ------------------------------------------------ */
.sidebar { border-right: 1px solid rgba(255, 255, 255, 0.06); }
.sidebar-header { padding: 22px 18px 16px; }
.nav-item {
  border-radius: var(--radius-sm);
  margin: 1px 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  gap: 11px;
  transition: background 0.14s, color 0.14s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); }
.nav-item.active { background: var(--sidebar-active); box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35); }
.nav-item i { width: 17px; text-align: center; font-size: 13.5px; }
.nav-section {
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 16px 22px 6px;
  color: #6b7f96;
}

/* ---------- 5. Controls ----------------------------------------------- */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  min-height: 38px;
  padding: 9px 16px;
}
.btn-primary { box-shadow: 0 1px 2px rgba(26, 115, 232, 0.28); }
.btn-primary:hover { background: var(--primary-dark); filter: none; }
.btn:focus-visible, .top-bar-btn:focus-visible, .react-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-sm { min-height: 32px; padding: 6px 12px; }

.field input[type=text], .field input[type=email], .field input[type=number],
.field input[type=date], .field input[type=password], .field input[type=tel],
.field select, .field textarea,
.composer textarea, .comment-form input[type=text] {
  border-radius: var(--radius-sm);
  border-color: var(--border-strong);
  transition: border-color 0.14s, box-shadow 0.14s;
}
.field input:focus, .field select:focus, .field textarea:focus { box-shadow: var(--ring); }
.field label { font-size: 11.5px; letter-spacing: 0.03em; }

.status-choice label { border-radius: var(--radius-sm); min-height: 44px; display: flex; align-items: center; justify-content: center; }

/* ---------- 6. Tables ------------------------------------------------- */
/* Wide tables scroll inside their own container. A soft edge fade signals
   there is more to the right, and the first column stays put. */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-radius: var(--radius-sm);
}
.table-container::-webkit-scrollbar { height: 8px; }
.table-container::-webkit-scrollbar-thumb { background: #cfd7e1; border-radius: 99px; }
.table-container::-webkit-scrollbar-track { background: transparent; }

table.data th {
  background: #f7f9fc;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: #6b7a8d;
  padding: 11px 14px;
}
table.data td { padding: 13px 14px; }
table.data tbody tr { transition: background 0.12s; }
table.data tbody tr:hover { background: #f8fafc; }

.pill { border-radius: 7px; padding: 4px 9px; font-size: 11px; letter-spacing: 0.01em; }
.role-badge { border-radius: 6px; }

/* ---------- 7. Progress bars ------------------------------------------ */
.bar { background: #e8edf3; border-radius: 99px; height: 8px; }
.bar.lg { height: 11px; }
.bar > span { border-radius: 99px; transition: width 0.5s cubic-bezier(.4,0,.2,1); }
.bar > span:not(.red):not(.orange):not(.green):not(.purple) {
  background: linear-gradient(90deg, #3b82f6, #1a73e8);
}
.bar > span.green { background: linear-gradient(90deg, #34d399, #0f9d58); }
.bar > span.orange { background: linear-gradient(90deg, #fbbf24, #f97316); }
.bar > span.red { background: linear-gradient(90deg, #f87171, #ea4335); }

/* ---------- 8. Feed --------------------------------------------------- */
.post { border-radius: var(--radius); }
.comment .bubble { border-radius: 14px; background: #f4f6f9; }
.react-btn { border-radius: 9px; min-height: 36px; }

/* ---------- 9. Modals ------------------------------------------------- */
.modal { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-overlay { backdrop-filter: blur(3px); }

/* ---------- 10. Alerts, empties --------------------------------------- */
.alert { border-radius: var(--radius-sm); }
.deadline { border-radius: var(--radius-sm); }
.empty { padding: 52px 20px; }
.empty i { font-size: 30px; opacity: 0.28; }

.week-nav { border-radius: var(--radius-sm); padding: 8px 12px; }


/* =====================================================================
   RESPONSIVE
   ===================================================================== */

/* ---------- Tablet ---------------------------------------------------- */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* ---------- Below the sidebar breakpoint ------------------------------ */
@media (max-width: 900px) {
  .top-bar { padding: 10px 14px; gap: 10px; }
  .core-values-bar { padding: 7px 14px; }
  .page-content { padding: 16px 14px 28px; }

  /* Page buttons drop to their own full-width row. */
  .page-actions {
    order: 10;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .page-actions::-webkit-scrollbar { display: none; }
  .page-actions .btn, .page-actions form { flex-shrink: 0; }

  .top-bar-actions { order: 3; margin-left: auto; }

  /* Icon-only chrome, so the title keeps its room. */
  .top-bar-btn .btn-text { display: none; }
  .top-bar-btn { padding: 8px 11px; }
  .user-details,
  .top-bar-actions .user-name { display: none; }

  .top-bar h1 { font-size: 17px; }
  .top-bar-titles .tiny { display: none; }

  .card { padding: 16px; border-radius: 12px; }
  .stat-card { padding: 15px; }
  .stat-info .value { font-size: 22px; }

  .notif-panel { width: min(88vw, 340px); right: -8px; }
}

/* ---------- Phones ----------------------------------------------------- */
@media (max-width: 640px) {
  /* Two compact tiles per row beats one giant one per row. */
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { flex-direction: column; align-items: flex-start; gap: 9px; padding: 13px; }
  .stat-icon { width: 36px; height: 36px; font-size: 15px; border-radius: 9px; }
  .stat-info { min-width: 0; width: 100%; }
  .stat-info h3 { font-size: 10.5px; }
  .stat-info .value { font-size: 19px; }
  .stat-info .change { font-size: 10.5px; line-height: 1.35; }

  .grid-2, .grid-3, .form-row, .goals-grid { grid-template-columns: 1fr; }

  /* iOS zooms the page when a focused input is under 16px. Attribute
     selectors are used so this outranks the base field styling. */
  .field input[type=text], .field input[type=email], .field input[type=number],
  .field input[type=date], .field input[type=password], .field input[type=tel],
  .field select, .field textarea,
  table.data input[type=number], table.data input[type=text],
  .comment-form input[type=text], .composer textarea,
  .week-nav input[type=date], .week-nav input[type=number],
  .card-header input, .card-header select { font-size: 16px; }

  /* Comfortable touch targets. */
  .btn, .top-bar-btn, .sidebar-toggle { min-height: 42px; }
  .btn-sm { min-height: 36px; }
  .nav-item { padding: 11px 12px; font-size: 14px; }

  /* Wide tables: keep the first column anchored while the rest scrolls. */
  .table-container { margin: 0 -16px; padding: 0 16px; }
  table.data th:first-child, table.data td:first-child {
    position: sticky;
    left: 0;
    background: var(--card);
    z-index: 1;
    box-shadow: 1px 0 0 var(--border);
  }
  table.data th:first-child { background: #f7f9fc; }
  table.data tbody tr:hover td:first-child { background: #f8fafc; }
  table.data tr.row-alert td:first-child { background: #fff7f6; }
  table.data { font-size: 12.5px; }
  table.data th, table.data td { padding: 10px 11px; }

  .card-header { align-items: flex-start; }
  .week-nav { gap: 8px; }
  .week-nav form { margin-left: 0; width: 100%; }
  .week-nav .range { font-size: 13px; }

  .modal { padding: 18px; border-radius: 14px; }
  .modal-overlay { padding: 12px; align-items: flex-start; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; justify-content: center; }

  .feed { max-width: 100%; }
  .composer-top { gap: 9px; }
  .post { padding: 15px 14px; }
  .reaction-bar { gap: 2px; }

  .pagination li span, .pagination li a { padding: 8px 11px; }
}

/* ---------- Very small phones ------------------------------------------ */
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  .top-bar h1 { font-size: 16px; }
}

/* ---------- Respect reduced motion ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Print ------------------------------------------------------- */
@media print {
  .sidebar, .top-bar, .core-values-bar, .page-actions, .sidebar-backdrop { display: none !important; }
  .main-content { margin: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ---------- Drawer must stay reachable on phones -----------------------
   An earlier rule hides .sidebar outright below 600px, which left the menu
   unreachable on a phone even with the toggle present. Restore it as the
   off-canvas drawer at every mobile width. */
@media (max-width: 600px) {
  .sidebar {
    display: flex;
    width: 264px;
    left: -280px;
  }
  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
}

/* ---------- Card-header toolbars on phones -----------------------------
   Search boxes, filters and week pickers sit in .card-header. On a narrow
   screen they need the full width rather than being squeezed beside the
   heading. */
@media (max-width: 640px) {
  .card-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .card-header > form,
  .card-header > .flex { width: 100%; flex-wrap: wrap; }
  .card-header input[type=text],
  .card-header input[type=number],
  .card-header select { flex: 1 1 140px; width: auto; min-width: 0; }
  .card-header .btn { flex-shrink: 0; }
}

/* ---------- Brand lock-up: two deliberate lines ------------------------ */
.brand-name { display: block; }
.brand-name .brand-line1,
.brand-name .brand-line2 { display: block; }
.sidebar-header .brand-name .brand-line1 {
  font-size: 13.5px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: -0.01em;
}
.sidebar-header .brand-name .brand-line2 {
  font-size: 11px;
  font-weight: 500;
  color: #8fa3b8;
  letter-spacing: 0.02em;
  margin-top: 1px;
}
.login-logo .brand-name .brand-line1 { font-size: 21px; font-weight: 700; line-height: 1.25; }
.login-logo .brand-name .brand-line2 { font-size: 15px; font-weight: 500; opacity: 0.72; margin-top: 2px; }

/* ---------- Request posts and moderation ------------------------------- */
.request-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.request-toggle:hover { border-color: var(--warning); color: #8a5d00; }
.request-toggle.on {
  background: var(--warning-light);
  border-color: var(--warning);
  color: #8a5d00;
  box-shadow: 0 0 0 3px rgba(249, 171, 0, 0.15);
}

/* A request reads clearly differently from an ordinary update. */
/* A request is tinted right through and bordered all the way around, so it
   reads as a different kind of card rather than a normal post with a stripe. */
.post.is-request {
  border: 1.5px solid var(--warning);
  background: #fff9ec;
  box-shadow: 0 0 0 3px rgba(249, 171, 0, 0.10), var(--shadow);
}

/* Inner surfaces warm up to match, otherwise they look pasted on. */
.post.is-request .comment .bubble { background: #fdf2da; }
.post.is-request .reaction-summary,
.post.is-request .reaction-bar,
.post.is-request .comment-list,
.post.is-request .comment-form { border-top-color: #f0dcb4; }
.post.is-request .post-tagged { border-top-color: #f0dcb4; }
.post.is-request .react-btn:hover { background: #fdf2da; }
.post.is-request .comment-form input[type=text],
.post.is-request .mention-menu { border-color: #e8d4ad; }
.pill-request { background: var(--warning-light); color: #8a5d00; }

.feed-tabs { margin-bottom: 16px; }
.feed-tabs a { display: inline-flex; align-items: center; gap: 7px; }

/* Hidden content stays legible to its author and to moderators. */
.post.is-hidden, .comment.is-hidden { opacity: 0.66; }
.hidden-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--danger-light);
  color: #a52318;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ---------- First-week getting-started tips ---------------------------- */
.tutorial {
  background: linear-gradient(135deg, #eef4ff 0%, #f7fbff 100%);
  border: 1px solid #cfe0f8;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.tutorial-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tutorial-title { display: flex; align-items: flex-start; gap: 11px; }
.tutorial-title > i {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 15px;
}
.tutorial-title strong { font-size: 14.5px; display: block; }

.tutorial-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.tutorial-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid #dce8f8;
  border-radius: var(--radius-sm);
  padding: 12px;
}
.step-num {
  width: 22px; height: 22px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}
.step-head { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.step-head i { color: var(--primary); margin-right: 5px; }

@media (max-width: 640px) {
  .tutorial { padding: 14px; }
  .tutorial-steps { grid-template-columns: 1fr; }
}

/* ---------- Awaiting-approval screen ----------------------------------- */
.pending-panel { text-align: center; color: #dbe6f0; }
.pending-icon {
  width: 62px; height: 62px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(249, 171, 0, 0.16);
  border: 1px solid rgba(249, 171, 0, 0.45);
  color: #fbbf24;
  border-radius: 50%;
  font-size: 24px;
}
.pending-panel h2 { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.pending-panel p { font-size: 13.5px; line-height: 1.65; color: rgba(255,255,255,0.62); }

.pending-details {
  text-align: left;
  margin: 20px 0 6px;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 14px;
}
.pending-details > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pending-details > div:last-child { border-bottom: 0; }
.pending-details span { color: rgba(255,255,255,0.45); }
.pending-details strong { color: #fff; font-weight: 600; text-align: right; }

.pending-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pending-actions .btn-outline { color: rgba(255,255,255,0.75); border-color: rgba(255,255,255,0.22); }
.pending-actions .btn-outline:hover { color: #fff; border-color: rgba(255,255,255,0.45); }

/* A reaction in flight: dimmed and non-interactive, no layout shift. */
.react-btn.is-busy, .link-btn.is-busy { opacity: 0.55; pointer-events: none; }
