.notarial-page {
  position: relative;
  overflow: hidden;
}

.notarial-page::before {
  position: absolute;
  top: -18rem;
  right: -14rem;
  width: 54rem;
  height: 54rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 130, 255, .15), transparent 68%);
  content: "";
  pointer-events: none;
}

.notarial-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  align-items: end;
  gap: clamp(2rem, 6vw, 5rem);
  padding-block: clamp(4.5rem, 8vw, 7.5rem) clamp(3rem, 6vw, 5rem);
}

.notarial-back {
  display: inline-block;
  margin-bottom: 2.2rem;
  color: var(--muted-strong);
  font-size: .77rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-decoration: none;
}

.notarial-hero-copy .page-title {
  max-width: 850px;
}

.notarial-privacy-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.35rem;
  border: 1px solid rgba(84, 213, 154, .22);
  border-radius: 18px;
  background: rgba(84, 213, 154, .055);
}

.notarial-privacy-card svg {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--success);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.notarial-privacy-card strong,
.notarial-privacy-card span {
  display: block;
}

.notarial-privacy-card strong {
  margin-bottom: .28rem;
  color: var(--ink);
  font-size: .88rem;
}

.notarial-privacy-card span {
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.55;
}

.notarial-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  align-items: start;
  gap: 1.25rem;
  padding-bottom: clamp(5rem, 9vw, 8rem);
}

.notarial-compose,
.notarial-preview {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(14, 37, 65, .94), rgba(7, 23, 42, .82));
  box-shadow: var(--shadow);
}

.notarial-compose {
  padding: clamp(1.25rem, 3vw, 2rem);
}

.notarial-preview {
  position: sticky;
  top: 5.5rem;
  padding: clamp(1.25rem, 3vw, 1.7rem);
}

.notarial-step-heading {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.notarial-step-heading > span {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border: 1px solid rgba(99, 214, 255, .24);
  border-radius: 12px;
  color: var(--blue-bright);
  font-size: .7rem;
  font-weight: 900;
}

.notarial-step-heading h2 {
  margin: 0 0 .25rem;
  color: var(--ink);
  font-size: 1.25rem;
}

.notarial-step-heading p {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
}

.notarial-source-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0 1.25rem;
}

.notarial-upload,
.notarial-rich-save {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  padding: .8rem 1rem;
  border: 1px solid rgba(99, 214, 255, .25);
  border-radius: 12px;
  background: rgba(99, 214, 255, .07);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.2;
}

.notarial-upload:hover,
.notarial-rich-save:hover:not(:disabled) {
  border-color: rgba(99, 214, 255, .52);
}

.notarial-rich-save:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.notarial-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.notarial-upload svg,
.notarial-rich-save svg,
.notarial-toolbar svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.notarial-file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notarial-toolbar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: rgba(1, 12, 24, .36);
}

.notarial-toolbar button {
  display: grid;
  width: 36px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.notarial-toolbar button:hover,
.notarial-toolbar button:focus-visible {
  border-color: var(--line);
  background: rgba(99, 214, 255, .08);
}

.notarial-toolbar > span {
  margin-left: auto;
  color: var(--muted);
  font-size: .67rem;
  text-align: right;
}

.notarial-draft-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-left: .35rem;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: .66rem;
  white-space: nowrap;
}

.notarial-draft-toggle input {
  accent-color: var(--blue-bright);
}

.notarial-editor {
  min-height: 330px;
  max-height: 640px;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0 0 14px 14px;
  outline: 0;
  overflow: auto;
  background: #fff;
  color: #13171c;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.notarial-editor:focus {
  border-color: rgba(99, 214, 255, .62);
  box-shadow: 0 0 0 3px rgba(99, 214, 255, .08);
}

.notarial-editor:empty::before {
  color: #74808a;
  content: attr(data-placeholder);
}

.notarial-editor img {
  max-width: 100%;
}

.notarial-editor table {
  width: 100%;
  border-collapse: collapse;
}

.notarial-editor td,
.notarial-editor th {
  padding: .35rem;
  border: 1px solid #ccd3d9;
}

.notarial-editor-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .25rem 1.25rem;
  color: var(--muted);
  font-size: .66rem;
}

.notarial-notices {
  display: grid;
  gap: .5rem;
  padding: 0;
  margin: 0 0 1.25rem;
  list-style: none;
}

.notarial-notices li {
  padding: .72rem .85rem;
  border-left: 3px solid var(--blue-bright);
  border-radius: 4px 10px 10px 4px;
  background: rgba(99, 214, 255, .06);
  color: var(--muted-strong);
  font-size: .72rem;
  line-height: 1.5;
}

