/* Redact PDF — workspace styles (uses theme vars from style.css) */
.rd-wrap { max-width: 860px; margin: 0 auto; padding: 56px 22px 90px; }
.rd-head { text-align: center; margin-bottom: 28px; }
.rd-head .eyebrow { margin-bottom: 16px; }
.rd-head h1 { font-size: clamp(2.2rem, 6vw, 3.2rem); }
.rd-head p { color: var(--txt2); margin-top: 12px; font-weight: 400; }
.rd-stage { animation: fadeUp .4s cubic-bezier(.22,1,.36,1) both; }
.hidden { display: none !important; }

/* when the editor is open, go full-bleed and hide the marketing header */
.rd-wrap.editing { max-width: 100%; padding: 0; }
.rd-wrap.editing .rd-head { display: none; }

/* dropzone */
.rd-drop { position: relative; display: block; max-width: 560px; margin: 0 auto; text-align: center; cursor: pointer; padding: 50px 22px; border: 1.5px dashed var(--line2); border-radius: var(--r-lg); background: var(--card); transition: all .25s; }
.rd-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rd-drop:hover, .rd-drop.drag { border-color: var(--lime); background: rgba(194,240,74,0.04); }
.rd-drop-ic { width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 16px; display: grid; place-items: center; background: var(--lime); color: #0a0b0d; transition: transform .25s; }
.rd-drop:hover .rd-drop-ic { transform: translateY(-4px); }
.rd-drop .t { font-size: 1.2rem; font-weight: 700; }
.rd-drop .s { font-family: 'JetBrains Mono', monospace; font-size: .76rem; color: var(--txt3); margin-top: 6px; }
.rd-drop .s strong { color: var(--lime); }

/* ============ workspace shell: rail | main | panel ============ */
.rd-shell { display: grid; grid-template-columns: 128px 1fr 340px; height: calc(100vh - 72px); min-height: 540px; background: var(--bg); }

/* left rail: page thumbnails */
.rd-rail { overflow-y: auto; padding: 16px 10px; border-right: 1px solid var(--line2); background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.rd-thumb { position: relative; display: block; width: 100%; padding: 0; border: 2px solid transparent; border-radius: 8px; background: var(--card); cursor: pointer; overflow: hidden; transition: border-color .15s, transform .1s; }
.rd-thumb:hover { transform: translateY(-1px); }
.rd-thumb img { display: block; width: 100%; height: auto; }
.rd-thumb span { position: absolute; bottom: 4px; right: 5px; font-family: 'JetBrains Mono', monospace; font-size: .58rem; color: var(--txt3); background: var(--surface); padding: 1px 5px; border-radius: 5px; }
.rd-thumb.sel { border-color: var(--lime); }
.rd-thumb.sel span { color: var(--lime); }

/* center: toolbar + canvas */
.rd-main { display: flex; flex-direction: column; min-width: 0; }
.rd-bar { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line2); background: var(--surface); position: relative; }
.rd-tool { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid transparent; border-radius: 10px; background: none; color: var(--txt2); cursor: pointer; transition: all .15s; }
.rd-tool:hover { background: var(--card); color: var(--txt); }
.rd-tool.sel { background: rgba(194,240,74,0.12); color: var(--lime); border-color: rgba(194,240,74,0.4); }
.rd-tool-l { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: .85rem; }
.rd-count-badge { margin-left: auto; min-width: 26px; height: 26px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 100px; background: var(--lime); color: #0a0b0d; font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: .78rem; box-shadow: 0 0 16px -4px var(--lime); }

.rd-canvas-area { flex: 1; overflow-y: auto; padding: 28px 20px 60px; background: var(--bg); }
.rd-pages { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.rd-pages.rd-pan .rd-canvas { cursor: grab; }
.rd-page-wrap { width: 100%; max-width: 620px; }
.rd-page-label { font-family: 'JetBrains Mono', monospace; font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--txt3); margin-bottom: 8px; }
.rd-canvas { position: relative; width: 100%; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: #fff; touch-action: none; cursor: crosshair; box-shadow: var(--shadow); }
.rd-canvas img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }
.rd-layer { position: absolute; inset: 0; }
.rd-box { position: absolute; background: #111; border: 1px solid #000; cursor: move; }
.rd-box.white { background: #fff; border: 1px dashed #888; }
.rd-box .rd-del { position: absolute; top: -10px; right: -10px; width: 19px; height: 19px; border-radius: 50%; border: none; background: #e23b3b; color: #fff; font-size: .65rem; cursor: pointer; display: none; place-items: center; z-index: 5; }
.rd-box.sel-on { outline: 2px solid var(--lime); outline-offset: 1px; }
.rd-box.sel-on .rd-del { display: grid; }
.rd-box-lbl { position: absolute; inset: 0; display: grid; place-items: center; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: .6rem; letter-spacing: .08em; color: #fff; pointer-events: none; text-transform: uppercase; overflow: hidden; }
.rd-box.white .rd-box-lbl { color: #000; }
.rd-rs { position: absolute; width: 12px; height: 12px; background: var(--lime); border: 1.5px solid #0a0b0d; border-radius: 2px; display: none; z-index: 6; }
.rd-box.sel-on .rd-rs { display: block; }
.rd-rs-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.rd-rs-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.rd-rs-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.rd-rs-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.rd-fallback { text-align: center; font-family: 'JetBrains Mono', monospace; font-size: .72rem; color: var(--txt3); margin: 20px 0; }

/* right panel: find & redact */
.rd-panel { overflow-y: auto; padding: 22px 20px 30px; border-left: 1px solid var(--line2); background: var(--surface); }
.rd-panel-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 18px; }
.rd-find-row { display: flex; gap: 8px; align-items: center; }
.rd-search-input { flex: 1; min-width: 0; padding: 12px 14px; background: var(--card); border: 1.5px solid var(--line2); border-radius: 12px; color: var(--txt); font-size: .9rem; outline: none; }
.rd-search-input:focus { border-color: var(--lime); }
.rd-rx { display: flex; align-items: center; gap: 5px; font-family: 'JetBrains Mono', monospace; font-size: .82rem; color: var(--txt3); cursor: pointer; }
.rd-rx input { accent-color: var(--lime); }
.rd-find { width: 100%; margin-top: 10px; padding: 12px; border: none; border-radius: 12px; background: var(--lime); color: #0a0b0d; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: .88rem; cursor: pointer; transition: filter .15s; }
.rd-find:hover { filter: brightness(1.05); }

.rd-panel-label { font-family: 'JetBrains Mono', monospace; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--txt3); margin: 22px 0 11px; }
.rd-cards { display: flex; flex-direction: column; gap: 9px; }
.rd-card { display: flex; align-items: center; gap: 13px; width: 100%; padding: 14px 15px; border: 1.5px solid var(--line2); border-radius: 14px; background: var(--card); color: var(--txt); cursor: pointer; text-align: left; transition: all .15s; }
.rd-card:hover { border-color: var(--lime); transform: translateX(2px); }
.rd-card.busy { opacity: .55; pointer-events: none; }
.rd-card-ic { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--surface2); color: var(--lime); }
.rd-card-t { display: flex; flex-direction: column; font-weight: 700; font-size: .96rem; line-height: 1.2; }
.rd-card-t small { font-weight: 400; font-size: .72rem; color: var(--txt3); margin-top: 3px; }
.rd-search-status { font-family: 'JetBrains Mono', monospace; font-size: .7rem; color: var(--lime); margin-top: 12px; min-height: 14px; }

/* box style + options */
.rd-opts { background: var(--card); border: 1px solid var(--line2); border-radius: 14px; padding: 13px 15px; display: flex; flex-direction: column; gap: 12px; }
.rd-fill { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.rd-swatch { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line2); cursor: pointer; padding: 0; }
.rd-swatch.sel { border-color: var(--lime); }
.rd-swatch-pick { position: relative; display: inline-grid; place-items: center; overflow: hidden;
  background: conic-gradient(from 0deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.rd-swatch-pick input[type=color] { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); border: none; padding: 0; background: none; cursor: pointer; opacity: 0; }
.rd-labtoggle { display: flex; align-items: center; gap: 6px; font-family: 'JetBrains Mono', monospace; font-size: .72rem; color: var(--txt3); cursor: pointer; }
.rd-labtoggle input { accent-color: var(--lime); }
.rd-labtext { width: 100px; padding: 6px 10px; background: var(--surface); border: 1.5px solid var(--line2); border-radius: 8px; color: var(--txt); font-size: .76rem; outline: none; }
.rd-labtext:focus { border-color: var(--lime); }
.rd-labtext:disabled { opacity: .45; cursor: not-allowed; }
.rd-scrub { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--txt2); cursor: pointer; }
.rd-scrub input { width: 16px; height: 16px; accent-color: var(--lime); }

.rd-panel-actions { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.rd-undo { padding: 9px; border: 1px dashed var(--line2); border-radius: 10px; background: none; color: var(--txt2); font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 600; font-size: .8rem; cursor: pointer; }
.rd-undo:hover { border-color: var(--lime); color: var(--lime); }
.rd-back { background: none; border: none; color: var(--txt3); font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 600; font-size: .82rem; cursor: pointer; padding: 6px; }
.rd-back:hover { color: var(--txt); }

/* loader / result */
.rd-scan-box, .rd-result-card { text-align: center; padding: 44px 26px; max-width: 460px; margin: 60px auto; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.rd-spin { width: 52px; height: 52px; margin: 0 auto 22px; border: 2px solid var(--surface2); border-top-color: var(--lime); border-radius: 50%; animation: spin .8s linear infinite; box-shadow: 0 0 20px -6px var(--lime); }
.rd-scan-box h3 { font-size: 1.3rem; } .rd-scan-box p { color: var(--txt3); margin-top: 10px; font-size: .8rem; }
.rd-check { width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--lime); color: #0a0b0d; box-shadow: 0 0 36px -6px rgba(194,240,74,0.7); }
.rd-result-card h3 { font-size: 1.5rem; } .rd-result-card > p { color: var(--txt2); margin-top: 8px; font-weight: 400; }
.rd-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 22px; }
.rd-stat { padding: 15px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.rd-stat.hi { border-color: rgba(194,240,74,0.4); background: rgba(194,240,74,0.06); }
.rd-stat .l { font-family: 'JetBrains Mono', monospace; font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; color: var(--txt3); margin-bottom: 5px; }
.rd-stat .v { font-weight: 800; font-size: 1.05rem; } .rd-stat .v.g { color: var(--lime); }

/* ============================================================
   MOBILE CONTROLS (hidden on desktop) — mirrors Edit PDF
   ============================================================ */
.rd-mobtoggle {
  display: none; position: fixed; bottom: 18px; right: 16px; z-index: 78;
  align-items: center; gap: 7px; padding: 12px 18px; border: none; border-radius: 100px;
  background: var(--lime); color: #0a0b0d; font-family: 'Plus Jakarta Sans',sans-serif;
  font-weight: 800; font-size: .85rem; cursor: pointer; box-shadow: var(--shadow-lg);
}
.rd-mobtoggle .ic { font-size: 1rem; line-height: 1; }
.rd-sheet-backdrop {
  display: none; position: fixed; inset: 0; z-index: 69;
  background: rgba(4,5,7,0.5); backdrop-filter: blur(2px);
}
.rd-sheet-backdrop.show { display: block; }
.rd-sheet-handle { display: none; }

/* ============ responsive ============ */
/* Tablet: tighten the columns */
@media (max-width: 1080px){
  .rd-shell { grid-template-columns: 104px 1fr 300px; }
}

/* Small tablet: drop the right panel to a narrower width, keep rail */
@media (max-width: 900px){
  .rd-shell { grid-template-columns: 92px 1fr 270px; }
  .rd-card-ic { flex-basis: 32px; height: 32px; }
  .rd-card-t { font-size: .9rem; }
}

/* Phone: single column; rail hidden, panel becomes a slide-up sheet */
@media (max-width: 720px){
  /* lock the workspace to the viewport so the CANVAS scrolls, not the window */
  .rd-shell { grid-template-columns: 1fr; height: calc(100vh - 64px); min-height: 0; overflow: hidden; }
  .rd-rail { display: none; }
  .rd-main { min-height: 0; height: 100%; position: relative; }
  .rd-bar { flex-shrink: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .rd-bar::-webkit-scrollbar { height: 0; }
  .rd-tool { flex-shrink: 0; }
  .rd-canvas-area { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 12px 90px; }

  /* show the floating toggle, frozen at the bottom-right of the page viewport */
  .rd-mobtoggle { display: inline-flex; position: absolute; bottom: 30px; right: 18px; top: auto; }

  /* right panel -> bottom sheet */
  .rd-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; max-height: 74vh; z-index: 70;
    padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
    border-left: none; border-top: 1px solid var(--line2);
    border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px -10px rgba(0,0,0,0.6);
    transform: translateY(110%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
  }
  .rd-panel.open { transform: translateY(0); }
  .rd-sheet-handle {
    display: block; width: 42px; height: 4px; margin: 4px auto 12px;
    background: var(--line2); border-radius: 100px;
  }
  .rd-panel-title { font-size: 1.15rem; margin-bottom: 14px; }
}

@media (max-width: 520px){
  .rd-tool-l { display: none; }
  .rd-tool { padding: 8px 10px; }
}
