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

* { box-sizing: border-box; }

:root {
  --ink: #16273F;
  --body: #33404F;
  --body2: #2B3644;
  --muted: #8791A0;
  --muted2: #5B6675;
  --muted3: #98A2B0;
  --card-border: #EAEDF3;
  --panel-border: #E7EBF1;
  --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; }

/* 90% width to match the sibling redesigned apps. */
.app-shell .rm-header-inner,
.app-shell .rm-footer-inner { max-width: 90%; }

@keyframes ctFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ------------------------------- Hero ------------------------------- */
.ct-hero-inner { max-width: 90%; margin: 0 auto; padding: 34px 32px 4px; }
.ct-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;
}
.ct-url { font-size: 15.5px; color: var(--muted2); padding-bottom: 8px; }

/* ------------------------------- Tabs ------------------------------- */
.ct-tabs {
  background: #fff;
  border-bottom: 1px solid var(--panel-border);
  box-shadow: 0 1px 2px rgba(18, 38, 63, 0.03);
  margin-top: 14px;
}
.ct-tabs-inner { max-width: 90%; margin: 0 auto; padding: 0 32px; display: flex; gap: 38px; }
.ct-tab {
  appearance: none;
  background: none;
  border: none;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--muted);
  padding: 18px 2px;
  margin: 0;
  border-bottom: 3px solid transparent;
}
.ct-tab.active { font-weight: 700; color: var(--ink); border-bottom-color: var(--red); }

/* ------------------------------- Main ------------------------------- */
.ct-main { flex: 1; max-width: 90%; width: 100%; margin: 0 auto; padding: 32px 32px 56px; }
.ct-panel { animation: ctFadeUp 0.35s ease both; }

