/* Clean, light, roomy. Deliberately a single light theme — the document being
   proofread is white paper, and a dark chrome around white pages reads badly. */
:root {
  --bg:        #f4f6f8;
  --panel:     #ffffff;
  --fg:        #1b1f24;
  --sub:       #6b7684;
  --faint:     #9aa4b0;
  --line:      #e6eaee;
  --line-soft: #f0f3f5;

  --accent:    #11a683;
  --accent-dk: #0b7a61;
  --accent-fg: #ffffff;
  --accent-wash: #e9f7f3;

  --spelling:   #e5484d;
  --grammar:    #f0932b;
  --style:      #3b82f6;
  --typography: #8b5cf6;

  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow-md: 0 1px 3px rgba(16,24,40,.07), 0 6px 16px rgba(16,24,40,.06);
  --shadow-lg: 0 2px 6px rgba(16,24,40,.08), 0 16px 40px rgba(16,24,40,.10);
  --radius: 10px;
}

* { box-sizing: border-box; }
/* our display:flex rules would otherwise beat the UA's [hidden] rule */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--accent-wash); }

/* ================================================================ topbar == */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 58px; flex: none;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15px; letter-spacing: -.015em;
}
.mark {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 800;
  box-shadow: 0 1px 3px rgba(17,166,131,.4);
}
.grow { flex: 1; }
.doc { display: flex; flex-direction: column; line-height: 1.3; min-width: 0;
       padding-left: 16px; border-left: 1px solid var(--line); }
.doc strong { font-weight: 600; font-size: 13.5px; overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; }
.muted { color: var(--faint); font-size: 11.5px; }
.controls { display: flex; gap: 8px; align-items: center; }

.btn {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 7px 13px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  white-space: nowrap; transition: background .13s, border-color .13s, box-shadow .13s;
}
.btn:hover:not(:disabled) { background: var(--bg); border-color: #d8dee5; }
.btn:disabled { opacity: .42; cursor: default; }
.btn.primary {
  background: var(--accent); color: var(--accent-fg); border-color: transparent;
  box-shadow: 0 1px 2px rgba(17,166,131,.32);
}
.btn.primary:hover:not(:disabled) { background: var(--accent-dk); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--faint);
             font-size: 15px; padding: 6px 9px; }
.btn.ghost:hover { background: var(--bg); color: var(--fg); }
.btn.big { padding: 12px 26px; font-size: 14.5px; border-radius: 9px; }
select {
  font: inherit; font-size: 13px; padding: 7px 9px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  cursor: pointer;
}

/* ============================================================== progress == */
.progress { height: 2px; background: transparent; flex: none; }
.progress .bar {
  height: 100%; width: 0; background: var(--accent);
  transition: width .3s ease; border-radius: 0 2px 2px 0;
}

/* ================================================================== main == */
main { flex: 1; min-height: 0; display: flex; }

