/* Dr. Kurita | Revisor Inteligente — same editorial system as drkurita.com.br */
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/manrope-var.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #f7f5f0;
  --bg-2: #efebe3;
  --surface: #ffffff;
  --text: #202126;
  --muted: #5d5a54;
  --faint: #8b867d;
  --line: rgba(32, 33, 38, 0.13);
  --line-strong: rgba(32, 33, 38, 0.26);
  --accent: #9d784c;
  --accent-ink: #7a5a35;
  --del: #a3412f;
  --del-bg: rgba(163, 65, 47, 0.09);
  --ins: #2f6b4f;
  --ins-bg: rgba(47, 107, 79, 0.11);
  --warn-bg: #f5ead6;
  --shadow: 0 24px 50px -30px rgba(32, 33, 38, 0.35);
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --doc: Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101114; --bg-2: #15171b; --surface: #1a1c20; --text: #f4f1eb; --muted: #aaa49a; --faint: #7d786f;
    --line: rgba(244, 241, 235, 0.1); --line-strong: rgba(244, 241, 235, 0.22); --accent: #c6a77b; --accent-ink: #d4b98f;
    --del: #e48b77; --del-bg: rgba(228, 139, 119, 0.12); --ins: #8fcfac; --ins-bg: rgba(143, 207, 172, 0.12);
    --warn-bg: rgba(198, 167, 123, 0.12); --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101114; --bg-2: #15171b; --surface: #1a1c20; --text: #f4f1eb; --muted: #aaa49a; --faint: #7d786f;
  --line: rgba(244, 241, 235, 0.1); --line-strong: rgba(244, 241, 235, 0.22); --accent: #c6a77b; --accent-ink: #d4b98f;
  --del: #e48b77; --del-bg: rgba(228, 139, 119, 0.12); --ins: #8fcfac; --ins-bg: rgba(143, 207, 172, 0.12);
  --warn-bg: rgba(198, 167, 123, 0.12); --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.08; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 1440px; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); height: 4rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: inherit; margin-right: auto; min-width: 0; }
.mark { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 1px solid var(--accent); border-radius: 50%; font-family: var(--serif); font-size: 1.2rem; color: var(--accent-ink); padding-top: 0.1em; }
.brand-txt { display: flex; align-items: baseline; gap: 0.6rem; min-width: 0; white-space: nowrap; }
.brand-name { font-family: var(--serif); font-size: 1.35rem; }
.brand-name em { color: var(--accent-ink); }
.brand-sep { color: var(--line-strong); }
.brand-app { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.top-ctl { display: flex; align-items: center; gap: 0.5rem; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.seg button { display: grid; place-items: center; min-width: 2.2rem; height: 2.2rem; padding: 0 0.6rem; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; transition: background-color 0.25s var(--ease), color 0.25s var(--ease); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg-text button { font-size: 0.85rem; font-weight: 600; padding: 0 0.9rem; }
.pill { height: 2.5rem; min-width: 2.5rem; padding: 0 0.9rem; border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; transition: border-color 0.25s var(--ease); }
.pill:hover { border-color: var(--accent); }
.user { display: flex; align-items: center; gap: 0.5rem; }
.user-email { font-size: 0.82rem; color: var(--muted); max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem; min-height: 2.9rem; padding: 0.7rem 1.3rem; border-radius: 999px; border: 1px solid transparent; font-size: 0.92rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), opacity 0.25s; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-solid { background: var(--text); color: var(--bg); }
.btn-solid:not(:disabled):hover { background: var(--accent-ink); }
.btn-line { border-color: var(--line-strong); background: none; }
.btn-line:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-lg { min-height: 3.3rem; padding-inline: 1.7rem; font-size: 1rem; }
.btn-sm { min-height: 2.25rem; padding: 0.35rem 0.95rem; font-size: 0.82rem; }
.btn-link { border: 0; background: none; padding: 0.3rem 0; color: var(--accent-ink); font-weight: 600; font-size: 0.85rem; cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.btn-link:disabled { color: var(--faint); text-decoration: none; cursor: default; }
.kicker { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 1.25rem; }
.kicker-rule { width: 2.2rem; height: 1px; background: var(--accent); }
.form { display: grid; gap: 1rem; margin-top: 2rem; }
.form label { display: grid; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
input[type="email"], input[type="password"], input[type="text"], .code-input { width: 100%; min-height: 3rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-size: 1rem; color: var(--text); transition: border-color 0.2s; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.code-input { font-size: 1.6rem; letter-spacing: 0.5em; text-align: center; font-variant-numeric: tabular-nums; }
.form-error { margin-top: 1rem; color: var(--del); font-size: 0.9rem; }

/* ---------- login ---------- */
.login { min-height: calc(100svh - 4rem); display: grid; place-items: center; padding: 2rem 1rem; background: radial-gradient(60vmax 60vmax at 85% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%); }
.login-card { width: min(100%, 26rem); }
.login-title { font-size: clamp(2.6rem, 9vw, 3.6rem); margin-bottom: 0.75rem; }

/* ---------- app ---------- */
.app { max-width: 1440px; margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2rem) 7rem; }
.steps { display: flex; gap: 0.5rem; list-style: none; margin: 0 0 1.75rem; padding: 0; counter-reset: s; }
.steps li { display: flex; align-items: center; gap: 0.55rem; font-size: 0.8rem; color: var(--faint); }
.steps li + li::before { content: ""; width: clamp(1rem, 4vw, 3rem); height: 1px; background: var(--line-strong); margin-right: 0.5rem; }
.steps span { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1px solid var(--line-strong); font-size: 0.75rem; font-weight: 700; }
.steps b { font-weight: 600; }
.steps .is-current { color: var(--text); }
.steps .is-current span { border-color: var(--accent); color: var(--accent-ink); }
.steps .is-done span { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.notice { padding: 1rem 1.2rem; border-left: 2px solid var(--accent); background: var(--warn-bg); margin-bottom: 1.5rem; font-size: 0.92rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 0.4rem; }

.compose-head, .review-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 1.5rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop { position: relative; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); transition: border-color 0.2s; }
.drop.is-over { border-color: var(--accent); border-style: dashed; }
.drop-hint { display: none; }
.drop.is-over .drop-hint { display: grid; place-items: center; position: absolute; inset: 0; border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); font-family: var(--serif); font-size: 1.6rem; color: var(--accent-ink); }
.editor { display: block; width: 100%; min-height: min(62vh, 44rem); resize: vertical; border: 0; border-radius: 14px; padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.25rem, 4vw, 3.5rem); background: transparent; font: 1.08rem/1.75 var(--doc); color: var(--text); }
.editor:focus { outline: none; }
.editor::placeholder { color: var(--faint); font-style: italic; }
.docx-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.docx-chip svg { color: var(--accent); }
.docx-chip .btn-link { margin-left: auto; }
.docx-preview { max-height: min(62vh, 44rem); overflow: auto; padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.25rem, 4vw, 3.5rem); }
.names { margin-top: 1rem; padding: 0.9rem 1.1rem; border: 1px solid var(--line); border-radius: 12px; }
.names summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; }
.names p { margin: 0.6rem 0 0.75rem; }
.compose-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; }