/* ------------------------------- Level pills ------------------------------- */
.ct-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  padding: 5px 13px;
  border-radius: 999px;
  white-space: nowrap;
}
.ct-pill.easy { color: #1F8A5B; background: #E7F7F1; border: 1px solid #CDEDE1; }
.ct-pill.intermediate { color: #B5772E; background: #FCF6E4; border: 1px solid #F1E7C4; }
.ct-pill.advanced { color: #D14545; background: #FCECEC; border: 1px solid #F5D5D5; }
.ct-pill.clean { color: #1F8A5B; background: #E7F7F1; border: 1px solid #CDEDE1; }
.ct-pill.issues { color: #D14545; background: #FCECEC; border: 1px solid #F5D5D5; }

/* ------------------------------- Pages: toolbar ------------------------------- */
.ct-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.ct-count { font-size: 14px; color: var(--muted); font-weight: 600; }
.ct-filter-groups { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ct-filter-group { display: flex; align-items: center; gap: 8px; }
.ct-filter-label { font-size: 12.5px; font-weight: 700; color: var(--muted3); text-transform: uppercase; letter-spacing: 0.4px; }
.ct-filter-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ct-filter {
  appearance: none;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  border: 1px solid #C9D2DE;
}
.ct-filter.active { background: #132638; color: #fff; border-color: #132638; }
.ct-filter-divider { width: 1px; height: 28px; background: #E2E6ED; }

/* ------------------------------- Pages: table ------------------------------- */
.ct-table {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  overflow: hidden;
}
.ct-row {
  display: grid;
  grid-template-columns: 2.2fr 1.2fr 0.8fr 1.3fr 1.1fr 0.9fr;
  gap: 16px;
  align-items: center;
}
.ct-thead { padding: 16px 26px; background: #F4F6FA; border-bottom: 1px solid var(--card-border); }
.ct-thead span { font-family: "Poppins", sans-serif; font-weight: 600; font-size: 13.5px; color: var(--muted2); }
.ct-thead .ct-th-actions { text-align: right; }
.ct-tbody-row { padding: 18px 26px; border-bottom: 1px solid #F1F4F8; }
.ct-tbody-row:last-child { border-bottom: none; }
.ct-page-cell { min-width: 0; }
.ct-page-title {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ct-page-url { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-words { font-size: 14.5px; color: var(--body); }
.ct-scanned { font-size: 13.5px; color: var(--muted2); }
.ct-actions { text-align: right; }
.ct-view {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 10px;
  text-decoration: none;
}
.ct-view:hover { background: var(--ink); color: #fff; }
.ct-view svg { stroke: currentColor; }
.ct-empty-row { padding: 40px; text-align: center; font-size: 15px; color: var(--muted); }

/* ------------------------------- Editor ------------------------------- */
.ct-editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.ct-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  padding: 22px;
}
.ct-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ct-card-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); margin: 0; }
.ct-clear { background: none; border: none; font-family: "Mulish", sans-serif; font-weight: 600; font-size: 13.5px; color: var(--muted); padding: 0; }
.ct-clear:hover { color: var(--ink); }
.ct-textarea {
  width: 100%;
  min-height: 440px;
  resize: vertical;
  border: 1px solid #DCE1E9;
  border-radius: 12px;
  padding: 18px 20px;
  font-family: "Mulish", sans-serif;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--body2);
  background: #FCFDFE;
}
.ct-textarea:focus { outline: none; border-color: #B7C7DE; }

.ct-side { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 20px; }
.ct-card.pad24 { padding: 24px; }
.ct-score-empty { text-align: center; padding: 24px 8px; color: var(--muted3); font-size: 14px; }
.ct-score-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.ct-score-value { font-family: "Poppins", sans-serif; font-weight: 800; font-size: 30px; color: var(--ink); line-height: 1; }
.ct-score-max { font-size: 12.5px; color: var(--muted3); }
.ct-segbar { display: flex; gap: 4px; margin-bottom: 20px; }
.ct-seg { flex: 1; height: 7px; border-radius: 999px; background: #EDF0F5; }
.ct-seg.on-advanced { background: #D14545; }
.ct-seg.on-intermediate { background: #E0A21E; }
.ct-seg.on-easy { background: #1FA97A; }
.ct-metrics { display: flex; flex-direction: column; gap: 11px; }
.ct-metric { display: flex; align-items: center; justify-content: space-between; }
.ct-metric-label { font-size: 13.5px; color: var(--muted); }
.ct-metric-value { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 14px; color: var(--ink); }

.ct-target-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 15px; color: var(--ink); margin: 0 0 4px; }
.ct-target-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.ct-segmented { display: flex; background: #F1F4F9; border: 1px solid #E5E9F0; border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 18px; }
.ct-segment {
  flex: 1;
  appearance: none;
  border: none;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 6px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted2);
}
.ct-segment.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(18, 38, 63, 0.12); }
.ct-rewrite-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  background: var(--red);
  border: none;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 6px 16px rgba(232, 64, 42, 0.28);
}
.ct-rewrite-btn:hover { background: #D0322A; }
.ct-rewrite-btn:disabled { opacity: 0.65; cursor: default; }

/* ------------------------------- Rewrite result ------------------------------- */
.ct-rewrite {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  padding: 24px 26px;
  margin-top: 24px;
  animation: ctFadeUp 0.3s ease both;
}
.ct-rewrite-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ct-rewrite-title-wrap { display: flex; align-items: center; gap: 12px; }
.ct-rewrite-avatar { width: 34px; height: 34px; border-radius: 50% 50% 50% 6px; background: var(--red); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ct-rewrite-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); margin: 0; }
.ct-rewrite-actions { display: flex; gap: 10px; }
.ct-rw-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 15px;
  border-radius: 10px;
}
.ct-rw-btn.copy { background: #fff; border: 1px solid #DCE1E9; color: var(--ink); }
.ct-rw-btn.copy:hover { border-color: var(--ink); }
.ct-rw-btn.copy.copied { color: #1F8A5B; border-color: #CDEDE1; background: #E7F7F1; }
.ct-rw-btn.use { background: var(--ink); border: none; color: #fff; }
.ct-rewrite-body {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--body2);
  background: #FBFCFE;
  border: 1px solid #EEF1F6;
  border-radius: 12px;
  padding: 20px 22px;
  white-space: pre-wrap;
}

/* ------------------------------- Notice / empty ------------------------------- */
.ct-notice {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

/* ------------------------------- Responsive ------------------------------- */
@media (max-width: 1000px) {
  .ct-editor { grid-template-columns: 1fr; }
  .ct-side { position: static; }
  .ct-table { overflow-x: auto; }
  .ct-row { grid-template-columns: 2fr 1.1fr 0.7fr 1.2fr 1fr 0.8fr; min-width: 820px; }
}
@media (max-width: 640px) {
  .ct-hero-inner, .ct-tabs-inner, .ct-main { padding-left: 20px; padding-right: 20px; }
}

/* ============================================================
   Page Detail — per-page content-quality report (page.html)
   ============================================================ */
.pd-hero-inner { max-width: 90%; margin: 0 auto; padding: 28px 32px 4px; }
.pd-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 16px;
  text-decoration: none;
}
.pd-back:hover { color: var(--ink); }
.pd-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.pd-head-copy { min-width: 0; }
.pd-title {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin: 0 0 6px;
}
.pd-url { font-size: 15px; color: #2F6FE0; font-weight: 600; text-decoration: none; }
.pd-url:hover { text-decoration: underline; }
.pd-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 11px;
  text-decoration: none;
}
.pd-live:hover { background: var(--ink); color: #fff; }
.pd-live:hover svg path { stroke: #fff; }

.pd-main { flex: 1; max-width: 90%; width: 100%; margin: 0 auto; padding: 26px 32px 56px; }
.pd-panel { animation: ctFadeUp 0.35s ease both; }

/* summary */
.pd-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-bottom: 28px; }
.pd-stat {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  padding: 22px;
}
.pd-stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pd-stat-label { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.pd-stat-num { font-family: "Poppins", sans-serif; font-weight: 800; font-size: 32px; line-height: 1; letter-spacing: -0.5px; }
.pd-stat-sub { font-size: 12.5px; color: var(--muted3); margin-top: 8px; }
.pd-stat .ct-pill + .pd-stat-sub { margin-top: 9px; }
.pd-stat-icon { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }

/* content blocks */
.pd-blocks-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 20px; color: var(--ink); margin: 0 0 16px; }
.pd-blocks { display: flex; flex-direction: column; gap: 16px; }
.pd-block {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  padding: 22px 24px;
}
.pd-block-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.pd-block-head-left { display: flex; align-items: center; gap: 10px; }
.pd-chip {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted2);
  background: #F1F4F9;
  border: 1px solid #E5E9F0;
  border-radius: 7px;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.pd-issue-note { font-size: 13px; color: var(--muted3); }
.pd-block-meta { display: flex; align-items: center; gap: 12px; }
.pd-words { font-size: 12.5px; color: var(--muted3); }
.pd-copy { margin: 0; font-size: 16px; line-height: 1.85; color: var(--body2); }
.pd-run.spelling {
  background: #FCECEC;
  color: #B93636;
  border-radius: 3px;
  padding: 0 2px;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: #D14545;
  text-underline-offset: 3px;
  cursor: help;
}
.pd-run.grammar {
  background: #FCF6E4;
  color: #8A6410;
  border-radius: 3px;
  padding: 0 2px;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: #E0A21E;
  text-underline-offset: 3px;
  cursor: help;
}

.pd-block-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid #F1F4F8; }
.pd-target { display: flex; align-items: center; gap: 10px; }
.pd-target-label { font-size: 12.5px; font-weight: 700; color: var(--muted3); text-transform: uppercase; letter-spacing: 0.4px; }
.pd-segmented { display: flex; background: #F1F4F9; border: 1px solid #E5E9F0; border-radius: 10px; padding: 3px; gap: 3px; }
.pd-segment {
  appearance: none;
  border: none;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted2);
}
.pd-segment.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(18, 38, 63, 0.12); }
.pd-fix {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: var(--red);
  border: none;
  border-radius: 11px;
  padding: 11px 18px;
  box-shadow: 0 6px 16px rgba(232, 64, 42, 0.26);
}
.pd-fix:hover { background: #D0322A; }
.pd-fix:disabled { opacity: 0.65; cursor: default; }

/* rewrite result */
.pd-result { margin-top: 16px; background: #FBFCFE; border: 1px solid #EEF1F6; border-radius: 12px; padding: 18px 20px; animation: ctFadeUp 0.3s ease both; }
.pd-result-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.pd-result-head-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pd-result-avatar { width: 28px; height: 28px; border-radius: 50% 50% 50% 5px; background: var(--red); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.pd-result-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 14px; color: var(--ink); }
.pd-fixed-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #E7F7F1;
  border: 1px solid #CDEDE1;
  color: #1F8A5B;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}
.pd-copy-btn { background: #fff; border: 1px solid #DCE1E9; color: var(--ink); font-family: "Poppins", sans-serif; font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: 9px; }
.pd-copy-btn:hover { border-color: var(--ink); }
.pd-copy-btn.copied { color: #1F8A5B; border-color: #CDEDE1; background: #E7F7F1; }
.pd-result-body { margin: 0; font-size: 15.5px; line-height: 1.8; color: var(--body2); }

.pd-notice {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(18, 38, 63, 0.05);
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

@media (max-width: 1000px) {
  .pd-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .pd-hero-inner, .pd-main { padding-left: 20px; padding-right: 20px; }
  .pd-summary { grid-template-columns: 1fr; }
}