.notarial-notices li[data-tone="warn"] {
  border-color: #f0bb68;
  background: rgba(240, 187, 104, .07);
}

.notarial-notices li[data-tone="error"] {
  border-color: #f07878;
  background: rgba(240, 120, 120, .07);
}

.notarial-profile {
  display: grid;
  gap: .55rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(1, 12, 24, .24);
}

.notarial-profile-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.notarial-profile-edit {
  padding: .35rem .6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(99, 214, 255, .08);
  color: var(--blue-bright);
  cursor: pointer;
  font: inherit;
  font-size: .66rem;
  font-weight: 800;
}

.notarial-profile label {
  color: var(--ink);
  font-size: .76rem;
  font-weight: 800;
}

.notarial-profile select {
  width: 100%;
  padding: .78rem .9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b2239;
  color: var(--ink);
  font: inherit;
  font-size: .8rem;
}

.notarial-profile p {
  margin: 0;
  color: var(--muted);
  font-size: .69rem;
  line-height: 1.5;
}

.notarial-profile-dialog,
.notarial-download-dialog {
  width: min(820px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: auto;
  background: #0d2033;
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .5);
}

.notarial-download-dialog {
  width: min(560px, calc(100vw - 2rem));
}

.notarial-profile-dialog::backdrop,
.notarial-download-dialog::backdrop {
  background: rgba(2, 9, 17, .76);
  backdrop-filter: blur(8px);
}

.notarial-profile-form,
.notarial-download-form {
  display: grid;
  gap: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem);
}

.notarial-download-name {
  display: grid;
  gap: .45rem;
  color: var(--muted-strong);
  font-size: .72rem;
  font-weight: 800;
}

.notarial-download-name > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(1, 12, 24, .5);
}

.notarial-download-name input {
  min-width: 0;
  padding: .85rem .9rem;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
}

.notarial-download-name > div:focus-within {
  border-color: rgba(99, 214, 255, .62);
  box-shadow: 0 0 0 3px rgba(99, 214, 255, .08);
}

.notarial-download-name strong {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 .9rem;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: .72rem;
}

.notarial-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.notarial-dialog-heading h2 {
  margin: .25rem 0 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.notarial-dialog-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 1.35rem;
}

.notarial-dialog-lead {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.55;
}

.notarial-margin-faces {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.notarial-margin-faces fieldset {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.notarial-margin-faces legend {
  padding: 0 .4rem;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 850;
}

.notarial-margin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.notarial-margin-grid label {
  display: grid;
  gap: .35rem;
  color: var(--muted-strong);
  font-size: .68rem;
}

.notarial-margin-grid label > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .4rem;
}

.notarial-margin-grid input {
  width: 100%;
  padding: .65rem .7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(1, 12, 24, .5);
  color: var(--ink);
  font: inherit;
}

.notarial-margin-grid small {
  color: var(--muted);
  font-size: .65rem;
}

.notarial-continuity-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: .75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(99, 214, 255, .05);
  cursor: pointer;
}

.notarial-continuity-option input {
  margin-top: .2rem;
  accent-color: var(--blue-bright);
}

.notarial-continuity-option span {
  display: grid;
  gap: .25rem;
}

.notarial-continuity-option strong {
  font-size: .78rem;
}

.notarial-continuity-option small {
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.5;
}

.notarial-continuity-suboption {
  margin-left: 2rem;
}

.notarial-continuity-suboption:has(input:disabled) {
  opacity: .5;
  cursor: not-allowed;
}

.notarial-profile-error {
  margin: 0;
  padding: .75rem .85rem;
  border-left: 3px solid #f07878;
  border-radius: 6px;
  background: rgba(240, 120, 120, .08);
  color: #ffabab;
  font-size: .72rem;
}

.notarial-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  flex-wrap: wrap;
}

.notarial-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: .65rem;
  margin-top: 1.25rem;
}

.notarial-button {
  min-height: 46px;
  padding: .72rem .9rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .035);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: .74rem;
  font-weight: 850;
}

.notarial-button:hover:not(:disabled) {
  border-color: rgba(99, 214, 255, .42);
  transform: translateY(-1px);
}

.notarial-button-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), #2d82ff);
  color: #fff;
}

.notarial-button-download {
  border-color: rgba(84, 213, 154, .32);
  color: var(--success);
}

.notarial-button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.notarial-status {
  min-height: 1.2em;
  margin: .8rem .2rem 0;
  color: var(--muted);
  font-size: .7rem;
}

