@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700;800&family=Mulish:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

* { box-sizing: border-box; }

:root {
  --ink: #16273F;
  --body: #33404F;
  --muted: #8791A0;
  --muted2: #5B6675;
  --muted3: #98A2B0;
  --card-border: #EAEDF3;
  --red: #E8402A;
}

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "Mulish", system-ui, sans-serif;
  color: var(--body);
  background: linear-gradient(180deg, #F5F3FB 0%, #F1F6F6 100%);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
body.auth-pending .app-shell { display: none; }
.app-shell .rm-header-inner, .app-shell .rm-footer-inner { max-width: 90%; }

@keyframes moFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes moPopIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ------------------------------- Hero (shared) ------------------------------- */
.mo-hero-inner { max-width: 90%; margin: 0 auto; padding: 32px 32px 8px; }
.mo-hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.mo-back { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-family: "Poppins", sans-serif; font-weight: 600; font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }
.mo-back:hover { color: var(--ink); }
.mo-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 38px; line-height: 1.05; letter-spacing: -0.5px; color: var(--ink); margin: 0 0 6px; padding-top: 4px; }
.mo-title.sm { font-size: 32px; line-height: 1.08; }
.mo-subtitle { font-size: 15.5px; color: var(--muted); }

.mo-primary {
  display: inline-flex; align-items: center; gap: 9px; background: var(--red); border: none; color: #fff;
  font-family: "Poppins", sans-serif; font-weight: 600; font-size: 15px; padding: 13px 22px; border-radius: 12px;
  box-shadow: 0 6px 16px rgba(232, 64, 42, 0.28);
}
.mo-primary:hover { background: #D0322A; }
.mo-outline {
  display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid #DCE1E9; color: var(--ink);
  font-family: "Poppins", sans-serif; font-weight: 600; font-size: 13.5px; padding: 10px 18px; border-radius: 10px;
}
.mo-outline:hover { border-color: var(--ink); }

.mo-main { flex: 1; max-width: 90%; width: 100%; margin: 0 auto; padding: 26px 32px 56px; }

/* platform + status pills */
.mo-plat { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.mo-plat.ios { color: #fff; background: #16273F; }
.mo-plat.android { color: #1F7A44; background: #E6F4EA; border: 1px solid #C6E7D2; }
.mo-status { display: inline-flex; align-items: center; font-family: "Poppins", sans-serif; font-weight: 700; font-size: 12.5px; padding: 6px 13px; border-radius: 999px; white-space: nowrap; }
.mo-status.red { color: #D14545; background: #FCECEC; border: 1px solid #F5D5D5; }
.mo-status.amber { color: #B5772E; background: #FCF6E4; border: 1px solid #F1E7C4; }
.mo-status.green { color: #1F8A5B; background: #E7F7F1; border: 1px solid #CDEDE1; }

/* ------------------------------- Page 1: Apps grid ------------------------------- */
.mo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; animation: moFadeUp 0.4s ease both; }
.mo-app {
  background: #fff; border: 1px solid var(--card-border); border-radius: 18px; box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  padding: 22px; cursor: pointer; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.mo-app:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: 0 10px 26px rgba(18, 38, 63, 0.09); }
.mo-app-top { display: flex; align-items: flex-start; gap: 14px; }
.mo-app-icon { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 15px; display: flex; align-items: center; justify-content: center; color: #fff; font-family: "Poppins", sans-serif; font-weight: 800; font-size: 24px; }
.mo-app-id { flex: 1; min-width: 0; }
.mo-app-name { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-app-bundle { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--muted3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-app-div { height: 1px; background: #F1F4F8; margin: 18px 0; }
.mo-app-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mo-app-scans { font-family: "Poppins", sans-serif; font-weight: 800; font-size: 22px; color: var(--ink); }
.mo-app-scans span { font-family: "Mulish", sans-serif; font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 5px; }
.mo-app-last { font-size: 12.5px; color: var(--muted3); margin-top: 2px; }
.mo-app-view { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 16px; font-family: "Poppins", sans-serif; font-weight: 600; font-size: 13.5px; color: var(--red); }

/* ------------------------------- Upload modal ------------------------------- */
.mo-overlay { position: fixed; inset: 0; background: rgba(16, 26, 40, 0.5); z-index: 55; display: flex; align-items: center; justify-content: center; padding: 24px; }
.mo-overlay[hidden] { display: none; }
.mo-modal { width: 100%; max-width: 520px; background: #fff; border-radius: 22px; box-shadow: 0 30px 80px rgba(16, 26, 40, 0.32); overflow: hidden; animation: moPopIn 0.28s ease both; }
.mo-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 24px 4px; }
.mo-modal-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 21px; color: var(--ink); margin: 0; }
.mo-modal-sub { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.mo-modal-close { width: 40px; height: 40px; border-radius: 12px; background: #F4F6FA; border: none; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.mo-modal-body { padding: 18px 24px 4px; }
.mo-drop { border: 2px dashed #DCE1E9; border-radius: 16px; padding: 26px 20px; text-align: center; background: #FBFCFE; cursor: pointer; }
.mo-drop.over { border-color: var(--red); background: #FEF4F2; }
.mo-drop-icon { width: 52px; height: 52px; border-radius: 14px; background: #FBE7E2; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.mo-drop-icon.ok { background: #E7F7F1; }
.mo-drop-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 15.5px; color: var(--ink); }
.mo-drop-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.mo-drop-sub .accent { color: var(--red); font-weight: 700; }
.mo-field { margin-top: 18px; }
.mo-label { display: block; font-family: "Poppins", sans-serif; font-weight: 600; font-size: 13px; color: var(--ink); margin-bottom: 8px; }
.mo-input { width: 100%; padding: 12px 14px; border: 1px solid #DCE1E9; border-radius: 12px; font-family: "Mulish", sans-serif; font-size: 14.5px; color: var(--ink); outline: none; background: #fff; }
.mo-input:focus { border-color: #B7C7DE; }
.mo-plat-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mo-plat-opt { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 12px; border: 1.5px solid #DCE1E9; border-radius: 12px; background: #fff; font-family: "Poppins", sans-serif; font-weight: 600; font-size: 14px; color: var(--ink); }
.mo-plat-opt .dot { width: 10px; height: 10px; border-radius: 50%; background: #C7CEDA; }
.mo-plat-opt.active { border-color: var(--red); background: #FEF4F2; }
.mo-plat-opt.active .dot { background: var(--red); }
.mo-modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 20px 24px; margin-top: 18px; background: #FBFCFE; border-top: 1px solid #F1F4F8; }
.mo-secondary { font-family: "Poppins", sans-serif; font-weight: 600; font-size: 14px; color: var(--muted2); background: #fff; border: 1.5px solid #DCE1E9; border-radius: 10px; padding: 11px 18px; }

/* ------------------------------- Page 2: Scans table ------------------------------- */
.mo-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.mo-identity .mo-app-icon { width: 64px; height: 64px; border-radius: 16px; font-size: 28px; }
.mo-identity-name-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mo-identity-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 5px; }
.mo-identity-meta .mono { font-family: "JetBrains Mono", monospace; font-size: 12.5px; }
.mo-meta-dot { width: 4px; height: 4px; border-radius: 50%; background: #C7CEDA; }
.mo-section-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 20px; color: var(--ink); margin: 24px 0 16px; }

.mo-card { background: #fff; border: 1px solid var(--card-border); border-radius: 20px; box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05); overflow: hidden; animation: moFadeUp 0.4s ease both; }
.mo-scroll { overflow-x: auto; }
.mo-table { border-collapse: collapse; width: 100%; min-width: 940px; }
.mo-table thead tr { background: #F8FAFD; border-bottom: 1px solid var(--card-border); }
.mo-table th { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); text-align: left; padding: 16px 18px; }
.mo-table th:first-child { padding-left: 24px; }
.mo-table th.center { text-align: center; }
.mo-table th.right { text-align: right; padding-right: 24px; }
.mo-table tbody tr { border-bottom: 1px solid #F1F4F8; }
.mo-table tbody tr:last-child { border-bottom: none; }
.mo-table td { padding: 18px; }
.mo-table td:first-child { padding-left: 24px; }
.mo-table td.center { text-align: center; }
.mo-table td.right { text-align: right; padding-right: 24px; }
.mo-cell-strong { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 15.5px; color: var(--ink); }
.mo-cell-sub { font-size: 12.5px; color: var(--muted3); margin-top: 2px; }
.mo-cell-mid { font-family: "Poppins", sans-serif; font-weight: 600; font-size: 14px; color: var(--body); }
.mo-count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; font-family: "Poppins", sans-serif; font-weight: 700; font-size: 14px; border-radius: 999px; padding: 5px 12px; color: var(--ink); background: #EEF1F6; border: 1px solid #E0E5EE; }
.mo-count-pill.red { color: #D14545; background: #FCECEC; border-color: #F5D5D5; }

/* ------------------------------- Page 3: Scan results ------------------------------- */
.mo-sev-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; animation: moFadeUp 0.35s ease both; }
.mo-sev-tile { border-radius: 16px; padding: 18px 20px; border: 1px solid; }
.mo-sev-tile-label { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 14px; }
.mo-sev-tile-count { font-family: "Poppins", sans-serif; font-weight: 800; font-size: 34px; line-height: 1.1; margin-top: 6px; }

.mo-results-body { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 26px; align-items: start; }
.mo-issues-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.mo-issues-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 20px; color: var(--ink); margin: 0; }
.mo-seg { display: inline-flex; background: #F1F4F9; border: 1px solid #E5E9F0; border-radius: 11px; padding: 4px; gap: 3px; }
.mo-seg-btn { appearance: none; border: none; background: transparent; font-family: "Poppins", sans-serif; font-weight: 600; font-size: 13px; color: var(--muted2); padding: 8px 14px; border-radius: 8px; }
.mo-seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(18, 38, 63, 0.12); }

.mo-issues { display: flex; flex-direction: column; gap: 14px; animation: moFadeUp 0.35s ease both; }
.mo-issue { background: #fff; border: 1px solid var(--card-border); border-left: 4px solid #C7CEDA; border-radius: 14px; box-shadow: 0 3px 12px rgba(18, 38, 63, 0.045); padding: 18px 20px; }
.mo-issue-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mo-sev-chip { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 11.5px; padding: 4px 10px; border-radius: 999px; }
.mo-issue-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 15.5px; color: var(--ink); flex: 1; min-width: 0; }
.mo-issue-status { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 12px; padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.mo-issue-status.todo { color: #5B6675; background: #EEF1F6; border: 1px solid #E0E5EE; }
.mo-issue-status.progress { color: #B5772E; background: #FCF6E4; border: 1px solid #F1E7C4; }
.mo-issue-status.fixed { color: #1F8A5B; background: #E7F7F1; border: 1px solid #CDEDE1; }
.mo-issue-desc { font-size: 14px; line-height: 1.55; color: var(--muted2); margin: 10px 0 0; }

/* phone mock */
.mo-phone-col { position: sticky; top: 96px; }
.mo-phone-card { background: #fff; border: 1px solid var(--card-border); border-radius: 20px; box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05); padding: 22px; text-align: center; }
.mo-phone-label { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 16px; }
.mo-phone { width: 262px; height: 540px; margin: 0 auto; background: #12141A; border-radius: 44px; padding: 11px; box-shadow: 0 22px 48px rgba(16, 26, 40, 0.34), inset 0 0 0 2px rgba(255,255,255,0.06); position: relative; }
.mo-screen { width: 100%; height: 100%; background: #EEF1F6; border-radius: 34px; overflow: hidden; position: relative; display: flex; flex-direction: column; }
.mo-island { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 92px; height: 26px; background: #12141A; border-radius: 999px; z-index: 2; }
.mo-statusbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px 0; font-family: "Poppins", sans-serif; font-weight: 700; font-size: 13px; color: #16273F; }
.mo-batt { width: 22px; height: 11px; border: 1.5px solid #16273F; border-radius: 3px; position: relative; }
.mo-batt::after { content: ""; position: absolute; inset: 1.5px; width: 70%; background: #16273F; border-radius: 1px; }
.mo-capture { flex: 1; margin: 16px; border-radius: 18px; background: repeating-linear-gradient(45deg, #E2E7EF, #E2E7EF 10px, #EEF1F6 10px, #EEF1F6 20px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.mo-capture-tile { width: 54px; height: 54px; border-radius: 14px; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(18,38,63,0.1); }
.mo-capture-cap { font-family: "JetBrains Mono", monospace; font-size: 11px; color: #7A8798; max-width: 160px; line-height: 1.5; }
.mo-phone-note { font-size: 12.5px; color: var(--muted3); margin-top: 16px; }

/* ------------------------------- Responsive ------------------------------- */
@media (max-width: 980px) {
  .mo-results-body { grid-template-columns: 1fr; }
  .mo-phone-col { position: static; }
  .mo-sev-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .mo-hero-inner, .mo-main { padding-left: 20px; padding-right: 20px; }
  .mo-sev-grid { grid-template-columns: 1fr; }
}

/* ---- API-wired states: empty / error / progress / target / screenshot overlay ---- */
.mo-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px; padding: 40px 24px; color: #5B6675; }
.mo-empty-title { font-weight: 700; color: #16273F; font-size: 16px; }
.mo-empty-sub { font-size: 13.5px; color: #6B7684; max-width: 420px; }
.mo-error { font-size: 13px; color: #C0392B; margin: 11px 0 0; }
.mo-issue-target { font-size: 12.5px; color: #5B6675; margin: 2px 0 0; word-break: break-all; }

.mo-spinner { width: 34px; height: 34px; border-radius: 50%; margin: 0 auto;
  border: 3px solid #E2E8F2; border-top-color: #3C7CE0; animation: mo-spin 0.8s linear infinite; }
@keyframes mo-spin { to { transform: rotate(360deg); } }

.mo-shot { position: relative; display: inline-block; line-height: 0; max-width: 300px; width: 100%;
  border-radius: 14px; overflow: hidden; border: 1px solid #E2E8F2; background: #F4F6FB; }
.mo-shot img { display: block; width: 100%; height: auto; }
/* Overlay layer sits exactly over the image; boxes are positioned in % of the
   screenshot's native size, so they track the image at any rendered width. */
.mo-shot-boxes { position: absolute; inset: 0; pointer-events: none; }
.mo-shot-box { position: absolute; box-sizing: border-box; border: 2px solid #D14545;
  border-radius: 3px; background: rgba(209,69,69,0.10); opacity: 0.55;
  transition: opacity 0.12s, background 0.12s, box-shadow 0.12s; }
.mo-shot-box.hi { opacity: 1; background: rgba(209,69,69,0.22); box-shadow: 0 0 0 2px rgba(209,69,69,0.45); }
.mo-issue { cursor: pointer; }