/* ------------------------------------------------------------- dropzone -- */
.dropzone { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.dropInner {
  background: var(--panel);
  border: 1.5px dashed #d5dce3; border-radius: 16px;
  padding: 56px 52px; text-align: center; max-width: 580px;
  box-shadow: var(--shadow-sm); transition: .16s;
}
.dropzone.hot .dropInner {
  border-color: var(--accent); background: var(--accent-wash);
  transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.dropIcon { width: 56px; height: 56px; color: #c3ccd6; margin-bottom: 16px; }
.dropzone h1 { font-size: 24px; margin: 0 0 10px; letter-spacing: -.03em; font-weight: 700; }
.dropzone p { color: var(--sub); margin: 0 0 24px; font-size: 14px; }
.formats, .engineline { font-size: 12px; margin: 20px 0 0 !important; color: var(--faint) !important; }
.engineline { cursor: pointer; }
.engineline:hover { color: var(--accent-dk) !important; }

/* --------------------------------------------------------------- viewer -- */
.viewer { flex: 1; display: flex; min-height: 0; }
.pages {
  flex: 1; overflow: auto; padding: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
}
.page {
  position: relative; background: #fff; border-radius: 4px; flex: none;
  box-shadow: var(--shadow-md);
}
.page canvas { display: block; border-radius: 4px; }
.page .pageNo {
  position: absolute; top: 100%; left: 0; right: 0; text-align: center;
  color: var(--faint); font-size: 11px; padding-top: 8px; letter-spacing: .02em;
}

.hl {
  position: absolute; cursor: pointer; border-radius: 2px;
  border-bottom: 2px solid currentColor;
  background: color-mix(in srgb, currentColor 15%, transparent);
  transition: background .12s;
}
.hl:hover { background: color-mix(in srgb, currentColor 32%, transparent); }
.hl.active {
  background: color-mix(in srgb, currentColor 38%, transparent);
  outline: 2px solid currentColor; outline-offset: 1px;
}
.hl.spelling { color: var(--spelling); } .hl.grammar { color: var(--grammar); }
.hl.style { color: var(--style); }      .hl.typography { color: var(--typography); }

.textdoc {
  background: var(--panel); box-shadow: var(--shadow-md); border-radius: 8px;
  padding: 52px 60px; max-width: 800px; width: 100%;
  white-space: pre-wrap; word-wrap: break-word;
  font: 14.5px/1.85 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.textdoc mark {
  background: color-mix(in srgb, currentColor 18%, transparent);
  color: inherit; border-bottom: 2px solid; border-radius: 2px; cursor: pointer;
}
.textdoc mark.spelling { color: var(--spelling); } .textdoc mark.grammar { color: var(--grammar); }
.textdoc mark.style { color: var(--style); }      .textdoc mark.typography { color: var(--typography); }
.textdoc mark.active { background: color-mix(in srgb, currentColor 40%, transparent); }

/* ================================================================ sidebar = */
.sidebar {
  width: 384px; flex: none; background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}

/* score card ------------------------------------------------------------- */
.score {
  display: flex; align-items: center; gap: 15px;
  padding: 18px 18px 16px; border-bottom: 1px solid var(--line-soft);
}
.ring { position: relative; width: 62px; height: 62px; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease, stroke .3s; }
.ring .num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 18px; font-weight: 700; letter-spacing: -.03em;
}
.scoreText { min-width: 0; }
.scoreText h3 { margin: 0 0 2px; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.scoreText p { margin: 0; font-size: 12px; color: var(--sub); }

/* filters ---------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 18px 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--sub);
  transition: .12s;
}
.chip::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; opacity: .35;
}
.chip[data-cat="all"]::before { display: none; }
.chip[data-cat="spelling"] { color: var(--spelling); }
.chip[data-cat="grammar"] { color: var(--grammar); }
.chip[data-cat="style"] { color: var(--style); }
.chip[data-cat="typography"] { color: var(--typography); }
.chip b { font-weight: 700; color: var(--faint); }
.chip:hover { border-color: #d3dae1; }
/* Each selected chip needs an explicit background: `background: currentColor`
   would resolve against this rule's own `color: #fff` and paint white-on-white. */
.chip.on { border-color: transparent; }
.chip.on::before { display: none; }
.chip.on, .chip.on b { color: #fff; }
.chip[data-cat="all"] { color: var(--fg); }
.chip[data-cat="all"].on      { background: var(--fg); }
.chip[data-cat="spelling"].on { background: var(--spelling); }
.chip[data-cat="grammar"].on  { background: var(--grammar); }
.chip[data-cat="style"].on    { background: var(--style); }
.chip[data-cat="typography"].on { background: var(--typography); }

/* bulk bar --------------------------------------------------------------- */
.bulk {
  display: flex; align-items: center; gap: 7px;
  padding: 0 18px 12px; border-bottom: 1px solid var(--line-soft);
}
.acceptedCount { font-size: 12px; color: var(--accent-dk); font-weight: 600; }
.mini {
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--sub);
}
.mini:hover { color: var(--fg); border-color: #d3dae1; background: var(--bg); }

/* issue cards ------------------------------------------------------------ */
.issues { overflow: auto; flex: 1; padding: 12px; }
.issue {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; margin-bottom: 9px; cursor: pointer;
  transition: box-shadow .14s, border-color .14s, transform .14s;
}
.issue:hover { box-shadow: var(--shadow-md); border-color: #dde3e9; transform: translateY(-1px); }
.issue.active { border-color: currentColor; box-shadow: var(--shadow-md); }
.issue.spelling { color: var(--spelling); } .issue.grammar { color: var(--grammar); }
.issue.style { color: var(--style); }      .issue.typography { color: var(--typography); }

.issue .head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.issue .cat {
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.issue .head::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.issue .pg { margin-left: auto; font-size: 11px; color: var(--faint); font-weight: 500; }
.issue .ctx { color: var(--fg); font-size: 13.5px; margin-bottom: 6px; line-height: 1.55; }
.issue .ctx s { text-decoration-color: currentColor; text-decoration-thickness: 2px; opacity: .75; }
.issue .ctx ins { text-decoration: none; font-weight: 700; color: var(--accent-dk); }
.issue .msg { color: var(--sub); font-size: 12.5px; line-height: 1.5; }

.alts { display: flex; flex-wrap: wrap; gap: 5px; margin: 9px 0 0; }
.alt {
  font: inherit; font-size: 11.5px; cursor: pointer; padding: 4px 9px;
  border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--sub);
}
.alt:hover { color: var(--fg); border-color: #d3dae1; }
.alt.on { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }

.acts { display: flex; gap: 7px; margin-top: 11px; }
.act {
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 6px 13px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel); color: var(--sub); transition: .12s;
}
.act.accept:hover { background: var(--accent); color: #fff; border-color: transparent; }
.act.dismiss:hover { border-color: var(--spelling); color: var(--spelling); }

.issue.accepted { background: var(--accent-wash); border-color: #bfe6db; }
.issue.accepted .act.accept { background: var(--accent); color: #fff; border-color: transparent; }
.issue.accepted .ctx s { opacity: .45; }
.issue.dismissed { opacity: .5; background: var(--bg); }
.issue.dismissed .ctx ins { text-decoration: line-through; }

.emptyState { padding: 48px 24px; text-align: center; color: var(--faint); font-size: 13px; }

/* --------------------------------------------------------------- scroll -- */
.issues::-webkit-scrollbar, .pages::-webkit-scrollbar { width: 10px; }
.issues::-webkit-scrollbar-thumb, .pages::-webkit-scrollbar-thumb {
  background: #d6dde4; border-radius: 6px; border: 3px solid transparent;
  background-clip: content-box;
}
.issues::-webkit-scrollbar-thumb:hover, .pages::-webkit-scrollbar-thumb:hover { background: #bcc6d0; background-clip: content-box; }

@media (max-width: 900px) {
  .sidebar { width: 320px; }
  .doc { display: none; }
}