.notarial-status[data-tone="success"] { color: var(--success); }
.notarial-status[data-tone="error"] { color: #ff9292; }
.notarial-status[data-tone="working"] { color: var(--blue-bright); }

.notarial-guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: 1.15rem 0 .8rem;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: .73rem;
}

.notarial-guide-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.notarial-preview-stage {
  position: relative;
  min-height: 600px;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  background: #dfe4e8;
}

.notarial-pdf-pages {
  display: grid;
  gap: 1.25rem;
  max-height: 760px;
  padding: 1rem;
  overflow: auto;
  background: #cfd5da;
}

.notarial-pdf-pages[hidden] {
  display: none;
}

.notarial-pdf-pages figure {
  display: grid;
  justify-items: center;
  margin: 0;
}

.notarial-pdf-pages canvas {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 10px 28px rgba(19, 33, 45, .2);
}

.notarial-pdf-pages figcaption {
  padding-top: .55rem;
  color: #4a5660;
  font-size: .67rem;
  font-weight: 700;
}

.notarial-preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 2rem;
  color: #5e6973;
  text-align: center;
}

.notarial-preview-empty[hidden] {
  display: none;
}

.notarial-preview-empty svg {
  width: 70px;
  height: 84px;
  margin-bottom: 1.2rem;
  fill: none;
  stroke: #778490;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.notarial-preview-empty strong {
  margin-bottom: .4rem;
  color: #26333d;
  font-size: .95rem;
}

.notarial-preview-empty span {
  max-width: 290px;
  font-size: .72rem;
  line-height: 1.55;
}

.notarial-validation {
  margin-top: .85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(1, 12, 24, .25);
}

.notarial-validation h3 {
  margin: 0 0 .75rem;
  color: var(--ink);
  font-size: .82rem;
}

.notarial-validation ul {
  display: grid;
  gap: .4rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.notarial-validation li {
  color: var(--muted);
  font-size: .69rem;
}

.notarial-validation li.is-valid { color: var(--success); }
.notarial-validation li.is-error { color: #ff9292; }

.notarial-method {
  display: grid;
  grid-template-columns: minmax(220px, .65fr) minmax(0, 1.35fr);
  gap: clamp(2rem, 6vw, 5rem);
  padding-block: clamp(4rem, 8vw, 7rem);
  border-top: 1px solid var(--line);
}

.notarial-method h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  letter-spacing: -.035em;
  line-height: 1.08;
}

.notarial-method-grid {
  display: grid;
  gap: 1.5rem;
}

.notarial-method-grid article {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.notarial-method-grid article > span {
  grid-row: 1 / span 2;
  color: var(--blue-bright);
  font-size: .68rem;
  font-weight: 900;
}

.notarial-method-grid h3 {
  margin: 0 0 .3rem;
  color: var(--ink);
  font-size: 1rem;
}

.notarial-method-grid p {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.65;
}

html[data-theme="light"] .notarial-compose,
html[data-theme="light"] .notarial-preview {
  background: linear-gradient(145deg, rgba(255, 255, 255, .99), rgba(239, 245, 250, .95));
  box-shadow: 0 22px 60px rgba(28, 52, 76, .11);
}

html[data-theme="light"] .notarial-toolbar,
html[data-theme="light"] .notarial-profile,
html[data-theme="light"] .notarial-validation {
  background: rgba(223, 233, 241, .48);
}

html[data-theme="light"] .notarial-profile-dialog,
html[data-theme="light"] .notarial-download-dialog {
  background: #f8fbfd;
}

html[data-theme="light"] .notarial-margin-grid input,
html[data-theme="light"] .notarial-download-name > div {
  background: #fff;
  color: #172838;
}

html[data-theme="light"] .notarial-profile select {
  background: #fff;
  color: #172838;
}

@media (max-width: 1040px) {
  .notarial-workspace { grid-template-columns: 1fr; }
  .notarial-preview { position: static; }
  .notarial-preview-stage { min-height: 720px; }
}

@media (max-width: 760px) {
  .notarial-hero,
  .notarial-method { grid-template-columns: 1fr; }
  .notarial-actions { grid-template-columns: 1fr; }
  .notarial-toolbar > span { display: none; }
  .notarial-toolbar { flex-wrap: wrap; }
  .notarial-margin-faces { grid-template-columns: 1fr; }
  .notarial-continuity-suboption { margin-left: 0; }
}

@media (max-width: 520px) {
  .notarial-hero { padding-top: 3.5rem; }
  .notarial-compose,
  .notarial-preview { border-radius: 20px; }
  .notarial-source-actions,
  .notarial-editor-meta { align-items: flex-start; flex-direction: column; }
  .notarial-preview-stage { min-height: 520px; }
}