/* document text (preview + review) */
.para { margin: 0 0 0.85em; font: 1.06rem/1.8 var(--doc); white-space: pre-wrap; overflow-wrap: anywhere; }
.para.is-bold { font-weight: 700; }
.para.in-table { margin: 0 0 0.35em; padding: 0.35em 0.8em; border-left: 2px solid var(--line-strong); background: var(--bg-2); font-size: 0.98rem; }
.para.is-empty { margin-bottom: 0.4em; }
.para.is-flagged { box-shadow: inset 3px 0 0 var(--accent); padding-left: 0.8em; }

/* progress */
.progress { max-width: 34rem; margin: 12vh auto; text-align: center; }
.progress-title { font-family: var(--serif); font-size: 2rem; margin-bottom: 1.5rem; }
.bar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 0.9rem; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s linear; }
.progress-stats { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; margin-bottom: 0.6rem; }
.progress-time { color: var(--muted); }
.progress-hint { font-size: 0.85rem; }
@media (prefers-reduced-motion: no-preference) {
  .bar span { background: linear-gradient(90deg, var(--accent), var(--accent-ink), var(--accent)); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* review */
.tabs { display: none; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; }
.doc { padding: clamp(1.25rem, 3vw, 2.75rem) clamp(1.25rem, 4vw, 3.5rem); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-height: 50vh; }
.sg { cursor: pointer; border-radius: 3px; transition: background-color 0.2s; }
.sg del { color: var(--del); background: var(--del-bg); text-decoration: line-through; text-decoration-thickness: 1px; }
.sg ins { color: var(--ins); background: var(--ins-bg); text-decoration: none; border-bottom: 1px solid currentColor; }
.sg.is-pending del { margin-right: 0.15em; }
.sg.is-accepted del { display: none; }
.sg.is-accepted ins { color: inherit; background: var(--ins-bg); border-bottom-style: dotted; }
.sg.is-rejected ins { display: none; }
.sg.is-rejected del { color: inherit; background: none; text-decoration: none; border-bottom: 1px dotted var(--faint); }
.sg:hover, .sg:focus-visible { background: color-mix(in srgb, var(--accent) 16%, transparent); }

.side { position: sticky; top: 5rem; max-height: calc(100vh - 6rem); overflow: auto; padding-right: 0.25rem; display: grid; gap: 1rem; align-content: start; }
.summary { padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.summary-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; text-align: center; }
.summary-nums b { display: block; font-family: var(--serif); font-size: 2rem; font-weight: 400; line-height: 1; }
.accept-all { width: 100%; margin-top: 1rem; }
.accept-all.is-undo { background: transparent; color: var(--text); border-color: var(--line-strong, var(--line)); }
.summary-nums span { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cats { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.3rem; border-top: 1px solid var(--line); padding-top: 0.8rem; }
.cats li { display: flex; align-items: center; gap: 0.6rem; }
.cats b { font-size: 0.85rem; margin-right: auto; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; background: var(--bg-2); color: var(--accent-ink); border: 1px solid var(--line); white-space: nowrap; }
#guard-note:not(:empty) { margin-top: 0.75rem; }

.flags { padding: 1.1rem 1.2rem; border: 1px dashed var(--accent); border-radius: 14px; background: var(--warn-bg); }
.flags-title { font-size: 1.35rem; display: flex; align-items: baseline; gap: 0.5rem; }
.flags-title b { font-family: var(--sans); font-size: 0.8rem; color: var(--accent-ink); }
.flags-note { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); margin: 0.4rem 0 0.8rem; }
.flags ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.flags li { cursor: pointer; font-size: 0.9rem; }
.flag-where { display: block; font-size: 0.72rem; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }
.flags q { font-family: var(--doc); font-style: italic; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.card { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color 0.25s var(--ease), opacity 0.25s; }
.card:hover { border-color: var(--line-strong); }
.card.is-accepted { border-color: color-mix(in srgb, var(--ins) 45%, transparent); }
.card.is-rejected { opacity: 0.62; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; }
.card-where { font-size: 0.75rem; color: var(--faint); }
.card-diff { font: 1.02rem/1.55 var(--doc); margin-bottom: 0.45rem; overflow-wrap: anywhere; }
.card-diff del { color: var(--del); background: var(--del-bg); text-decoration-thickness: 1px; }
.card-diff ins { color: var(--ins); background: var(--ins-bg); text-decoration: none; }
.arrow { color: var(--faint); margin: 0 0.4rem; font-family: var(--sans); }
.card-why { font-size: 0.88rem; color: var(--muted); margin-bottom: 0.8rem; }
.card-act { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.btn-accept { background: var(--text); color: var(--bg); }
.btn-accept:hover { background: var(--ins); color: #fff; }
.btn-reject { background: none; border-color: var(--line-strong); }
.btn-reject:hover { border-color: var(--del); color: var(--del); }
.card-state { font-size: 0.8rem; font-weight: 700; }
.card.is-accepted .card-state { color: var(--ins); }
.card.is-rejected .card-state { color: var(--muted); }
.card .btn-undo { display: none; }
.card:not(.is-pending) .btn-accept, .card:not(.is-pending) .btn-reject { display: none; }
.card:not(.is-pending) .btn-undo { display: inline; }
.empty { padding: 1.5rem; border: 1px solid var(--line); border-radius: 14px; text-align: center; display: grid; gap: 0.4rem; justify-items: center; }
.empty.is-error { border-color: var(--del); }
.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* action bar */
.actionbar { position: fixed; inset: auto 0 0; z-index: 15; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.actionbar-in { max-width: 1440px; margin: 0 auto; padding: 0.75rem clamp(1rem, 3vw, 2rem); display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem; }
.act-right { margin-left: auto; display: flex; gap: 0.6rem; }
.confirm { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.9rem; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 5.5rem); translate: -50% 0; z-index: 30; max-width: min(92vw, 34rem); padding: 0.85rem 1.2rem; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 0.9rem; box-shadow: var(--shadow); }
.toast.err { background: var(--del); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .review-grid { grid-template-columns: minmax(0, 1fr); }
  .tabs { display: flex; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
  .tabs button { flex: 1; min-height: 2.9rem; border: 0; background: none; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
  .tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
  .tabs b { color: var(--accent-ink); }
  .review-grid[data-tab="side"] [data-pane="doc"], .review-grid[data-tab="doc"] [data-pane="side"] { display: none; }
  .side { position: static; max-height: none; overflow: visible; padding: 0; }
}
@media (max-width: 640px) {
  .brand-sep, .brand-app { display: none; }
  .user-email { display: none; }
  .top-ctl { gap: 0.35rem; }
  .seg button { min-width: 2.4rem; height: 2.4rem; padding: 0 0.5rem; }
  .steps b { display: none; }
  .compose-actions, .compose-actions .btn { width: 100%; }
  .compose-foot .btn { width: 100%; }
  .view-seg { width: 100%; }
  .view-seg button { flex: 1; }
  .act-right { width: 100%; margin: 0; }
  .act-right .btn { flex: 1; padding-inline: 0.8rem; font-size: 0.85rem; }
  .actionbar-in { justify-content: space-between; }
  .summary-nums b { font-size: 1.6rem; }
  .doc { padding: 1.1rem; }
  .para { font-size: 1rem; }
  .app { padding-bottom: 9rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 480px) { .brand-txt { display: none; } }
