/* BJA Portal - applicant/student /me/ pages */

:root {
  --me-bg: #f6f7fa;
  --me-card: #fff;
  --me-text: #1f2533;
  --me-muted: #5a6a85;
  --me-accent: #1f3a64;
  --me-line: #e3e7ef;
}

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

body.me .wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
body.me .me-narrow { max-width: 460px; }

/* ---------- Header ---------- */
.me-header {
  background: var(--me-accent);
  color: #fff;
}
.me-header .wrap {
  display: flex;
  align-items: center;
  height: 56px;
}
.me-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  margin-right: auto;
}
.me-brand span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.75;
  margin-left: 8px;
  border-left: 1px solid rgba(255,255,255,0.3);
  padding-left: 8px;
}
.me-nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.me-nav a { color: #fff; text-decoration: none; opacity: 0.9; }
.me-nav a:hover { opacity: 1; }
.me-nav .who { font-size: 12px; opacity: 0.75; padding: 0 6px 0 14px; border-left: 1px solid rgba(255,255,255,0.3); margin-left: 4px; }
.me-nav .logout-form { display: inline; margin: 0; }
.me-nav button.logout {
  appearance: none; -webkit-appearance: none;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
}
.me-nav button.logout:hover { background: rgba(255,255,255,0.08); }

/* ---------- Main + footer ---------- */
.me-main { padding: 32px 0 64px; min-height: 60vh; }
.me-footer { background: #eef1f6; color: var(--me-muted); padding: 18px 0; font-size: 13px; }
.me-footer .wrap { display: flex; justify-content: space-between; }

/* ---------- Typography ---------- */
body.me h1 { font-size: 26px; font-weight: 600; margin: 0 0 4px; color: var(--me-accent); }
body.me h2 { font-size: 18px; font-weight: 600; margin: 28px 0 10px; color: var(--me-accent); }
body.me h3 { font-size: 15px; font-weight: 600; margin: 14px 0 4px; }
body.me .lede { color: var(--me-muted); font-size: 15px; margin: 4px 0 22px; }
body.me .me-muted { color: var(--me-muted); }
body.me .me-mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.93em; }
body.me .me-back { color: var(--me-muted); text-decoration: none; font-size: 14px; }
body.me .me-back:hover { color: var(--me-accent); }
body.me .me-secondary { color: var(--me-muted); font-size: 14px; margin-top: 28px; }
body.me .me-secondary-link { color: var(--me-accent); text-decoration: none; font-size: 13px; font-weight: 500; }
body.me .me-secondary-link:hover { text-decoration: underline; }

/* ---------- Forms / buttons ---------- */
body.me .me-form { background: var(--me-card); border: 1px solid var(--me-line); border-radius: 8px; padding: 24px; }
body.me .me-form label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 16px; }
body.me .me-form input[type=email],
body.me .me-form input[type=text] {
  display: block; width: 100%; box-sizing: border-box;
  padding: 10px 12px; margin-top: 6px; font-size: 14px;
  border: 1px solid #c8cfdc; border-radius: 4px;
}
body.me .btn-primary {
  appearance: none; -webkit-appearance: none;
  background: var(--me-accent); color: #fff;
  border: 1px solid var(--me-accent);
  border-radius: 4px; padding: 10px 18px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  text-decoration: none; display: inline-block;
}
body.me .btn-primary:hover { background: #2a4373; }
body.me .btn-secondary {
  appearance: none; -webkit-appearance: none;
  background: #fff; color: var(--me-accent);
  border: 1px solid #c8cfdc;
  border-radius: 4px; padding: 8px 14px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  text-decoration: none; display: inline-block;
}
body.me .btn-secondary:hover { border-color: var(--me-accent); }
body.me .me-help { font-size: 13px; color: var(--me-muted); margin-top: 16px; }

/* ---------- Flashes ---------- */
body.me .flash { padding: 12px 16px; border-radius: 6px; margin: 16px 0; font-size: 14px; }
body.me .flash-ok  { background: #e6f4ea; border: 1px solid #86c79b; color: #266b38; }
body.me .flash-err { background: #fcebe6; border: 1px solid #e9a895; color: #8b2c14; }

/* ---------- Dashboard ---------- */
body.me .me-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin: 24px 0 8px;
}
body.me .me-stat {
  background: var(--me-card); border: 1px solid var(--me-line); border-radius: 8px;
  padding: 16px; text-align: center;
}
body.me .me-stat .num { font-size: 28px; font-weight: 700; color: var(--me-accent); }
body.me .me-stat .lbl { font-size: 12px; color: var(--me-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }

body.me .me-applist { display: grid; gap: 16px; }
body.me .me-app-card {
  background: var(--me-card); border: 1px solid var(--me-line);
  border-radius: 8px; padding: 18px 20px;
}
body.me .me-app-card header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
body.me .me-app-card h3 { flex: 1; margin: 0; font-size: 16px; }
body.me .me-app-card dl {
  display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px;
  font-size: 14px; margin: 0 0 14px;
}
body.me .me-app-card dt { color: var(--me-muted); }
body.me .me-app-card dd { margin: 0; }
body.me .me-app-card dd .ok { color: #266b38; }
body.me .me-app-actions { display: flex; gap: 10px; flex-wrap: wrap; }

body.me .me-card { background: var(--me-card); border: 1px solid var(--me-line); border-radius: 8px; padding: 24px; }

/* ---------- Status badges ---------- */
body.me .me-badge {
  display: inline-block;
  font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 12px;
  border: 1px solid; text-transform: uppercase; letter-spacing: 0.04em;
}
body.me .me-badge-inProgress { background: #fff4e3; border-color: #f1c585; color: #7a4a04; }
body.me .me-badge-submitted  { background: #eef2fb; border-color: #b4c2dc; color: #2a4373; }
body.me .me-badge-approved,
body.me .me-badge-enrolled,
body.me .me-badge-signed,
body.me .me-badge-ok          { background: #e6f4ea; border-color: #86c79b; color: #266b38; }
body.me .me-badge-rejected,
body.me .me-badge-withdrawn   { background: #fcebe6; border-color: #e9a895; color: #8b2c14; }
body.me .me-badge-pending     { background: #fff4e3; border-color: #f1c585; color: #7a4a04; }
body.me .me-badge-lead        { background: #f0f4fb; border-color: #c8d3e8; color: #4a5a78; }

body.me .me-status { font-size: 14px; margin-bottom: 18px; }

/* ---------- Sections / tables ---------- */
body.me .me-section { background: var(--me-card); border: 1px solid var(--me-line); border-radius: 8px; padding: 18px 22px; margin: 16px 0; }
body.me .me-section h2 { margin-top: 0; display: flex; align-items: center; gap: 12px; }
body.me .me-table { width: 100%; border-collapse: collapse; font-size: 14px; }
body.me .me-table th, body.me .me-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--me-line); }
body.me .me-table th { background: #f0f4fb; font-weight: 600; color: var(--me-accent); }
body.me .me-agreement-list { list-style: none; padding: 0; margin: 0; }
body.me .me-agreement-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--me-line);
}
body.me .me-agreement-list li:last-child { border-bottom: 0; }

/* ---------- Messages ---------- */
.me-msg-wrap {
  display: grid; grid-template-columns: 320px 1fr; gap: 0;
  background: var(--me-card); border: 1px solid var(--me-line);
  border-radius: 8px; overflow: hidden;
  min-height: 60vh;
}
.me-msg-sidebar { border-right: 1px solid var(--me-line); padding: 16px; }
.me-msg-sidebar h2 { margin: 0 0 14px; }
.me-thread-list { list-style: none; padding: 0; margin: 0; }
.me-thread-list li { border-bottom: 1px solid var(--me-line); }
.me-thread-list li:last-child { border-bottom: 0; }
.me-thread-list a {
  display: block; padding: 12px 8px; color: var(--me-text);
  text-decoration: none; border-radius: 4px;
}
.me-thread-list li.active a { background: #eef2fb; }
.me-thread-list a:hover { background: #f6f8fb; }
.me-thread-list .subj { font-weight: 500; font-size: 14px; }
.me-thread-list .snip { color: var(--me-muted); font-size: 12.5px; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.me-thread-list .ts { color: var(--me-muted); font-size: 11px; margin-top: 2px; }
.me-msg-pane { padding: 18px 24px; display: flex; flex-direction: column; }
.me-msg-pane h2 { margin-top: 0; }
.me-msg-stream { flex: 1; overflow-y: auto; padding-bottom: 16px; }
.me-msg {
  background: #f6f8fb; border-radius: 8px; padding: 12px 14px;
  margin: 10px 0; max-width: 78%;
}
.me-msg.mine  { background: #eef2fb; margin-left: auto; }
.me-msg.theirs{ background: #f6f8fb; margin-right: auto; }
.me-msg header { display: flex; gap: 12px; font-size: 12px; color: var(--me-muted); margin-bottom: 6px; }
.me-msg .body { font-size: 14px; }
.me-msg-reply textarea {
  width: 100%; box-sizing: border-box;
  border: 1px solid #c8cfdc; border-radius: 4px;
  padding: 10px; font-size: 14px; font-family: inherit;
  resize: vertical; margin-top: 6px;
}
.me-msg-reply button { margin-top: 10px; }
.me-empty-pane { padding: 60px 20px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  body.me .me-stats { grid-template-columns: 1fr 1fr; }
  .me-msg-wrap { grid-template-columns: 1fr; }
  .me-msg-sidebar { border-right: 0; border-bottom: 1px solid var(--me-line); }
}
